fixed types

This commit is contained in:
Martino Ferrari
2026-02-06 17:48:05 +01:00
parent e1549afa07
commit 12ceba0bf6
2 changed files with 104 additions and 109 deletions

View File

@@ -32,6 +32,7 @@
#include "JASDNRTStateMachineGAM.h"
#include "AdvancedErrorManagement.h"
#include "TypeDescriptor.h"
/*---------------------------------------------------------------------------*/
/* Static definitions */
@@ -54,7 +55,7 @@ JASDNRTStateMachineGAM::JASDNRTStateMachineGAM() {
mhvps_hvon = 0;
// Parameters which get from Input signals.
triggerSignal = NULL_PTR(MARTe::uint32 *);
triggerSignal = NULL_PTR(MARTe::uint8 *);
currentTime = NULL_PTR(MARTe::uint32 *);
triggerDelay_mhvps_hvon = NULL_PTR(MARTe::uint32 *);
triggerDelay_aps_hvon = NULL_PTR(MARTe::uint32 *);
@@ -62,16 +63,16 @@ JASDNRTStateMachineGAM::JASDNRTStateMachineGAM() {
triggerDelay_bps_hvon = NULL_PTR(MARTe::uint32 *);
triggerDelay_bps_swon = NULL_PTR(MARTe::uint32 *);
triggerDelay_shotlen = NULL_PTR(MARTe::uint32 *);
stopRequest = NULL_PTR(MARTe::uint32 *);
stopRequest = NULL_PTR(MARTe::uint8 *);
modePulseLengthLimit = NULL_PTR(MARTe::uint32 *);
sdnCommand = NULL_PTR(MARTe::uint16 *);
// write out target.
outputSignal = NULL_PTR(MARTe::uint32 *);
outputBeamON = NULL_PTR(MARTe::uint32 *);
outputHVArmed = NULL_PTR(MARTe::uint32 *);
outputHVInjection = NULL_PTR(MARTe::uint32 *);
outputRFON = NULL_PTR(MARTe::uint32 *);
outputBeamON = NULL_PTR(MARTe::uint8 *);
outputHVArmed = NULL_PTR(MARTe::uint8 *);
outputHVInjection = NULL_PTR(MARTe::uint8 *);
outputRFON = NULL_PTR(MARTe::uint8 *);
outputBeamONTime = NULL_PTR(MARTe::uint32 *);
outputRFONTime = NULL_PTR(MARTe::uint32 *);
shotCounter = NULL_PTR(MARTe::uint32 *);
@@ -149,7 +150,7 @@ bool JASDNRTStateMachineGAM::Setup() {
uint32 c;
for (c = 0u; c < numberOfInputSignals; c++) {
TypeDescriptor inputType = GetSignalType(InputSignals, c);
ok = (inputType == UnsignedInteger32Bit || inputType == UnsignedInteger16Bit);
ok = (inputType == UnsignedInteger32Bit || inputType == UnsignedInteger16Bit || inputType == UnsignedInteger8Bit);
if (!ok) {
StreamString signalName;
(void) GetSignalName(InputSignals, c, signalName);
@@ -162,7 +163,7 @@ bool JASDNRTStateMachineGAM::Setup() {
uint32 c;
for (c = 0u; c < numberOfOutputSignals; c++) {
TypeDescriptor outputType = GetSignalType(OutputSignals, c);
ok = (outputType == UnsignedInteger32Bit);
ok = (outputType == UnsignedInteger32Bit || outputType == UnsignedInteger8Bit);
if (!ok) {
StreamString signalName;
(void) GetSignalName(InputSignals, c, signalName);
@@ -172,22 +173,22 @@ bool JASDNRTStateMachineGAM::Setup() {
}
if (ok) {
currentTime = reinterpret_cast<uint32 *>(GetInputSignalMemory(0));
triggerSignal = reinterpret_cast<uint32 *>(GetInputSignalMemory(1));
triggerSignal = reinterpret_cast<uint8 *>(GetInputSignalMemory(1));
triggerDelay_mhvps_hvon = reinterpret_cast<uint32 *>(GetInputSignalMemory(2));
triggerDelay_aps_hvon = reinterpret_cast<uint32 *>(GetInputSignalMemory(3));
triggerDelay_aps_swon = reinterpret_cast<uint32 *>(GetInputSignalMemory(4));
triggerDelay_bps_hvon = reinterpret_cast<uint32 *>(GetInputSignalMemory(5));
triggerDelay_bps_swon = reinterpret_cast<uint32 *>(GetInputSignalMemory(6));
triggerDelay_shotlen = reinterpret_cast<uint32 *>(GetInputSignalMemory(7));
stopRequest = reinterpret_cast<uint32 *>(GetInputSignalMemory(8));
stopRequest = reinterpret_cast<uint8 *>(GetInputSignalMemory(8));
modePulseLengthLimit = reinterpret_cast<uint32 *>(GetInputSignalMemory(9));
sdnCommand = reinterpret_cast<uint16 *>(GetInputSignalMemory(10));
outputSignal = reinterpret_cast<uint32 *>(GetOutputSignalMemory(0));
outputBeamON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(1));
outputHVArmed = reinterpret_cast<uint32 *>(GetOutputSignalMemory(2));
outputHVInjection = reinterpret_cast<uint32 *>(GetOutputSignalMemory(3));
outputRFON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(4));
outputBeamON = reinterpret_cast<uint8 *>(GetOutputSignalMemory(1));
outputHVArmed = reinterpret_cast<uint8 *>(GetOutputSignalMemory(2));
outputHVInjection = reinterpret_cast<uint8 *>(GetOutputSignalMemory(3));
outputRFON = reinterpret_cast<uint8 *>(GetOutputSignalMemory(4));
outputBeamONTime = reinterpret_cast<uint32 *>(GetOutputSignalMemory(5));
outputRFONTime = reinterpret_cast<uint32 *>(GetOutputSignalMemory(6));
shotCounter = reinterpret_cast<uint32 *>(GetOutputSignalMemory(7));

View File

@@ -16,7 +16,8 @@
* basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the Licence permissions and limitations under the Licence.
* @details This header file contains the declaration of the class JARTStateMachineGAM
* @details This header file contains the declaration of the class
JARTStateMachineGAM
* with all of its public, protected and private members. It may also include
* definitions for inline methods which need to be visible to the compiler.
*/
@@ -41,13 +42,9 @@
/**
* @brief GAM provides real-time state machine that communicate with SDN packet.
*
* The configuration syntax is (names and signal quantity are only given as an example):
* <pre>
* +GAMSDNRealTimeStateMachine = {
* Class = JASDNRTStateMachineGAM
* ConditionTrigger = 1
* mhvps_hvon = 4
* aps_hvon = 1
* The configuration syntax is (names and signal quantity are only given as an
* example): <pre> +GAMSDNRealTimeStateMachine = { Class =
* JASDNRTStateMachineGAM ConditionTrigger = 1 mhvps_hvon = 4 aps_hvon = 1
* aps_swon = 16
* bps_hvon = 2
* bps_swon = 8
@@ -135,114 +132,111 @@
* }
* }
* </pre>
*
*
*/
class JASDNRTStateMachineGAM : public MARTe::GAM, public MARTe::StatefulI {
public:
CLASS_REGISTER_DECLARATION()
CLASS_REGISTER_DECLARATION()
JASDNRTStateMachineGAM();
JASDNRTStateMachineGAM();
virtual ~JASDNRTStateMachineGAM();
virtual ~JASDNRTStateMachineGAM();
virtual bool Initialise(MARTe::StructuredDataI & data);
virtual bool Initialise(MARTe::StructuredDataI &data);
virtual bool Setup();
virtual bool Setup();
virtual bool Execute();
virtual bool Execute();
virtual bool PrepareNextState(const MARTe::char8 * const currentStateName,
const MARTe::char8 * const nextStateName);
virtual bool PrepareNextState(const MARTe::char8 *const currentStateName,
const MARTe::char8 *const nextStateName);
private:
//The list of possible states
enum JARealTimeState {
WaitTrigger = 0,
SwitchingHVPS_HVON = 1,
WaitSDNTrigger = 2,
SwitchingHVPS_SWON = 3,
RFON = 4,
HVTerminate = 5
};
// The list of possible states
enum JARealTimeState {
WaitTrigger = 0,
SwitchingHVPS_HVON = 1,
WaitSDNTrigger = 2,
SwitchingHVPS_SWON = 3,
RFON = 4,
HVTerminate = 5
};
//The current rtState
JARealTimeState currentState;
// The current rtState
JARealTimeState currentState;
/////////////////////////////////////////////////
// Static parameter given by cfg File
/////////////////////////////////////////////////
//A given condition
MARTe::uint32 conditionTrigger;
//What to output in a given state and condition
MARTe::uint32 mhvps_hvon;
MARTe::uint32 aps_hvon;
MARTe::uint32 aps_swon;
MARTe::uint32 bps_hvon;
MARTe::uint32 bps_swon;
/////////////////////////////////////////////////
// Static parameter given by cfg File
/////////////////////////////////////////////////
// A given condition
MARTe::uint32 conditionTrigger;
// What to output in a given state and condition
MARTe::uint32 mhvps_hvon;
MARTe::uint32 aps_hvon;
MARTe::uint32 aps_swon;
MARTe::uint32 bps_hvon;
MARTe::uint32 bps_swon;
/////////////////////////////////////////////////
// Input signals
/////////////////////////////////////////////////
//The trigger signal (PLC_ON)
MARTe::uint32 *triggerSignal;
//Time signal (Time from TimerGAM)
MARTe::uint32 *currentTime;
// Input signals for trigger delay parameters
MARTe::uint32 *triggerDelay_mhvps_hvon;
MARTe::uint32 *triggerDelay_aps_hvon;
MARTe::uint32 *triggerDelay_aps_swon;
MARTe::uint32 *triggerDelay_bps_hvon;
MARTe::uint32 *triggerDelay_bps_swon;
MARTe::uint32 *triggerDelay_shotlen;
// Input signal for sequence stop request.
MARTe::uint32 *stopRequest;
// Input signal for pulse length limit by mode.
MARTe::uint32 *modePulseLengthLimit;
// Input signal for SDN commands.
MARTe::uint16 *sdnCommand;
/////////////////////////////////////////////////
// Input signals
/////////////////////////////////////////////////
// The trigger signal (PLC_ON)
MARTe::uint8 *triggerSignal;
// Time signal (Time from TimerGAM)
MARTe::uint32 *currentTime;
// Input signals for trigger delay parameters
MARTe::uint32 *triggerDelay_mhvps_hvon;
MARTe::uint32 *triggerDelay_aps_hvon;
MARTe::uint32 *triggerDelay_aps_swon;
MARTe::uint32 *triggerDelay_bps_hvon;
MARTe::uint32 *triggerDelay_bps_swon;
MARTe::uint32 *triggerDelay_shotlen;
// Input signal for sequence stop request.
MARTe::uint8 *stopRequest;
// Input signal for pulse length limit by mode.
MARTe::uint32 *modePulseLengthLimit;
// Input signal for SDN commands.
MARTe::uint16 *sdnCommand;
/////////////////////////////////////////////////////////////
// Output signal to which the output value will be written.
/////////////////////////////////////////////////////////////
// One state write One signal.
MARTe::uint32 *outputSignal;
// state notify output
MARTe::uint32 *outputBeamON;
MARTe::uint32 *outputHVArmed;
MARTe::uint32 *outputHVInjection;
MARTe::uint32 *outputRFON;
// elapsed time notify output;
MARTe::uint32 *outputBeamONTime;
MARTe::uint32 *outputRFONTime;
// shot counter (coutup every RFON time.)
MARTe::uint32 *shotCounter;
//////////////////////////////
//Internal Parameters
//////////////////////////////
//PLC_ON time holder
MARTe::uint32 plcOnTime;
//APS_SWON time holder
MARTe::uint32 apsSwonTime;
MARTe::uint32 apsSwoffTime;
/////////////////////////////////////////////////////////////
// Output signal to which the output value will be written.
/////////////////////////////////////////////////////////////
// One state write One signal.
MARTe::uint32 *outputSignal;
// state notify output
MARTe::uint8 *outputBeamON;
MARTe::uint8 *outputHVArmed;
MARTe::uint8 *outputHVInjection;
MARTe::uint8 *outputRFON;
// elapsed time notify output;
MARTe::uint32 *outputBeamONTime;
MARTe::uint32 *outputRFONTime;
// shot counter (coutup every RFON time.)
MARTe::uint32 *shotCounter;
//PS turn off delay
MARTe::uint32 turn_off_delay;
//////////////////////////////
// Internal Parameters
//////////////////////////////
// PLC_ON time holder
MARTe::uint32 plcOnTime;
// APS_SWON time holder
MARTe::uint32 apsSwonTime;
MARTe::uint32 apsSwoffTime;
//SDN trigger command arrival time.
MARTe::uint32 sdnTriggerTime;
//HVPS state holder
bool mhvps_hvon_is_on;
bool aps_hvon_is_on;
bool aps_swon_is_on;
bool bps_hvon_is_on;
bool bps_swon_is_on;
// PS turn off delay
MARTe::uint32 turn_off_delay;
// SDN trigger command arrival time.
MARTe::uint32 sdnTriggerTime;
// HVPS state holder
bool mhvps_hvon_is_on;
bool aps_hvon_is_on;
bool aps_swon_is_on;
bool bps_hvon_is_on;
bool bps_swon_is_on;
};
/*---------------------------------------------------------------------------*/
/* Inline method definitions */
/*---------------------------------------------------------------------------*/