Generation working and Compilation of MARTe components
This commit is contained in:
@@ -0,0 +1,260 @@
|
||||
/**
|
||||
* @file JARTStateMachineGAM.h
|
||||
* @brief Header file for class JARTStateMachineGAM
|
||||
* @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_JARTSTATEMACHINEGAM_H_
|
||||
#define GAMS_JARTSTATEMACHINEGAM_H_
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Standard header includes */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Project header includes */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "GAM.h"
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Class declaration */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief GAM that provides real-time state machine.
|
||||
*
|
||||
* The configuration syntax is (names and signal quantity are only given as an example):
|
||||
* <pre>
|
||||
* +GAMRealTimeStateMachine = {
|
||||
* Class = JARTStateMachineGAM
|
||||
* 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
|
||||
* }
|
||||
* }
|
||||
* OutputSignals = {
|
||||
* Value = {
|
||||
* DataSource = DDB1
|
||||
* Type = uint32
|
||||
* Trigger = 1
|
||||
* }
|
||||
* BEAM_ON_STAT = {
|
||||
* 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 JARTStateMachineGAM : public MARTe::GAM, public MARTe::StatefulI {
|
||||
public:
|
||||
CLASS_REGISTER_DECLARATION()
|
||||
|
||||
JARTStateMachineGAM();
|
||||
|
||||
virtual ~JARTStateMachineGAM();
|
||||
|
||||
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 = 1,
|
||||
RFON = 2,
|
||||
HVTerminate = 3
|
||||
};
|
||||
|
||||
//The current rtState
|
||||
JARealTimeState currentState;
|
||||
|
||||
//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;
|
||||
|
||||
//The trigger signal (PLC_ON)
|
||||
MARTe::uint32 *triggerSignal;
|
||||
|
||||
//Time signal
|
||||
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 short pulse mode.
|
||||
MARTe::uint32 *short_pulse_mode;
|
||||
|
||||
// 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;
|
||||
|
||||
// Added for HVPS state (20201117)
|
||||
MARTe::uint32 *outputAPSHVON;
|
||||
MARTe::uint32 *outputAPSSWON;
|
||||
MARTe::uint32 *outputBPSHVON;
|
||||
MARTe::uint32 *outputBPSSWON;
|
||||
MARTe::uint32 *outputMHVPSON;
|
||||
|
||||
// Output signals for NI devices
|
||||
MARTe::uint32 *outputSignalNI6259;
|
||||
MARTe::uint8 *outputSignalNI6528P3;
|
||||
MARTe::uint8 *outputSignalNI6528P4;
|
||||
|
||||
//////////////////////////////
|
||||
//Internal Parameters
|
||||
//////////////////////////////
|
||||
//PLC_ON time holder
|
||||
MARTe::uint32 plcOnTime;
|
||||
//APS_SWON time holder
|
||||
MARTe::uint32 apsSwonTime;
|
||||
MARTe::uint32 apsSwoffTime;
|
||||
MARTe::uint64 apsSwonHighResolutionTime;
|
||||
|
||||
//PS turn off delay
|
||||
MARTe::uint32 turn_off_delay;
|
||||
|
||||
//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;
|
||||
|
||||
// terminal values
|
||||
MARTe::uint8 p3Value;
|
||||
MARTe::uint8 p4Value;
|
||||
MARTe::uint8 aps_hvon_state;
|
||||
MARTe::uint8 aps_swon_state;
|
||||
MARTe::uint8 mhvps_hvon_state;
|
||||
MARTe::uint8 bps_hvon_state;
|
||||
MARTe::uint8 bps_swon_state;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Inline method definitions */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
#endif /* GAMS_JARTSTATEMACHINEGAM_H_ */
|
||||
@@ -0,0 +1,180 @@
|
||||
record (bo,"EC-GN-P01-PB1F:PSU1000-CON-HV")
|
||||
{
|
||||
field(DESC, "GY1 BPS HVON")
|
||||
field(ONAM, "ON")
|
||||
field(PINI, "YES")
|
||||
field(SCAN, "Passive")
|
||||
field(SIML, "EC-GN-P01-GAF:STAT-DO-SIMM")
|
||||
field(VAL, "0")
|
||||
field(ZNAM, "OFF")
|
||||
}
|
||||
|
||||
record (bo,"EC-GN-P01-PB1F:PSU1000-CON-SW")
|
||||
{
|
||||
field(DESC, "GY1 BPS HV SWON")
|
||||
field(ONAM, "ON")
|
||||
field(PINI, "YES")
|
||||
field(SCAN, "Passive")
|
||||
field(SIML, "EC-GN-P01-GAF:STAT-DO-SIMM")
|
||||
field(VAL, "0")
|
||||
field(ZNAM, "OFF")
|
||||
}
|
||||
|
||||
record (bo,"EC-GN-P01-PB1F:PSU1000-CTRP")
|
||||
{
|
||||
field(DESC, "GY1 BPS Shutdonw request")
|
||||
field(ONAM, "ON")
|
||||
field(PINI, "YES")
|
||||
field(SCAN, "Passive")
|
||||
field(SIML, "EC-GN-P01-GAF:STAT-DO-SIMM")
|
||||
field(VAL, "0")
|
||||
field(ZNAM, "OFF")
|
||||
}
|
||||
|
||||
record (bi,"EC-GN-P01-PB1F:PSU1000-YFLT")
|
||||
{
|
||||
field(DESC, "GY1 BPS Fault")
|
||||
field(DTYP, "asynInt32")
|
||||
field(INP, "@asyn(ni6528_1, 3) bitread")
|
||||
field(ONAM, "FAULT")
|
||||
field(PINI, "YES")
|
||||
field(SCAN, "I/O Intr")
|
||||
field(SIML, "EC-GN-P01-GAF:STAT-DI-SIMM")
|
||||
field(VAL, "0")
|
||||
field(ZNAM, "NORMAL")
|
||||
}
|
||||
|
||||
record (bi,"EC-GN-P01-PB1F:PSU1000-YSTA")
|
||||
{
|
||||
field(DESC, "GY1 BPS Ready")
|
||||
field(DTYP, "asynInt32")
|
||||
field(INP, "@asyn(ni6528_1, 2) bitread")
|
||||
field(ONAM, "READY")
|
||||
field(PINI, "YES")
|
||||
field(SCAN, "I/O Intr")
|
||||
field(SIML, "EC-GN-P01-GAF:STAT-DI-SIMM")
|
||||
field(VAL, "0")
|
||||
field(ZNAM, "NO")
|
||||
}
|
||||
|
||||
record (bo,"EC-GN-P01-PB1F:STAT-MANM")
|
||||
{
|
||||
field(DESC, "Manual Mode SW for GY1 BPS")
|
||||
field(ONAM, "ON")
|
||||
field(PINI, "YES")
|
||||
field(SCAN, "Passive")
|
||||
field(VAL, "1")
|
||||
field(ZNAM, "OFF")
|
||||
}
|
||||
|
||||
record (ao,"EC-GN-P01-PB1F:PSU1000-EREF")
|
||||
{
|
||||
field(ASLO, "4")
|
||||
field(DESC, "GY1 BPS voltage setpoint")
|
||||
field(DRVH, "40")
|
||||
field(DRVL, "0")
|
||||
field(DTYP, "asynFloat64")
|
||||
field(EGU, "kV")
|
||||
field(HOPR, "40")
|
||||
field(LOPR, "0")
|
||||
field(OUT, "@asyn(ni6368_1, 0) write_ao")
|
||||
field(PINI, "YES")
|
||||
field(PREC, "2")
|
||||
field(SCAN, "Passive")
|
||||
field(SIML, "EC-GN-P01-GAF:STAT-AO-SIMM")
|
||||
field(VAL, "0")
|
||||
}
|
||||
|
||||
record (ao,"EC-GN-P01-PB1F:PSU1000-EREF-MSP")
|
||||
{
|
||||
field(DESC, "GY1 BPS voltage manual setpoint")
|
||||
field(DRVH, "40")
|
||||
field(DRVL, "0")
|
||||
field(EGU, "kV")
|
||||
field(HOPR, "40")
|
||||
field(LOPR, "0")
|
||||
field(PINI, "YES")
|
||||
field(PREC, "2")
|
||||
field(SCAN, "Passive")
|
||||
field(VAL, "0")
|
||||
}
|
||||
|
||||
record (ai,"EC-GN-P01-PB1F:PSU1000-ET")
|
||||
{
|
||||
field(DESC, "GY1 BPS Measured Voltage")
|
||||
field(EGU, "kV")
|
||||
field(PINI, "YES")
|
||||
field(PREC, "3")
|
||||
field(SCAN, ".1 second")
|
||||
field(SIML, "EC-GN-P01-GAF:STAT-AI-SIMM")
|
||||
}
|
||||
|
||||
record (waveform,"EC-GN-P01-PB1F:PSU1000-ET-WF")
|
||||
{
|
||||
field(DESC, "GY1 BPS Measured Voltage")
|
||||
field(EGU, "V")
|
||||
field(FTVL, "FLOAT")
|
||||
field(NELM, "8000")
|
||||
field(PINI, "YES")
|
||||
field(PREC, "3")
|
||||
field(SCAN, "Passive")
|
||||
field(SIML, "EC-GN-P01-GAF:STAT-AI-SIMM")
|
||||
}
|
||||
|
||||
record (ai,"EC-GN-P01-PB1F:PSU1000-IT")
|
||||
{
|
||||
field(DESC, "GY1 BPS Measured Current")
|
||||
field(EGU, "A")
|
||||
field(PINI, "YES")
|
||||
field(PREC, "3")
|
||||
field(SCAN, ".1 second")
|
||||
field(SIML, "EC-GN-P01-GAF:STAT-AI-SIMM")
|
||||
}
|
||||
|
||||
record (waveform,"EC-GN-P01-PB1F:PSU1000-IT-WF")
|
||||
{
|
||||
field(DESC, "GY1 BPS Measured Current")
|
||||
field(EGU, "A")
|
||||
field(FTVL, "FLOAT")
|
||||
field(NELM, "8000")
|
||||
field(PINI, "YES")
|
||||
field(PREC, "3")
|
||||
field(SCAN, "Passive")
|
||||
field(SIML, "EC-GN-P01-GAF:STAT-AI-SIMM")
|
||||
}
|
||||
|
||||
record (ai,"EC-GN-P01-PB1F:STAT-DT-HVON")
|
||||
{
|
||||
field(DESC, "Time diff to GY1 BPS Gate ON")
|
||||
field(EGU, "us")
|
||||
field(HOPR, "5000000")
|
||||
field(LOPR, "1000")
|
||||
field(PINI, "YES")
|
||||
field(PREC, "0")
|
||||
field(SCAN, "Passive")
|
||||
field(VAL, "500000")
|
||||
}
|
||||
|
||||
record (ai,"EC-GN-P01-PB1F:STAT-DT-SWON")
|
||||
{
|
||||
field(DESC, "Time diff to GY1 BPS SW ON")
|
||||
field(EGU, "us")
|
||||
field(HOPR, "5000000")
|
||||
field(LOPR, "1000")
|
||||
field(PINI, "YES")
|
||||
field(PREC, "0")
|
||||
field(SCAN, "Passive")
|
||||
field(VAL, "550000")
|
||||
}
|
||||
|
||||
record (waveform,"EC-GN-P01-PB1F:STAT-PREP-WF")
|
||||
{
|
||||
field(DESC, "GY1 BPS prepro schedule")
|
||||
field(EGU, "V")
|
||||
field(FTVL, "FLOAT")
|
||||
field(NELM, "8000")
|
||||
field(PINI, "NO")
|
||||
field(PREC, "2")
|
||||
field(SCAN, "Passive")
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
#======================================================================
|
||||
# SYS Monitor
|
||||
#======================================================================
|
||||
cd $(EPICS_ROOT)/db
|
||||
#dbLoadRecords("picmg-sensors.db","CBS=EC-GN-SYSM, CTRLTYPE=F, IDX=0, PP=01, PPPP=52RF, NNNN=4210, TTT=PCF")
|
||||
#dbLoadRecords("sysmon.db","CBS=EC-GN-SYSM, CTRLTYPE=F, IDX=0, PP=01, PPPP=52RF, NNNN=4210, TTT=PCF")
|
||||
|
||||
|
||||
#======================================================================
|
||||
# IOC Monitor
|
||||
#======================================================================
|
||||
cd $(EPICS_ROOT)/db
|
||||
dbLoadRecords("iocmon.db","CBS=EC-GN-SYSM, CTRLTYPE=F, IDX=0, IOCTYPE=SYSM, PP=01, PPPP=52RF, NNNN=4210, TTT=PCF")
|
||||
|
||||
|
||||
#- End-of-file marker - do not delete or add lines below!
|
||||
Reference in New Issue
Block a user