251 lines
8.3 KiB
Plaintext
251 lines
8.3 KiB
Plaintext
/**
|
|
* @file JARTStateMachineGAM.h
|
|
* @brief Header file for class JASDNRTStateMachineGAM
|
|
* @date Nov 26, 2018
|
|
* @author aneto
|
|
*
|
|
* @copyright Copyright 2015 F4E | European Joint Undertaking for ITER and
|
|
* the Development of Fusion Energy ('Fusion for Energy').
|
|
* Licensed under the EUPL, Version 1.1 or - as soon they will be approved
|
|
* by the European Commission - subsequent versions of the EUPL (the "Licence")
|
|
* You may not use this work except in compliance with the Licence.
|
|
* You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl
|
|
*
|
|
* @warning Unless required by applicable law or agreed to in writing,
|
|
* software distributed under the Licence is distributed on an "AS IS"
|
|
* 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
|
|
* 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.
|
|
*/
|
|
|
|
#ifndef GAMS_JASDNRTSTATEMACHINEGAM_H_
|
|
#define GAMS_JASDNRTSTATEMACHINEGAM_H_
|
|
|
|
/*---------------------------------------------------------------------------*/
|
|
/* Standard header includes */
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
/*---------------------------------------------------------------------------*/
|
|
/* Project header includes */
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
#include "GAM.h"
|
|
|
|
/*---------------------------------------------------------------------------*/
|
|
/* Class declaration */
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
/**
|
|
* @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
|
|
* aps_swon = 16
|
|
* bps_hvon = 2
|
|
* bps_swon = 8
|
|
* InputSignals = {
|
|
* Time = {
|
|
* DataSource = DDB1
|
|
* Type = uint32
|
|
* }
|
|
* PLC_ON = {
|
|
* DataSource = DDB1
|
|
* Type = uint32
|
|
* }
|
|
* MHVPS_DT = {
|
|
* DataSource = DDB1
|
|
* Type = uint32
|
|
* }
|
|
* APS_HVON_DT = {
|
|
* DataSource = DDB1
|
|
* Type = uint32
|
|
* }
|
|
* APS_SWON_DT = {
|
|
* DataSource = DDB1
|
|
* Type = uint32
|
|
* }
|
|
* BPS_HVON_DT = {
|
|
* DataSource = DDB1
|
|
* Type = uint32
|
|
* }
|
|
* BPS_SWON_DT = {
|
|
* DataSource = DDB1
|
|
* Type = uint32
|
|
* }
|
|
* SHOTLEN = {
|
|
* DataSource = DDB1
|
|
* Type = uint32
|
|
* }
|
|
* StopRequest = {
|
|
* DataSource = DDB1
|
|
* Type = uint32
|
|
* }
|
|
* MODE_SHOTLEN_FLAG = {
|
|
* DataSource = DDB1
|
|
* Type = uint32
|
|
* }
|
|
* Command = {
|
|
* DataSource = RealTimeThreadAsyncBridge
|
|
* Type = uint16
|
|
* }
|
|
* }
|
|
* OutputSignals = {
|
|
* Value = {
|
|
* //DataSource = NI6259
|
|
* DataSource = Display
|
|
* Type = uint32
|
|
* Trigger = 1
|
|
* }
|
|
* BeamON = {
|
|
* DataSource = RealTimeThreadAsyncBridge
|
|
* Type = uint32
|
|
* }
|
|
* HVARMED = {
|
|
* DataSource = RealTimeThreadAsyncBridge
|
|
* Type = uint32
|
|
* }
|
|
* HVINJECTION = {
|
|
* DataSource = RealTimeThreadAsyncBridge
|
|
* Type = uint32
|
|
* }
|
|
* RFON = {
|
|
* DataSource = RealTimeThreadAsyncBridge
|
|
* Type = uint32
|
|
* }
|
|
* BeamONTime = {
|
|
* DataSource = RealTimeThreadAsyncBridge
|
|
* Type = uint32
|
|
* }
|
|
* RFONTime = {
|
|
* DataSource = RealTimeThreadAsyncBridge
|
|
* Type = uint32
|
|
* }
|
|
* SHOT_ID = {
|
|
* DataSource = RealTimeThreadAsyncBridge
|
|
* Type = uint32
|
|
* }
|
|
* }
|
|
* }
|
|
* </pre>
|
|
*
|
|
*/
|
|
|
|
class JASDNRTStateMachineGAM : public MARTe::GAM, public MARTe::StatefulI {
|
|
public:
|
|
CLASS_REGISTER_DECLARATION()
|
|
|
|
JASDNRTStateMachineGAM();
|
|
|
|
virtual ~JASDNRTStateMachineGAM();
|
|
|
|
virtual bool Initialise(MARTe::StructuredDataI & data);
|
|
|
|
virtual bool Setup();
|
|
|
|
virtual bool Execute();
|
|
|
|
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 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;
|
|
|
|
/////////////////////////////////////////////////
|
|
// 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;
|
|
|
|
/////////////////////////////////////////////////////////////
|
|
// 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;
|
|
|
|
//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 */
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
#endif /* GAMS_JASDNRTSTATEMACHINEGAM_H_ */
|