EPICS Msg Version
Signed-off-by: Bernardo Carvalho <bernardo.carvalho@tecnico.ulisboa.pt>
This commit is contained in:
@@ -32,6 +32,7 @@ def build_import_table_langmuir():
|
|||||||
table.append(nd)
|
table.append(nd)
|
||||||
return table
|
return table
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
def plot_signals(pulse, nodeTable):
|
def plot_signals(pulse, nodeTable):
|
||||||
try:
|
try:
|
||||||
@@ -64,7 +65,8 @@ def plot_signals(pulse, nodeTable):
|
|||||||
|
|
||||||
|
|
||||||
def get_arguments():
|
def get_arguments():
|
||||||
parser = argparse.ArgumentParser(description='ISTTOK ')
|
parser = argparse.ArgumentParser(
|
||||||
|
description='Import SDAS ISTTOK to csv File ')
|
||||||
parser.add_argument('-p', '--pulse',
|
parser.add_argument('-p', '--pulse',
|
||||||
help='pulse (shot) number', default='46241', type=int)
|
help='pulse (shot) number', default='46241', type=int)
|
||||||
# parser.add_argument('-s', '--shot',
|
# parser.add_argument('-s', '--shot',
|
||||||
@@ -82,6 +84,8 @@ def get_arguments():
|
|||||||
action='store_true', help='Plot Signals')
|
action='store_true', help='Plot Signals')
|
||||||
parser.add_argument('-n', '--names',
|
parser.add_argument('-n', '--names',
|
||||||
action='store_true', help='Print Node Table')
|
action='store_true', help='Print Node Table')
|
||||||
|
parser.add_argument('-z', '--zeros', type=int,
|
||||||
|
help='Insert zeros rows', default='0')
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
@@ -99,14 +103,20 @@ if (__name__ == "__main__"):
|
|||||||
time = np.arange(len(data), dtype='uint32') * int(period)
|
time = np.arange(len(data), dtype='uint32') * int(period)
|
||||||
langmuirNp = np.array(langmuirData).T
|
langmuirNp = np.array(langmuirData).T
|
||||||
data2file = np.insert(langmuirNp, 0, time, axis=1)
|
data2file = np.insert(langmuirNp, 0, time, axis=1)
|
||||||
filename = f"{args.file:s}_{pulseNo}.csv"
|
if args.zeros > 0:
|
||||||
head = ('#Time (uint32)[1],Langmuir0 (float32)[1],Langmuir1 (float32)[1],'
|
nCol = data2file.shape[1]
|
||||||
'Langmuir2 (float32)[1],Langmuir3 (float32)[1]')
|
zerRows = np.zeros([args.zeros, nCol])
|
||||||
# formt = ['%d', '%.6f', '%.6f', '%.6f', '%.6f']
|
data2file = np.insert(data2file, 0, zerRows, axis=0)
|
||||||
formt = '%d,%.6f,%.6f,%.6f,%.6f'
|
fname = f"{args.file:s}_{pulseNo}"
|
||||||
# formt = '%d,{%.6f,%.6f,%.6f,%.6f}'
|
filename = f"{fname}.csv"
|
||||||
# head = '#TimeSdas (uint32)[1],LangmuirSignals (float32)[4]'
|
# head = ('#Time (uint32)[1],Langmuir0 (float32)[1],Langmuir1 (float32)[1],'
|
||||||
|
# 'Langmuir2 (float32)[1],Langmuir3 (float32)[1]')
|
||||||
|
# formt = '%d,%.6f,%.6f,%.6f,%.6f'
|
||||||
|
formt = '%d,{%.6f,%.6f,%.6f,%.6f}'
|
||||||
|
head = '#TimeSdas (uint32)[1],LangmuirSignals (float32)[4]'
|
||||||
np.savetxt(filename, data2file, fmt=formt,
|
np.savetxt(filename, data2file, fmt=formt,
|
||||||
header=head, comments='') # , delimiter=',')
|
header=head, comments='')
|
||||||
|
# , delimiter=',')
|
||||||
|
np.save(fname, data2file)
|
||||||
# plot_signals(46241, table)
|
# plot_signals(46241, table)
|
||||||
|
# formt = ['%d', '%.6f', '%.6f', '%.6f', '%.6f']
|
||||||
|
|||||||
@@ -114,7 +114,7 @@
|
|||||||
NextState = "WAITING_FOR_PRE"
|
NextState = "WAITING_FOR_PRE"
|
||||||
NextStateError = "IDLE"
|
NextStateError = "IDLE"
|
||||||
Timeout = 0
|
Timeout = 0
|
||||||
+ChangeToRunMsg = {
|
+ChangeToWaitPreMsg = {
|
||||||
Class = Message
|
Class = Message
|
||||||
Destination = MdsLoopApp
|
Destination = MdsLoopApp
|
||||||
Mode = ExpectsReply
|
Mode = ExpectsReply
|
||||||
@@ -158,6 +158,16 @@
|
|||||||
NextState = "PULSING"
|
NextState = "PULSING"
|
||||||
NextStateError = "IDLE"
|
NextStateError = "IDLE"
|
||||||
Timeout = 0
|
Timeout = 0
|
||||||
|
+ChangeToRunMsg = {
|
||||||
|
Class = Message
|
||||||
|
Destination = MdsLoopApp
|
||||||
|
Mode = ExpectsReply
|
||||||
|
Function = PrepareNextState
|
||||||
|
+Parameters = {
|
||||||
|
Class = ConfigurationDatabase
|
||||||
|
param1 = Online
|
||||||
|
}
|
||||||
|
}
|
||||||
+CalcOffSetsMsg = {
|
+CalcOffSetsMsg = {
|
||||||
Class = "Message"
|
Class = "Message"
|
||||||
Destination = "MdsLoopApp.Functions.GAMElectricProbes"
|
Destination = "MdsLoopApp.Functions.GAMElectricProbes"
|
||||||
@@ -508,7 +518,7 @@ $MdsLoopApp = {
|
|||||||
}
|
}
|
||||||
+FileReader_DS = {
|
+FileReader_DS = {
|
||||||
Class = FileDataSource::FileReader
|
Class = FileDataSource::FileReader
|
||||||
Filename = "../Analysis/LangmuirSdas_46241_strt.csv"
|
Filename = "../Analysis/LangmuirSdas_46241.csv"
|
||||||
FileFormat = "csv"
|
FileFormat = "csv"
|
||||||
CSVSeparator = ","
|
CSVSeparator = ","
|
||||||
Interpolate = "no"
|
Interpolate = "no"
|
||||||
@@ -525,7 +535,7 @@ $MdsLoopApp = {
|
|||||||
Overwrite = "yes"
|
Overwrite = "yes"
|
||||||
FileFormat = "csv"
|
FileFormat = "csv"
|
||||||
CSVSeparator = ","
|
CSVSeparator = ","
|
||||||
StoreOnTrigger = 0
|
StoreOnTrigger = 0 //Compulsory. If 0 all the data in the circular buffer is continuously stored. If 1 data is stored when the Trigger signal is 1 (see below).
|
||||||
Signals = {
|
Signals = {
|
||||||
Time = {
|
Time = {
|
||||||
Type = uint32
|
Type = uint32
|
||||||
|
|||||||
@@ -310,10 +310,10 @@ namespace MARTe {
|
|||||||
|
|
||||||
bool ElectricProbesGAM::Execute() {
|
bool ElectricProbesGAM::Execute() {
|
||||||
//*outputEpZ = 3.4;
|
//*outputEpZ = 3.4;
|
||||||
*outputEpR = (inputSignal[2] - inputOffsets[2]) -
|
*outputEpR = inputSignal[0];
|
||||||
(inputSignal[1] - inputOffsets[1]);
|
*outputEpZ = inputSignal[0] - inputOffsets[0];
|
||||||
*outputEpZ = inputSignal[0] - inputSignal[3];
|
//*outputEpR = (inputSignal[2] - inputOffsets[2]) -
|
||||||
//;*inputElectricTop - *inputElectricOuter;
|
//*outputEpZ = inputSignal[0] - inputSignal[3];
|
||||||
//*outputSignal1 = *inputSignals[0] - *inputSignals[1];
|
//*outputSignal1 = *inputSignals[0] - *inputSignals[1];
|
||||||
|
|
||||||
//update the last values
|
//update the last values
|
||||||
@@ -404,8 +404,14 @@ namespace MARTe {
|
|||||||
ErrorManagement::ErrorType ElectricProbesGAM::CalcOffSets() {
|
ErrorManagement::ErrorType ElectricProbesGAM::CalcOffSets() {
|
||||||
|
|
||||||
ErrorManagement::ErrorType ret = MARTe::ErrorManagement::NoError;
|
ErrorManagement::ErrorType ret = MARTe::ErrorManagement::NoError;
|
||||||
|
//REPORT_ERROR(ErrorManagement::Information,
|
||||||
|
// "CalcOffSets. numberOfSamplesAvg: %d!", numberOfSamplesAvg);
|
||||||
REPORT_ERROR(ErrorManagement::Information,
|
REPORT_ERROR(ErrorManagement::Information,
|
||||||
"CalcOffSets. numberOfSamplesAvg: %d!", numberOfSamplesAvg);
|
"CalcOffSets. Inputs:%f, %f, %f, %f.",
|
||||||
|
inputSignal[0],
|
||||||
|
inputSignal[1],
|
||||||
|
inputSignal[2],
|
||||||
|
inputSignal[3]);
|
||||||
if (numberOfSamplesAvg > 1u) {
|
if (numberOfSamplesAvg > 1u) {
|
||||||
for (uint32 i = 0u; i < EP_NUM_INPUTS; i++) {
|
for (uint32 i = 0u; i < EP_NUM_INPUTS; i++) {
|
||||||
inputOffsets[i] = 0.0f;
|
inputOffsets[i] = 0.0f;
|
||||||
@@ -413,9 +419,13 @@ namespace MARTe {
|
|||||||
inputOffsets[i] += lastInputs[i][k];
|
inputOffsets[i] += lastInputs[i][k];
|
||||||
}
|
}
|
||||||
inputOffsets[i] /= numberOfSamplesAvg;
|
inputOffsets[i] /= numberOfSamplesAvg;
|
||||||
REPORT_ERROR(ErrorManagement::Information,
|
|
||||||
"CalcOffSets. Offset:%d= %f!", i, inputOffsets[i]);
|
|
||||||
}
|
}
|
||||||
|
REPORT_ERROR(ErrorManagement::Information,
|
||||||
|
"CalcOffSets. Offset:%f, %f, %f, %f.",
|
||||||
|
inputOffsets[0],
|
||||||
|
inputOffsets[1],
|
||||||
|
inputOffsets[2],
|
||||||
|
inputOffsets[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
Reference in New Issue
Block a user