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