Generation working and Compilation of MARTe components
This commit is contained in:
@@ -0,0 +1,206 @@
|
||||
record (bo,"EC-GN-P01-PA2F:PSU4000-CON-HV")
|
||||
{
|
||||
field(DESC, "GY2 APS HVON")
|
||||
field(ONAM, "ON")
|
||||
field(PINI, "YES")
|
||||
field(SCAN, "Passive")
|
||||
field(SIML, "EC-GN-P01-GBF:STAT-DO-SIMM")
|
||||
field(VAL, "0")
|
||||
field(ZNAM, "OFF")
|
||||
}
|
||||
|
||||
record (bo,"EC-GN-P01-PA2F:PSU4000-CON-SW")
|
||||
{
|
||||
field(DESC, "GY2 APS HV SWON")
|
||||
field(ONAM, "ON")
|
||||
field(PINI, "YES")
|
||||
field(SCAN, "Passive")
|
||||
field(SIML, "EC-GN-P01-GBF:STAT-DO-SIMM")
|
||||
field(VAL, "0")
|
||||
field(ZNAM, "OFF")
|
||||
}
|
||||
|
||||
record (bo,"EC-GN-P01-PA2F:PSU4000-CTRP")
|
||||
{
|
||||
field(DESC, "GY2 APS Shutdown request")
|
||||
field(ONAM, "ON")
|
||||
field(PINI, "YES")
|
||||
field(SCAN, "Passive")
|
||||
field(SIML, "EC-GN-P01-GBF:STAT-DO-SIMM")
|
||||
field(VAL, "0")
|
||||
field(ZNAM, "OFF")
|
||||
}
|
||||
|
||||
record (bi,"EC-GN-P01-PA2F:PSU4000-YFLT")
|
||||
{
|
||||
field(DESC, "GY2 APS Fault")
|
||||
field(DTYP, "asynInt32")
|
||||
field(INP, "@asyn(ni6528_0, 1) bitread")
|
||||
field(ONAM, "FAULT")
|
||||
field(PINI, "YES")
|
||||
field(SCAN, "I/O Intr")
|
||||
field(SIML, "EC-GN-P01-GBF:STAT-DI-SIMM")
|
||||
field(VAL, "0")
|
||||
field(ZNAM, "NORMAL")
|
||||
}
|
||||
|
||||
record (bi,"EC-GN-P01-PA2F:PSU4000-YSTA")
|
||||
{
|
||||
field(DESC, "GY2 APS Ready")
|
||||
field(DTYP, "asynInt32")
|
||||
field(INP, "@asyn(ni6528_0, 0) bitread")
|
||||
field(ONAM, "READY")
|
||||
field(PINI, "YES")
|
||||
field(SCAN, "I/O Intr")
|
||||
field(SIML, "EC-GN-P01-GBF:STAT-DI-SIMM")
|
||||
field(VAL, "0")
|
||||
field(ZNAM, "NO")
|
||||
}
|
||||
|
||||
record (bo,"EC-GN-P01-PA2F:STAT-MANM")
|
||||
{
|
||||
field(DESC, "Manual Mode SW for GY2 APS")
|
||||
field(ONAM, "ON")
|
||||
field(PINI, "YES")
|
||||
field(SCAN, "Passive")
|
||||
field(VAL, "1")
|
||||
field(ZNAM, "OFF")
|
||||
}
|
||||
|
||||
record (ao,"EC-GN-P01-PA2F:PSU4000-EREF")
|
||||
{
|
||||
field(DESC, "GY2 APS voltage setpoint")
|
||||
field(DRVH, "10")
|
||||
field(DRVL, "-20")
|
||||
field(DTYP, "asynFloat64")
|
||||
field(EGU, "kV")
|
||||
field(HOPR, "10")
|
||||
field(LOPR, "-20")
|
||||
field(OUT, "@asyn(ni6368_0, 1) write_ao")
|
||||
field(PINI, "YES")
|
||||
field(PREC, "2")
|
||||
field(SCAN, "Passive")
|
||||
field(SIML, "EC-GN-P01-GBF:STAT-AO-SIMM")
|
||||
field(VAL, "0")
|
||||
}
|
||||
|
||||
record (ao,"EC-GN-P01-PA2F:PSU4000-EREF-MSP")
|
||||
{
|
||||
field(DESC, "GY2 APS voltage manual setpoint")
|
||||
field(DRVH, "10")
|
||||
field(DRVL, "-20")
|
||||
field(EGU, "kV")
|
||||
field(HOPR, "10")
|
||||
field(LOPR, "-20")
|
||||
field(PINI, "YES")
|
||||
field(PREC, "2")
|
||||
field(SCAN, "Passive")
|
||||
field(VAL, "0")
|
||||
}
|
||||
|
||||
record (ao,"EC-GN-P01-PA2F:PSU4000-EREF-P")
|
||||
{
|
||||
field(ASLO, "2")
|
||||
field(DESC, "GY2 APS P-voltage setpoint")
|
||||
field(DRVH, "0")
|
||||
field(DRVL, "-20")
|
||||
field(DTYP, "asynFloat64")
|
||||
field(EGU, "kV")
|
||||
field(HOPR, "10")
|
||||
field(LOPR, "-20")
|
||||
field(OUT, "@asyn(ni6368_0, 2) write_ao")
|
||||
field(PINI, "YES")
|
||||
field(PREC, "2")
|
||||
field(SCAN, "Passive")
|
||||
field(SIML, "EC-GN-P01-GBF:STAT-AO-SIMM")
|
||||
field(VAL, "0")
|
||||
}
|
||||
|
||||
record (ai,"EC-GN-P01-PA2F:PSU4000-ET")
|
||||
{
|
||||
field(DESC, "GY2 APS Measured Volatege")
|
||||
field(EGU, "kV")
|
||||
field(PINI, "YES")
|
||||
field(PREC, "3")
|
||||
field(SCAN, ".1 second")
|
||||
field(SIML, "EC-GN-P01-GBF:STAT-AI-SIMM")
|
||||
}
|
||||
|
||||
record (waveform,"EC-GN-P01-PA2F:PSU4000-ET-WF")
|
||||
{
|
||||
field(DESC, "GY2 APS Measured Volatege")
|
||||
field(EGU, "V")
|
||||
field(FTVL, "FLOAT")
|
||||
field(NELM, "8000")
|
||||
field(PINI, "YES")
|
||||
field(PREC, "3")
|
||||
field(SCAN, "Passive")
|
||||
field(SIML, "EC-GN-P01-GBF:STAT-AI-SIMM")
|
||||
}
|
||||
|
||||
record (ai,"EC-GN-P01-PA2F:PSU4000-IT")
|
||||
{
|
||||
field(DESC, "GY2 APS Measued Current")
|
||||
field(EGU, "A")
|
||||
field(PINI, "YES")
|
||||
field(PREC, "3")
|
||||
field(SCAN, ".1 second")
|
||||
field(SIML, "EC-GN-P01-GBF:STAT-AI-SIMM")
|
||||
}
|
||||
|
||||
record (waveform,"EC-GN-P01-PA2F:PSU4000-IT-WF")
|
||||
{
|
||||
field(DESC, "GY2 APS Measued Current")
|
||||
field(EGU, "A")
|
||||
field(FTVL, "FLOAT")
|
||||
field(NELM, "8000")
|
||||
field(PINI, "YES")
|
||||
field(PREC, "3")
|
||||
field(SCAN, "Passive")
|
||||
field(SIML, "EC-GN-P01-GBF:STAT-AI-SIMM")
|
||||
}
|
||||
|
||||
record (ai,"EC-GN-P01-PA2F:STAT-DT-HVON")
|
||||
{
|
||||
field(DESC, "Time diff to GY2 APS 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-PA2F:STAT-DT-SWON")
|
||||
{
|
||||
field(DESC, "Time diff to GY2 APS SW ON")
|
||||
field(EGU, "us")
|
||||
field(HOPR, "5000000")
|
||||
field(LOPR, "1000")
|
||||
field(PINI, "YES")
|
||||
field(PREC, "0")
|
||||
field(SCAN, "Passive")
|
||||
field(VAL, "600000")
|
||||
}
|
||||
|
||||
record (calcout,"EC-GN-P01-PA2F:STAT-EREF-CONV")
|
||||
{
|
||||
field(CALC, "A>0?A:((A>-20)?A/2:-10)")
|
||||
field(DESC, "GYB APS engineer value conversion")
|
||||
field(OOPT, "On Change")
|
||||
field(OUT, "EC-GN-P01-PA2F:PSU4000-EREF PP")
|
||||
field(SCAN, "Passive")
|
||||
}
|
||||
|
||||
record (waveform,"EC-GN-P01-PA2F:STAT-PREP-WF")
|
||||
{
|
||||
field(DESC, "GY2 APS prepro schedule")
|
||||
field(EGU, "V")
|
||||
field(FTVL, "FLOAT")
|
||||
field(NELM, "8000")
|
||||
field(PINI, "NO")
|
||||
field(PREC, "2")
|
||||
field(SCAN, "Passive")
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
taskset -c 12-15 ./Main.sh -f ../Configurations/JAGyrotronB_FY19_P1.cfg -l RealTimeLoader -m StateMachine:Start
|
||||
@@ -0,0 +1,177 @@
|
||||
/**
|
||||
* @file JASampleGAM.cpp
|
||||
* @brief Source file for class JASampleGAM
|
||||
* @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 source file contains the definition of all the methods for
|
||||
* the class JASampleGAM (public, protected, and private). Be aware that some
|
||||
* methods, such as those inline could be defined on the header file, instead.
|
||||
*/
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Standard header includes */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Project header includes */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "JASampleGAM.h"
|
||||
|
||||
#include "AdvancedErrorManagement.h"
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Static definitions */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Method definitions */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
JASampleGAM::JASampleGAM() {
|
||||
// initialize member variables.
|
||||
param1 = 0;
|
||||
param2 = 0;
|
||||
|
||||
//Input signals.
|
||||
input1 = NULL_PTR(MARTe::uint32 *);
|
||||
input2 = NULL_PTR(MARTe::float32 *);
|
||||
//Output signals.
|
||||
output1= NULL_PTR(MARTe::uint32 *);
|
||||
output2 = NULL_PTR(MARTe::float32 *);
|
||||
|
||||
}
|
||||
|
||||
JASampleGAM::~JASampleGAM() {
|
||||
}
|
||||
|
||||
bool JASampleGAM::Initialise(MARTe::StructuredDataI & data) {
|
||||
//GAM parameters are initialized.
|
||||
using namespace MARTe;
|
||||
bool ok = GAM::Initialise(data);
|
||||
if (ok) {
|
||||
ok = data.Read("param1", param1);
|
||||
if (!ok) {
|
||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The param1 shall be specified");
|
||||
}
|
||||
}
|
||||
if (ok) {
|
||||
ok = data.Read("param2", param2);
|
||||
if (!ok) {
|
||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The param2 shall be specified");
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool JASampleGAM::PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName) {
|
||||
//This method changes internal parameter based on next realtime state.
|
||||
return true;
|
||||
}
|
||||
|
||||
bool JASampleGAM::Setup() {
|
||||
// Setup memory for input/output signals on the GAM.
|
||||
using namespace MARTe;
|
||||
bool ok = (numberOfInputSignals == 2u);
|
||||
if (ok) {
|
||||
ok = (numberOfOutputSignals == 2u);
|
||||
if (!ok) {
|
||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Two output signals shall be defined");
|
||||
}
|
||||
}
|
||||
else {
|
||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Two input signals shall be defined");
|
||||
}
|
||||
// Do type check for input signals.
|
||||
if (ok) {
|
||||
uint32 c;
|
||||
for (c = 0u; c < numberOfInputSignals; c++) {
|
||||
TypeDescriptor inputType = GetSignalType(InputSignals, c);
|
||||
ok = ((inputType == UnsignedInteger32Bit) || (inputType == Float32Bit));
|
||||
if (!ok) {
|
||||
StreamString signalName;
|
||||
(void) GetSignalName(InputSignals, c, signalName);
|
||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as uint32 or flaot32", signalName.Buffer());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// Do type check for output signals
|
||||
if (ok) {
|
||||
uint32 c;
|
||||
for (c = 0u; c < numberOfOutputSignals; c++) {
|
||||
TypeDescriptor outputType = GetSignalType(OutputSignals, c);
|
||||
ok = ((outputType == UnsignedInteger32Bit) || (outputType == Float32Bit));
|
||||
if (!ok) {
|
||||
StreamString signalName;
|
||||
(void) GetSignalName(InputSignals, c, signalName);
|
||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as uint32 or float32", signalName.Buffer());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Signal id can get by signal name in configuration file
|
||||
if (ok) {
|
||||
StreamString signalName = "InputXXX"; //Variable name in configuration file.
|
||||
uint32 signalxxxIndex; //Index is copied to this variable by using signal name.
|
||||
ok = GetSignalIndex(InputSignals, signalxxxIndex, signalName.Buffer());
|
||||
if (!ok) {
|
||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "InputXXX input signal shall be defined");
|
||||
}
|
||||
else {
|
||||
TypeDescriptor inputType = GetSignalType(InputSignals, signalxxxIndex);
|
||||
ok = (inputType == Float32Bit);
|
||||
if (!ok) {
|
||||
StreamString signalName;
|
||||
(void) GetSignalName(InputSignals, signalxxxIndex, signalName);
|
||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as float32", signalName.Buffer());
|
||||
} else {
|
||||
inputXXX = reinterpret_cast<float32 *>(GetInputSignalMemory(signalxxxIndex));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Do type cast. with explicit signal id.
|
||||
if (ok) {
|
||||
input1 = reinterpret_cast<uint32 *>(GetInputSignalMemory(0));
|
||||
input2 = reinterpret_cast<float32 *>(GetInputSignalMemory(1));
|
||||
|
||||
output1 = reinterpret_cast<uint32 *>(GetOutputSignalMemory(0));
|
||||
output2 = reinterpret_cast<float32 *>(GetOutputSignalMemory(1));
|
||||
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool JASampleGAM::Execute() {
|
||||
// This method is called every realtime state thread cycle.
|
||||
using namespace MARTe;
|
||||
REPORT_ERROR(ErrorManagement::Information, "input1 is %d.", *input1);
|
||||
REPORT_ERROR(ErrorManagement::Information, "input2 is %f.", *input2);
|
||||
REPORT_ERROR(ErrorManagement::Information, "inputXXX is %f.", *inputXXX);
|
||||
|
||||
REPORT_ERROR(ErrorManagement::Information, "maltiply param value to input.");
|
||||
|
||||
*output1 = *input1 * param1;
|
||||
*output2 = *input2 * param2;
|
||||
|
||||
REPORT_ERROR(ErrorManagement::Information, "output1 is %d.", *output1);
|
||||
REPORT_ERROR(ErrorManagement::Information, "output2 is %f.", *output2);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
CLASS_REGISTER(JASampleGAM, "1.0")
|
||||
Reference in New Issue
Block a user