Tested and working... NI libraries were missin
This commit is contained in:
@@ -39,7 +39,7 @@ of the distribution package..
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.iter.codac.units</groupId>
|
<groupId>org.iter.codac.units</groupId>
|
||||||
<artifactId>maven-iter-settings</artifactId>
|
<artifactId>maven-iter-settings</artifactId>
|
||||||
<version>6.3.0</version>
|
<version>6.1.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<!-- unit owner and developers -->
|
<!-- unit owner and developers -->
|
||||||
@@ -103,6 +103,9 @@ of the distribution package..
|
|||||||
<include type="file" source="obj/Build/x86-linux/GAMs/JAConditionalSignalUpdateGAM/" target="${project.artifactId}/lib">
|
<include type="file" source="obj/Build/x86-linux/GAMs/JAConditionalSignalUpdateGAM/" target="${project.artifactId}/lib">
|
||||||
<include>*.so</include>
|
<include>*.so</include>
|
||||||
</include>
|
</include>
|
||||||
|
<include type="file" source="obj/Build/x86-linux/GAMs/JAESDNTimeCompareGAM/" target="${project.artifactId}/lib">
|
||||||
|
<include>*.so</include>
|
||||||
|
</include>
|
||||||
<include type="file" source="obj/Build/x86-linux/GAMs/JAMessageGAM/" target="${project.artifactId}/lib">
|
<include type="file" source="obj/Build/x86-linux/GAMs/JAMessageGAM/" target="${project.artifactId}/lib">
|
||||||
<include>*.so</include>
|
<include>*.so</include>
|
||||||
</include>
|
</include>
|
||||||
|
|||||||
@@ -0,0 +1,132 @@
|
|||||||
|
/**
|
||||||
|
* @file JAESDNTimeCompareGAM.cpp
|
||||||
|
* @brief Source file for class JAESDNTimeCompareGAM
|
||||||
|
* @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 JAESDNTimeCompareGAM (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 "JAESDNTimeCompareGAM.h"
|
||||||
|
#include "AdvancedErrorManagement.h"
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/* Static definitions */
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/* Method definitions */
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
JAESDNTimeCompareGAM::JAESDNTimeCompareGAM() {
|
||||||
|
//ESDNTime holder
|
||||||
|
esdntime_previous = 0;
|
||||||
|
|
||||||
|
//Input signals.
|
||||||
|
esdntime = NULL_PTR(MARTe::uint32 *);
|
||||||
|
|
||||||
|
//Output signals.
|
||||||
|
sdn_connection = NULL_PTR(MARTe::uint32 *);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
JAESDNTimeCompareGAM::~JAESDNTimeCompareGAM() {
|
||||||
|
if (esdntime != NULL_PTR(MARTe::uint32 *)) {
|
||||||
|
delete[] esdntime;
|
||||||
|
}
|
||||||
|
if (sdn_connection != NULL_PTR(MARTe::uint32 *)) {
|
||||||
|
delete[] sdn_connection;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool JAESDNTimeCompareGAM::Initialise(MARTe::StructuredDataI & data) {
|
||||||
|
using namespace MARTe;
|
||||||
|
return GAM::Initialise(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool JAESDNTimeCompareGAM::PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool JAESDNTimeCompareGAM::Setup() {
|
||||||
|
// Setup memory for input/output signals on the GAM.
|
||||||
|
using namespace MARTe;
|
||||||
|
bool ok = (numberOfInputSignals == 1u);
|
||||||
|
// Do type check for input signals.
|
||||||
|
if (ok) {
|
||||||
|
ok = (numberOfOutputSignals == 1u);
|
||||||
|
if (!ok) {
|
||||||
|
REPORT_ERROR(ErrorManagement::ParametersError, "Number of output signals shall be the same as "
|
||||||
|
"number of expected values.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
REPORT_ERROR(ErrorManagement::ParametersError, "Number of input signals shall be the same as "
|
||||||
|
"number of expected values.");
|
||||||
|
}
|
||||||
|
if (ok) {
|
||||||
|
uint32 c;
|
||||||
|
for (c = 0u; c < numberOfInputSignals; c++) {
|
||||||
|
TypeDescriptor inputType = GetSignalType(InputSignals, c);
|
||||||
|
ok = (inputType == UnsignedInteger32Bit);
|
||||||
|
if (!ok) {
|
||||||
|
StreamString signalName;
|
||||||
|
(void) GetSignalName(InputSignals, c, signalName);
|
||||||
|
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as uint32", signalName.Buffer());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ok) {
|
||||||
|
uint32 c;
|
||||||
|
for (c = 0u; c < numberOfOutputSignals; c++) {
|
||||||
|
TypeDescriptor outputType = GetSignalType(OutputSignals, c);
|
||||||
|
ok = (outputType == UnsignedInteger32Bit);
|
||||||
|
if (!ok) {
|
||||||
|
StreamString signalName;
|
||||||
|
(void) GetSignalName(InputSignals, c, signalName);
|
||||||
|
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as uint32", signalName.Buffer());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ok) {
|
||||||
|
esdntime = reinterpret_cast<uint32 *>(GetInputSignalMemory(0));
|
||||||
|
sdn_connection = reinterpret_cast<uint32 *>(GetOutputSignalMemory(0));
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool JAESDNTimeCompareGAM::Execute() {
|
||||||
|
using namespace MARTe;
|
||||||
|
bool connected;
|
||||||
|
|
||||||
|
connected = !(esdntime_previous == *esdntime);
|
||||||
|
if (connected) *sdn_connection = 1;
|
||||||
|
else *sdn_connection = 0;
|
||||||
|
|
||||||
|
esdntime_previous = *esdntime;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
CLASS_REGISTER(JAESDNTimeCompareGAM, "1.0")
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
/**
|
||||||
|
* @file JAESDNTimeCompareGAM.h
|
||||||
|
* @brief Header file for class JAESDNTimeCompareGAM
|
||||||
|
* @date Feb, 2021
|
||||||
|
* @author ksakakida
|
||||||
|
*
|
||||||
|
* @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 JAESDNTimeCompareGAM
|
||||||
|
* 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_JAESDNTimeCompareGAM_H_
|
||||||
|
#define GAMS_JAESDNTimeCompareGAM_H_
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/* Standard header includes */
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/* Project header includes */
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "GAM.h"
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/* Class declaration */
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/**
|
||||||
|
* @brief GAM that sends a message when one-cycle before ESDNTime and current one are same. This GAM is based on JAMessageGAM.
|
||||||
|
* @details Sample
|
||||||
|
*
|
||||||
|
* The configuration syntax is:
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* +SDNTimeCompareGAM = {
|
||||||
|
* Class = JAESDNTimeCompareGAM
|
||||||
|
* InputSignals = {
|
||||||
|
* ESDNTime = {
|
||||||
|
* DataSource = "DDB1"
|
||||||
|
* Type = uint32
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* OutputSignals = {
|
||||||
|
* SDN_Connection = {
|
||||||
|
* DataSource = "DDB1"
|
||||||
|
* Type = uint32
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
class JAESDNTimeCompareGAM : public MARTe::GAM, public MARTe::StatefulI {
|
||||||
|
public:
|
||||||
|
CLASS_REGISTER_DECLARATION()
|
||||||
|
|
||||||
|
JAESDNTimeCompareGAM();
|
||||||
|
|
||||||
|
virtual ~JAESDNTimeCompareGAM();
|
||||||
|
|
||||||
|
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:
|
||||||
|
// ESDNTime holder
|
||||||
|
MARTe::uint32 esdntime_previous;
|
||||||
|
|
||||||
|
// Input signals
|
||||||
|
MARTe::uint32 *esdntime;
|
||||||
|
|
||||||
|
// Output signals
|
||||||
|
MARTe::uint32 *sdn_connection; // 0: disconnected, 1: connected
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/* Inline method definitions */
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif /* GAMS_JAESDNTimeCompareGAM_H_ */
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
#############################################################
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# 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 for the specific language governing
|
||||||
|
# permissions and limitations under the Licence.
|
||||||
|
#
|
||||||
|
# $Id: Makefile.gcc 3 2012-01-15 16:26:07Z aneto $
|
||||||
|
#
|
||||||
|
#############################################################
|
||||||
|
|
||||||
|
include Makefile.inc
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
#############################################################
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# 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 for the specific language governing
|
||||||
|
# permissions and limitations under the Licence.
|
||||||
|
#
|
||||||
|
# $Id: Makefile.inc 3 2012-01-15 16:26:07Z aneto $
|
||||||
|
#
|
||||||
|
#############################################################
|
||||||
|
OBJSX=JAESDNTimeCompareGAM.x
|
||||||
|
|
||||||
|
PACKAGE=GAMs
|
||||||
|
|
||||||
|
ROOT_DIR=../../../../obj
|
||||||
|
MAKEDEFAULTDIR=$(MARTe2_DIR)/MakeDefaults
|
||||||
|
include $(MAKEDEFAULTDIR)/MakeStdLibDefs.$(TARGET)
|
||||||
|
|
||||||
|
INCLUDES += -I.
|
||||||
|
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L0Types
|
||||||
|
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L1Portability
|
||||||
|
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L2Objects
|
||||||
|
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L3Streams
|
||||||
|
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L4Messages
|
||||||
|
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L4Configuration
|
||||||
|
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L5GAMs
|
||||||
|
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L1Portability
|
||||||
|
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L3Services
|
||||||
|
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L4Messages
|
||||||
|
INCLUDES += -I$(MARTe2_DIR)/Source/Core/FileSystem/L1Portability
|
||||||
|
INCLUDES += -I$(MARTe2_DIR)/Source/Core/FileSystem/L3Streams
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
all: $(OBJS) $(SUBPROJ) \
|
||||||
|
$(BUILD_DIR)/JAESDNTimeCompareGAM$(LIBEXT) \
|
||||||
|
$(BUILD_DIR)/JAESDNTimeCompareGAM$(DLLEXT)
|
||||||
|
echo $(OBJS)
|
||||||
|
|
||||||
|
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
||||||
@@ -120,7 +120,7 @@ bool JAModeControlGAM::Execute() {
|
|||||||
rfonTime = *inputSignals[9];
|
rfonTime = *inputSignals[9];
|
||||||
resetRemainingTime = false;
|
resetRemainingTime = false;
|
||||||
pulseLengthLimit = CalcPulseLengthLimit(inputSignals);
|
pulseLengthLimit = CalcPulseLengthLimit(inputSignals);
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "Pulse Length was set to Limit:%d", pulseLengthLimit);
|
//REPORT_ERROR(ErrorManagement::Debug, "Pulse Length was set to Limit:%d", pulseLengthLimit);
|
||||||
}
|
}
|
||||||
// Turn on the flag during RFON if the pulse legth over the limit.
|
// Turn on the flag during RFON if the pulse legth over the limit.
|
||||||
if ((*inputSignals[9] - rfonTime <= pulseLengthLimit) && (previousState == 1u)) {
|
if ((*inputSignals[9] - rfonTime <= pulseLengthLimit) && (previousState == 1u)) {
|
||||||
|
|||||||
@@ -36,7 +36,10 @@
|
|||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Static definitions */
|
/* Static definitions */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static MARTe::uint64 getCurrentTimeUs() {
|
||||||
|
using namespace MARTe;
|
||||||
|
return static_cast<uint64>(HighResolutionTimer::Counter() * HighResolutionTimer::Period() * 1e6f + 0.5f);
|
||||||
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Method definitions */
|
/* Method definitions */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
@@ -64,7 +67,9 @@ JASDNRTStateMachineGAM::JASDNRTStateMachineGAM() {
|
|||||||
triggerDelay_shotlen = NULL_PTR(MARTe::uint32 *);
|
triggerDelay_shotlen = NULL_PTR(MARTe::uint32 *);
|
||||||
stopRequest = NULL_PTR(MARTe::uint32 *);
|
stopRequest = NULL_PTR(MARTe::uint32 *);
|
||||||
modePulseLengthLimit = NULL_PTR(MARTe::uint32 *);
|
modePulseLengthLimit = NULL_PTR(MARTe::uint32 *);
|
||||||
sdnCommand = NULL_PTR(MARTe::uint16 *);
|
Command = NULL_PTR(MARTe::uint16 *);
|
||||||
|
Command2 = NULL_PTR(MARTe::uint16 *);
|
||||||
|
sdnStatus = NULL_PTR(MARTe::uint8 *);
|
||||||
|
|
||||||
// write out target.
|
// write out target.
|
||||||
outputSignal = NULL_PTR(MARTe::uint32 *);
|
outputSignal = NULL_PTR(MARTe::uint32 *);
|
||||||
@@ -81,6 +86,17 @@ JASDNRTStateMachineGAM::JASDNRTStateMachineGAM() {
|
|||||||
aps_swon_is_on = false;
|
aps_swon_is_on = false;
|
||||||
bps_hvon_is_on = false;
|
bps_hvon_is_on = false;
|
||||||
bps_swon_is_on = false;
|
bps_swon_is_on = false;
|
||||||
|
|
||||||
|
sdnCommand = 0;
|
||||||
|
groupFix = 0;
|
||||||
|
|
||||||
|
apsSwonHighResolutionTime = 0;
|
||||||
|
|
||||||
|
aps_hvon_state=0;
|
||||||
|
aps_swon_state=0;
|
||||||
|
mhvps_hvon_state=0;
|
||||||
|
bps_hvon_state=0;
|
||||||
|
bps_swon_state=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
JASDNRTStateMachineGAM::~JASDNRTStateMachineGAM() {
|
JASDNRTStateMachineGAM::~JASDNRTStateMachineGAM() {
|
||||||
@@ -135,21 +151,21 @@ bool JASDNRTStateMachineGAM::PrepareNextState(const MARTe::char8 * const current
|
|||||||
|
|
||||||
bool JASDNRTStateMachineGAM::Setup() {
|
bool JASDNRTStateMachineGAM::Setup() {
|
||||||
using namespace MARTe;
|
using namespace MARTe;
|
||||||
bool ok = (numberOfInputSignals == 11u);
|
bool ok = (numberOfInputSignals == 13u);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
ok = (numberOfOutputSignals == 8u);
|
ok = (numberOfOutputSignals == 15u);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Seven output signals shall be defined");
|
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "15 output signals shall be defined");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Nine input signals shall be defined");
|
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "13 input signals shall be defined");
|
||||||
}
|
}
|
||||||
if (ok) {
|
if (ok) {
|
||||||
uint32 c;
|
uint32 c;
|
||||||
for (c = 0u; c < numberOfInputSignals; c++) {
|
for (c = 0u; c < numberOfInputSignals; c++) {
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, c);
|
TypeDescriptor inputType = GetSignalType(InputSignals, c);
|
||||||
ok = (inputType == UnsignedInteger32Bit || inputType == UnsignedInteger16Bit);
|
ok = (inputType == UnsignedInteger32Bit || inputType == UnsignedInteger16Bit || inputType == UnsignedInteger8Bit);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
StreamString signalName;
|
StreamString signalName;
|
||||||
(void) GetSignalName(InputSignals, c, signalName);
|
(void) GetSignalName(InputSignals, c, signalName);
|
||||||
@@ -162,7 +178,7 @@ bool JASDNRTStateMachineGAM::Setup() {
|
|||||||
uint32 c;
|
uint32 c;
|
||||||
for (c = 0u; c < numberOfOutputSignals; c++) {
|
for (c = 0u; c < numberOfOutputSignals; c++) {
|
||||||
TypeDescriptor outputType = GetSignalType(OutputSignals, c);
|
TypeDescriptor outputType = GetSignalType(OutputSignals, c);
|
||||||
ok = (outputType == UnsignedInteger32Bit);
|
ok = (outputType == UnsignedInteger32Bit || outputType == UnsignedInteger8Bit);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
StreamString signalName;
|
StreamString signalName;
|
||||||
(void) GetSignalName(InputSignals, c, signalName);
|
(void) GetSignalName(InputSignals, c, signalName);
|
||||||
@@ -181,7 +197,9 @@ bool JASDNRTStateMachineGAM::Setup() {
|
|||||||
triggerDelay_shotlen = reinterpret_cast<uint32 *>(GetInputSignalMemory(7));
|
triggerDelay_shotlen = reinterpret_cast<uint32 *>(GetInputSignalMemory(7));
|
||||||
stopRequest = reinterpret_cast<uint32 *>(GetInputSignalMemory(8));
|
stopRequest = reinterpret_cast<uint32 *>(GetInputSignalMemory(8));
|
||||||
modePulseLengthLimit = reinterpret_cast<uint32 *>(GetInputSignalMemory(9));
|
modePulseLengthLimit = reinterpret_cast<uint32 *>(GetInputSignalMemory(9));
|
||||||
sdnCommand = reinterpret_cast<uint16 *>(GetInputSignalMemory(10));
|
Command = reinterpret_cast<uint16 *>(GetInputSignalMemory(10));
|
||||||
|
Command2 = reinterpret_cast<uint16 *>(GetInputSignalMemory(11));
|
||||||
|
sdnStatus = reinterpret_cast<uint8 *>(GetInputSignalMemory(12));
|
||||||
|
|
||||||
outputSignal = reinterpret_cast<uint32 *>(GetOutputSignalMemory(0));
|
outputSignal = reinterpret_cast<uint32 *>(GetOutputSignalMemory(0));
|
||||||
outputBeamON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(1));
|
outputBeamON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(1));
|
||||||
@@ -191,6 +209,15 @@ bool JASDNRTStateMachineGAM::Setup() {
|
|||||||
outputBeamONTime = reinterpret_cast<uint32 *>(GetOutputSignalMemory(5));
|
outputBeamONTime = reinterpret_cast<uint32 *>(GetOutputSignalMemory(5));
|
||||||
outputRFONTime = reinterpret_cast<uint32 *>(GetOutputSignalMemory(6));
|
outputRFONTime = reinterpret_cast<uint32 *>(GetOutputSignalMemory(6));
|
||||||
shotCounter = reinterpret_cast<uint32 *>(GetOutputSignalMemory(7));
|
shotCounter = reinterpret_cast<uint32 *>(GetOutputSignalMemory(7));
|
||||||
|
|
||||||
|
outputAPSHVON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(8));
|
||||||
|
outputAPSSWON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(9));
|
||||||
|
outputBPSHVON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(10));
|
||||||
|
outputBPSSWON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(11));
|
||||||
|
outputMHVPSON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(12));
|
||||||
|
|
||||||
|
outputSignalNI6528P3 = reinterpret_cast<uint8 *>(GetOutputSignalMemory(13));
|
||||||
|
outputSignalNI6528P4 = reinterpret_cast<uint8 *>(GetOutputSignalMemory(14));
|
||||||
*shotCounter = 0;
|
*shotCounter = 0;
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
@@ -198,11 +225,19 @@ bool JASDNRTStateMachineGAM::Setup() {
|
|||||||
|
|
||||||
bool JASDNRTStateMachineGAM::Execute() {
|
bool JASDNRTStateMachineGAM::Execute() {
|
||||||
using namespace MARTe;
|
using namespace MARTe;
|
||||||
|
if (!groupFix && (*triggerSignal != false)) {
|
||||||
|
sdnCommand = (1 - *sdnStatus)*(*Command) + (*sdnStatus)*(*Command2);
|
||||||
|
groupFix = 1;
|
||||||
|
sdnStatusFix = *sdnStatus;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sdnCommand = (1 - sdnStatusFix)*(*Command) + sdnStatusFix*(*Command2);
|
||||||
|
}
|
||||||
if (currentState == WaitTrigger) {
|
if (currentState == WaitTrigger) {
|
||||||
|
|
||||||
//State Transition condition
|
//State Transition condition
|
||||||
if ((*triggerSignal == conditionTrigger)) {
|
if ((*triggerSignal == conditionTrigger)) {
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "Start beam-on sequence in SDN mode.");
|
//REPORT_ERROR(ErrorManagement::Debug, "Start beam-on sequence in SDN mode.");
|
||||||
plcOnTime = *currentTime; //Save pulse start time.
|
plcOnTime = *currentTime; //Save pulse start time.
|
||||||
*outputBeamON = 0;
|
*outputBeamON = 0;
|
||||||
//State transition.
|
//State transition.
|
||||||
@@ -213,20 +248,22 @@ bool JASDNRTStateMachineGAM::Execute() {
|
|||||||
|
|
||||||
//Actions in this state.
|
//Actions in this state.
|
||||||
if (*stopRequest != 0 || *triggerSignal != conditionTrigger) {
|
if (*stopRequest != 0 || *triggerSignal != conditionTrigger) {
|
||||||
*outputSignal -= aps_swon;
|
*outputSignal = 0;
|
||||||
currentState = HVTerminate;
|
currentState = HVTerminate;
|
||||||
}
|
}
|
||||||
if (*currentTime >= (plcOnTime + *triggerDelay_bps_hvon) && bps_hvon_is_on == false){
|
if (*currentTime >= (plcOnTime + *triggerDelay_bps_hvon) && bps_hvon_is_on == false){
|
||||||
//Do action
|
//Do action
|
||||||
*outputSignal += bps_hvon;
|
*outputSignal += bps_hvon;
|
||||||
bps_hvon_is_on = true;
|
bps_hvon_is_on = true; bps_hvon_state=1;
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "bps_hvon was set to outputSignal at %d.", *currentTime);
|
//REPORT_ERROR(ErrorManagement::Debug, "bps_hvon was set to outputSignal at %d.", *currentTime);
|
||||||
|
*outputBPSHVON=1;
|
||||||
}
|
}
|
||||||
if (*currentTime >= (plcOnTime + *triggerDelay_aps_hvon) && aps_hvon_is_on == false) {
|
if (*currentTime >= (plcOnTime + *triggerDelay_aps_hvon) && aps_hvon_is_on == false) {
|
||||||
//Do action
|
//Do action
|
||||||
*outputSignal += aps_hvon;
|
*outputSignal += aps_hvon;
|
||||||
aps_hvon_is_on = true;
|
aps_hvon_is_on = true; aps_hvon_state=1;
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "aps_hvon was set to outputSignal.");
|
//REPORT_ERROR(ErrorManagement::Debug, "aps_hvon was set to outputSignal.");
|
||||||
|
*outputAPSHVON=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
*outputBeamONTime = *currentTime - plcOnTime; //Save RFON start time.
|
*outputBeamONTime = *currentTime - plcOnTime; //Save RFON start time.
|
||||||
@@ -242,7 +279,7 @@ bool JASDNRTStateMachineGAM::Execute() {
|
|||||||
*outputBeamONTime = *currentTime - plcOnTime; //Save RFON start time.
|
*outputBeamONTime = *currentTime - plcOnTime; //Save RFON start time.
|
||||||
|
|
||||||
// State change conditions
|
// State change conditions
|
||||||
if (*sdnCommand == 1){
|
if (sdnCommand == 1){
|
||||||
sdnTriggerTime = *currentTime;
|
sdnTriggerTime = *currentTime;
|
||||||
currentState = SwitchingHVPS_SWON;
|
currentState = SwitchingHVPS_SWON;
|
||||||
}
|
}
|
||||||
@@ -262,68 +299,80 @@ bool JASDNRTStateMachineGAM::Execute() {
|
|||||||
if (*currentTime >= (sdnTriggerTime + *triggerDelay_bps_swon) && bps_swon_is_on==false){
|
if (*currentTime >= (sdnTriggerTime + *triggerDelay_bps_swon) && bps_swon_is_on==false){
|
||||||
//Do action
|
//Do action
|
||||||
*outputSignal += bps_swon;
|
*outputSignal += bps_swon;
|
||||||
bps_swon_is_on = true;
|
bps_swon_is_on = true; bps_swon_state=1;
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "bps_swon was set to outputSignal at %d.", *currentTime);
|
//REPORT_ERROR(ErrorManagement::Debug, "bps_swon was set to outputSignal at %d.", *currentTime);
|
||||||
|
*outputBPSSWON=1;
|
||||||
}
|
}
|
||||||
if (*currentTime >= (sdnTriggerTime + *triggerDelay_mhvps_hvon) && mhvps_hvon_is_on==false) {
|
if (*currentTime >= (sdnTriggerTime + *triggerDelay_mhvps_hvon) && mhvps_hvon_is_on==false) {
|
||||||
//Do action
|
//Do action
|
||||||
*outputSignal += mhvps_hvon;
|
*outputSignal += mhvps_hvon;
|
||||||
mhvps_hvon_is_on = true;
|
mhvps_hvon_is_on = true; mhvps_hvon_state=1;
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "mhvps_hvon was set to outputSignal at %d.", *currentTime);
|
//REPORT_ERROR(ErrorManagement::Debug, "mhvps_hvon was set to outputSignal at %d.", *currentTime);
|
||||||
|
*outputMHVPSON=1;
|
||||||
}
|
}
|
||||||
if (bps_swon_is_on && mhvps_hvon_is_on && *currentTime >= (sdnTriggerTime + *triggerDelay_aps_swon)){
|
if (bps_swon_is_on && mhvps_hvon_is_on && *currentTime >= (sdnTriggerTime + *triggerDelay_aps_swon)){
|
||||||
//Do action
|
//Do action
|
||||||
*outputSignal += aps_swon;
|
*outputSignal += aps_swon;
|
||||||
aps_swon_is_on = true;
|
aps_swon_is_on = true; aps_swon_state=1;
|
||||||
|
apsSwonHighResolutionTime = getCurrentTimeUs();
|
||||||
apsSwonTime = *currentTime;
|
apsSwonTime = *currentTime;
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "aps_swon was set to outputSignal at %d.", *currentTime);
|
//REPORT_ERROR(ErrorManagement::Debug, "aps_swon was set to outputSignal at %d.", *currentTime);
|
||||||
|
*outputAPSSWON=1;
|
||||||
}
|
}
|
||||||
*outputBeamONTime = *currentTime - plcOnTime; //Save RFON start time.
|
*outputBeamONTime = *currentTime - plcOnTime; //Save RFON start time.
|
||||||
|
|
||||||
if (bps_swon_is_on || mhvps_hvon_is_on){
|
if (bps_swon_is_on || mhvps_hvon_is_on){
|
||||||
*outputHVInjection = 0;
|
*outputHVInjection = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//State transition condition
|
//State transition condition
|
||||||
if (aps_swon_is_on){
|
if (aps_swon_is_on){
|
||||||
currentState = RFON;
|
currentState = RFON;
|
||||||
*outputRFON = 0;
|
*outputRFON = 0;
|
||||||
|
*outputBeamON = 1;
|
||||||
*shotCounter += 1;
|
*shotCounter += 1;
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "state was changed to RFON");
|
//REPORT_ERROR(ErrorManagement::Debug, "state was changed to RFON");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (currentState == RFON) {
|
else if (currentState == RFON) {
|
||||||
|
|
||||||
//SDN command processing.
|
//SDN command processing.
|
||||||
if (*sdnCommand == 4 && aps_swon_is_on) {
|
if (sdnCommand == 4 && aps_swon_is_on) {
|
||||||
*outputSignal -= aps_swon;
|
*outputSignal -= aps_swon;
|
||||||
aps_swon_is_on = false;
|
aps_swon_is_on = false; aps_swon_state=0;
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "sdn command was 4");
|
//REPORT_ERROR(ErrorManagement::Debug, "sdn command was 4");
|
||||||
|
*outputAPSSWON=0;
|
||||||
}
|
}
|
||||||
if (*sdnCommand == 3 && !aps_swon_is_on) {
|
if (sdnCommand == 3 && !aps_swon_is_on) {
|
||||||
*outputSignal += aps_swon;
|
*outputSignal += aps_swon;
|
||||||
aps_swon_is_on = true;
|
aps_swon_is_on = true; aps_swon_state=0;
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "sdn command was 3");
|
//REPORT_ERROR(ErrorManagement::Debug, "sdn command was 3");
|
||||||
|
*outputAPSSWON=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Action in this state.
|
//Action in this state.
|
||||||
if ((*sdnCommand == 2) || (*modePulseLengthLimit == 1u) || (*currentTime >= (sdnTriggerTime + *triggerDelay_aps_swon + *triggerDelay_shotlen))) {
|
if ((sdnCommand == 2) || (*modePulseLengthLimit == 1u) || (*currentTime >= (sdnTriggerTime + *triggerDelay_aps_swon + *triggerDelay_shotlen))) {
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "shotlen: %d", *triggerDelay_shotlen);
|
//REPORT_ERROR(ErrorManagement::Debug, "shotlen: %d", *triggerDelay_shotlen);
|
||||||
if (*sdnCommand == 2) {
|
if (sdnCommand == 2) {
|
||||||
REPORT_ERROR(ErrorManagement::Information, "sdn command was 2");
|
//REPORT_ERROR(ErrorManagement::Information, "sdn command was 2");
|
||||||
} else if (*currentTime >= (sdnTriggerTime + *triggerDelay_aps_swon + *triggerDelay_shotlen)){
|
} else if (*currentTime >= (sdnTriggerTime + *triggerDelay_aps_swon + *triggerDelay_shotlen)){
|
||||||
REPORT_ERROR(ErrorManagement::Information, "pulse length reached setpoint.");
|
//REPORT_ERROR(ErrorManagement::Information, "pulse length reached setpoint.");
|
||||||
}
|
}
|
||||||
//Do action
|
//Do action
|
||||||
*outputSignal -= aps_swon; //Turn off only aps_swon
|
*outputSignal -= aps_swon; //Turn off only aps_swon
|
||||||
mhvps_hvon_is_on = false;
|
mhvps_hvon_is_on = false;
|
||||||
aps_hvon_is_on = false;
|
aps_hvon_is_on = false;
|
||||||
aps_swon_is_on = false;
|
aps_swon_is_on = false; aps_swon_state=0;
|
||||||
bps_hvon_is_on = false;
|
bps_hvon_is_on = false;
|
||||||
bps_swon_is_on = false;
|
bps_swon_is_on = false;
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "0 was set to outputSignal at %d.", *currentTime);
|
*outputAPSHVON=0;
|
||||||
|
*outputAPSSWON=0;
|
||||||
|
*outputBPSHVON=0;
|
||||||
|
*outputBPSSWON=0;
|
||||||
|
*outputMHVPSON=0;
|
||||||
|
//REPORT_ERROR(ErrorManagement::Debug, "0 was set to outputSignal at %d.", *currentTime);
|
||||||
}
|
}
|
||||||
*outputRFON = 0;
|
*outputRFON = 1;
|
||||||
*outputBeamONTime = *currentTime - plcOnTime;
|
*outputBeamONTime = *currentTime - plcOnTime;
|
||||||
*outputRFONTime = *currentTime - apsSwonTime;
|
*outputRFONTime = *currentTime - apsSwonTime;
|
||||||
|
|
||||||
@@ -332,29 +381,37 @@ bool JASDNRTStateMachineGAM::Execute() {
|
|||||||
if (!aps_swon_is_on && !bps_swon_is_on && !mhvps_hvon_is_on) {
|
if (!aps_swon_is_on && !bps_swon_is_on && !mhvps_hvon_is_on) {
|
||||||
currentState = HVTerminate;
|
currentState = HVTerminate;
|
||||||
apsSwoffTime = *currentTime;
|
apsSwoffTime = *currentTime;
|
||||||
REPORT_ERROR(ErrorManagement::Information, "state was changed to HVTerminate");
|
//REPORT_ERROR(ErrorManagement::Information, "state was changed to HVTerminate");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (currentState == HVTerminate) {
|
else if (currentState == HVTerminate) {
|
||||||
|
|
||||||
//Action in this state.
|
//Action in this state.
|
||||||
*outputBeamON = 1;
|
*outputBeamON = 0;
|
||||||
*outputHVArmed = 1;
|
*outputHVArmed = 0;
|
||||||
*outputHVInjection = 1;
|
*outputHVInjection = 0;
|
||||||
*outputRFON = 1;
|
*outputRFON = 0;
|
||||||
|
|
||||||
// State transition condition.
|
// State transition condition.
|
||||||
if (*currentTime - apsSwoffTime >= turn_off_delay){
|
if (*currentTime - apsSwoffTime >= turn_off_delay){
|
||||||
*outputSignal = 0;
|
*outputSignal = 0;
|
||||||
|
mhvps_hvon_state=0;
|
||||||
|
aps_hvon_state=0;
|
||||||
|
bps_hvon_state=0;
|
||||||
|
bps_swon_state=0;
|
||||||
}
|
}
|
||||||
if (*triggerSignal == false){
|
if (*triggerSignal == false){
|
||||||
//Check PLC_ON is reset
|
//Check PLC_ON is reset
|
||||||
currentState = WaitTrigger;
|
currentState = WaitTrigger;
|
||||||
*outputSignal = 0;
|
*outputSignal = 0;
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "state was changed to WaitTrigger");
|
groupFix = 0;
|
||||||
|
//REPORT_ERROR(ErrorManagement::Debug, "state was changed to WaitTrigger");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
p3Value = 1*aps_hvon_state +2*aps_swon_state + 8*bps_hvon_state +16*bps_swon_state + 64*(*outputBeamON);
|
||||||
|
*outputSignalNI6528P3 = ~p3Value;
|
||||||
|
p4Value = 8*mhvps_hvon_state;
|
||||||
|
*outputSignalNI6528P4 = ~p4Value;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -92,10 +92,18 @@
|
|||||||
* DataSource = DDB1
|
* DataSource = DDB1
|
||||||
* Type = uint32
|
* Type = uint32
|
||||||
* }
|
* }
|
||||||
* Command = {
|
* Command = {//from packet x
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
* DataSource = RealTimeThreadAsyncBridge
|
||||||
* Type = uint16
|
* Type = uint16
|
||||||
* }
|
* }
|
||||||
|
* Command2 = {//from packet y
|
||||||
|
* DataSource = RealTimeThreadAsyncBridge
|
||||||
|
* Type = uint16
|
||||||
|
* }
|
||||||
|
* ESDNStatus = {// 0 or 1. If 0, packet x is used, elif 1, packet y is used.
|
||||||
|
* DataSource = RealTimeThreadAsyncBridge
|
||||||
|
* Type = uint8
|
||||||
|
* }
|
||||||
* }
|
* }
|
||||||
* OutputSignals = {
|
* OutputSignals = {
|
||||||
* Value = {
|
* Value = {
|
||||||
@@ -199,8 +207,12 @@ private:
|
|||||||
MARTe::uint32 *stopRequest;
|
MARTe::uint32 *stopRequest;
|
||||||
// Input signal for pulse length limit by mode.
|
// Input signal for pulse length limit by mode.
|
||||||
MARTe::uint32 *modePulseLengthLimit;
|
MARTe::uint32 *modePulseLengthLimit;
|
||||||
// Input signal for SDN commands.
|
// Input signal for SDN commands from packet x.
|
||||||
MARTe::uint16 *sdnCommand;
|
MARTe::uint16 *Command;
|
||||||
|
// Input signal for SDN commands from packet y.
|
||||||
|
MARTe::uint16 *Command2;
|
||||||
|
// Input signal for SDN status.
|
||||||
|
MARTe::uint8 *sdnStatus;
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////
|
||||||
// Output signal to which the output value will be written.
|
// Output signal to which the output value will be written.
|
||||||
@@ -217,6 +229,17 @@ private:
|
|||||||
MARTe::uint32 *outputRFONTime;
|
MARTe::uint32 *outputRFONTime;
|
||||||
// shot counter (coutup every RFON time.)
|
// shot counter (coutup every RFON time.)
|
||||||
MARTe::uint32 *shotCounter;
|
MARTe::uint32 *shotCounter;
|
||||||
|
|
||||||
|
// Added for HVPS state (20210602)
|
||||||
|
MARTe::uint32 *outputAPSHVON;
|
||||||
|
MARTe::uint32 *outputAPSSWON;
|
||||||
|
MARTe::uint32 *outputBPSHVON;
|
||||||
|
MARTe::uint32 *outputBPSSWON;
|
||||||
|
MARTe::uint32 *outputMHVPSON;
|
||||||
|
|
||||||
|
// Output signals for NI devices
|
||||||
|
MARTe::uint8 *outputSignalNI6528P3;
|
||||||
|
MARTe::uint8 *outputSignalNI6528P4;
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//Internal Parameters
|
//Internal Parameters
|
||||||
@@ -226,6 +249,7 @@ private:
|
|||||||
//APS_SWON time holder
|
//APS_SWON time holder
|
||||||
MARTe::uint32 apsSwonTime;
|
MARTe::uint32 apsSwonTime;
|
||||||
MARTe::uint32 apsSwoffTime;
|
MARTe::uint32 apsSwoffTime;
|
||||||
|
MARTe::uint64 apsSwonHighResolutionTime;
|
||||||
|
|
||||||
//PS turn off delay
|
//PS turn off delay
|
||||||
MARTe::uint32 turn_off_delay;
|
MARTe::uint32 turn_off_delay;
|
||||||
@@ -239,6 +263,22 @@ private:
|
|||||||
bool bps_hvon_is_on;
|
bool bps_hvon_is_on;
|
||||||
bool bps_swon_is_on;
|
bool bps_swon_is_on;
|
||||||
|
|
||||||
|
//command x or y
|
||||||
|
MARTe::uint16 sdnCommand;
|
||||||
|
//packet group must not be changed during real time operation
|
||||||
|
MARTe::uint16 groupFix; //0: packet group is not fixed yet, 1: fixed.
|
||||||
|
//when packet group is fixed, sdnStatus is copied to this variable.
|
||||||
|
MARTe::uint8 sdnStatusFix;
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,8 @@
|
|||||||
SPB = JAMessageGAM.x JAPreProgrammedGAM.x JAModeControlGAM.x \
|
SPB = JAMessageGAM.x JAPreProgrammedGAM.x JAModeControlGAM.x \
|
||||||
JAWFRecordGAM.x JATriangleWaveGAM.x JARampupGAM.x \
|
JAWFRecordGAM.x JATriangleWaveGAM.x JARampupGAM.x \
|
||||||
JARTStateMachineGAM.x JASDNRTStateMachineGAM.x JATerminalInterfaceGAM.x \
|
JARTStateMachineGAM.x JASDNRTStateMachineGAM.x JATerminalInterfaceGAM.x \
|
||||||
JABitSumGAM.x JAConditionalSignalUpdateGAM.x JASourceChoiseGAM.x JABitReverseGAM.x
|
JABitSumGAM.x JAConditionalSignalUpdateGAM.x JASourceChoiseGAM.x JABitReverseGAM.x \
|
||||||
|
JAESDNTimeCompareGAM.x
|
||||||
|
|
||||||
MAKEDEFAULTDIR=$(MARTe2_DIR)/MakeDefaults
|
MAKEDEFAULTDIR=$(MARTe2_DIR)/MakeDefaults
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -2325,6 +2325,63 @@
|
|||||||
Function = GoError
|
Function = GoError
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
+GoErrorFromWaitHVON_SDNGAM = {
|
||||||
|
Class = JAMessageGAM
|
||||||
|
Operation = OR
|
||||||
|
//ExpectedIntValues = {1 1 1 1 1 1 1 1 1 1 0}
|
||||||
|
ExpectedIntValues = {1 1 1 1 1 1 1 1 1 1}
|
||||||
|
InputSignals = {
|
||||||
|
GYA_APS_FLT = {
|
||||||
|
DataSource = EPICSCAInput
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
GYB_APS_FLT = {
|
||||||
|
DataSource = EPICSCAInput
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
GYA_BPS_FLT = {
|
||||||
|
DataSource = EPICSCAInput
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
GYB_BPS_FLT = {
|
||||||
|
DataSource = EPICSCAInput
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
MHVPS_OV = {
|
||||||
|
DataSource = EPICSCAInput
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
MHVPS_OC = {
|
||||||
|
DataSource = EPICSCAInput
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
MHVPS_FLT = {
|
||||||
|
DataSource = EPICSCAInput
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
MIS_ITL = {
|
||||||
|
DataSource = EPICSCAInput
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
MISB_ITL = {
|
||||||
|
DataSource = EPICSCAInput
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
PLC_ITL = {
|
||||||
|
DataSource = EPICSCAInput
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
//SDN_Connection = {
|
||||||
|
// DataSource = DDB1
|
||||||
|
// Type = uint32
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
+Event = {
|
||||||
|
Class = Message
|
||||||
|
Destination = StateMachine
|
||||||
|
Function = GoError
|
||||||
|
}
|
||||||
|
}
|
||||||
// Reset HVPS outputs. ToDo: Fix to access NI d.s.
|
// Reset HVPS outputs. ToDo: Fix to access NI d.s.
|
||||||
+ResetPSsGAM = {
|
+ResetPSsGAM = {
|
||||||
Class = ConstantGAM
|
Class = ConstantGAM
|
||||||
@@ -2403,8 +2460,13 @@
|
|||||||
NumberOfDimensions = 1
|
NumberOfDimensions = 1
|
||||||
NumberOfElements = 64
|
NumberOfElements = 64
|
||||||
Ranges = {{0 0}}
|
Ranges = {{0 0}}
|
||||||
// TODO uncomment this for release/testing
|
}
|
||||||
//Frequency = 1
|
ESDNStatus = {
|
||||||
|
DataSource = SDNSubCommands
|
||||||
|
Type = uint8
|
||||||
|
NumberOfDimensions = 1
|
||||||
|
NumberOfElements = 1
|
||||||
|
Ranges = {{0 0}}
|
||||||
}
|
}
|
||||||
ESDNTime = {
|
ESDNTime = {
|
||||||
DataSource = SDNSubCommands
|
DataSource = SDNSubCommands
|
||||||
@@ -2418,17 +2480,39 @@
|
|||||||
DataSource = RealTimeThreadAsyncBridge
|
DataSource = RealTimeThreadAsyncBridge
|
||||||
Type = uint16
|
Type = uint16
|
||||||
}
|
}
|
||||||
|
ESDNStatus = {
|
||||||
|
DataSource = RealTimeThreadAsyncBridge
|
||||||
|
Type = uint8
|
||||||
|
}
|
||||||
ESDNTime = {
|
ESDNTime = {
|
||||||
DataSource = DDB1
|
DataSource = DDB1
|
||||||
Type = uint32
|
Type = uint32
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+debugSDNGAM = {//for debug
|
+SDNCommandGAM2 = {
|
||||||
Class = IOGAM
|
Class = IOGAM
|
||||||
InputSignals = {
|
InputSignals = {
|
||||||
Command = {
|
Command = {
|
||||||
|
DataSource = SDNSubCommands2
|
||||||
|
Type = uint16
|
||||||
|
NumberOfDimensions = 1
|
||||||
|
NumberOfElements = 64
|
||||||
|
Ranges = {{0 0}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
OutputSignals = {
|
||||||
|
Command2 = {
|
||||||
DataSource = RealTimeThreadAsyncBridge
|
DataSource = RealTimeThreadAsyncBridge
|
||||||
|
Type = uint16
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+debugGAM = {//for validation func. debug
|
||||||
|
Class = IOGAM
|
||||||
|
InputSignals = {
|
||||||
|
SDN_Connection = {
|
||||||
|
DataSource = DDB1
|
||||||
Type = uint32
|
Type = uint32
|
||||||
}
|
}
|
||||||
ESDNTime = {
|
ESDNTime = {
|
||||||
@@ -2437,9 +2521,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
OutputSignals = {
|
OutputSignals = {
|
||||||
Command_DISP = {
|
SDN_Connection_DISP = {
|
||||||
DataSource = Display
|
DataSource = Display
|
||||||
Type = float32
|
Type = uint32
|
||||||
}
|
}
|
||||||
ESDNTime_DISP = {
|
ESDNTime_DISP = {
|
||||||
DataSource = Display
|
DataSource = Display
|
||||||
@@ -2447,6 +2531,54 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
+debugGAM_Group = {//for group func. debug
|
||||||
|
Class = IOGAM
|
||||||
|
InputSignals = {
|
||||||
|
ESDNStatus = {
|
||||||
|
DataSource = SDNSubCommands
|
||||||
|
Type = uint8
|
||||||
|
}
|
||||||
|
Command = {
|
||||||
|
DataSource = SDNSubCommands
|
||||||
|
Type = uint16
|
||||||
|
Ranges = {{0 0}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
OutputSignals = {
|
||||||
|
ESDNStatus1_DISP = {
|
||||||
|
DataSource = Display
|
||||||
|
Type = uint8
|
||||||
|
}
|
||||||
|
Command1_DISP = {
|
||||||
|
DataSource = Display
|
||||||
|
Type = uint16
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+debugGAM_Group2 = {//for group func. debug
|
||||||
|
Class = IOGAM
|
||||||
|
InputSignals = {
|
||||||
|
ESDNStatus = {
|
||||||
|
DataSource = SDNSubCommands2
|
||||||
|
Type = uint8
|
||||||
|
}
|
||||||
|
Command = {
|
||||||
|
DataSource = SDNSubCommands2
|
||||||
|
Type = uint16
|
||||||
|
Ranges = {{0 0}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
OutputSignals = {
|
||||||
|
ESDNStatus2_DISP = {
|
||||||
|
DataSource = Display
|
||||||
|
Type = uint8
|
||||||
|
}
|
||||||
|
Command2_DISP = {
|
||||||
|
DataSource = Display
|
||||||
|
Type = uint16
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+SDNReplyGAM = {
|
+SDNReplyGAM = {
|
||||||
Class = IOGAM
|
Class = IOGAM
|
||||||
InputSignals = {
|
InputSignals = {
|
||||||
@@ -2659,7 +2791,21 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Write SDN waveform data into PS setpoint PV.
|
+SDNTimeCompareGAM = { // for "Validation" functionality
|
||||||
|
Class = JAESDNTimeCompareGAM
|
||||||
|
InputSignals = {
|
||||||
|
ESDNTime = {
|
||||||
|
DataSource = DDB1
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
}
|
||||||
|
OutputSignals = {
|
||||||
|
SDN_Connection = {
|
||||||
|
DataSource = DDB1
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Timer for SDN thread.
|
// Timer for SDN thread.
|
||||||
+TimeSDNGAM = {
|
+TimeSDNGAM = {
|
||||||
@@ -2672,7 +2818,8 @@
|
|||||||
Counter = {
|
Counter = {
|
||||||
DataSource = TimerSDN
|
DataSource = TimerSDN
|
||||||
Type = uint32
|
Type = uint32
|
||||||
Frequency = 1000 //operation:1k(=1ms cyc), debug:10
|
//Frequency = 1000 //operation:1k(=1ms cyc), debug:10
|
||||||
|
Frequency = 900 //TimeCompareGAM for validation function properly work at 900Hz
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OutputSignals = {
|
OutputSignals = {
|
||||||
@@ -2698,7 +2845,7 @@
|
|||||||
Counter = {
|
Counter = {
|
||||||
DataSource = Timer
|
DataSource = Timer
|
||||||
Type = uint32
|
Type = uint32
|
||||||
Frequency = 200000 //operation:10k(=100us cyc)
|
Frequency = 10000
|
||||||
//Frequency = 100000 //operation:100k(=10us cyc)
|
//Frequency = 100000 //operation:100k(=10us cyc)
|
||||||
}
|
}
|
||||||
RTThreadPerf = {
|
RTThreadPerf = {
|
||||||
@@ -3191,7 +3338,14 @@
|
|||||||
DataSource = RealTimeThreadAsyncBridge
|
DataSource = RealTimeThreadAsyncBridge
|
||||||
Type = uint16
|
Type = uint16
|
||||||
}
|
}
|
||||||
|
Command2 = {
|
||||||
|
DataSource = RealTimeThreadAsyncBridge
|
||||||
|
Type = uint16
|
||||||
|
}
|
||||||
|
ESDNStatus = {
|
||||||
|
DataSource = RealTimeThreadAsyncBridge
|
||||||
|
Type = uint8
|
||||||
|
}
|
||||||
}
|
}
|
||||||
OutputSignals = {
|
OutputSignals = {
|
||||||
RTSMValue = {
|
RTSMValue = {
|
||||||
@@ -3227,6 +3381,37 @@
|
|||||||
DataSource = RealTimeThreadAsyncBridge
|
DataSource = RealTimeThreadAsyncBridge
|
||||||
Type = uint32
|
Type = uint32
|
||||||
}
|
}
|
||||||
|
//Added 20210602
|
||||||
|
APS_HVON = {
|
||||||
|
DataSource = RealTimeThreadAsyncBridge
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
APS_SWON = {
|
||||||
|
DataSource = RealTimeThreadAsyncBridge
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
BPS_HVON = {
|
||||||
|
DataSource = RealTimeThreadAsyncBridge
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
BPS_SWON = {
|
||||||
|
DataSource = RealTimeThreadAsyncBridge
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
MHVPS_HVON = {
|
||||||
|
DataSource = RealTimeThreadAsyncBridge
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
NI6528P3Value = {
|
||||||
|
DataSource = NI6528P3
|
||||||
|
//DataSource = DDB1
|
||||||
|
Type = uint8
|
||||||
|
}
|
||||||
|
NI6528P4Value = {
|
||||||
|
DataSource = NI6528P4
|
||||||
|
//DataSource = DDB1
|
||||||
|
Type = uint8
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3572,8 +3757,11 @@
|
|||||||
}
|
}
|
||||||
// for data exechange between threads.
|
// for data exechange between threads.
|
||||||
+RealTimeThreadAsyncBridge = {
|
+RealTimeThreadAsyncBridge = {
|
||||||
Class = RealTimeThreadAsyncBridge
|
//Class = RealTimeThreadAsyncBridge
|
||||||
NumberOfBuffers = 20
|
//NumberOfBuffers = 20
|
||||||
|
NumberOfBuffers = 64
|
||||||
|
Class = GAMDataSource
|
||||||
|
AllowNoProducers = 1
|
||||||
}
|
}
|
||||||
// for access ECPIS PV.
|
// for access ECPIS PV.
|
||||||
+EPICSCAInput = {
|
+EPICSCAInput = {
|
||||||
@@ -4205,27 +4393,27 @@
|
|||||||
}
|
}
|
||||||
//PXI Board status PVs
|
//PXI Board status PVs
|
||||||
PXI6259_0 = {
|
PXI6259_0 = {
|
||||||
PVName = "EC-GN-HWCF:6259-0-STATUS"
|
PVName = "EC-GN-P01-HWCF:6259-0-STATUS"
|
||||||
Type = uint32
|
Type = uint32
|
||||||
}
|
}
|
||||||
PXI6259_1 = {
|
PXI6259_1 = {
|
||||||
PVName = "EC-GN-HWCF:6259-1-STATUS"
|
PVName = "EC-GN-P01-HWCF:6259-1-STATUS"
|
||||||
Type = uint32
|
Type = uint32
|
||||||
}
|
}
|
||||||
PXI6528_0 = {
|
PXI6528_0 = {
|
||||||
PVName = "EC-GN-HWCF:6528-0-STATUS"
|
PVName = "EC-GN-P01-HWCF:6528-0-STATUS"
|
||||||
Type = uint32
|
Type = uint32
|
||||||
}
|
}
|
||||||
PXI6528_1 = {
|
PXI6528_1 = {
|
||||||
PVName = "EC-GN-HWCF:6528-1-STATUS"
|
PVName = "EC-GN-P01-HWCF:6528-1-STATUS"
|
||||||
Type = uint32
|
Type = uint32
|
||||||
}
|
}
|
||||||
PXI6368_0 = {
|
PXI6368_0 = {
|
||||||
PVName = "EC-GN-HWCF:6368-0-STATUS"
|
PVName = "EC-GN-P01-HWCF:6368-0-STATUS"
|
||||||
Type = uint32
|
Type = uint32
|
||||||
}
|
}
|
||||||
PXI6368_1 = {
|
PXI6368_1 = {
|
||||||
PVName = "EC-GN-HWCF:6368-1-STATUS"
|
PVName = "EC-GN-P01-HWCF:6368-1-STATUS"
|
||||||
Type = uint32
|
Type = uint32
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4457,6 +4645,51 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
+SDNSubCommands2 = {
|
||||||
|
Class = SDN::SDNSubscriber
|
||||||
|
Topic = ECPC2SCUJA2
|
||||||
|
Interface = enp27s0f0
|
||||||
|
CPUs = 0x200 //change from 100
|
||||||
|
Locked = 1
|
||||||
|
Timeout = 2
|
||||||
|
Signals = {
|
||||||
|
Header = {
|
||||||
|
Type = uint8
|
||||||
|
NumberOfDimensions = 1
|
||||||
|
NumberOfElements = 48
|
||||||
|
}
|
||||||
|
ESDNHeaderVersionId = {
|
||||||
|
Type = uint8
|
||||||
|
NumberOfDimensions = 1
|
||||||
|
NumberOfElements = 1
|
||||||
|
}
|
||||||
|
ESDNHeaderSize = {
|
||||||
|
Type = uint8
|
||||||
|
NumberOfDimensions = 1
|
||||||
|
NumberOfElements = 1
|
||||||
|
}
|
||||||
|
ESDNStatus = {
|
||||||
|
Type = uint8
|
||||||
|
NumberOfDimensions = 1
|
||||||
|
NumberOfElements = 1
|
||||||
|
}
|
||||||
|
ESDNDoNotUse = {
|
||||||
|
Type = uint8
|
||||||
|
NumberOfDimensions = 1
|
||||||
|
NumberOfElements = 1
|
||||||
|
}
|
||||||
|
ESDNTime = {
|
||||||
|
Type = uint32
|
||||||
|
NumberOfDimensions = 1
|
||||||
|
NumberOfElements = 1
|
||||||
|
}
|
||||||
|
Command = {
|
||||||
|
Type = uint16
|
||||||
|
NumberOfDimensions = 1
|
||||||
|
NumberOfElements = 64
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+SDNReply = {
|
+SDNReply = {
|
||||||
Class = SDN::SDNPublisher
|
Class = SDN::SDNPublisher
|
||||||
Topic = SCUJA2ECPC
|
Topic = SCUJA2ECPC
|
||||||
@@ -4740,7 +4973,7 @@
|
|||||||
}
|
}
|
||||||
+Thread2 = {
|
+Thread2 = {
|
||||||
Class = RealTimeThread
|
Class = RealTimeThread
|
||||||
Functions = {TimeSDNGAM SDNCommandGAM SDNReplyGAM}
|
Functions = {TimeSDNGAM SDNCommandGAM SDNCommandGAM2 SDNReplyGAM SDNTimeCompareGAM }
|
||||||
CPUs = 0x200
|
CPUs = 0x200
|
||||||
}
|
}
|
||||||
+Thread3 = {
|
+Thread3 = {
|
||||||
@@ -4766,7 +4999,7 @@
|
|||||||
}
|
}
|
||||||
+Thread2 = {
|
+Thread2 = {
|
||||||
Class = RealTimeThread
|
Class = RealTimeThread
|
||||||
Functions = {TimeSDNGAM SDNCommandGAM SDNReplyGAM}
|
Functions = {TimeSDNGAM SDNCommandGAM SDNCommandGAM2 SDNReplyGAM SDNTimeCompareGAM }
|
||||||
CPUs = 0x200
|
CPUs = 0x200
|
||||||
}
|
}
|
||||||
+Thread3 = {
|
+Thread3 = {
|
||||||
@@ -4792,7 +5025,7 @@
|
|||||||
}
|
}
|
||||||
+Thread2 = {
|
+Thread2 = {
|
||||||
Class = RealTimeThread
|
Class = RealTimeThread
|
||||||
Functions = {TimeSDNGAM SDNCommandGAM SDNReplyGAM}
|
Functions = {TimeSDNGAM SDNCommandGAM SDNCommandGAM2 SDNReplyGAM SDNTimeCompareGAM }
|
||||||
CPUs = 0x200
|
CPUs = 0x200
|
||||||
}
|
}
|
||||||
+Thread3 = {
|
+Thread3 = {
|
||||||
@@ -4818,7 +5051,7 @@
|
|||||||
}
|
}
|
||||||
+Thread2 = {
|
+Thread2 = {
|
||||||
Class = RealTimeThread
|
Class = RealTimeThread
|
||||||
Functions = {TimeSDNGAM SDNCommandGAM SDNReplyGAM}
|
Functions = {TimeSDNGAM SDNCommandGAM SDNCommandGAM2 SDNReplyGAM SDNTimeCompareGAM }
|
||||||
CPUs = 0x200
|
CPUs = 0x200
|
||||||
}
|
}
|
||||||
+Thread3 = {
|
+Thread3 = {
|
||||||
@@ -4848,7 +5081,7 @@
|
|||||||
}
|
}
|
||||||
+Thread2 = {
|
+Thread2 = {
|
||||||
Class = RealTimeThread
|
Class = RealTimeThread
|
||||||
Functions = {TimeSDNGAM SDNCommandGAM SDNReplyGAM}
|
Functions = {TimeSDNGAM SDNCommandGAM SDNCommandGAM2 SDNReplyGAM SDNTimeCompareGAM }
|
||||||
CPUs = 0x200
|
CPUs = 0x200
|
||||||
}
|
}
|
||||||
+Thread3 = {
|
+Thread3 = {
|
||||||
@@ -4875,19 +5108,19 @@
|
|||||||
choiseGAM EPICSOutputGAM PXI6368Error03GAM PXI6368Error04GAM PXI6259ErrorGAM PXIErrorGAM
|
choiseGAM EPICSOutputGAM PXI6368Error03GAM PXI6368Error04GAM PXI6259ErrorGAM PXIErrorGAM
|
||||||
writeBeamONStateGAM writeHVArmedStateGAM writeHVInjectionStateGAM writeRFONStateGAM
|
writeBeamONStateGAM writeHVArmedStateGAM writeHVInjectionStateGAM writeRFONStateGAM
|
||||||
writeBeamONTimeGAM writeRFONTimeGAM
|
writeBeamONTimeGAM writeRFONTimeGAM
|
||||||
FromWaitHVONToWaitStandby FromWaitHVONToWaitPermit GoErrorGAM }
|
FromWaitHVONToWaitStandby FromWaitHVONToWaitPermit GoErrorFromWaitHVON_SDNGAM }
|
||||||
CPUs = 0x100
|
CPUs = 0x100
|
||||||
}
|
}
|
||||||
+Thread2 = {
|
+Thread2 = {
|
||||||
Class = RealTimeThread
|
Class = RealTimeThread
|
||||||
Functions = {TimeSDNGAM SDNCommandGAM SDNReplyGAM}
|
Functions = {TimeSDNGAM SDNCommandGAM SDNCommandGAM2 SDNReplyGAM SDNTimeCompareGAM }
|
||||||
CPUs = 0x200
|
CPUs = 0x200
|
||||||
}
|
}
|
||||||
+Thread3 = {
|
+Thread3 = {
|
||||||
Class = RealTimeThread
|
Class = RealTimeThread
|
||||||
Functions = {Timer100kHzGAM GAMEPICSCA StopRequestGAM ModeLimitGAM
|
Functions = {Timer100kHzGAM GAMEPICSCA StopRequestGAM ModeLimitGAM
|
||||||
NI6528P3GAM NI6528P4GAM
|
NI6528P3GAM NI6528P4GAM
|
||||||
GAMSDNRealTimeStateMachine terminalInterfaceGAM NI6528P5GAM NI6528P5PV2PortGAM}
|
GAMSDNRealTimeStateMachine NI6528P5GAM NI6528P5PV2PortGAM}
|
||||||
CPUs = 0x400
|
CPUs = 0x400
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4907,7 +5140,7 @@
|
|||||||
}
|
}
|
||||||
+Thread2 = {
|
+Thread2 = {
|
||||||
Class = RealTimeThread
|
Class = RealTimeThread
|
||||||
Functions = {TimeSDNGAM SDNCommandGAM SDNReplyGAM}
|
Functions = {TimeSDNGAM SDNCommandGAM SDNCommandGAM2 SDNReplyGAM SDNTimeCompareGAM }
|
||||||
CPUs = 0x200
|
CPUs = 0x200
|
||||||
}
|
}
|
||||||
+Thread3 = {
|
+Thread3 = {
|
||||||
@@ -4934,14 +5167,14 @@
|
|||||||
}
|
}
|
||||||
+Thread2 = {
|
+Thread2 = {
|
||||||
Class = RealTimeThread
|
Class = RealTimeThread
|
||||||
Functions = {TimeSDNGAM SDNCommandGAM SDNReplyGAM}
|
Functions = {TimeSDNGAM SDNCommandGAM SDNCommandGAM2 SDNReplyGAM SDNTimeCompareGAM }
|
||||||
CPUs = 0x200
|
CPUs = 0x200
|
||||||
}
|
}
|
||||||
+Thread3 = {
|
+Thread3 = {
|
||||||
Class = RealTimeThread
|
Class = RealTimeThread
|
||||||
Functions = {Timer100kHzGAM GAMEPICSCA StopRequestGAM ModeLimitGAM
|
Functions = {Timer100kHzGAM GAMEPICSCA StopRequestGAM ModeLimitGAM
|
||||||
NI6528P3GAM NI6528P4GAM
|
NI6528P3GAM NI6528P4GAM
|
||||||
GAMSDNRealTimeStateMachine terminalInterfaceGAM NI6528P5GAM NI6528P5PV2PortGAM}
|
GAMSDNRealTimeStateMachine NI6528P5GAM NI6528P5PV2PortGAM}
|
||||||
CPUs = 0x400
|
CPUs = 0x400
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4955,12 +5188,12 @@
|
|||||||
Class = RealTimeThread
|
Class = RealTimeThread
|
||||||
Functions = {Timer1kHzGAM InErrorGAM PXI6368Error03GAM PXI6368Error04GAM PXI6259ErrorGAM PXIErrorGAM
|
Functions = {Timer1kHzGAM InErrorGAM PXI6368Error03GAM PXI6368Error04GAM PXI6259ErrorGAM PXIErrorGAM
|
||||||
ExitedHVArmedInjectionRFONGAM ResetPSsGAM
|
ExitedHVArmedInjectionRFONGAM ResetPSsGAM
|
||||||
FromErrorToWaitStandbyGAM ErrorGAM choiseGAM EPICSOutputGAM FHPSSetpointGAM FHPSRampupGAM CCPSWaveformGAM}
|
FromErrorToWaitStandbyGAM ErrorGAM choiseGAM EPICSOutputGAM FHPSSetpointGAM FHPSRampupGAM CCPSWaveformGAM }
|
||||||
CPUs = 0x100
|
CPUs = 0x100
|
||||||
}
|
}
|
||||||
+Thread2 = {
|
+Thread2 = {
|
||||||
Class = RealTimeThread
|
Class = RealTimeThread
|
||||||
Functions = {TimeSDNGAM SDNCommandGAM SDNReplyGAM}
|
Functions = {TimeSDNGAM SDNCommandGAM SDNCommandGAM2 SDNReplyGAM SDNTimeCompareGAM }
|
||||||
CPUs = 0x200
|
CPUs = 0x200
|
||||||
}
|
}
|
||||||
+Thread3 = {
|
+Thread3 = {
|
||||||
|
|||||||
@@ -2301,6 +2301,63 @@
|
|||||||
Function = GoError
|
Function = GoError
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
+GoErrorFromWaitHVON_SDNGAM = {
|
||||||
|
Class = JAMessageGAM
|
||||||
|
Operation = OR
|
||||||
|
//ExpectedIntValues = {1 1 1 1 1 1 1 1 1 1 0}
|
||||||
|
ExpectedIntValues = {1 1 1 1 1 1 1 1 1 1}
|
||||||
|
InputSignals = {
|
||||||
|
GYA_APS_FLT = {
|
||||||
|
DataSource = EPICSCAInput
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
GYB_APS_FLT = {
|
||||||
|
DataSource = EPICSCAInput
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
GYA_BPS_FLT = {
|
||||||
|
DataSource = EPICSCAInput
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
GYB_BPS_FLT = {
|
||||||
|
DataSource = EPICSCAInput
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
MHVPS_OV = {
|
||||||
|
DataSource = EPICSCAInput
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
MHVPS_OC = {
|
||||||
|
DataSource = EPICSCAInput
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
MHVPS_FLT = {
|
||||||
|
DataSource = EPICSCAInput
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
MIS_ITL = {
|
||||||
|
DataSource = EPICSCAInput
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
MISB_ITL = {
|
||||||
|
DataSource = EPICSCAInput
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
PLC_ITL = {
|
||||||
|
DataSource = EPICSCAInput
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
//SDN_Connection = {
|
||||||
|
// DataSource = DDB1
|
||||||
|
// Type = uint32
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
+Event = {
|
||||||
|
Class = Message
|
||||||
|
Destination = StateMachine
|
||||||
|
Function = GoError
|
||||||
|
}
|
||||||
|
}
|
||||||
// Reset HVPS outputs. ToDo: Fix to access NI d.s.
|
// Reset HVPS outputs. ToDo: Fix to access NI d.s.
|
||||||
+ResetPSsGAM = {
|
+ResetPSsGAM = {
|
||||||
Class = ConstantGAM
|
Class = ConstantGAM
|
||||||
@@ -2399,7 +2456,24 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
+SDNCommandGAM2 = {
|
||||||
|
Class = IOGAM
|
||||||
|
InputSignals = {
|
||||||
|
Command = {
|
||||||
|
DataSource = SDNSubCommands2
|
||||||
|
Type = uint16
|
||||||
|
NumberOfDimensions = 1
|
||||||
|
NumberOfElements = 64
|
||||||
|
Ranges = {{0 0}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
OutputSignals = {
|
||||||
|
Command2 = {
|
||||||
|
DataSource = RealTimeThreadAsyncBridge
|
||||||
|
Type = uint16
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+SDNReplyGAM = {
|
+SDNReplyGAM = {
|
||||||
Class = IOGAM
|
Class = IOGAM
|
||||||
InputSignals = {
|
InputSignals = {
|
||||||
@@ -2612,7 +2686,21 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Write SDN waveform data into PS setpoint PV.
|
+SDNTimeCompareGAM = { // for "Validation" functionality
|
||||||
|
Class = JAESDNTimeCompareGAM
|
||||||
|
InputSignals = {
|
||||||
|
ESDNTime = {
|
||||||
|
DataSource = DDB1
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
}
|
||||||
|
OutputSignals = {
|
||||||
|
SDN_Connection = {
|
||||||
|
DataSource = DDB1
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Timer for SDN thread.
|
// Timer for SDN thread.
|
||||||
+TimeSDNGAM = {
|
+TimeSDNGAM = {
|
||||||
@@ -2625,12 +2713,8 @@
|
|||||||
Counter = {
|
Counter = {
|
||||||
DataSource = TimerSDN
|
DataSource = TimerSDN
|
||||||
Type = uint32
|
Type = uint32
|
||||||
Frequency = 1000 //operation:1k(=1ms cyc), debug:10
|
//Frequency = 1000 //operation:1k(=1ms cyc), debug:10
|
||||||
}
|
Frequency = 900 //TimeCompareGAM for validation function properly work at 900Hz for QST ECPC
|
||||||
RTThreadPerf = {
|
|
||||||
DataSource = Timings
|
|
||||||
Alias = "WaitHVON.Thread3_CycleTime"
|
|
||||||
Type = uint32
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OutputSignals = {
|
OutputSignals = {
|
||||||
@@ -2642,10 +2726,6 @@
|
|||||||
DataSource = DDB1
|
DataSource = DDB1
|
||||||
Type = uint32
|
Type = uint32
|
||||||
}
|
}
|
||||||
RTThreadPerfSDN = {
|
|
||||||
DataSource = DDB1
|
|
||||||
Type = uint32
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2660,7 +2740,8 @@
|
|||||||
Counter = {
|
Counter = {
|
||||||
DataSource = Timer
|
DataSource = Timer
|
||||||
Type = uint32
|
Type = uint32
|
||||||
Frequency = 200000 //operation:100k(=10us cyc), debug:10
|
Frequency = 10000
|
||||||
|
//Frequency = 100000 //operation:100k(=10us cyc), debug:10
|
||||||
}
|
}
|
||||||
RTThreadPerf = {
|
RTThreadPerf = {
|
||||||
DataSource = Timings
|
DataSource = Timings
|
||||||
@@ -3228,6 +3309,14 @@
|
|||||||
DataSource = RealTimeThreadAsyncBridge
|
DataSource = RealTimeThreadAsyncBridge
|
||||||
Type = uint16
|
Type = uint16
|
||||||
}
|
}
|
||||||
|
Command2 = {
|
||||||
|
DataSource = RealTimeThreadAsyncBridge
|
||||||
|
Type = uint16
|
||||||
|
}
|
||||||
|
ESDNStatus = {
|
||||||
|
DataSource = RealTimeThreadAsyncBridge
|
||||||
|
Type = uint8
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
OutputSignals = {
|
OutputSignals = {
|
||||||
@@ -3264,6 +3353,37 @@
|
|||||||
DataSource = RealTimeThreadAsyncBridge
|
DataSource = RealTimeThreadAsyncBridge
|
||||||
Type = uint32
|
Type = uint32
|
||||||
}
|
}
|
||||||
|
//Added 20210603
|
||||||
|
APS_HVON = {
|
||||||
|
DataSource = RealTimeThreadAsyncBridge
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
APS_SWON = {
|
||||||
|
DataSource = RealTimeThreadAsyncBridge
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
BPS_HVON = {
|
||||||
|
DataSource = RealTimeThreadAsyncBridge
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
BPS_SWON = {
|
||||||
|
DataSource = RealTimeThreadAsyncBridge
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
MHVPS_HVON = {
|
||||||
|
DataSource = RealTimeThreadAsyncBridge
|
||||||
|
Type = uint32
|
||||||
|
}
|
||||||
|
NI6528P3Value = {
|
||||||
|
DataSource = NI6528P3
|
||||||
|
//DataSource = DDB1
|
||||||
|
Type = uint8
|
||||||
|
}
|
||||||
|
NI6528P4GYAValue = {
|
||||||
|
DataSource = NI6528P4GYA
|
||||||
|
//DataSource = DDB1
|
||||||
|
Type = uint8
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3496,8 +3616,11 @@
|
|||||||
}
|
}
|
||||||
// for data exechange between threads.
|
// for data exechange between threads.
|
||||||
+RealTimeThreadAsyncBridge = {
|
+RealTimeThreadAsyncBridge = {
|
||||||
Class = RealTimeThreadAsyncBridge
|
//Class = RealTimeThreadAsyncBridge
|
||||||
NumberOfBuffers = 20
|
//NumberOfBuffers = 20
|
||||||
|
NumberOfBuffers = 64
|
||||||
|
Class = GAMDataSource
|
||||||
|
AllowNoProducers = 1
|
||||||
}
|
}
|
||||||
// for access ECPIS PV.
|
// for access ECPIS PV.
|
||||||
+EPICSCAInput = {
|
+EPICSCAInput = {
|
||||||
@@ -4155,27 +4278,27 @@
|
|||||||
}
|
}
|
||||||
//PXI Board status PVs
|
//PXI Board status PVs
|
||||||
PXI6259_0 = {
|
PXI6259_0 = {
|
||||||
PVName = "EC-GN-HWCF:6259-0-STATUS"
|
PVName = "EC-GN-P01-HWCF:6259-0-STATUS"
|
||||||
Type = uint32
|
Type = uint32
|
||||||
}
|
}
|
||||||
PXI6259_1 = {
|
PXI6259_1 = {
|
||||||
PVName = "EC-GN-HWCF:6259-1-STATUS"
|
PVName = "EC-GN-P01-HWCF:6259-1-STATUS"
|
||||||
Type = uint32
|
Type = uint32
|
||||||
}
|
}
|
||||||
PXI6528_0 = {
|
PXI6528_0 = {
|
||||||
PVName = "EC-GN-HWCF:6528-0-STATUS"
|
PVName = "EC-GN-P01-HWCF:6528-0-STATUS"
|
||||||
Type = uint32
|
Type = uint32
|
||||||
}
|
}
|
||||||
PXI6528_1 = {
|
PXI6528_1 = {
|
||||||
PVName = "EC-GN-HWCF:6528-1-STATUS"
|
PVName = "EC-GN-P01-HWCF:6528-1-STATUS"
|
||||||
Type = uint32
|
Type = uint32
|
||||||
}
|
}
|
||||||
PXI6368_0 = {
|
PXI6368_0 = {
|
||||||
PVName = "EC-GN-HWCF:6368-0-STATUS"
|
PVName = "EC-GN-P01-HWCF:6368-0-STATUS"
|
||||||
Type = uint32
|
Type = uint32
|
||||||
}
|
}
|
||||||
PXI6368_1 = {
|
PXI6368_1 = {
|
||||||
PVName = "EC-GN-HWCF:6368-1-STATUS"
|
PVName = "EC-GN-P01-HWCF:6368-1-STATUS"
|
||||||
Type = uint32
|
Type = uint32
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4366,6 +4489,51 @@
|
|||||||
Class = SDN::SDNSubscriber
|
Class = SDN::SDNSubscriber
|
||||||
Topic = ECPC2SCUJA
|
Topic = ECPC2SCUJA
|
||||||
Interface = enp27s0f0
|
Interface = enp27s0f0
|
||||||
|
CPUs = 0x2000
|
||||||
|
Locked = 1
|
||||||
|
Timeout = 2
|
||||||
|
Signals = {
|
||||||
|
Header = {
|
||||||
|
Type = uint8
|
||||||
|
NumberOfDimensions = 1
|
||||||
|
NumberOfElements = 48
|
||||||
|
}
|
||||||
|
ESDNHeaderVersionId = {
|
||||||
|
Type = uint8
|
||||||
|
NumberOfDimensions = 1
|
||||||
|
NumberOfElements = 1
|
||||||
|
}
|
||||||
|
ESDNHeaderSize = {
|
||||||
|
Type = uint8
|
||||||
|
NumberOfDimensions = 1
|
||||||
|
NumberOfElements = 1
|
||||||
|
}
|
||||||
|
ESDNStatus = {
|
||||||
|
Type = uint8
|
||||||
|
NumberOfDimensions = 1
|
||||||
|
NumberOfElements = 1
|
||||||
|
}
|
||||||
|
ESDNDoNotUse = {
|
||||||
|
Type = uint8
|
||||||
|
NumberOfDimensions = 1
|
||||||
|
NumberOfElements = 1
|
||||||
|
}
|
||||||
|
ESDNTime = {
|
||||||
|
Type = uint32
|
||||||
|
NumberOfDimensions = 1
|
||||||
|
NumberOfElements = 1
|
||||||
|
}
|
||||||
|
Command = {
|
||||||
|
Type = uint16
|
||||||
|
NumberOfDimensions = 1
|
||||||
|
NumberOfElements = 64
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+SDNSubCommands2 = {
|
||||||
|
Class = SDN::SDNSubscriber
|
||||||
|
Topic = ECPC2SCUJA2
|
||||||
|
Interface = enp27s0f0
|
||||||
CPUs = 0x2000
|
CPUs = 0x2000
|
||||||
Locked = 1
|
Locked = 1
|
||||||
Timeout = 2
|
Timeout = 2
|
||||||
@@ -4710,7 +4878,7 @@
|
|||||||
}
|
}
|
||||||
+Thread2 = {
|
+Thread2 = {
|
||||||
Class = RealTimeThread
|
Class = RealTimeThread
|
||||||
Functions = {TimeSDNGAM SDNCommandGAM SDNReplyGAM}
|
Functions = {TimeSDNGAM SDNCommandGAM SDNCommandGAM2 SDNReplyGAM SDNTimeCompareGAM }
|
||||||
CPUs = 0x2000
|
CPUs = 0x2000
|
||||||
}
|
}
|
||||||
+Thread3 = {
|
+Thread3 = {
|
||||||
@@ -4731,12 +4899,12 @@
|
|||||||
Class = RealTimeThread
|
Class = RealTimeThread
|
||||||
Functions = {Timer1kHzGAM CCPSWaveformGAM FHPSSetpointGAM FHPSRampupGAM InWaitStandbyGAM
|
Functions = {Timer1kHzGAM CCPSWaveformGAM FHPSSetpointGAM FHPSRampupGAM InWaitStandbyGAM
|
||||||
choiseGAM MCPSGAM GCPSGAM EPICSOutputGAM PXI6368Error03GAM PXI6368Error04GAM PXI6259ErrorGAM PXIErrorGAM
|
choiseGAM MCPSGAM GCPSGAM EPICSOutputGAM PXI6368Error03GAM PXI6368Error04GAM PXI6259ErrorGAM PXIErrorGAM
|
||||||
GoDisabledGAM GoWaitReadyGAM GoErrorGAM CCPSWaveformGAM }
|
GoDisabledGAM GoWaitReadyGAM GoErrorGAM }
|
||||||
CPUs = 0x1000
|
CPUs = 0x1000
|
||||||
}
|
}
|
||||||
+Thread2 = {
|
+Thread2 = {
|
||||||
Class = RealTimeThread
|
Class = RealTimeThread
|
||||||
Functions = {TimeSDNGAM SDNCommandGAM SDNReplyGAM}
|
Functions = {TimeSDNGAM SDNCommandGAM SDNCommandGAM2 SDNReplyGAM SDNTimeCompareGAM }
|
||||||
CPUs = 0x2000
|
CPUs = 0x2000
|
||||||
}
|
}
|
||||||
+Thread3 = {
|
+Thread3 = {
|
||||||
@@ -4762,7 +4930,7 @@
|
|||||||
}
|
}
|
||||||
+Thread2 = {
|
+Thread2 = {
|
||||||
Class = RealTimeThread
|
Class = RealTimeThread
|
||||||
Functions = {TimeSDNGAM SDNCommandGAM SDNReplyGAM}
|
Functions = {TimeSDNGAM SDNCommandGAM SDNCommandGAM2 SDNReplyGAM SDNTimeCompareGAM }
|
||||||
CPUs = 0x2000
|
CPUs = 0x2000
|
||||||
}
|
}
|
||||||
+Thread3 = {
|
+Thread3 = {
|
||||||
@@ -4788,7 +4956,7 @@
|
|||||||
}
|
}
|
||||||
+Thread2 = {
|
+Thread2 = {
|
||||||
Class = RealTimeThread
|
Class = RealTimeThread
|
||||||
Functions = {TimeSDNGAM SDNCommandGAM SDNReplyGAM}
|
Functions = {TimeSDNGAM SDNCommandGAM SDNCommandGAM2 SDNReplyGAM SDNTimeCompareGAM }
|
||||||
CPUs = 0x2000
|
CPUs = 0x2000
|
||||||
}
|
}
|
||||||
+Thread3 = {
|
+Thread3 = {
|
||||||
@@ -4818,7 +4986,7 @@
|
|||||||
}
|
}
|
||||||
+Thread2 = {
|
+Thread2 = {
|
||||||
Class = RealTimeThread
|
Class = RealTimeThread
|
||||||
Functions = {TimeSDNGAM SDNCommandGAM SDNReplyGAM}
|
Functions = {TimeSDNGAM SDNCommandGAM SDNCommandGAM2 SDNReplyGAM SDNTimeCompareGAM }
|
||||||
CPUs = 0x2000
|
CPUs = 0x2000
|
||||||
}
|
}
|
||||||
+Thread3 = {
|
+Thread3 = {
|
||||||
@@ -4840,19 +5008,19 @@
|
|||||||
choiseGAM EPICSOutputGAM PXI6368Error03GAM PXI6368Error04GAM PXI6259ErrorGAM PXIErrorGAM
|
choiseGAM EPICSOutputGAM PXI6368Error03GAM PXI6368Error04GAM PXI6259ErrorGAM PXIErrorGAM
|
||||||
writeBeamONStateGAM writeHVArmedStateGAM writeHVInjectionStateGAM writeRFONStateGAM
|
writeBeamONStateGAM writeHVArmedStateGAM writeHVInjectionStateGAM writeRFONStateGAM
|
||||||
writeBeamONTimeGAM writeRFONTimeGAM
|
writeBeamONTimeGAM writeRFONTimeGAM
|
||||||
FromWaitHVONToWaitStandby FromWaitHVONToWaitPermit GoErrorGAM }
|
FromWaitHVONToWaitStandby FromWaitHVONToWaitPermit GoErrorFromWaitHVON_SDNGAM }
|
||||||
CPUs = 0x1000
|
CPUs = 0x1000
|
||||||
}
|
}
|
||||||
+Thread2 = {
|
+Thread2 = {
|
||||||
Class = RealTimeThread
|
Class = RealTimeThread
|
||||||
Functions = {TimeSDNGAM SDNCommandGAM SDNReplyGAM}
|
Functions = {TimeSDNGAM SDNCommandGAM SDNCommandGAM2 SDNReplyGAM SDNTimeCompareGAM }
|
||||||
CPUs = 0x2000
|
CPUs = 0x2000
|
||||||
}
|
}
|
||||||
+Thread3 = {
|
+Thread3 = {
|
||||||
Class = RealTimeThread
|
Class = RealTimeThread
|
||||||
Functions = {Timer100kHzGAM GAMEPICSCA StopRequestGAM ModeLimitGAM
|
Functions = {Timer100kHzGAM GAMEPICSCA StopRequestGAM ModeLimitGAM
|
||||||
NI6528P3GAM NI6528P4GAM NI6528P4GYAGAM NI6528P4PV2PortGAM NI6528P4WriteGAM
|
NI6528P3GAM NI6528P4GAM NI6528P4GYAGAM NI6528P4PV2PortGAM NI6528P4WriteGAM
|
||||||
GAMSDNRealTimeStateMachine terminalInterfaceGAM NI6528P5GAM NI6528P5PV2PortGAM}
|
GAMSDNRealTimeStateMachine NI6528P5GAM NI6528P5PV2PortGAM}
|
||||||
CPUs = 0x4000
|
CPUs = 0x4000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4872,7 +5040,7 @@
|
|||||||
}
|
}
|
||||||
+Thread2 = {
|
+Thread2 = {
|
||||||
Class = RealTimeThread
|
Class = RealTimeThread
|
||||||
Functions = {TimeSDNGAM SDNCommandGAM SDNReplyGAM}
|
Functions = {TimeSDNGAM SDNCommandGAM SDNCommandGAM2 SDNReplyGAM SDNTimeCompareGAM }
|
||||||
CPUs = 0x2000
|
CPUs = 0x2000
|
||||||
}
|
}
|
||||||
+Thread3 = {
|
+Thread3 = {
|
||||||
@@ -4899,14 +5067,14 @@
|
|||||||
}
|
}
|
||||||
+Thread2 = {
|
+Thread2 = {
|
||||||
Class = RealTimeThread
|
Class = RealTimeThread
|
||||||
Functions = {TimeSDNGAM SDNCommandGAM SDNReplyGAM}
|
Functions = {TimeSDNGAM SDNCommandGAM SDNCommandGAM2 SDNReplyGAM SDNTimeCompareGAM }
|
||||||
CPUs = 0x2000
|
CPUs = 0x2000
|
||||||
}
|
}
|
||||||
+Thread3 = {
|
+Thread3 = {
|
||||||
Class = RealTimeThread
|
Class = RealTimeThread
|
||||||
Functions = {Timer100kHzGAM GAMEPICSCA StopRequestGAM ModeLimitGAM
|
Functions = {Timer100kHzGAM GAMEPICSCA StopRequestGAM ModeLimitGAM
|
||||||
NI6528P3GAM NI6528P4GAM NI6528P4GYAGAM NI6528P4PV2PortGAM NI6528P4WriteGAM
|
NI6528P3GAM NI6528P4GAM NI6528P4GYAGAM NI6528P4PV2PortGAM NI6528P4WriteGAM
|
||||||
GAMSDNRealTimeStateMachine terminalInterfaceGAM NI6528P5GAM NI6528P5PV2PortGAM}
|
GAMSDNRealTimeStateMachine NI6528P5GAM NI6528P5PV2PortGAM}
|
||||||
CPUs = 0x4000
|
CPUs = 0x4000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4920,12 +5088,12 @@
|
|||||||
Class = RealTimeThread
|
Class = RealTimeThread
|
||||||
Functions = {Timer1kHzGAM InErrorGAM PXI6368Error03GAM PXI6368Error04GAM PXI6259ErrorGAM PXIErrorGAM
|
Functions = {Timer1kHzGAM InErrorGAM PXI6368Error03GAM PXI6368Error04GAM PXI6259ErrorGAM PXIErrorGAM
|
||||||
ExitedHVArmedInjectionRFONGAM ResetPSsGAM
|
ExitedHVArmedInjectionRFONGAM ResetPSsGAM
|
||||||
FromErrorToWaitStandbyGAM ErrorGAM choiseGAM EPICSOutputGAM FHPSSetpointGAM FHPSRampupGAM CCPSWaveformGAM}
|
FromErrorToWaitStandbyGAM ErrorGAM choiseGAM EPICSOutputGAM FHPSSetpointGAM FHPSRampupGAM CCPSWaveformGAM }
|
||||||
CPUs = 0x1000
|
CPUs = 0x1000
|
||||||
}
|
}
|
||||||
+Thread2 = {
|
+Thread2 = {
|
||||||
Class = RealTimeThread
|
Class = RealTimeThread
|
||||||
Functions = {TimeSDNGAM SDNCommandGAM SDNReplyGAM}
|
Functions = {TimeSDNGAM SDNCommandGAM SDNCommandGAM2 SDNReplyGAM SDNTimeCompareGAM }
|
||||||
CPUs = 0x2000
|
CPUs = 0x2000
|
||||||
}
|
}
|
||||||
+Thread3 = {
|
+Thread3 = {
|
||||||
|
|||||||
@@ -0,0 +1,132 @@
|
|||||||
|
/**
|
||||||
|
* @file JAESDNTimeCompareGAM.cpp
|
||||||
|
* @brief Source file for class JAESDNTimeCompareGAM
|
||||||
|
* @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 JAESDNTimeCompareGAM (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 "JAESDNTimeCompareGAM.h"
|
||||||
|
#include "AdvancedErrorManagement.h"
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/* Static definitions */
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/* Method definitions */
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
JAESDNTimeCompareGAM::JAESDNTimeCompareGAM() {
|
||||||
|
//ESDNTime holder
|
||||||
|
esdntime_previous = 0;
|
||||||
|
|
||||||
|
//Input signals.
|
||||||
|
esdntime = NULL_PTR(MARTe::uint32 *);
|
||||||
|
|
||||||
|
//Output signals.
|
||||||
|
sdn_connection = NULL_PTR(MARTe::uint32 *);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
JAESDNTimeCompareGAM::~JAESDNTimeCompareGAM() {
|
||||||
|
if (esdntime != NULL_PTR(MARTe::uint32 *)) {
|
||||||
|
delete[] esdntime;
|
||||||
|
}
|
||||||
|
if (sdn_connection != NULL_PTR(MARTe::uint32 *)) {
|
||||||
|
delete[] sdn_connection;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool JAESDNTimeCompareGAM::Initialise(MARTe::StructuredDataI & data) {
|
||||||
|
using namespace MARTe;
|
||||||
|
return GAM::Initialise(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool JAESDNTimeCompareGAM::PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool JAESDNTimeCompareGAM::Setup() {
|
||||||
|
// Setup memory for input/output signals on the GAM.
|
||||||
|
using namespace MARTe;
|
||||||
|
bool ok = (numberOfInputSignals == 1u);
|
||||||
|
// Do type check for input signals.
|
||||||
|
if (ok) {
|
||||||
|
ok = (numberOfOutputSignals == 1u);
|
||||||
|
if (!ok) {
|
||||||
|
REPORT_ERROR(ErrorManagement::ParametersError, "Number of output signals shall be the same as "
|
||||||
|
"number of expected values.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
REPORT_ERROR(ErrorManagement::ParametersError, "Number of input signals shall be the same as "
|
||||||
|
"number of expected values.");
|
||||||
|
}
|
||||||
|
if (ok) {
|
||||||
|
uint32 c;
|
||||||
|
for (c = 0u; c < numberOfInputSignals; c++) {
|
||||||
|
TypeDescriptor inputType = GetSignalType(InputSignals, c);
|
||||||
|
ok = (inputType == UnsignedInteger32Bit);
|
||||||
|
if (!ok) {
|
||||||
|
StreamString signalName;
|
||||||
|
(void) GetSignalName(InputSignals, c, signalName);
|
||||||
|
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as uint32", signalName.Buffer());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ok) {
|
||||||
|
uint32 c;
|
||||||
|
for (c = 0u; c < numberOfOutputSignals; c++) {
|
||||||
|
TypeDescriptor outputType = GetSignalType(OutputSignals, c);
|
||||||
|
ok = (outputType == UnsignedInteger32Bit);
|
||||||
|
if (!ok) {
|
||||||
|
StreamString signalName;
|
||||||
|
(void) GetSignalName(InputSignals, c, signalName);
|
||||||
|
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as uint32", signalName.Buffer());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ok) {
|
||||||
|
esdntime = reinterpret_cast<uint32 *>(GetInputSignalMemory(0));
|
||||||
|
sdn_connection = reinterpret_cast<uint32 *>(GetOutputSignalMemory(0));
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool JAESDNTimeCompareGAM::Execute() {
|
||||||
|
using namespace MARTe;
|
||||||
|
bool connected;
|
||||||
|
|
||||||
|
connected = !(esdntime_previous == *esdntime);
|
||||||
|
if (connected) *sdn_connection = 1;
|
||||||
|
else *sdn_connection = 0;
|
||||||
|
|
||||||
|
esdntime_previous = *esdntime;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
CLASS_REGISTER(JAESDNTimeCompareGAM, "1.0")
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
/**
|
||||||
|
* @file JAESDNTimeCompareGAM.h
|
||||||
|
* @brief Header file for class JAESDNTimeCompareGAM
|
||||||
|
* @date Feb, 2021
|
||||||
|
* @author ksakakida
|
||||||
|
*
|
||||||
|
* @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 JAESDNTimeCompareGAM
|
||||||
|
* 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_JAESDNTimeCompareGAM_H_
|
||||||
|
#define GAMS_JAESDNTimeCompareGAM_H_
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/* Standard header includes */
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/* Project header includes */
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "GAM.h"
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/* Class declaration */
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/**
|
||||||
|
* @brief GAM that sends a message when one-cycle before ESDNTime and current one are same. This GAM is based on JAMessageGAM.
|
||||||
|
* @details Sample
|
||||||
|
*
|
||||||
|
* The configuration syntax is:
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* +SDNTimeCompareGAM = {
|
||||||
|
* Class = JAESDNTimeCompareGAM
|
||||||
|
* InputSignals = {
|
||||||
|
* ESDNTime = {
|
||||||
|
* DataSource = "DDB1"
|
||||||
|
* Type = uint32
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* OutputSignals = {
|
||||||
|
* SDN_Connection = {
|
||||||
|
* DataSource = "DDB1"
|
||||||
|
* Type = uint32
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
class JAESDNTimeCompareGAM : public MARTe::GAM, public MARTe::StatefulI {
|
||||||
|
public:
|
||||||
|
CLASS_REGISTER_DECLARATION()
|
||||||
|
|
||||||
|
JAESDNTimeCompareGAM();
|
||||||
|
|
||||||
|
virtual ~JAESDNTimeCompareGAM();
|
||||||
|
|
||||||
|
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:
|
||||||
|
// ESDNTime holder
|
||||||
|
MARTe::uint32 esdntime_previous;
|
||||||
|
|
||||||
|
// Input signals
|
||||||
|
MARTe::uint32 *esdntime;
|
||||||
|
|
||||||
|
// Output signals
|
||||||
|
MARTe::uint32 *sdn_connection; // 0: disconnected, 1: connected
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/* Inline method definitions */
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif /* GAMS_JAESDNTimeCompareGAM_H_ */
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
#############################################################
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# 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 for the specific language governing
|
||||||
|
# permissions and limitations under the Licence.
|
||||||
|
#
|
||||||
|
# $Id: Makefile.gcc 3 2012-01-15 16:26:07Z aneto $
|
||||||
|
#
|
||||||
|
#############################################################
|
||||||
|
|
||||||
|
include Makefile.inc
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
#############################################################
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# 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 for the specific language governing
|
||||||
|
# permissions and limitations under the Licence.
|
||||||
|
#
|
||||||
|
# $Id: Makefile.inc 3 2012-01-15 16:26:07Z aneto $
|
||||||
|
#
|
||||||
|
#############################################################
|
||||||
|
OBJSX=JAESDNTimeCompareGAM.x
|
||||||
|
|
||||||
|
PACKAGE=GAMs
|
||||||
|
|
||||||
|
ROOT_DIR=../../
|
||||||
|
MAKEDEFAULTDIR=$(MARTe2_DIR)/MakeDefaults
|
||||||
|
include $(MAKEDEFAULTDIR)/MakeStdLibDefs.$(TARGET)
|
||||||
|
|
||||||
|
INCLUDES += -I.
|
||||||
|
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L0Types
|
||||||
|
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L1Portability
|
||||||
|
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L2Objects
|
||||||
|
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L3Streams
|
||||||
|
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L4Messages
|
||||||
|
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L4Configuration
|
||||||
|
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L5GAMs
|
||||||
|
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L1Portability
|
||||||
|
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L3Services
|
||||||
|
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L4Messages
|
||||||
|
INCLUDES += -I$(MARTe2_DIR)/Source/Core/FileSystem/L1Portability
|
||||||
|
INCLUDES += -I$(MARTe2_DIR)/Source/Core/FileSystem/L3Streams
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
all: $(OBJS) $(SUBPROJ) \
|
||||||
|
$(BUILD_DIR)/JAESDNTimeCompareGAM$(LIBEXT) \
|
||||||
|
$(BUILD_DIR)/JAESDNTimeCompareGAM$(DLLEXT)
|
||||||
|
echo $(OBJS)
|
||||||
|
|
||||||
|
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
||||||
@@ -120,7 +120,7 @@ bool JAModeControlGAM::Execute() {
|
|||||||
rfonTime = *inputSignals[9];
|
rfonTime = *inputSignals[9];
|
||||||
resetRemainingTime = false;
|
resetRemainingTime = false;
|
||||||
pulseLengthLimit = CalcPulseLengthLimit(inputSignals);
|
pulseLengthLimit = CalcPulseLengthLimit(inputSignals);
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "Pulse Length was set to Limit:%d", pulseLengthLimit);
|
//REPORT_ERROR(ErrorManagement::Debug, "Pulse Length was set to Limit:%d", pulseLengthLimit);
|
||||||
}
|
}
|
||||||
// Turn on the flag during RFON if the pulse legth over the limit.
|
// Turn on the flag during RFON if the pulse legth over the limit.
|
||||||
if ((*inputSignals[9] - rfonTime <= pulseLengthLimit) && (previousState == 1u)) {
|
if ((*inputSignals[9] - rfonTime <= pulseLengthLimit) && (previousState == 1u)) {
|
||||||
|
|||||||
@@ -1,411 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JARTStateMachineGAM.cpp
|
|
||||||
* @brief Source 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 source file contains the definition of all the methods for
|
|
||||||
* the class JARTStateMachineGAM (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 "JARTStateMachineGAM.h"
|
|
||||||
|
|
||||||
#include "AdvancedErrorManagement.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Static definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
static MARTe::uint64 getCurrentTimeUs() {
|
|
||||||
using namespace MARTe;
|
|
||||||
return static_cast<uint64>(HighResolutionTimer::Counter() * HighResolutionTimer::Period() * 1e6f + 0.5f);
|
|
||||||
}
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
JARTStateMachineGAM::JARTStateMachineGAM() {
|
|
||||||
currentState = WaitTrigger; // Set Entry state.
|
|
||||||
plcOnTime = 0; // Triggered time holder.
|
|
||||||
|
|
||||||
//Output and condition in a given state.
|
|
||||||
conditionTrigger = 1;
|
|
||||||
aps_hvon = 0;
|
|
||||||
aps_swon = 0;
|
|
||||||
bps_hvon = 0;
|
|
||||||
bps_swon = 0;
|
|
||||||
mhvps_hvon = 0;
|
|
||||||
|
|
||||||
// Parameters which get from Input signals.
|
|
||||||
triggerSignal = NULL_PTR(MARTe::uint32 *);
|
|
||||||
currentTime = NULL_PTR(MARTe::uint32 *);
|
|
||||||
turn_off_delay = 2000; //us
|
|
||||||
|
|
||||||
triggerDelay_mhvps_hvon = NULL_PTR(MARTe::uint32 *);
|
|
||||||
triggerDelay_aps_hvon = NULL_PTR(MARTe::uint32 *);
|
|
||||||
triggerDelay_aps_swon = NULL_PTR(MARTe::uint32 *);
|
|
||||||
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 *);
|
|
||||||
modePulseLengthLimit = NULL_PTR(MARTe::uint32 *);
|
|
||||||
short_pulse_mode = NULL_PTR(MARTe::uint32 *);
|
|
||||||
|
|
||||||
modulation = NULL_PTR(MARTe::uint32 *);
|
|
||||||
|
|
||||||
// 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 *);
|
|
||||||
outputBeamONTime = NULL_PTR(MARTe::uint32 *);
|
|
||||||
outputRFONTime = NULL_PTR(MARTe::uint32 *);
|
|
||||||
shotCounter = NULL_PTR(MARTe::uint32 *);
|
|
||||||
|
|
||||||
mhvps_hvon_is_on = false;
|
|
||||||
aps_hvon_is_on = false;
|
|
||||||
aps_swon_is_on = false;
|
|
||||||
bps_hvon_is_on = false;
|
|
||||||
bps_swon_is_on = false;
|
|
||||||
|
|
||||||
apsSwonHighResolutionTime = 0;
|
|
||||||
|
|
||||||
aps_hvon_state=0;
|
|
||||||
aps_swon_state=0;
|
|
||||||
mhvps_hvon_state=0;
|
|
||||||
bps_hvon_state=0;
|
|
||||||
bps_swon_state=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
JARTStateMachineGAM::~JARTStateMachineGAM() {
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JARTStateMachineGAM::Initialise(MARTe::StructuredDataI & data) {
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = GAM::Initialise(data);
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("ConditionTrigger", conditionTrigger);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The Condition1 shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("mhvps_hvon", mhvps_hvon);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The mhvps_hvon shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("aps_hvon", aps_hvon);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The aps_hvon shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("aps_swon", aps_swon);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The aps_swon shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("bps_hvon", bps_hvon);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The bps_hvon shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("bps_swon", bps_swon);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The bps_swon shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JARTStateMachineGAM::PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName) {
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JARTStateMachineGAM::Setup() {
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = (numberOfInputSignals == 12u);
|
|
||||||
if (ok) {
|
|
||||||
ok = (numberOfOutputSignals == 16u);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Seven output signals shall be defined %d",numberOfOutputSignals);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Nine input signals shall be defined");
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
uint32 c;
|
|
||||||
for (c = 0u; c < numberOfInputSignals; c++) {
|
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, c);
|
|
||||||
ok = (inputType == UnsignedInteger32Bit);
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(InputSignals, c, signalName);
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as uint32", signalName.Buffer());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
uint32 c;
|
|
||||||
for (c = 0u; c < numberOfOutputSignals; c++) {
|
|
||||||
TypeDescriptor outputType = GetSignalType(OutputSignals, c);
|
|
||||||
ok = (outputType == UnsignedInteger32Bit || outputType == UnsignedInteger8Bit);
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(InputSignals, c, signalName);
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as uint32", signalName.Buffer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
currentTime = reinterpret_cast<uint32 *>(GetInputSignalMemory(0));
|
|
||||||
triggerSignal = reinterpret_cast<uint32 *>(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));
|
|
||||||
modePulseLengthLimit = reinterpret_cast<uint32 *>(GetInputSignalMemory(9));
|
|
||||||
short_pulse_mode = reinterpret_cast<uint32 *>(GetInputSignalMemory(10));
|
|
||||||
modulation = reinterpret_cast<uint32 *>(GetInputSignalMemory(11));
|
|
||||||
|
|
||||||
|
|
||||||
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));
|
|
||||||
outputBeamONTime = reinterpret_cast<uint32 *>(GetOutputSignalMemory(5));
|
|
||||||
outputRFONTime = reinterpret_cast<uint32 *>(GetOutputSignalMemory(6));
|
|
||||||
shotCounter = reinterpret_cast<uint32 *>(GetOutputSignalMemory(7));
|
|
||||||
|
|
||||||
outputAPSHVON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(8));
|
|
||||||
outputAPSSWON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(9));
|
|
||||||
outputBPSHVON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(10));
|
|
||||||
outputBPSSWON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(11));
|
|
||||||
outputMHVPSON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(12));
|
|
||||||
|
|
||||||
outputSignalNI6259 = reinterpret_cast<uint32 *>(GetOutputSignalMemory(13));
|
|
||||||
outputSignalNI6528P3 = reinterpret_cast<uint8 *>(GetOutputSignalMemory(14));
|
|
||||||
outputSignalNI6528P4 = reinterpret_cast<uint8 *>(GetOutputSignalMemory(15));
|
|
||||||
|
|
||||||
*shotCounter = 0;
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JARTStateMachineGAM::Execute() {
|
|
||||||
using namespace MARTe;
|
|
||||||
|
|
||||||
if (currentState == WaitTrigger) {
|
|
||||||
|
|
||||||
//State Transition condition
|
|
||||||
if ((*triggerSignal == conditionTrigger)) {
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "Start beam-on sequence at %d.", *currentTime);
|
|
||||||
plcOnTime = *currentTime; //Save pulse start time.
|
|
||||||
//*outputBeamON = 0;
|
|
||||||
//State transition.
|
|
||||||
currentState = SwitchingHVPS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (currentState == SwitchingHVPS) {
|
|
||||||
|
|
||||||
//Actions in this state.
|
|
||||||
if (*stopRequest != 0 || *triggerSignal != conditionTrigger) {
|
|
||||||
*outputSignal = 0;
|
|
||||||
currentState = HVTerminate;
|
|
||||||
}
|
|
||||||
if (*currentTime >= (plcOnTime + *triggerDelay_bps_hvon) && bps_hvon_is_on == false){
|
|
||||||
//Do action
|
|
||||||
*outputSignal += bps_hvon;
|
|
||||||
bps_hvon_is_on = true; bps_hvon_state=1;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "bps_hvon was set to outputSignal at %d.", *currentTime);
|
|
||||||
*outputBPSHVON=1;
|
|
||||||
}
|
|
||||||
if (*currentTime >= (plcOnTime + *triggerDelay_aps_hvon) && aps_hvon_is_on == false) {
|
|
||||||
//Do action
|
|
||||||
*outputSignal += aps_hvon;
|
|
||||||
aps_hvon_is_on = true; aps_hvon_state=1;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "aps_hvon was set to outputSignal at %d.", *currentTime);
|
|
||||||
*outputAPSHVON=1;
|
|
||||||
}
|
|
||||||
if (*currentTime >= (plcOnTime + *triggerDelay_bps_swon) && bps_swon_is_on==false){
|
|
||||||
//Do action
|
|
||||||
*outputSignal += bps_swon;
|
|
||||||
bps_swon_is_on = true; bps_swon_state=1;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "bps_swon was set to outputSignal at %d.", *currentTime);
|
|
||||||
*outputBPSSWON=1;
|
|
||||||
}
|
|
||||||
if (*currentTime >= (plcOnTime + *triggerDelay_mhvps_hvon) && mhvps_hvon_is_on==false) {
|
|
||||||
//Do action
|
|
||||||
*outputSignal += mhvps_hvon;
|
|
||||||
mhvps_hvon_is_on = true; mhvps_hvon_state=1;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "mhvps_hvon was set to outputSignal at %d.", *currentTime);
|
|
||||||
*outputMHVPSON=1;
|
|
||||||
}
|
|
||||||
if (bps_swon_is_on && mhvps_hvon_is_on && *currentTime >= (plcOnTime + *triggerDelay_aps_swon)){
|
|
||||||
//Do action
|
|
||||||
*outputSignal += aps_swon;
|
|
||||||
aps_swon_is_on = true; aps_swon_state=1;
|
|
||||||
apsSwonHighResolutionTime = getCurrentTimeUs();
|
|
||||||
apsSwonTime = *currentTime;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "aps_swon was set to outputSignal at %d.", *currentTime);
|
|
||||||
*outputAPSSWON=1;
|
|
||||||
}
|
|
||||||
*outputBeamONTime = *currentTime - plcOnTime; //Save RFON start time.
|
|
||||||
if (bps_hvon_is_on && aps_hvon_is_on){
|
|
||||||
*outputHVArmed = 1;
|
|
||||||
}
|
|
||||||
if (bps_swon_is_on || mhvps_hvon_is_on){
|
|
||||||
*outputHVInjection = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
//State transition condition
|
|
||||||
if (aps_swon_is_on){
|
|
||||||
currentState = RFON;
|
|
||||||
*outputRFON = 0;
|
|
||||||
*outputBeamON = 1;
|
|
||||||
*shotCounter += 1;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "state was changed to RFON");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (currentState == RFON) {
|
|
||||||
|
|
||||||
//Action in this state.
|
|
||||||
if (*stopRequest != 0 || *triggerSignal != conditionTrigger) {
|
|
||||||
//debug
|
|
||||||
//if((*stopRequest != 0)){
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "Stop request was called.!!!");
|
|
||||||
//} else {
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "PLC_ON was reset.!!!");
|
|
||||||
//}
|
|
||||||
*outputSignal -= aps_swon;
|
|
||||||
mhvps_hvon_is_on = false; mhvps_hvon_state=0;
|
|
||||||
aps_hvon_is_on = false; aps_hvon_state=0;
|
|
||||||
aps_swon_is_on = false; aps_swon_state=0;
|
|
||||||
bps_hvon_is_on = false; bps_hvon_state=0;
|
|
||||||
bps_swon_is_on = false; bps_swon_state=0;
|
|
||||||
currentState = HVTerminate;
|
|
||||||
*outputAPSHVON=0;
|
|
||||||
*outputAPSSWON=0;
|
|
||||||
*outputBPSHVON=0;
|
|
||||||
*outputBPSSWON=0;
|
|
||||||
*outputMHVPSON=0;
|
|
||||||
}
|
|
||||||
uint32 updatePeriod = 100; // in microsecnds (get this from Timer)
|
|
||||||
if ((*modePulseLengthLimit == 1u) || (getCurrentTimeUs() + updatePeriod >= (apsSwonHighResolutionTime + *triggerDelay_shotlen))) {
|
|
||||||
|
|
||||||
// Now we do busy wait
|
|
||||||
while (getCurrentTimeUs() < (apsSwonHighResolutionTime + *triggerDelay_shotlen)) {
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "!");
|
|
||||||
}
|
|
||||||
// We stop busy waiting #executionOverhead before expected pulse off time
|
|
||||||
//debug
|
|
||||||
//if((*modePulseLengthLimit == 1u)){
|
|
||||||
// REPORT_ERROR(ErrorManagement::Debug, "Mode limit detected.!!!");
|
|
||||||
//} else {
|
|
||||||
// REPORT_ERROR(ErrorManagement::Debug, "Shot length reached to the setpoint.!!!");
|
|
||||||
//}
|
|
||||||
//debug end.
|
|
||||||
//Do action
|
|
||||||
*outputSignal -= aps_swon; //Turn off only APS_SWON first.
|
|
||||||
mhvps_hvon_is_on = false;
|
|
||||||
aps_hvon_is_on = false;
|
|
||||||
aps_swon_is_on = false; aps_swon_state=0;
|
|
||||||
bps_hvon_is_on = false;
|
|
||||||
bps_swon_is_on = false;
|
|
||||||
*outputAPSHVON=0;
|
|
||||||
*outputAPSSWON=0;
|
|
||||||
*outputBPSHVON=0;
|
|
||||||
*outputBPSSWON=0;
|
|
||||||
*outputMHVPSON=0;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "0 was set to outputSignal at %d.", *currentTime);
|
|
||||||
}
|
|
||||||
*outputRFON = 1;
|
|
||||||
*outputBeamONTime = *currentTime - plcOnTime;
|
|
||||||
*outputRFONTime = *currentTime - apsSwonTime;
|
|
||||||
|
|
||||||
|
|
||||||
//State transition condition
|
|
||||||
if (!aps_swon_is_on && !bps_swon_is_on && !mhvps_hvon_is_on) {
|
|
||||||
currentState = HVTerminate;
|
|
||||||
apsSwoffTime = *currentTime;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "state was changed to HVTerminate");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (currentState == HVTerminate) {
|
|
||||||
//In the HVTerminate state, turn APS_SWON off first, and wait 1ms. Finally turn other PS off.
|
|
||||||
//Action in this state.
|
|
||||||
*outputBeamON = 0;
|
|
||||||
*outputHVArmed = 0;
|
|
||||||
*outputHVInjection = 0;
|
|
||||||
*outputRFON = 0;
|
|
||||||
|
|
||||||
// State transition condition.
|
|
||||||
if (*currentTime - apsSwoffTime >= turn_off_delay){
|
|
||||||
*outputSignal = 0;
|
|
||||||
mhvps_hvon_state=0;
|
|
||||||
aps_hvon_state=0;
|
|
||||||
bps_hvon_state=0;
|
|
||||||
bps_swon_state=0;
|
|
||||||
}
|
|
||||||
if (*triggerSignal == false){
|
|
||||||
//Check PLC_ON is reset
|
|
||||||
currentState = WaitTrigger;
|
|
||||||
*outputSignal = 0;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "PLC_ON was reset. The State was changed to WaitTrigger at %d.", *currentTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(*short_pulse_mode == 1){
|
|
||||||
p3Value = 1*aps_hvon_state + 8*bps_hvon_state +16*bps_swon_state + 64*(*outputBeamON);
|
|
||||||
*outputSignalNI6259 = 1*aps_swon_state;
|
|
||||||
*outputSignalNI6528P3 = ~p3Value;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "short pulse mode with p3: %d.", p3Value);
|
|
||||||
} else {
|
|
||||||
p3Value = 1*aps_hvon_state +2*aps_swon_state + 8*bps_hvon_state +16*bps_swon_state + 64*(*outputBeamON);
|
|
||||||
*outputSignalNI6528P3 = ~p3Value;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "long pulse mode with p3: %d.", p3Value);
|
|
||||||
}
|
|
||||||
if (modulation) {
|
|
||||||
p4Value = 8*mhvps_hvon_state + 32;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
p4Value = 8*mhvps_hvon_state;
|
|
||||||
}
|
|
||||||
//*outputSignalNI6528P4 = ~(*ni6528p4Value | p4Value);
|
|
||||||
*outputSignalNI6528P4 = ~p4Value;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
CLASS_REGISTER(JARTStateMachineGAM, "1.0")
|
|
||||||
@@ -1,262 +0,0 @@
|
|||||||
/**
|
|
||||||
* @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;
|
|
||||||
// Input signal for modulation pv.
|
|
||||||
MARTe::uint32 *modulation;
|
|
||||||
|
|
||||||
// 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_ */
|
|
||||||
@@ -1,402 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file JARTStateMachineGAM.cpp
|
|
||||||
* @brief Source 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 source file contains the definition of all the methods for
|
|
||||||
* the class JARTStateMachineGAM (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 "JARTStateMachineGAM.h"
|
|
||||||
|
|
||||||
#include "AdvancedErrorManagement.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Static definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
static MARTe::uint64 getCurrentTimeUs() {
|
|
||||||
using namespace MARTe;
|
|
||||||
return static_cast<uint64>(HighResolutionTimer::Counter() * HighResolutionTimer::Period() * 1e6f + 0.5f);
|
|
||||||
}
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* Method definitions */
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
JARTStateMachineGAM::JARTStateMachineGAM() {
|
|
||||||
currentState = WaitTrigger; // Set Entry state.
|
|
||||||
plcOnTime = 0; // Triggered time holder.
|
|
||||||
|
|
||||||
//Output and condition in a given state.
|
|
||||||
conditionTrigger = 1;
|
|
||||||
aps_hvon = 0;
|
|
||||||
aps_swon = 0;
|
|
||||||
bps_hvon = 0;
|
|
||||||
bps_swon = 0;
|
|
||||||
mhvps_hvon = 0;
|
|
||||||
|
|
||||||
// Parameters which get from Input signals.
|
|
||||||
triggerSignal = NULL_PTR(MARTe::uint32 *);
|
|
||||||
currentTime = NULL_PTR(MARTe::uint32 *);
|
|
||||||
turn_off_delay = 2000; //us
|
|
||||||
|
|
||||||
triggerDelay_mhvps_hvon = NULL_PTR(MARTe::uint32 *);
|
|
||||||
triggerDelay_aps_hvon = NULL_PTR(MARTe::uint32 *);
|
|
||||||
triggerDelay_aps_swon = NULL_PTR(MARTe::uint32 *);
|
|
||||||
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 *);
|
|
||||||
modePulseLengthLimit = NULL_PTR(MARTe::uint32 *);
|
|
||||||
|
|
||||||
// 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 *);
|
|
||||||
outputBeamONTime = NULL_PTR(MARTe::uint32 *);
|
|
||||||
outputRFONTime = NULL_PTR(MARTe::uint32 *);
|
|
||||||
shotCounter = NULL_PTR(MARTe::uint32 *);
|
|
||||||
|
|
||||||
mhvps_hvon_is_on = false;
|
|
||||||
aps_hvon_is_on = false;
|
|
||||||
aps_swon_is_on = false;
|
|
||||||
bps_hvon_is_on = false;
|
|
||||||
bps_swon_is_on = false;
|
|
||||||
|
|
||||||
apsSwonHighResolutionTime = 0;
|
|
||||||
|
|
||||||
aps_hvon_state=0;
|
|
||||||
aps_swon_state=0;
|
|
||||||
mhvps_hvon_state=0;
|
|
||||||
bps_hvon_state=0;
|
|
||||||
bps_swon_state=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
JARTStateMachineGAM::~JARTStateMachineGAM() {
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JARTStateMachineGAM::Initialise(MARTe::StructuredDataI & data) {
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = GAM::Initialise(data);
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("ConditionTrigger", conditionTrigger);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The Condition1 shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("mhvps_hvon", mhvps_hvon);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The mhvps_hvon shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("aps_hvon", aps_hvon);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The aps_hvon shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("aps_swon", aps_swon);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The aps_swon shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("bps_hvon", bps_hvon);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The bps_hvon shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
ok = data.Read("bps_swon", bps_swon);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "The bps_swon shall be specified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JARTStateMachineGAM::PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName) {
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JARTStateMachineGAM::Setup() {
|
|
||||||
using namespace MARTe;
|
|
||||||
bool ok = (numberOfInputSignals == 11u);
|
|
||||||
if (ok) {
|
|
||||||
ok = (numberOfOutputSignals == 16u);
|
|
||||||
if (!ok) {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Seven output signals shall be defined %d",numberOfOutputSignals);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Nine input signals shall be defined");
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
uint32 c;
|
|
||||||
for (c = 0u; c < numberOfInputSignals; c++) {
|
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, c);
|
|
||||||
ok = (inputType == UnsignedInteger32Bit);
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(InputSignals, c, signalName);
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as uint32", signalName.Buffer());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
uint32 c;
|
|
||||||
for (c = 0u; c < numberOfOutputSignals; c++) {
|
|
||||||
TypeDescriptor outputType = GetSignalType(OutputSignals, c);
|
|
||||||
ok = (outputType == UnsignedInteger32Bit || outputType == UnsignedInteger8Bit);
|
|
||||||
if (!ok) {
|
|
||||||
StreamString signalName;
|
|
||||||
(void) GetSignalName(InputSignals, c, signalName);
|
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as uint32", signalName.Buffer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ok) {
|
|
||||||
currentTime = reinterpret_cast<uint32 *>(GetInputSignalMemory(0));
|
|
||||||
triggerSignal = reinterpret_cast<uint32 *>(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));
|
|
||||||
modePulseLengthLimit = reinterpret_cast<uint32 *>(GetInputSignalMemory(9));
|
|
||||||
short_pulse_mode = reinterpret_cast<uint32 *>(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));
|
|
||||||
outputBeamONTime = reinterpret_cast<uint32 *>(GetOutputSignalMemory(5));
|
|
||||||
outputRFONTime = reinterpret_cast<uint32 *>(GetOutputSignalMemory(6));
|
|
||||||
shotCounter = reinterpret_cast<uint32 *>(GetOutputSignalMemory(7));
|
|
||||||
|
|
||||||
outputAPSHVON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(8));
|
|
||||||
outputAPSSWON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(9));
|
|
||||||
outputBPSHVON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(10));
|
|
||||||
outputBPSSWON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(11));
|
|
||||||
outputMHVPSON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(12));
|
|
||||||
|
|
||||||
outputSignalNI6259 = reinterpret_cast<uint32 *>(GetOutputSignalMemory(13));
|
|
||||||
outputSignalNI6528P3 = reinterpret_cast<uint8 *>(GetOutputSignalMemory(14));
|
|
||||||
outputSignalNI6528P4 = reinterpret_cast<uint8 *>(GetOutputSignalMemory(15));
|
|
||||||
|
|
||||||
*shotCounter = 0;
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JARTStateMachineGAM::Execute() {
|
|
||||||
using namespace MARTe;
|
|
||||||
|
|
||||||
if (currentState == WaitTrigger) {
|
|
||||||
|
|
||||||
//State Transition condition
|
|
||||||
if ((*triggerSignal == conditionTrigger)) {
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "Start beam-on sequence at %d.", *currentTime);
|
|
||||||
plcOnTime = *currentTime; //Save pulse start time.
|
|
||||||
//*outputBeamON = 0;
|
|
||||||
//State transition.
|
|
||||||
currentState = SwitchingHVPS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (currentState == SwitchingHVPS) {
|
|
||||||
|
|
||||||
//Actions in this state.
|
|
||||||
if (*stopRequest != 0 || *triggerSignal != conditionTrigger) {
|
|
||||||
*outputSignal = 0;
|
|
||||||
currentState = HVTerminate;
|
|
||||||
}
|
|
||||||
if (*currentTime >= (plcOnTime + *triggerDelay_bps_hvon) && bps_hvon_is_on == false){
|
|
||||||
//Do action
|
|
||||||
*outputSignal += bps_hvon;
|
|
||||||
bps_hvon_is_on = true; bps_hvon_state=1;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "bps_hvon was set to outputSignal at %d.", *currentTime);
|
|
||||||
*outputBPSHVON=1;
|
|
||||||
}
|
|
||||||
if (*currentTime >= (plcOnTime + *triggerDelay_aps_hvon) && aps_hvon_is_on == false) {
|
|
||||||
//Do action
|
|
||||||
*outputSignal += aps_hvon;
|
|
||||||
aps_hvon_is_on = true; aps_hvon_state=1;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "aps_hvon was set to outputSignal at %d.", *currentTime);
|
|
||||||
*outputAPSHVON=1;
|
|
||||||
}
|
|
||||||
if (*currentTime >= (plcOnTime + *triggerDelay_bps_swon) && bps_swon_is_on==false){
|
|
||||||
//Do action
|
|
||||||
*outputSignal += bps_swon;
|
|
||||||
bps_swon_is_on = true; bps_swon_state=1;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "bps_swon was set to outputSignal at %d.", *currentTime);
|
|
||||||
*outputBPSSWON=1;
|
|
||||||
}
|
|
||||||
if (*currentTime >= (plcOnTime + *triggerDelay_mhvps_hvon) && mhvps_hvon_is_on==false) {
|
|
||||||
//Do action
|
|
||||||
*outputSignal += mhvps_hvon;
|
|
||||||
mhvps_hvon_is_on = true; mhvps_hvon_state=1;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "mhvps_hvon was set to outputSignal at %d.", *currentTime);
|
|
||||||
*outputMHVPSON=1;
|
|
||||||
}
|
|
||||||
if (bps_swon_is_on && mhvps_hvon_is_on && *currentTime >= (plcOnTime + *triggerDelay_aps_swon)){
|
|
||||||
//Do action
|
|
||||||
*outputSignal += aps_swon;
|
|
||||||
aps_swon_is_on = true; aps_swon_state=1;
|
|
||||||
apsSwonHighResolutionTime = getCurrentTimeUs();
|
|
||||||
apsSwonTime = *currentTime;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "aps_swon was set to outputSignal at %d.", *currentTime);
|
|
||||||
*outputAPSSWON=1;
|
|
||||||
}
|
|
||||||
*outputBeamONTime = *currentTime - plcOnTime; //Save RFON start time.
|
|
||||||
if (bps_hvon_is_on && aps_hvon_is_on){
|
|
||||||
*outputHVArmed = 1;
|
|
||||||
}
|
|
||||||
if (bps_swon_is_on || mhvps_hvon_is_on){
|
|
||||||
*outputHVInjection = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
//State transition condition
|
|
||||||
if (aps_swon_is_on){
|
|
||||||
currentState = RFON;
|
|
||||||
*outputRFON = 0;
|
|
||||||
*outputBeamON = 1;
|
|
||||||
*shotCounter += 1;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "state was changed to RFON");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (currentState == RFON) {
|
|
||||||
|
|
||||||
//Action in this state.
|
|
||||||
if (*stopRequest != 0 || *triggerSignal != conditionTrigger) {
|
|
||||||
//debug
|
|
||||||
//if((*stopRequest != 0)){
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "Stop request was called.!!!");
|
|
||||||
//} else {
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "PLC_ON was reset.!!!");
|
|
||||||
//}
|
|
||||||
*outputSignal -= aps_swon;
|
|
||||||
mhvps_hvon_is_on = false; mhvps_hvon_state=0;
|
|
||||||
aps_hvon_is_on = false; aps_hvon_state=0;
|
|
||||||
aps_swon_is_on = false; aps_swon_state=0;
|
|
||||||
bps_hvon_is_on = false; bps_hvon_state=0;
|
|
||||||
bps_swon_is_on = false; bps_swon_state=0;
|
|
||||||
currentState = HVTerminate;
|
|
||||||
*outputAPSHVON=0;
|
|
||||||
*outputAPSSWON=0;
|
|
||||||
*outputBPSHVON=0;
|
|
||||||
*outputBPSSWON=0;
|
|
||||||
*outputMHVPSON=0;
|
|
||||||
}
|
|
||||||
uint32 updatePeriod = 100; // in microsecnds (get this from Timer)
|
|
||||||
if ((*modePulseLengthLimit == 1u) || (getCurrentTimeUs() + updatePeriod >= (apsSwonHighResolutionTime + *triggerDelay_shotlen))) {
|
|
||||||
|
|
||||||
// Now we do busy wait
|
|
||||||
while (getCurrentTimeUs() < (apsSwonHighResolutionTime + *triggerDelay_shotlen)) {
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "!");
|
|
||||||
}
|
|
||||||
// We stop busy waiting #executionOverhead before expected pulse off time
|
|
||||||
//debug
|
|
||||||
//if((*modePulseLengthLimit == 1u)){
|
|
||||||
// REPORT_ERROR(ErrorManagement::Debug, "Mode limit detected.!!!");
|
|
||||||
//} else {
|
|
||||||
// REPORT_ERROR(ErrorManagement::Debug, "Shot length reached to the setpoint.!!!");
|
|
||||||
//}
|
|
||||||
//debug end.
|
|
||||||
//Do action
|
|
||||||
*outputSignal -= aps_swon; //Turn off only APS_SWON first.
|
|
||||||
mhvps_hvon_is_on = false;
|
|
||||||
aps_hvon_is_on = false;
|
|
||||||
aps_swon_is_on = false; aps_swon_state=0;
|
|
||||||
bps_hvon_is_on = false;
|
|
||||||
bps_swon_is_on = false;
|
|
||||||
*outputAPSHVON=0;
|
|
||||||
*outputAPSSWON=0;
|
|
||||||
*outputBPSHVON=0;
|
|
||||||
*outputBPSSWON=0;
|
|
||||||
*outputMHVPSON=0;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "0 was set to outputSignal at %d.", *currentTime);
|
|
||||||
}
|
|
||||||
*outputRFON = 1;
|
|
||||||
*outputBeamONTime = *currentTime - plcOnTime;
|
|
||||||
*outputRFONTime = *currentTime - apsSwonTime;
|
|
||||||
|
|
||||||
|
|
||||||
//State transition condition
|
|
||||||
if (!aps_swon_is_on && !bps_swon_is_on && !mhvps_hvon_is_on) {
|
|
||||||
currentState = HVTerminate;
|
|
||||||
apsSwoffTime = *currentTime;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "state was changed to HVTerminate");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (currentState == HVTerminate) {
|
|
||||||
//In the HVTerminate state, turn APS_SWON off first, and wait 1ms. Finally turn other PS off.
|
|
||||||
//Action in this state.
|
|
||||||
*outputBeamON = 0;
|
|
||||||
*outputHVArmed = 0;
|
|
||||||
*outputHVInjection = 0;
|
|
||||||
*outputRFON = 0;
|
|
||||||
|
|
||||||
// State transition condition.
|
|
||||||
if (*currentTime - apsSwoffTime >= turn_off_delay){
|
|
||||||
*outputSignal = 0;
|
|
||||||
mhvps_hvon_state=0;
|
|
||||||
aps_hvon_state=0;
|
|
||||||
bps_hvon_state=0;
|
|
||||||
bps_swon_state=0;
|
|
||||||
}
|
|
||||||
if (*triggerSignal == false){
|
|
||||||
//Check PLC_ON is reset
|
|
||||||
currentState = WaitTrigger;
|
|
||||||
*outputSignal = 0;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "PLC_ON was reset. The State was changed to WaitTrigger at %d.", *currentTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(*short_pulse_mode == 1){
|
|
||||||
p3Value = 1*aps_hvon_state + 8*bps_hvon_state +16*bps_swon_state + 64*(*outputBeamON);
|
|
||||||
*outputSignalNI6259 = 1*aps_swon_state;
|
|
||||||
*outputSignalNI6528P3 = ~p3Value;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "short pulse mode with p3: %d.", p3Value);
|
|
||||||
} else {
|
|
||||||
p3Value = 1*aps_hvon_state +2*aps_swon_state + 8*bps_hvon_state +16*bps_swon_state + 64*(*outputBeamON);
|
|
||||||
*outputSignalNI6528P3 = ~p3Value;
|
|
||||||
//REPORT_ERROR(ErrorManagement::Debug, "long pulse mode with p3: %d.", p3Value);
|
|
||||||
}
|
|
||||||
p4Value = 8*mhvps_hvon_state;
|
|
||||||
//*outputSignalNI6528P4 = ~(*ni6528p4Value | p4Value);
|
|
||||||
*outputSignalNI6528P4 = ~p4Value;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
CLASS_REGISTER(JARTStateMachineGAM, "1.0")
|
|
||||||
@@ -1,260 +0,0 @@
|
|||||||
/**
|
|
||||||
* @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_ */
|
|
||||||
@@ -36,7 +36,10 @@
|
|||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Static definitions */
|
/* Static definitions */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static MARTe::uint64 getCurrentTimeUs() {
|
||||||
|
using namespace MARTe;
|
||||||
|
return static_cast<uint64>(HighResolutionTimer::Counter() * HighResolutionTimer::Period() * 1e6f + 0.5f);
|
||||||
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Method definitions */
|
/* Method definitions */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
@@ -64,7 +67,9 @@ JASDNRTStateMachineGAM::JASDNRTStateMachineGAM() {
|
|||||||
triggerDelay_shotlen = NULL_PTR(MARTe::uint32 *);
|
triggerDelay_shotlen = NULL_PTR(MARTe::uint32 *);
|
||||||
stopRequest = NULL_PTR(MARTe::uint32 *);
|
stopRequest = NULL_PTR(MARTe::uint32 *);
|
||||||
modePulseLengthLimit = NULL_PTR(MARTe::uint32 *);
|
modePulseLengthLimit = NULL_PTR(MARTe::uint32 *);
|
||||||
sdnCommand = NULL_PTR(MARTe::uint16 *);
|
Command = NULL_PTR(MARTe::uint16 *);
|
||||||
|
Command2 = NULL_PTR(MARTe::uint16 *);
|
||||||
|
sdnStatus = NULL_PTR(MARTe::uint8 *);
|
||||||
|
|
||||||
// write out target.
|
// write out target.
|
||||||
outputSignal = NULL_PTR(MARTe::uint32 *);
|
outputSignal = NULL_PTR(MARTe::uint32 *);
|
||||||
@@ -81,6 +86,17 @@ JASDNRTStateMachineGAM::JASDNRTStateMachineGAM() {
|
|||||||
aps_swon_is_on = false;
|
aps_swon_is_on = false;
|
||||||
bps_hvon_is_on = false;
|
bps_hvon_is_on = false;
|
||||||
bps_swon_is_on = false;
|
bps_swon_is_on = false;
|
||||||
|
|
||||||
|
sdnCommand = 0;
|
||||||
|
groupFix = 0;
|
||||||
|
|
||||||
|
apsSwonHighResolutionTime = 0;
|
||||||
|
|
||||||
|
aps_hvon_state=0;
|
||||||
|
aps_swon_state=0;
|
||||||
|
mhvps_hvon_state=0;
|
||||||
|
bps_hvon_state=0;
|
||||||
|
bps_swon_state=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
JASDNRTStateMachineGAM::~JASDNRTStateMachineGAM() {
|
JASDNRTStateMachineGAM::~JASDNRTStateMachineGAM() {
|
||||||
@@ -135,21 +151,21 @@ bool JASDNRTStateMachineGAM::PrepareNextState(const MARTe::char8 * const current
|
|||||||
|
|
||||||
bool JASDNRTStateMachineGAM::Setup() {
|
bool JASDNRTStateMachineGAM::Setup() {
|
||||||
using namespace MARTe;
|
using namespace MARTe;
|
||||||
bool ok = (numberOfInputSignals == 11u);
|
bool ok = (numberOfInputSignals == 13u);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
ok = (numberOfOutputSignals == 8u);
|
ok = (numberOfOutputSignals == 15u);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Seven output signals shall be defined");
|
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "15 output signals shall be defined");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Nine input signals shall be defined");
|
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "13 input signals shall be defined");
|
||||||
}
|
}
|
||||||
if (ok) {
|
if (ok) {
|
||||||
uint32 c;
|
uint32 c;
|
||||||
for (c = 0u; c < numberOfInputSignals; c++) {
|
for (c = 0u; c < numberOfInputSignals; c++) {
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, c);
|
TypeDescriptor inputType = GetSignalType(InputSignals, c);
|
||||||
ok = (inputType == UnsignedInteger32Bit || inputType == UnsignedInteger16Bit);
|
ok = (inputType == UnsignedInteger32Bit || inputType == UnsignedInteger16Bit || inputType == UnsignedInteger8Bit);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
StreamString signalName;
|
StreamString signalName;
|
||||||
(void) GetSignalName(InputSignals, c, signalName);
|
(void) GetSignalName(InputSignals, c, signalName);
|
||||||
@@ -162,7 +178,7 @@ bool JASDNRTStateMachineGAM::Setup() {
|
|||||||
uint32 c;
|
uint32 c;
|
||||||
for (c = 0u; c < numberOfOutputSignals; c++) {
|
for (c = 0u; c < numberOfOutputSignals; c++) {
|
||||||
TypeDescriptor outputType = GetSignalType(OutputSignals, c);
|
TypeDescriptor outputType = GetSignalType(OutputSignals, c);
|
||||||
ok = (outputType == UnsignedInteger32Bit);
|
ok = (outputType == UnsignedInteger32Bit || outputType == UnsignedInteger8Bit);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
StreamString signalName;
|
StreamString signalName;
|
||||||
(void) GetSignalName(InputSignals, c, signalName);
|
(void) GetSignalName(InputSignals, c, signalName);
|
||||||
@@ -181,7 +197,9 @@ bool JASDNRTStateMachineGAM::Setup() {
|
|||||||
triggerDelay_shotlen = reinterpret_cast<uint32 *>(GetInputSignalMemory(7));
|
triggerDelay_shotlen = reinterpret_cast<uint32 *>(GetInputSignalMemory(7));
|
||||||
stopRequest = reinterpret_cast<uint32 *>(GetInputSignalMemory(8));
|
stopRequest = reinterpret_cast<uint32 *>(GetInputSignalMemory(8));
|
||||||
modePulseLengthLimit = reinterpret_cast<uint32 *>(GetInputSignalMemory(9));
|
modePulseLengthLimit = reinterpret_cast<uint32 *>(GetInputSignalMemory(9));
|
||||||
sdnCommand = reinterpret_cast<uint16 *>(GetInputSignalMemory(10));
|
Command = reinterpret_cast<uint16 *>(GetInputSignalMemory(10));
|
||||||
|
Command2 = reinterpret_cast<uint16 *>(GetInputSignalMemory(11));
|
||||||
|
sdnStatus = reinterpret_cast<uint8 *>(GetInputSignalMemory(12));
|
||||||
|
|
||||||
outputSignal = reinterpret_cast<uint32 *>(GetOutputSignalMemory(0));
|
outputSignal = reinterpret_cast<uint32 *>(GetOutputSignalMemory(0));
|
||||||
outputBeamON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(1));
|
outputBeamON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(1));
|
||||||
@@ -191,6 +209,15 @@ bool JASDNRTStateMachineGAM::Setup() {
|
|||||||
outputBeamONTime = reinterpret_cast<uint32 *>(GetOutputSignalMemory(5));
|
outputBeamONTime = reinterpret_cast<uint32 *>(GetOutputSignalMemory(5));
|
||||||
outputRFONTime = reinterpret_cast<uint32 *>(GetOutputSignalMemory(6));
|
outputRFONTime = reinterpret_cast<uint32 *>(GetOutputSignalMemory(6));
|
||||||
shotCounter = reinterpret_cast<uint32 *>(GetOutputSignalMemory(7));
|
shotCounter = reinterpret_cast<uint32 *>(GetOutputSignalMemory(7));
|
||||||
|
|
||||||
|
outputAPSHVON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(8));
|
||||||
|
outputAPSSWON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(9));
|
||||||
|
outputBPSHVON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(10));
|
||||||
|
outputBPSSWON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(11));
|
||||||
|
outputMHVPSON = reinterpret_cast<uint32 *>(GetOutputSignalMemory(12));
|
||||||
|
|
||||||
|
outputSignalNI6528P3 = reinterpret_cast<uint8 *>(GetOutputSignalMemory(13));
|
||||||
|
outputSignalNI6528P4 = reinterpret_cast<uint8 *>(GetOutputSignalMemory(14));
|
||||||
*shotCounter = 0;
|
*shotCounter = 0;
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
@@ -198,11 +225,19 @@ bool JASDNRTStateMachineGAM::Setup() {
|
|||||||
|
|
||||||
bool JASDNRTStateMachineGAM::Execute() {
|
bool JASDNRTStateMachineGAM::Execute() {
|
||||||
using namespace MARTe;
|
using namespace MARTe;
|
||||||
|
if (!groupFix && (*triggerSignal != false)) {
|
||||||
|
sdnCommand = (1 - *sdnStatus)*(*Command) + (*sdnStatus)*(*Command2);
|
||||||
|
groupFix = 1;
|
||||||
|
sdnStatusFix = *sdnStatus;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sdnCommand = (1 - sdnStatusFix)*(*Command) + sdnStatusFix*(*Command2);
|
||||||
|
}
|
||||||
if (currentState == WaitTrigger) {
|
if (currentState == WaitTrigger) {
|
||||||
|
|
||||||
//State Transition condition
|
//State Transition condition
|
||||||
if ((*triggerSignal == conditionTrigger)) {
|
if ((*triggerSignal == conditionTrigger)) {
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "Start beam-on sequence in SDN mode.");
|
//REPORT_ERROR(ErrorManagement::Debug, "Start beam-on sequence in SDN mode.");
|
||||||
plcOnTime = *currentTime; //Save pulse start time.
|
plcOnTime = *currentTime; //Save pulse start time.
|
||||||
*outputBeamON = 0;
|
*outputBeamON = 0;
|
||||||
//State transition.
|
//State transition.
|
||||||
@@ -213,20 +248,22 @@ bool JASDNRTStateMachineGAM::Execute() {
|
|||||||
|
|
||||||
//Actions in this state.
|
//Actions in this state.
|
||||||
if (*stopRequest != 0 || *triggerSignal != conditionTrigger) {
|
if (*stopRequest != 0 || *triggerSignal != conditionTrigger) {
|
||||||
*outputSignal -= aps_swon;
|
*outputSignal = 0;
|
||||||
currentState = HVTerminate;
|
currentState = HVTerminate;
|
||||||
}
|
}
|
||||||
if (*currentTime >= (plcOnTime + *triggerDelay_bps_hvon) && bps_hvon_is_on == false){
|
if (*currentTime >= (plcOnTime + *triggerDelay_bps_hvon) && bps_hvon_is_on == false){
|
||||||
//Do action
|
//Do action
|
||||||
*outputSignal += bps_hvon;
|
*outputSignal += bps_hvon;
|
||||||
bps_hvon_is_on = true;
|
bps_hvon_is_on = true; bps_hvon_state=1;
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "bps_hvon was set to outputSignal at %d.", *currentTime);
|
//REPORT_ERROR(ErrorManagement::Debug, "bps_hvon was set to outputSignal at %d.", *currentTime);
|
||||||
|
*outputBPSHVON=1;
|
||||||
}
|
}
|
||||||
if (*currentTime >= (plcOnTime + *triggerDelay_aps_hvon) && aps_hvon_is_on == false) {
|
if (*currentTime >= (plcOnTime + *triggerDelay_aps_hvon) && aps_hvon_is_on == false) {
|
||||||
//Do action
|
//Do action
|
||||||
*outputSignal += aps_hvon;
|
*outputSignal += aps_hvon;
|
||||||
aps_hvon_is_on = true;
|
aps_hvon_is_on = true; aps_hvon_state=1;
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "aps_hvon was set to outputSignal.");
|
//REPORT_ERROR(ErrorManagement::Debug, "aps_hvon was set to outputSignal.");
|
||||||
|
*outputAPSHVON=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
*outputBeamONTime = *currentTime - plcOnTime; //Save RFON start time.
|
*outputBeamONTime = *currentTime - plcOnTime; //Save RFON start time.
|
||||||
@@ -242,7 +279,7 @@ bool JASDNRTStateMachineGAM::Execute() {
|
|||||||
*outputBeamONTime = *currentTime - plcOnTime; //Save RFON start time.
|
*outputBeamONTime = *currentTime - plcOnTime; //Save RFON start time.
|
||||||
|
|
||||||
// State change conditions
|
// State change conditions
|
||||||
if (*sdnCommand == 1){
|
if (sdnCommand == 1){
|
||||||
sdnTriggerTime = *currentTime;
|
sdnTriggerTime = *currentTime;
|
||||||
currentState = SwitchingHVPS_SWON;
|
currentState = SwitchingHVPS_SWON;
|
||||||
}
|
}
|
||||||
@@ -262,68 +299,80 @@ bool JASDNRTStateMachineGAM::Execute() {
|
|||||||
if (*currentTime >= (sdnTriggerTime + *triggerDelay_bps_swon) && bps_swon_is_on==false){
|
if (*currentTime >= (sdnTriggerTime + *triggerDelay_bps_swon) && bps_swon_is_on==false){
|
||||||
//Do action
|
//Do action
|
||||||
*outputSignal += bps_swon;
|
*outputSignal += bps_swon;
|
||||||
bps_swon_is_on = true;
|
bps_swon_is_on = true; bps_swon_state=1;
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "bps_swon was set to outputSignal at %d.", *currentTime);
|
//REPORT_ERROR(ErrorManagement::Debug, "bps_swon was set to outputSignal at %d.", *currentTime);
|
||||||
|
*outputBPSSWON=1;
|
||||||
}
|
}
|
||||||
if (*currentTime >= (sdnTriggerTime + *triggerDelay_mhvps_hvon) && mhvps_hvon_is_on==false) {
|
if (*currentTime >= (sdnTriggerTime + *triggerDelay_mhvps_hvon) && mhvps_hvon_is_on==false) {
|
||||||
//Do action
|
//Do action
|
||||||
*outputSignal += mhvps_hvon;
|
*outputSignal += mhvps_hvon;
|
||||||
mhvps_hvon_is_on = true;
|
mhvps_hvon_is_on = true; mhvps_hvon_state=1;
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "mhvps_hvon was set to outputSignal at %d.", *currentTime);
|
//REPORT_ERROR(ErrorManagement::Debug, "mhvps_hvon was set to outputSignal at %d.", *currentTime);
|
||||||
|
*outputMHVPSON=1;
|
||||||
}
|
}
|
||||||
if (bps_swon_is_on && mhvps_hvon_is_on && *currentTime >= (sdnTriggerTime + *triggerDelay_aps_swon)){
|
if (bps_swon_is_on && mhvps_hvon_is_on && *currentTime >= (sdnTriggerTime + *triggerDelay_aps_swon)){
|
||||||
//Do action
|
//Do action
|
||||||
*outputSignal += aps_swon;
|
*outputSignal += aps_swon;
|
||||||
aps_swon_is_on = true;
|
aps_swon_is_on = true; aps_swon_state=1;
|
||||||
|
apsSwonHighResolutionTime = getCurrentTimeUs();
|
||||||
apsSwonTime = *currentTime;
|
apsSwonTime = *currentTime;
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "aps_swon was set to outputSignal at %d.", *currentTime);
|
//REPORT_ERROR(ErrorManagement::Debug, "aps_swon was set to outputSignal at %d.", *currentTime);
|
||||||
|
*outputAPSSWON=1;
|
||||||
}
|
}
|
||||||
*outputBeamONTime = *currentTime - plcOnTime; //Save RFON start time.
|
*outputBeamONTime = *currentTime - plcOnTime; //Save RFON start time.
|
||||||
|
|
||||||
if (bps_swon_is_on || mhvps_hvon_is_on){
|
if (bps_swon_is_on || mhvps_hvon_is_on){
|
||||||
*outputHVInjection = 0;
|
*outputHVInjection = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//State transition condition
|
//State transition condition
|
||||||
if (aps_swon_is_on){
|
if (aps_swon_is_on){
|
||||||
currentState = RFON;
|
currentState = RFON;
|
||||||
*outputRFON = 0;
|
*outputRFON = 0;
|
||||||
|
*outputBeamON = 1;
|
||||||
*shotCounter += 1;
|
*shotCounter += 1;
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "state was changed to RFON");
|
//REPORT_ERROR(ErrorManagement::Debug, "state was changed to RFON");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (currentState == RFON) {
|
else if (currentState == RFON) {
|
||||||
|
|
||||||
//SDN command processing.
|
//SDN command processing.
|
||||||
if (*sdnCommand == 4 && aps_swon_is_on) {
|
if (sdnCommand == 4 && aps_swon_is_on) {
|
||||||
*outputSignal -= aps_swon;
|
*outputSignal -= aps_swon;
|
||||||
aps_swon_is_on = false;
|
aps_swon_is_on = false; aps_swon_state=0;
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "sdn command was 4");
|
//REPORT_ERROR(ErrorManagement::Debug, "sdn command was 4");
|
||||||
|
*outputAPSSWON=0;
|
||||||
}
|
}
|
||||||
if (*sdnCommand == 3 && !aps_swon_is_on) {
|
if (sdnCommand == 3 && !aps_swon_is_on) {
|
||||||
*outputSignal += aps_swon;
|
*outputSignal += aps_swon;
|
||||||
aps_swon_is_on = true;
|
aps_swon_is_on = true; aps_swon_state=0;
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "sdn command was 3");
|
//REPORT_ERROR(ErrorManagement::Debug, "sdn command was 3");
|
||||||
|
*outputAPSSWON=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Action in this state.
|
//Action in this state.
|
||||||
if ((*sdnCommand == 2) || (*modePulseLengthLimit == 1u) || (*currentTime >= (sdnTriggerTime + *triggerDelay_aps_swon + *triggerDelay_shotlen))) {
|
if ((sdnCommand == 2) || (*modePulseLengthLimit == 1u) || (*currentTime >= (sdnTriggerTime + *triggerDelay_aps_swon + *triggerDelay_shotlen))) {
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "shotlen: %d", *triggerDelay_shotlen);
|
//REPORT_ERROR(ErrorManagement::Debug, "shotlen: %d", *triggerDelay_shotlen);
|
||||||
if (*sdnCommand == 2) {
|
if (sdnCommand == 2) {
|
||||||
REPORT_ERROR(ErrorManagement::Information, "sdn command was 2");
|
//REPORT_ERROR(ErrorManagement::Information, "sdn command was 2");
|
||||||
} else if (*currentTime >= (sdnTriggerTime + *triggerDelay_aps_swon + *triggerDelay_shotlen)){
|
} else if (*currentTime >= (sdnTriggerTime + *triggerDelay_aps_swon + *triggerDelay_shotlen)){
|
||||||
REPORT_ERROR(ErrorManagement::Information, "pulse length reached setpoint.");
|
//REPORT_ERROR(ErrorManagement::Information, "pulse length reached setpoint.");
|
||||||
}
|
}
|
||||||
//Do action
|
//Do action
|
||||||
*outputSignal -= aps_swon; //Turn off only aps_swon
|
*outputSignal -= aps_swon; //Turn off only aps_swon
|
||||||
mhvps_hvon_is_on = false;
|
mhvps_hvon_is_on = false;
|
||||||
aps_hvon_is_on = false;
|
aps_hvon_is_on = false;
|
||||||
aps_swon_is_on = false;
|
aps_swon_is_on = false; aps_swon_state=0;
|
||||||
bps_hvon_is_on = false;
|
bps_hvon_is_on = false;
|
||||||
bps_swon_is_on = false;
|
bps_swon_is_on = false;
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "0 was set to outputSignal at %d.", *currentTime);
|
*outputAPSHVON=0;
|
||||||
|
*outputAPSSWON=0;
|
||||||
|
*outputBPSHVON=0;
|
||||||
|
*outputBPSSWON=0;
|
||||||
|
*outputMHVPSON=0;
|
||||||
|
//REPORT_ERROR(ErrorManagement::Debug, "0 was set to outputSignal at %d.", *currentTime);
|
||||||
}
|
}
|
||||||
*outputRFON = 0;
|
*outputRFON = 1;
|
||||||
*outputBeamONTime = *currentTime - plcOnTime;
|
*outputBeamONTime = *currentTime - plcOnTime;
|
||||||
*outputRFONTime = *currentTime - apsSwonTime;
|
*outputRFONTime = *currentTime - apsSwonTime;
|
||||||
|
|
||||||
@@ -332,29 +381,37 @@ bool JASDNRTStateMachineGAM::Execute() {
|
|||||||
if (!aps_swon_is_on && !bps_swon_is_on && !mhvps_hvon_is_on) {
|
if (!aps_swon_is_on && !bps_swon_is_on && !mhvps_hvon_is_on) {
|
||||||
currentState = HVTerminate;
|
currentState = HVTerminate;
|
||||||
apsSwoffTime = *currentTime;
|
apsSwoffTime = *currentTime;
|
||||||
REPORT_ERROR(ErrorManagement::Information, "state was changed to HVTerminate");
|
//REPORT_ERROR(ErrorManagement::Information, "state was changed to HVTerminate");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (currentState == HVTerminate) {
|
else if (currentState == HVTerminate) {
|
||||||
|
|
||||||
//Action in this state.
|
//Action in this state.
|
||||||
*outputBeamON = 1;
|
*outputBeamON = 0;
|
||||||
*outputHVArmed = 1;
|
*outputHVArmed = 0;
|
||||||
*outputHVInjection = 1;
|
*outputHVInjection = 0;
|
||||||
*outputRFON = 1;
|
*outputRFON = 0;
|
||||||
|
|
||||||
// State transition condition.
|
// State transition condition.
|
||||||
if (*currentTime - apsSwoffTime >= turn_off_delay){
|
if (*currentTime - apsSwoffTime >= turn_off_delay){
|
||||||
*outputSignal = 0;
|
*outputSignal = 0;
|
||||||
|
mhvps_hvon_state=0;
|
||||||
|
aps_hvon_state=0;
|
||||||
|
bps_hvon_state=0;
|
||||||
|
bps_swon_state=0;
|
||||||
}
|
}
|
||||||
if (*triggerSignal == false){
|
if (*triggerSignal == false){
|
||||||
//Check PLC_ON is reset
|
//Check PLC_ON is reset
|
||||||
currentState = WaitTrigger;
|
currentState = WaitTrigger;
|
||||||
*outputSignal = 0;
|
*outputSignal = 0;
|
||||||
REPORT_ERROR(ErrorManagement::Debug, "state was changed to WaitTrigger");
|
groupFix = 0;
|
||||||
|
//REPORT_ERROR(ErrorManagement::Debug, "state was changed to WaitTrigger");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
p3Value = 1*aps_hvon_state +2*aps_swon_state + 8*bps_hvon_state +16*bps_swon_state + 64*(*outputBeamON);
|
||||||
|
*outputSignalNI6528P3 = ~p3Value;
|
||||||
|
p4Value = 8*mhvps_hvon_state;
|
||||||
|
*outputSignalNI6528P4 = ~p4Value;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -92,10 +92,18 @@
|
|||||||
* DataSource = DDB1
|
* DataSource = DDB1
|
||||||
* Type = uint32
|
* Type = uint32
|
||||||
* }
|
* }
|
||||||
* Command = {
|
* Command = {//from packet x
|
||||||
* DataSource = RealTimeThreadAsyncBridge
|
* DataSource = RealTimeThreadAsyncBridge
|
||||||
* Type = uint16
|
* Type = uint16
|
||||||
* }
|
* }
|
||||||
|
* Command2 = {//from packet y
|
||||||
|
* DataSource = RealTimeThreadAsyncBridge
|
||||||
|
* Type = uint16
|
||||||
|
* }
|
||||||
|
* ESDNStatus = {// 0 or 1. If 0, packet x is used, elif 1, packet y is used.
|
||||||
|
* DataSource = RealTimeThreadAsyncBridge
|
||||||
|
* Type = uint8
|
||||||
|
* }
|
||||||
* }
|
* }
|
||||||
* OutputSignals = {
|
* OutputSignals = {
|
||||||
* Value = {
|
* Value = {
|
||||||
@@ -199,8 +207,12 @@ private:
|
|||||||
MARTe::uint32 *stopRequest;
|
MARTe::uint32 *stopRequest;
|
||||||
// Input signal for pulse length limit by mode.
|
// Input signal for pulse length limit by mode.
|
||||||
MARTe::uint32 *modePulseLengthLimit;
|
MARTe::uint32 *modePulseLengthLimit;
|
||||||
// Input signal for SDN commands.
|
// Input signal for SDN commands from packet x.
|
||||||
MARTe::uint16 *sdnCommand;
|
MARTe::uint16 *Command;
|
||||||
|
// Input signal for SDN commands from packet y.
|
||||||
|
MARTe::uint16 *Command2;
|
||||||
|
// Input signal for SDN status.
|
||||||
|
MARTe::uint8 *sdnStatus;
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////
|
||||||
// Output signal to which the output value will be written.
|
// Output signal to which the output value will be written.
|
||||||
@@ -217,6 +229,17 @@ private:
|
|||||||
MARTe::uint32 *outputRFONTime;
|
MARTe::uint32 *outputRFONTime;
|
||||||
// shot counter (coutup every RFON time.)
|
// shot counter (coutup every RFON time.)
|
||||||
MARTe::uint32 *shotCounter;
|
MARTe::uint32 *shotCounter;
|
||||||
|
|
||||||
|
// Added for HVPS state (20210602)
|
||||||
|
MARTe::uint32 *outputAPSHVON;
|
||||||
|
MARTe::uint32 *outputAPSSWON;
|
||||||
|
MARTe::uint32 *outputBPSHVON;
|
||||||
|
MARTe::uint32 *outputBPSSWON;
|
||||||
|
MARTe::uint32 *outputMHVPSON;
|
||||||
|
|
||||||
|
// Output signals for NI devices
|
||||||
|
MARTe::uint8 *outputSignalNI6528P3;
|
||||||
|
MARTe::uint8 *outputSignalNI6528P4;
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//Internal Parameters
|
//Internal Parameters
|
||||||
@@ -226,6 +249,7 @@ private:
|
|||||||
//APS_SWON time holder
|
//APS_SWON time holder
|
||||||
MARTe::uint32 apsSwonTime;
|
MARTe::uint32 apsSwonTime;
|
||||||
MARTe::uint32 apsSwoffTime;
|
MARTe::uint32 apsSwoffTime;
|
||||||
|
MARTe::uint64 apsSwonHighResolutionTime;
|
||||||
|
|
||||||
//PS turn off delay
|
//PS turn off delay
|
||||||
MARTe::uint32 turn_off_delay;
|
MARTe::uint32 turn_off_delay;
|
||||||
@@ -239,6 +263,22 @@ private:
|
|||||||
bool bps_hvon_is_on;
|
bool bps_hvon_is_on;
|
||||||
bool bps_swon_is_on;
|
bool bps_swon_is_on;
|
||||||
|
|
||||||
|
//command x or y
|
||||||
|
MARTe::uint16 sdnCommand;
|
||||||
|
//packet group must not be changed during real time operation
|
||||||
|
MARTe::uint16 groupFix; //0: packet group is not fixed yet, 1: fixed.
|
||||||
|
//when packet group is fixed, sdnStatus is copied to this variable.
|
||||||
|
MARTe::uint8 sdnStatusFix;
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,8 @@
|
|||||||
SPB = JAMessageGAM.x JAPreProgrammedGAM.x JAModeControlGAM.x \
|
SPB = JAMessageGAM.x JAPreProgrammedGAM.x JAModeControlGAM.x \
|
||||||
JAWFRecordGAM.x JATriangleWaveGAM.x JARampupGAM.x \
|
JAWFRecordGAM.x JATriangleWaveGAM.x JARampupGAM.x \
|
||||||
JARTStateMachineGAM.x JASDNRTStateMachineGAM.x JATerminalInterfaceGAM.x \
|
JARTStateMachineGAM.x JASDNRTStateMachineGAM.x JATerminalInterfaceGAM.x \
|
||||||
JABitSumGAM.x JAConditionalSignalUpdateGAM.x JASourceChoiseGAM.x JABitReverseGAM.x
|
JABitSumGAM.x JAConditionalSignalUpdateGAM.x JASourceChoiseGAM.x JABitReverseGAM.x \
|
||||||
|
JAESDNTimeCompareGAM.x
|
||||||
|
|
||||||
MAKEDEFAULTDIR=$(MARTe2_DIR)/MakeDefaults
|
MAKEDEFAULTDIR=$(MARTe2_DIR)/MakeDefaults
|
||||||
|
|
||||||
|
|||||||
1
EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Startup/Main.sh
Normal file → Executable file
1
EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Startup/Main.sh
Normal file → Executable file
@@ -123,6 +123,7 @@ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/JATerminalInterfaceGAM/
|
|||||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/JABitSumGAM/
|
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/JABitSumGAM/
|
||||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/JASourceChoiseGAM/
|
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/JASourceChoiseGAM/
|
||||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/JABitReverseGAM/
|
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/JABitReverseGAM/
|
||||||
|
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/JAESDNTimeCompareGAM/
|
||||||
### Add EPICS lib path
|
### Add EPICS lib path
|
||||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$EPICS_BASE/lib/$EPICS_HOST_ARCH
|
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$EPICS_BASE/lib/$EPICS_HOST_ARCH
|
||||||
#LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/FilterDownsamplingGAM/
|
#LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Build/x86-linux/GAMs/FilterDownsamplingGAM/
|
||||||
|
|||||||
0
EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Startup/runECPCSub.sh
Normal file → Executable file
0
EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Startup/runECPCSub.sh
Normal file → Executable file
0
EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Startup/runEPICSTEST.sh
Normal file → Executable file
0
EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Startup/runEPICSTEST.sh
Normal file → Executable file
0
EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Startup/runHWTEST.sh
Normal file → Executable file
0
EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Startup/runHWTEST.sh
Normal file → Executable file
0
EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Startup/runMain.sh
Normal file → Executable file
0
EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Startup/runMain.sh
Normal file → Executable file
0
EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Startup/runMainB.sh
Normal file → Executable file
0
EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Startup/runMainB.sh
Normal file → Executable file
0
EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Startup/runNI6528TEST.sh
Normal file → Executable file
0
EC-GN-JA-PCF-IN/src/main/resources/qst-gyrotron-fast-controller/Startup/runNI6528TEST.sh
Normal file → Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
taskset -c 8-11 ./Main.sh -f ../Configurations/JAGyro_Test.cfg -l RealTimeLoader -m StateMachine:Start
|
||||||
|
|
||||||
@@ -60,6 +60,7 @@ while(1):
|
|||||||
8: SYNC mode operation
|
8: SYNC mode operation
|
||||||
9: GYA / Async mode --- operator set delay and pulse length on HMI
|
9: GYA / Async mode --- operator set delay and pulse length on HMI
|
||||||
10: GYB / Async mode --- operator set delay and pulse length on HMI
|
10: GYB / Async mode --- operator set delay and pulse length on HMI
|
||||||
|
11: GYA / Async mode several times --- operator set delay and pulse length on HMI
|
||||||
'''
|
'''
|
||||||
inpval = raw_input()
|
inpval = raw_input()
|
||||||
|
|
||||||
@@ -83,8 +84,10 @@ while(1):
|
|||||||
test_async.test_async_GYA_manual()
|
test_async.test_async_GYA_manual()
|
||||||
elif inpval == "10":
|
elif inpval == "10":
|
||||||
test_async.test_async_GYB_manual()
|
test_async.test_async_GYB_manual()
|
||||||
|
elif inpval == "11":
|
||||||
|
test_async.test_async_GYA_times()
|
||||||
else:
|
else:
|
||||||
print 'invalid value. Enter 1 to 10!'
|
print 'invalid value. Enter 1 to 11!'
|
||||||
continue
|
continue
|
||||||
|
|
||||||
print '..... End of test code .....'
|
print '..... End of test code .....'
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ def test_async_shortpulse():
|
|||||||
res = subprocess.call('caput EC-GN-P01-PMF:STAT-DT-HVON 300', shell=True)
|
res = subprocess.call('caput EC-GN-P01-PMF:STAT-DT-HVON 300', shell=True)
|
||||||
res = subprocess.call('caput EC-GN-P01-PB1F:STAT-DT-SWON 400', shell=True)
|
res = subprocess.call('caput EC-GN-P01-PB1F:STAT-DT-SWON 400', shell=True)
|
||||||
res = subprocess.call('caput EC-GN-P01-PA1F:STAT-DT-SWON 800', shell=True) #Should be grater than 1ms.
|
res = subprocess.call('caput EC-GN-P01-PA1F:STAT-DT-SWON 800', shell=True) #Should be grater than 1ms.
|
||||||
res = subprocess.call('caput EC-GN-P01-GAF:STAT-DT-SHOTLEN 500', shell=True)
|
res = subprocess.call('caput EC-GN-P01-GAF:STAT-DT-SHOTLEN 100', shell=True)
|
||||||
print '2.Write PERMIT'
|
print '2.Write PERMIT'
|
||||||
res = subprocess.call('caput EC-GN-P01-GPS:PLC4110-CON-GY1PRM.SVAL 1', shell=True)
|
res = subprocess.call('caput EC-GN-P01-GPS:PLC4110-CON-GY1PRM.SVAL 1', shell=True)
|
||||||
res = subprocess.call('caput EC-GN-P01-GPS:PLC4110-CON-GY1PRM 1', shell=True)
|
res = subprocess.call('caput EC-GN-P01-GPS:PLC4110-CON-GY1PRM 1', shell=True)
|
||||||
@@ -412,3 +412,43 @@ def test_async_GYB_manual():
|
|||||||
res = subprocess.call('caput EC-GN-P01-GPS:PLC4110-CON-GY2PRM.SVAL 0', shell=True)
|
res = subprocess.call('caput EC-GN-P01-GPS:PLC4110-CON-GY2PRM.SVAL 0', shell=True)
|
||||||
res = subprocess.call('caput EC-GN-P01-GPS:PLC4110-CON-GY2PRM 0', shell=True)
|
res = subprocess.call('caput EC-GN-P01-GPS:PLC4110-CON-GY2PRM 0', shell=True)
|
||||||
print "end of async, non-prepro mode test!"
|
print "end of async, non-prepro mode test!"
|
||||||
|
|
||||||
|
def test_async_GYA_times():
|
||||||
|
""""
|
||||||
|
Test GYA operation with Async mode several times.
|
||||||
|
"""
|
||||||
|
print '1.. Set delays and pulse length on HMI\n and set sleep time here:'
|
||||||
|
inp_val = raw_input()
|
||||||
|
try:
|
||||||
|
sleep_time = float(inp_val)
|
||||||
|
except:
|
||||||
|
return
|
||||||
|
print 'How many times is the pulse generated?'
|
||||||
|
times = raw_input()
|
||||||
|
for i in range(1, int(times) + 1):
|
||||||
|
# turn on permit
|
||||||
|
print '2.. set PulseLengthLimitMode to 1 flag'
|
||||||
|
res = subprocess.call('caput EC-GN-P01-GPS:PLC4110-YTS-MD1.SVAL 1', shell = True)
|
||||||
|
res = subprocess.call('caput EC-GN-P01-GPS:PLC4110-YTS-MD1 1', shell = True)
|
||||||
|
res = subprocess.call('caput EC-GN-P01-GPF:STAT-MD1-LIM 1000000', shell = True)
|
||||||
|
time.sleep(1)
|
||||||
|
print '3. Write PERMIT'
|
||||||
|
res = subprocess.call('caput EC-GN-P01-GPS:PLC4110-CON-GY1PRM.SVAL 1', shell=True)
|
||||||
|
res = subprocess.call('caput EC-GN-P01-GPS:PLC4110-CON-GY1PRM 1', shell=True)
|
||||||
|
time.sleep(1)
|
||||||
|
# trun on HVON trigger
|
||||||
|
print '4. Write HVON'
|
||||||
|
res = subprocess.call('caput EC-GN-P01-GPS:PLC4110-YTS-ST3R.SVAL 1', shell=True)
|
||||||
|
res = subprocess.call('caput EC-GN-P01-GPS:PLC4110-YTS-ST3R 1', shell=True) #HVON signal from PLC
|
||||||
|
time.sleep(sleep_time)
|
||||||
|
print '5. Confirm generated pulse'
|
||||||
|
print '6. Reset HVON'
|
||||||
|
res = subprocess.call('caput EC-GN-P01-GPS:PLC4110-YTS-ST3R.SVAL 0', shell=True)
|
||||||
|
res = subprocess.call('caput EC-GN-P01-GPS:PLC4110-YTS-ST3R 0', shell=True)
|
||||||
|
time.sleep(1)
|
||||||
|
print '7. Reset PERMIT'
|
||||||
|
res = subprocess.call('caput EC-GN-P01-GPS:PLC4110-CON-GY1PRM.SVAL 0', shell=True)
|
||||||
|
res = subprocess.call('caput EC-GN-P01-GPS:PLC4110-CON-GY1PRM 0', shell=True)
|
||||||
|
print '%d times beam-on complete' % i
|
||||||
|
res = subprocess.call('caget EC-GN-P01-GAF:STAT-BEAMON-TIME >> BEAMON-TIME.log', shell=True)
|
||||||
|
print "end of async, non-prepro mode test!"
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Submodule ec-gn-ja-pcf-sdd-in updated: 7eb4277b09...a2882e7a5c
11
generate.sh
11
generate.sh
@@ -88,12 +88,15 @@ ok=$(echo ${mask} | cut -c ${cid})
|
|||||||
|
|
||||||
if [[ ${ok} != "0" ]]; then
|
if [[ ${ok} != "0" ]]; then
|
||||||
|
|
||||||
cat patches/EC-GN-PCF0CORE_sddPreDriverConf.patch ${project_name}/src/main/epics/iocBoot/iocEC-GN-PCF0CORE/sddPreDriverConf.cmd > sddPreDriverConf_patched.cmd
|
cat patches/EC-GN-P01-PCF0CORE_sddPreDriverConf.patch ${project_name}/src/main/epics/iocBoot/iocEC-GN-P01-PCF0CORE/sddPreDriverConf.cmd > sddPreDriverConf_patched.cmd
|
||||||
mv -f sddPreDriverConf_patched.cmd ${project_name}/src/main/epics/iocBoot/iocEC-GN-PCF0CORE/sddPreDriverConf.cmd
|
mv -f sddPreDriverConf_patched.cmd ${project_name}/src/main/epics/iocBoot/iocEC-GN-P01-PCF0CORE/sddPreDriverConf.cmd
|
||||||
|
|
||||||
cat patches/EC-GN-PCF0CORE_userPreDriverConf.patch ${project_name}/src/main/epics/iocBoot/iocEC-GN-PCF0CORE/userPreDriverConf.cmd > userPreDriverConf_patched.cmd
|
cat patches/EC-GN-P01-PCF0CORE_userPreDriverConf.patch ${project_name}/src/main/epics/iocBoot/iocEC-GN-P01-PCF0CORE/userPreDriverConf.cmd > userPreDriverConf_patched.cmd
|
||||||
mv -f userPreDriverConf_patched.cmd ${project_name}/src/main/epics/iocBoot/iocEC-GN-PCF0CORE/userPreDriverConf.cmd
|
mv -f userPreDriverConf_patched.cmd ${project_name}/src/main/epics/iocBoot/iocEC-GN-P01-PCF0CORE/userPreDriverConf.cmd
|
||||||
|
|
||||||
|
sed -i 's+# Add all the support libraries needed by this IOC+# Add all the support libraries needed by this IOC\n-include $(EPICS_ROOT)/mk/asyn.mk\n-include $(EPICS_ROOT)/mk/picmg.mk\n-include $(EPICS_ROOT)/mk/stream.mk\n-include $(EPICS_ROOT)/mk/nisync-epics.mk\n-include $(EPICS_ROOT)/mk/nisync-generalTime.mk\n-include $(EPICS_ROOT)/mk/nixseries-epics.mk\n-include $(EPICS_ROOT)/mk/pxi6259-epics.mk\n-include $(EPICS_ROOT)/mk/pxi6528-epics.mk+g' EC-GN-JA-PCF/src/main/epics/EC-GN-P01App/src/Makefile
|
||||||
|
|
||||||
|
sed -i 's+epicsEnvSet("\(.*\)")+epicsEnvSet("\1:${TOP}/iocBoot/iocEC-GN-P01-PCF0CORE")+g' EC-GN-JA-PCF/src/main/epics/iocBoot/iocEC-GN-P01-PCF0CORE/envSystem
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cid=$((cid+1))
|
cid=$((cid+1))
|
||||||
|
|||||||
@@ -60,4 +60,5 @@ pxi6528_init("ni6528_0", "/dev/pxi6528.0")
|
|||||||
# pxi6528_reset("ni6528_0")
|
# pxi6528_reset("ni6528_0")
|
||||||
pxi6528_init("ni6528_1", "/dev/pxi6528.1")
|
pxi6528_init("ni6528_1", "/dev/pxi6528.1")
|
||||||
# asynSetTraceMask("ni6528_1",0,255)
|
# asynSetTraceMask("ni6528_1",0,255)
|
||||||
# pxi6528_reset("ni6528_1")
|
# pxi6528_reset("ni6528_1")
|
||||||
|
|
||||||
@@ -61,4 +61,5 @@ drvAsynIPPortConfigure("FHPS2", "192.168.5.7:6000")
|
|||||||
|
|
||||||
drvAsynIPPortConfigure("MC2", "192.168.5.8:6000")
|
drvAsynIPPortConfigure("MC2", "192.168.5.8:6000")
|
||||||
|
|
||||||
drvAsynIPPortConfigure("GC2", "192.168.5.9:6000")
|
drvAsynIPPortConfigure("GC2", "192.168.5.9:6000")
|
||||||
|
|
||||||
Reference in New Issue
Block a user