Added EProbes GAM

Signed-off-by: Bernardo Carvalho <bernardo.carvalho@tecnico.ulisboa.pt>
This commit is contained in:
2024-11-18 15:23:28 +00:00
parent 3b890ca623
commit c76250d3ab
7 changed files with 121 additions and 198 deletions

View File

@@ -17,7 +17,8 @@ from MdsImportSdas import mds_writer, plot_signals
mdsTreeName = 'isttoksdas' mdsTreeName = 'isttoksdas'
MDS_NODEFMT = "\\TOP.HARDWARE.ATCA1.IOC1.CHANNELS.INPUT_{}.RAW" MDS_NODEFMT = "\\TOP.HARDWARE.ATCA1.IOC_0.CHANNEL_{}.RAW"
# MDS_NODEFMT = "\\TOP.HARDWARE.ATCA1.IOC1.CHANNELS.INPUT_{}.RAW"
SDAS_NODEFMT = 'MARTE_NODE_IVO3.DataCollection.Channel_{}' SDAS_NODEFMT = 'MARTE_NODE_IVO3.DataCollection.Channel_{}'
NUM_PROBES = 12 NUM_PROBES = 12
@@ -27,7 +28,8 @@ def build_import_table():
table = [] table = []
for n in range(NUM_PROBES): for n in range(NUM_PROBES):
sdas_str = SDAS_NODEFMT.format(str(166 + n).zfill(3)) sdas_str = SDAS_NODEFMT.format(str(166 + n).zfill(3))
mds_str = MDS_NODEFMT.format(str(n).zfill(2)) # mds_str = MDS_NODEFMT.format(str(n).zfill(2))
mds_str = MDS_NODEFMT.format(str(n))
# print(sdas_str) # print(sdas_str)
nd = {'sdas': sdas_str, 'mds': mds_str, nd = {'sdas': sdas_str, 'mds': mds_str,
'name': f'Mirnov coil no. {n+1}'} 'name': f'Mirnov coil no. {n+1}'}

View File

@@ -131,7 +131,7 @@
Function = PrepareNextState Function = PrepareNextState
+Parameters = { +Parameters = {
Class = ConfigurationDatabase Class = ConfigurationDatabase
param1 = Run param1 = Online
} }
} }
+StopCurrentStateExecutionMsg = { +StopCurrentStateExecutionMsg = {
@@ -260,7 +260,7 @@ $MdsLoopApp = {
} }
Run_Thread1_CycleTime = { Run_Thread1_CycleTime = {
DataSource = Timings DataSource = Timings
Alias = "Run.Thread1_CycleTime" Alias = "Online.Thread1_CycleTime"
Type = uint32 Type = uint32
} }
} }
@@ -302,6 +302,38 @@ $MdsLoopApp = {
} }
} }
} }
+GAMElectricProbes = {
Class = ElectricProbesGAM
Gain = 5 //Compulsory
InputSignals = {
Langmuir0 = {
DataSource = "DDB1"
Type = float32
}
Langmuir1 = {
DataSource = "DDB1"
Type = float32
}
Langmuir2 = {
DataSource = "DDB1"
Type = float32
}
Langmuir3 = {
DataSource = "DDB1"
Type = float32
}
}
OutputSignals = {
SignalEP_OutR = {
DataSource = "DDB1"
Type = float32
}
SignalEP_OutZ = {
DataSource = "DDB1"
Type = float32
}
}
}
+GAMConvert2Double = { +GAMConvert2Double = {
Class = "ConversionGAM" Class = "ConversionGAM"
InputSignals = { InputSignals = {
@@ -332,6 +364,7 @@ $MdsLoopApp = {
} }
Mirnov6 = { Mirnov6 = {
DataSource = "DDB1" DataSource = "DDB1"
Type = uint32
Type = float32 Type = float32
} }
Mirnov7 = { Mirnov7 = {
@@ -446,7 +479,7 @@ $MdsLoopApp = {
} }
} }
OutputSignals = { OutputSignals = {
OutputSignal1 = { OutputSignalSSM = {
DataSource = "DDB1" DataSource = "DDB1"
Type = float64 Type = float64
} }
@@ -611,7 +644,11 @@ $MdsLoopApp = {
DataSource = "DDB1" DataSource = "DDB1"
Type = float32 Type = float32
} }
OutputSignal1 = { Langmuir0 = {
DataSource = "DDB1"
Type = float32
}
OutputSignalSSM = {
DataSource = "DDB1" DataSource = "DDB1"
Type = float64 Type = float64
} }
@@ -627,6 +664,10 @@ $MdsLoopApp = {
Type = float32 Type = float32
} }
OutMdsW1 = { OutMdsW1 = {
DataSource = MDSWriter
Type = float32
}
OutMdsW2 = {
DataSource = MDSWriter DataSource = MDSWriter
Type = float64 Type = float64
} }
@@ -806,15 +847,20 @@ $MdsLoopApp = {
MakeSegmentAfterNWrites = 100 MakeSegmentAfterNWrites = 100
} }
OutMdsW1 = { //As many as required. OutMdsW1 = { //As many as required.
NodeName = "\TOP.OUT.OUT1" // node of the tree node NodeName = "\TOP.OUT.OUT1"
Period = 0.0001 //Compulsory. Period between signal samples. Period = 0.0001
AutomaticSegmentation = 0
MakeSegmentAfterNWrites = 100
}
OutMdsW2 = {
NodeName = "\TOP.OUT.OUT2"
Period = 0.0001
AutomaticSegmentation = 0 AutomaticSegmentation = 0
MakeSegmentAfterNWrites = 100 MakeSegmentAfterNWrites = 100
} }
CycleTime = { //As many as required. CycleTime = { //As many as required.
NodeName = "\TOP.OUT.Cycle_Time" // node of the tree node NodeName = "\TOP.OUT.Cycle_Time" // node of the tree node
//NodeName = "Cycle_Time" //Compulsory. MDSplus node name Period = 0.0001
Period = 0.0001 //Compulsory. Period between signal samples.
AutomaticSegmentation = 0 AutomaticSegmentation = 0
MakeSegmentAfterNWrites = 100 MakeSegmentAfterNWrites = 100
} }
@@ -834,14 +880,14 @@ $MdsLoopApp = {
} }
} }
} }
+Run = { +Online = {
Class = RealTimeState Class = RealTimeState
+Threads = { +Threads = {
Class = ReferenceContainer Class = ReferenceContainer
+Thread1 = { +Thread1 = {
Class = RealTimeThread Class = RealTimeThread
CPUs = 0x1 CPUs = 0x1
Functions = {GAMTimer GAMWF1 GAMMDSReader GAMConvert2Double GAMSSM GAMMDSWriter} Functions = {GAMTimer GAMWF1 GAMMDSReader GAMConvert2Double GAMElectricProbes GAMSSM GAMMDSWriter}
} }
} }
} }

View File

@@ -43,19 +43,27 @@ namespace MARTeIsttok {
GAM(), GAM(),
MessageI() { MessageI() {
gain = 0u; gain = 0u;
inputSignals = NULL_PTR(MARTe::float32 **); //inputSignals = NULL_PTR(MARTe::float32 **);
outputSignals = NULL_PTR(MARTe::float32 **); //outputSignals = NULL_PTR(MARTe::float32 **);
outputSignal1 = NULL; // outputSignal1 = NULL;
inputElectricTop = NULL_PTR(MARTe::float32 *);
inputElectricInner = NULL_PTR(MARTe::float32 *);
inputElectricOuter = NULL_PTR(MARTe::float32 *);
inputElectricBottom = NULL_PTR(MARTe::float32 *);
outputEpR = NULL_PTR(MARTe::float32 *);
outputEpZ = NULL_PTR(MARTe::float32 *);
} }
ElectricProbesGAM::~ElectricProbesGAM() { ElectricProbesGAM::~ElectricProbesGAM() {
if (inputSignals != NULL_PTR(MARTe::float32 **)) { //if (inputSignals != NULL_PTR(MARTe::float32 **)) {
delete[] inputSignals; // delete[] inputSignals;
} //}
if (outputSignals != NULL_PTR(MARTe::float32 **)) { /*if (outputSignals != NULL_PTR(MARTe::float32 **)) {
delete[] outputSignals; delete[] outputSignals;
} }
outputSignal1 = NULL; */
} }
bool ElectricProbesGAM::Initialise(MARTe::StructuredDataI & data) { bool ElectricProbesGAM::Initialise(MARTe::StructuredDataI & data) {
@@ -79,21 +87,10 @@ namespace MARTeIsttok {
bool ElectricProbesGAM::Setup() { bool ElectricProbesGAM::Setup() {
using namespace MARTe; using namespace MARTe;
uint32 numberOfInputSignals = GetNumberOfInputSignals(); uint32 numberOfInputSignals = GetNumberOfInputSignals();
uint32 numberOfOutputSignals = GetNumberOfOutputSignals();
bool ok = (numberOfInputSignals == 4u); bool ok = (numberOfInputSignals == 4u);
if (!ok) { if (!ok) {
REPORT_ERROR(ErrorManagement::ParametersError, "The number of input signals shall be equal to 4. numberOfInputSignals = %d ", numberOfInputSignals); REPORT_ERROR(ErrorManagement::ParametersError, "The number of input signals shall be equal to 4. numberOfInputSignals = %d ", numberOfInputSignals);
} }
if (ok) {
inputSignals = new float32*[numberOfInputSignals];
}
if (ok) {
ok = (numberOfOutputSignals == 1u);
if (!ok) {
REPORT_ERROR(ErrorManagement::ParametersError,
"The number of output signals shall be equal to 1. numberOfOutputSignals = %d", numberOfOutputSignals);
}
}
if (ok) { if (ok) {
uint32 n; uint32 n;
@@ -144,20 +141,28 @@ namespace MARTeIsttok {
"The number of input signal elements shall be equal to 1. numberOfInputElements(%s) = %d", inputSignalName.Buffer(), numberOfInputElements); "The number of input signal elements shall be equal to 1. numberOfInputElements(%s) = %d", inputSignalName.Buffer(), numberOfInputElements);
} }
if (ok) { // if (ok) {
inputSignals[n] = reinterpret_cast<float32 *>(GetInputSignalMemory(n)); // inputSignals[n] = reinterpret_cast<float32 *>(GetInputSignalMemory(n));
} // }
} }
if (ok) {
inputElectricTop = reinterpret_cast<float32 *>(GetInputSignalMemory(0u));
inputElectricInner = reinterpret_cast<float32 *>(GetInputSignalMemory(1u));
inputElectricOuter = reinterpret_cast<float32 *>(GetInputSignalMemory(2u));
inputElectricBottom = reinterpret_cast<float32 *>(GetInputSignalMemory(3u));
REPORT_ERROR(ErrorManagement::Information, "InputSignals reinterpret_cast OK");
}
} }
// OutputSignals
uint32 numberOfOutputSignals = GetNumberOfOutputSignals();
ok = (numberOfOutputSignals == 2u); ok = (numberOfOutputSignals == 2u);
if (!ok) { if (!ok) {
REPORT_ERROR(ErrorManagement::ParametersError, "The number of output signals shall be equal to 2. numberOfOutputSignals = %d ", numberOfOutputSignals); REPORT_ERROR(ErrorManagement::ParametersError, "The number of output signals shall be equal to 2. numberOfOutputSignals = %d ", numberOfOutputSignals);
} }
if (ok) {
outputSignals = new float32*[numberOfOutputSignals];
}
if (ok) { if (ok) {
uint32 n; uint32 n;
for (n = 0u; (n < numberOfOutputSignals) && (ok); n++) { for (n = 0u; (n < numberOfOutputSignals) && (ok); n++) {
@@ -190,8 +195,7 @@ namespace MARTeIsttok {
if (ok) { if (ok) {
ok = (numberOfOutputDimensions == 0u); ok = (numberOfOutputDimensions == 0u);
if (!ok) { if (!ok) {
REPORT_ERROR( REPORT_ERROR(ErrorManagement::ParametersError,
ErrorManagement::ParametersError,
"The number of output signals dimensions shall be equal to 0. numberOfOutputDimensions (%s) = %d", outputSignalName.Buffer(), numberOfOutputDimensions); "The number of output signals dimensions shall be equal to 0. numberOfOutputDimensions (%s) = %d", outputSignalName.Buffer(), numberOfOutputDimensions);
} }
} }
@@ -207,12 +211,10 @@ namespace MARTeIsttok {
"The number of output signals elements shall be equal to 1. (%s) numberOfOutputElements = %d", outputSignalName.Buffer(), numberOfOutputElements); "The number of output signals elements shall be equal to 1. (%s) numberOfOutputElements = %d", outputSignalName.Buffer(), numberOfOutputElements);
} }
} }
if (ok) { if (ok) {
outputSignals[0] = reinterpret_cast<float32 *>(GetOutputSignalMemory(0)); outputEpR = reinterpret_cast<float32 *>(GetOutputSignalMemory(0u));
outputSignal1 = reinterpret_cast<float32 *>(GetOutputSignalMemory(1)); outputEpZ = reinterpret_cast<float32 *>(GetOutputSignalMemory(1u));
} }
} }
return ok; return ok;
@@ -221,6 +223,10 @@ namespace MARTeIsttok {
bool ElectricProbesGAM::Execute() { bool ElectricProbesGAM::Execute() {
//*outputSignal = *inputSignal; //*outputSignal = *inputSignal;
*outputEpR = 4.3;
// *outputEpZ = 3.4;
*outputEpZ = *inputElectricTop;
//*outputSignal1 = *inputSignals[0]; // - *inputSignals[1];
//*outputSignal1 = *inputSignals[0] - *inputSignals[1]; //*outputSignal1 = *inputSignals[0] - *inputSignals[1];
return true; return true;
} }

View File

@@ -112,13 +112,20 @@ private:
/** /**
* The input signals * The input signals
*/ */
MARTe::float32 **inputSignals; // MARTe::float32 **inputSignals;
MARTe::float32 *inputElectricTop;
MARTe::float32 *inputElectricInner;
MARTe::float32 *inputElectricOuter;
MARTe::float32 *inputElectricBottom;
/** /**
* The output signals * The output signals
*/ */
MARTe::float32 **outputSignals; // MARTe::float32 **outputSignals;
MARTe::float32 *outputSignal1; //MARTe::float32 *outputSignal1;
MARTe::float32 *outputEpR;
MARTe::float32 *outputEpZ;
/** /**

View File

@@ -27,6 +27,7 @@ done
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_DIR/Build/x86-linux/Core/ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_DIR/Build/x86-linux/Core/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/Components/DataSources/AtcaIop/ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/Components/DataSources/AtcaIop/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/Components/GAMs/ElectricProbesGAM/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/EPICSCA/ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/EPICSCA/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/EPICSPVA/ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_Components_DIR/Build/x86-linux/Components/DataSources/EPICSPVA/

View File

@@ -25,6 +25,12 @@ add node TIMED/usage=signal
set def \ISTTOKOUTPUT::TOP.OUT set def \ISTTOKOUTPUT::TOP.OUT
add node OUT0/usage=signal add node OUT0/usage=signal
add node OUT1/usage=signal add node OUT1/usage=signal
add node OUT2/usage=signal
add node OUT3/usage=signal
add node OUT4/usage=signal
add node OUT5/usage=signal
add node OUT6/usage=signal
add node OUT7/usage=signal
add node CYCLE_TIME/usage=signal add node CYCLE_TIME/usage=signal
add node IPLASMA/usage=signal add node IPLASMA/usage=signal
add node IP_X/usage=signal add node IP_X/usage=signal
@@ -74,6 +80,6 @@ add node CYCLETD/usage=signal
write write
close close
# set tree isttokoutput set tree isttokoutput
# create pulse 1 create pulse 1
exit exit

View File

@@ -1,6 +1,5 @@
edit isttoksdas/new edit isttoksdas/new
#add node .ATCAIOP1
add node .INP add node .INP
add node .REFS add node .REFS
add node .ERRORS add node .ERRORS
@@ -16,155 +15,11 @@ add node .ATCA1
add node .ATCA2 add node .ATCA2
# set def \ISTTOKSDAS::TOP.HARDWARE.ATCA1 # set def \ISTTOKSDAS::TOP.HARDWARE.ATCA1
set def .ATCA1 set def .ATCA1
add node .IOC1 add node IOC_0/model=IOCMIMORT
set def .IOC1 add node IOC_1/model=IOCMIMORT
add node COMMENT/usage=text set def \ISTTOKSDAS::TOP.HARDWARE.ATCA1.IOC_1"
add node SLOT/usage=numeric put SLOT "2"
add node CLOCK_FREQ/usage=numeric # put CLOCK_FREQ "20000"
put CLOCK_FREQ "20000"
add node .CHANNELS
set def .CHANNELS
add node .INPUT_00
add node .INPUT_12
add node .INPUT_13
add node .INPUT_14
add node .INPUT_15
set def .INPUT_00
add node RAW/usage=signal
add node GAIN/usage=numeric
# put GAIN "0.000076294"
put GAIN "1.0"
add node OFFSET/usage=numeric
put OFFSET "0.0"
add node SIGNAL/usage=signal
put SIGNAL "BUILD_SIGNAL(GAIN*(RAW - OFFSET),RAW)"
set def \ISTTOKSDAS::TOP.HARDWARE.ATCA1.IOC1.CHANNELS
add node .INPUT_01
set def .INPUT_01
add node RAW/usage=signal
add node GAIN/usage=numeric
put GAIN "1.0"
add node OFFSET/usage=numeric
put OFFSET "0.0"
add node SIGNAL/usage=signal
put SIGNAL "BUILD_SIGNAL(GAIN*(RAW - OFFSET),RAW)"
set def \ISTTOKSDAS::TOP.HARDWARE.ATCA1.IOC1.CHANNELS
add node .INPUT_02
set def .INPUT_02
add node RAW/usage=signal
add node GAIN/usage=numeric
put GAIN "1.0"
add node OFFSET/usage=numeric
put OFFSET "0.0"
add node SIGNAL/usage=signal
put SIGNAL "BUILD_SIGNAL(GAIN*(RAW - OFFSET),RAW)"
set def \ISTTOKSDAS::TOP.HARDWARE.ATCA1.IOC1.CHANNELS
add node .INPUT_03
set def .INPUT_03
add node RAW/usage=signal
add node GAIN/usage=numeric
put GAIN "1.0"
add node OFFSET/usage=numeric
put OFFSET "0.0"
add node SIGNAL/usage=signal
put SIGNAL "BUILD_SIGNAL(GAIN*(RAW - OFFSET),RAW)"
set def \ISTTOKSDAS::TOP.HARDWARE.ATCA1.IOC1.CHANNELS
add node .INPUT_04
set def .INPUT_04
add node RAW/usage=signal
add node GAIN/usage=numeric
put GAIN "1.0"
add node OFFSET/usage=numeric
put OFFSET "0.0"
add node SIGNAL/usage=signal
put SIGNAL "BUILD_SIGNAL(GAIN*(RAW - OFFSET),RAW)"
set def \ISTTOKSDAS::TOP.HARDWARE.ATCA1.IOC1.CHANNELS
add node .INPUT_05
set def .INPUT_05
add node RAW/usage=signal
add node GAIN/usage=numeric
put GAIN "1.0"
add node OFFSET/usage=numeric
put OFFSET "0.0"
add node SIGNAL/usage=signal
put SIGNAL "BUILD_SIGNAL(GAIN*(RAW - OFFSET),RAW)"
set def \ISTTOKSDAS::TOP.HARDWARE.ATCA1.IOC1.CHANNELS
add node .INPUT_06
set def .INPUT_06
add node RAW/usage=signal
add node GAIN/usage=numeric
put GAIN "1.0"
add node OFFSET/usage=numeric
put OFFSET "0.0"
add node SIGNAL/usage=signal
put SIGNAL "BUILD_SIGNAL(GAIN*(RAW - OFFSET),RAW)"
set def \ISTTOKSDAS::TOP.HARDWARE.ATCA1.IOC1.CHANNELS
add node .INPUT_07
set def .INPUT_07
add node RAW/usage=signal
add node GAIN/usage=numeric
put GAIN "1.0"
add node OFFSET/usage=numeric
put OFFSET "0.0"
add node SIGNAL/usage=signal
put SIGNAL "BUILD_SIGNAL(GAIN*(RAW - OFFSET),RAW)"
set def \ISTTOKSDAS::TOP.HARDWARE.ATCA1.IOC1.CHANNELS
add node .INPUT_08
set def .INPUT_08
add node RAW/usage=signal
add node GAIN/usage=numeric
put GAIN "1.0"
add node OFFSET/usage=numeric
put OFFSET "0.0"
add node SIGNAL/usage=signal
put SIGNAL "BUILD_SIGNAL(GAIN*(RAW - OFFSET),RAW)"
set def \ISTTOKSDAS::TOP.HARDWARE.ATCA1.IOC1.CHANNELS
add node .INPUT_09
set def .INPUT_09
add node RAW/usage=signal
add node GAIN/usage=numeric
put GAIN "1.0"
add node OFFSET/usage=numeric
put OFFSET "0.0"
add node SIGNAL/usage=signal
put SIGNAL "BUILD_SIGNAL(GAIN*(RAW - OFFSET),RAW)"
set def \ISTTOKSDAS::TOP.HARDWARE.ATCA1.IOC1.CHANNELS
add node .INPUT_10
set def .INPUT_10
add node RAW/usage=signal
add node GAIN/usage=numeric
put GAIN "1.0"
add node OFFSET/usage=numeric
put OFFSET "0.0"
add node SIGNAL/usage=signal
put SIGNAL "BUILD_SIGNAL(GAIN*(RAW - OFFSET),RAW)"
set def \ISTTOKSDAS::TOP.HARDWARE.ATCA1.IOC1.CHANNELS
add node .INPUT_11
set def .INPUT_11
add node RAW/usage=signal
add node GAIN/usage=numeric
put GAIN "1.0"
add node OFFSET/usage=numeric
put OFFSET "0.0"
add node SIGNAL/usage=signal
put SIGNAL "BUILD_SIGNAL(GAIN*(RAW - OFFSET),RAW)"
set def \ISTTOKSDAS::TOP.HARDWARE.ATCA1.IOC1.CHANNELS
set def \ISTTOKSDAS::TOP.HARDWARE.ATCA1.IOC1.CHANNELS.INPUT_12
add node IOCINTCHAN/usage=subtree
set def \ISTTOKSDAS::TOP.INP set def \ISTTOKSDAS::TOP.INP