Generation working and Compilation of MARTe components

This commit is contained in:
ferrog
2025-05-13 16:03:11 +00:00
parent 3a5e378d99
commit 4faee3802a
1571 changed files with 611466 additions and 0 deletions

View File

@@ -0,0 +1,149 @@
/**
* @file JAMessageGAM.h
* @brief Header file for class JAMessageGAM
* @date Jan, 2019
* @author rhari
*
* @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 JAMessageGAM
* 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_JAMESSAGEGAM_H_
#define GAMS_JAMESSAGEGAM_H_
/*---------------------------------------------------------------------------*/
/* Standard header includes */
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
/* Project header includes */
/*---------------------------------------------------------------------------*/
#include "GAM.h"
#include "Message.h"
/*---------------------------------------------------------------------------*/
/* Class declaration */
/*---------------------------------------------------------------------------*/
/**
* @brief GAM that sends a message when input signals have expected values. Message will not be sent multiple
* times without first changing the application state.
*
* The configuration syntax is (names and signal quantity are only given as an example):
* <pre>
* +MessageGAM = {
* Class = JAMessageGAM
* Operation = AND // Accepted values are: AND, OR, XOR, NOR. Default value is AND.
* ExpectedIntValues = {1 10} // Expected values for input signals of integral type.
* ExpectedFloatValues = {3.5} // Expected values for float signals of floting point type.
* Comparators = {EQUALS GREATER NOT} // Accepted values are: EQUALS, NOT, GREATER, EQUALS_OR_GREATER, LESS, EQUALS_OR_LESS
* // Comparators element is optional. Default comparator is EQUALS.
* InputSignals = {
* Sig1 = {
* DataSource = EPICSCAInput
* Type = uint32
* }
* Sig2 = {
* DataSource = EPICSCAInput
* Type = float32
* }
* Sig3 = {
* DataSource = EPICSCAInput
* Type = uint32
* }
* }
* +Event = { // Message to be sent when condition is true.
* Class = Message
* Destination = StateMachine
* Function = GoDisabled
* }
* }
* </pre>
* This example will send Event message when Sig1 == 1 && Sig2 > 3.5 && Sig3 != 10
*/
class JAMessageGAM : public MARTe::GAM, public MARTe::StatefulI {
public:
CLASS_REGISTER_DECLARATION()
JAMessageGAM();
virtual ~JAMessageGAM();
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);
enum ComparisonMode {
Equals, Not, Greater, EqualsOrGreater, Less, EqualsOrLess
};
private:
/**
* @brief Does the input signal at provided index have the expected value.
* @param[in] index of the signal.
* @param[out] floatValueIndex lookup index for expected float values array.
* @param[out] intValueIndex lookup index for expected integer values array.
* @return true if the signal has expected value.
*/
bool Compare(MARTe::uint32 index, MARTe::uint32 &floatValueIndex, MARTe::uint32 &intValueIndex);
enum OperationMode {
And, Or, Xor, Nor
};
// Input signals
void **inputSignals;
MARTe::TypeDescriptor *inputSignalTypes;
// Condition operation.
OperationMode operation;
// Message to be sent when conditions are met.
MARTe::ReferenceT<MARTe::Message> eventMsg;
// Was the message already sent and we are waiting for a state change before next message can be sent.
bool needsReset;
// Array of expected integer values of input signals.
MARTe::uint64* expectedValuesInt;
// Array of expected float values for input signals.
MARTe::float64* expectedValuesFloat;
// Expected integer values count (must be equal to numberOfInputSignals - floatValuesCount)
MARTe::uint32 intValuesCount;
// Expected integer values count (must be equal to numberOfInputSignals - floatValuesCount)
MARTe::uint32 floatValuesCount;
// Array of comparators
ComparisonMode* comparators;
};
/*---------------------------------------------------------------------------*/
/* Inline method definitions */
/*---------------------------------------------------------------------------*/
#endif /* GAMS_JAMESSAGEGAM_H_ */

View File

@@ -0,0 +1,59 @@
TOP=../..
include $(TOP)/configure/CONFIG
#----------------------------------------
# ADD MACRO DEFINITIONS AFTER THIS LINE
#========================================
#========================================
# Build the IOC application
PROD_IOC = CUB
# CUB.dbd will be created and installed
DBD += CUB.dbd
# CUB.dbd will be made up from these files:
-include $(EPICS_ROOT)/mk/codac-common.mk
# Add all the support libraries needed by this IOC
-include $(EPICS_ROOT)/mk/asyn.mk
-include $(EPICS_ROOT)/mk/s7PLCAsyn.mk
CUB_DBD += $(CODAC_DBD)
CUB_LIBS += $(CODAC_LIBS)
# # SNCSEQ
# <sncProgram>_SNCFLAGS += +r -c +d
# CUB_DBD += <sncProgram>.dbd
# CUB_SRCS += <sncProgram>.stt
# CUB_LIBS += seq pv
# CUB_registerRecordDeviceDriver.cpp derives from CUB.dbd
CUB_SRCS += CUB_registerRecordDeviceDriver.cpp
# Build the main IOC entry point on workstation OSs.
CUB_SRCS_DEFAULT += CUBMain.cpp
CUB_SRCS_vxWorks += -nil-
# Add support from base/src/vxWorks if needed
#CUB_OBJS_vxWorks += $(EPICS_BASE_BIN)/vxComLibrary
#=============================
# Include SNL program makefile snippets
-include ../*.snlprog
#=============================
# Finally link to the EPICS Base libraries
CUB_LIBS += $(EPICS_BASE_IOC_LIBS)
#===========================
include $(TOP)/configure/RULES
#----------------------------------------
# ADD RULES AFTER THIS LINE
#----------------------------------------

View File

@@ -0,0 +1,29 @@
ECPCSubscriber.cfg is a configuration for testing ECPC simulator (JAECPCSimulator.cfg).
Setup:
1) Run softIoc. In qst-gyrotron-fast-controller/Configurations execute command:
softIoc -d ECPC_IOC.db
2) Run ECPC simulator. In qst-gyrotron-fast-controller/Startup execute command:
./Main.sh -f ../Configurations/JAECPCSimulator.cfg -l RealTimeLoader -m StateMachine:Start
3) Run ECPC subscriber. In qst-gyrotron-fast-controller/Startup execute command:
./Main.sh -f ../Configurations/tests/ECPCSubscriber.cfg -l RealTimeLoader -m StateMachine:Start
The ECPC simulator should automatically start sending waveforms, which will be printed by the ECPC subscriber every 10 milliseconds.
The ECPC simulator will also be sending command, which is printed by the ECPC subscriber every millisecond.
To change command that is being sent, you have to caput 1 to one of following PVs:
MHVPS_ON (command 1)
GYA_BPS_SWON (command 2)
GYA_APS_SWON (command 3)
GYB_BPS_SWON (command 4)
GYB_APS_SWON (command 5)
GYA_BPS_SWOFF (command 6)
GYA_APS_SWOFF (command 7)
GYB_BPS_SWOFF (command 8)
GYB_APS_SWOFF (command 9)
RF_OFF (command 10)
To stop sending that command, caput 0 to that PV.