Fixed types and feedback
This commit is contained in:
@@ -41,11 +41,10 @@
|
|||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
JARampupGAM::JARampupGAM() : GAM() {
|
JARampupGAM::JARampupGAM() : GAM() {
|
||||||
current_setpoint = NULL_PTR(MARTe::float32 *);
|
|
||||||
target_value = NULL_PTR(MARTe::float32 *);
|
target_value = NULL_PTR(MARTe::float32 *);
|
||||||
rampup_time = NULL_PTR(MARTe::float32 *);
|
rampup_time = NULL_PTR(MARTe::float32 *);
|
||||||
start = NULL_PTR(MARTe::uint32 *);
|
start = NULL_PTR(MARTe::uint32 *);
|
||||||
standby = NULL_PTR(MARTe::uint32 *);
|
standby = NULL_PTR(MARTe::uint8 *);
|
||||||
isAuto = NULL_PTR(MARTe::uint32 *);
|
isAuto = NULL_PTR(MARTe::uint32 *);
|
||||||
FHPS_PrePro = NULL_PTR(MARTe::float32 *);
|
FHPS_PrePro = NULL_PTR(MARTe::float32 *);
|
||||||
|
|
||||||
@@ -59,8 +58,7 @@ JARampupGAM::JARampupGAM() : GAM() {
|
|||||||
inWaitStandby = false;
|
inWaitStandby = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
JARampupGAM::~JARampupGAM() {
|
JARampupGAM::~JARampupGAM() {}
|
||||||
}
|
|
||||||
|
|
||||||
bool JARampupGAM::Initialise(MARTe::StructuredDataI &data) {
|
bool JARampupGAM::Initialise(MARTe::StructuredDataI &data) {
|
||||||
using namespace MARTe;
|
using namespace MARTe;
|
||||||
@@ -69,15 +67,16 @@ bool JARampupGAM::Initialise(MARTe::StructuredDataI & data) {
|
|||||||
|
|
||||||
bool JARampupGAM::Setup() {
|
bool JARampupGAM::Setup() {
|
||||||
using namespace MARTe;
|
using namespace MARTe;
|
||||||
bool ok = (numberOfInputSignals == 7u);
|
bool ok = (numberOfInputSignals == 6u);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
ok = (numberOfOutputSignals == 2u);
|
ok = (numberOfOutputSignals == 2u);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Two output signals shall be defined.");
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
|
"Two output signals shall be defined.");
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Six input signals shall be defined.");
|
"Six input signals shall be defined.");
|
||||||
}
|
}
|
||||||
uint32 currentspvIndex;
|
uint32 currentspvIndex;
|
||||||
uint32 targetvIndex;
|
uint32 targetvIndex;
|
||||||
@@ -91,13 +90,14 @@ bool JARampupGAM::Setup() {
|
|||||||
StreamString signalName = "Currspv";
|
StreamString signalName = "Currspv";
|
||||||
ok = GetSignalIndex(InputSignals, currentspvIndex, signalName.Buffer());
|
ok = GetSignalIndex(InputSignals, currentspvIndex, signalName.Buffer());
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Currspv input signal shall be defined.");
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
}
|
"Currspv input signal shall be defined.");
|
||||||
else {
|
} else {
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, currentspvIndex);
|
TypeDescriptor inputType = GetSignalType(InputSignals, currentspvIndex);
|
||||||
ok = (inputType == Float32Bit);
|
ok = (inputType == Float32Bit);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Signal Currspv shall be defined as float32.");
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
|
"Signal Currspv shall be defined as float32.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -105,13 +105,14 @@ bool JARampupGAM::Setup() {
|
|||||||
StreamString signalName = "Targetv";
|
StreamString signalName = "Targetv";
|
||||||
ok = GetSignalIndex(InputSignals, targetvIndex, signalName.Buffer());
|
ok = GetSignalIndex(InputSignals, targetvIndex, signalName.Buffer());
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Targetv input signal shall be defined.");
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
}
|
"Targetv input signal shall be defined.");
|
||||||
else {
|
} else {
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, targetvIndex);
|
TypeDescriptor inputType = GetSignalType(InputSignals, targetvIndex);
|
||||||
ok = (inputType == Float32Bit);
|
ok = (inputType == Float32Bit);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Signal Targetv shall be defined as float32.");
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
|
"Signal Targetv shall be defined as float32.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -119,13 +120,14 @@ bool JARampupGAM::Setup() {
|
|||||||
StreamString signalName = "Time";
|
StreamString signalName = "Time";
|
||||||
ok = GetSignalIndex(InputSignals, timeIndex, signalName.Buffer());
|
ok = GetSignalIndex(InputSignals, timeIndex, signalName.Buffer());
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Time input signal shall be defined.");
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
}
|
"Time input signal shall be defined.");
|
||||||
else {
|
} else {
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, timeIndex);
|
TypeDescriptor inputType = GetSignalType(InputSignals, timeIndex);
|
||||||
ok = (inputType == Float32Bit);
|
ok = (inputType == Float32Bit);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Signal Time shall be defined as float32.");
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
|
"Signal Time shall be defined as float32.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -133,13 +135,14 @@ bool JARampupGAM::Setup() {
|
|||||||
StreamString signalName = "Start";
|
StreamString signalName = "Start";
|
||||||
ok = GetSignalIndex(InputSignals, startIndex, signalName.Buffer());
|
ok = GetSignalIndex(InputSignals, startIndex, signalName.Buffer());
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Start input signal shall be defined.");
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
}
|
"Start input signal shall be defined.");
|
||||||
else {
|
} else {
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, startIndex);
|
TypeDescriptor inputType = GetSignalType(InputSignals, startIndex);
|
||||||
ok = (inputType == UnsignedInteger32Bit);
|
ok = (inputType == UnsignedInteger32Bit);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Start shall be defined as uint32.");
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
|
"Start shall be defined as uint32.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -147,13 +150,14 @@ bool JARampupGAM::Setup() {
|
|||||||
StreamString signalName = "PLC_STANDBY";
|
StreamString signalName = "PLC_STANDBY";
|
||||||
ok = GetSignalIndex(InputSignals, standbyIndex, signalName.Buffer());
|
ok = GetSignalIndex(InputSignals, standbyIndex, signalName.Buffer());
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "PLC_STANDBY input signal shall be defined.");
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
}
|
"PLC_STANDBY input signal shall be defined.");
|
||||||
else {
|
} else {
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, standbyIndex);
|
TypeDescriptor inputType = GetSignalType(InputSignals, standbyIndex);
|
||||||
ok = (inputType == UnsignedInteger32Bit);
|
ok = (inputType == UnsignedInteger8Bit);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "PLC_STANDBY shall be defined as uint32.");
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
|
"PLC_STANDBY shall be defined as uint8.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -161,13 +165,14 @@ bool JARampupGAM::Setup() {
|
|||||||
StreamString signalName = "MANUAL_AUTO";
|
StreamString signalName = "MANUAL_AUTO";
|
||||||
ok = GetSignalIndex(InputSignals, isAutoIndex, signalName.Buffer());
|
ok = GetSignalIndex(InputSignals, isAutoIndex, signalName.Buffer());
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "MANUAL_AUTO input signal shall be defined.");
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
}
|
"MANUAL_AUTO input signal shall be defined.");
|
||||||
else {
|
} else {
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, isAutoIndex);
|
TypeDescriptor inputType = GetSignalType(InputSignals, isAutoIndex);
|
||||||
ok = (inputType == UnsignedInteger32Bit);
|
ok = (inputType == UnsignedInteger32Bit);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "MANUAL_AUTO shall be defined as uint32.");
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
|
"MANUAL_AUTO shall be defined as uint32.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -175,13 +180,14 @@ bool JARampupGAM::Setup() {
|
|||||||
StreamString signalName = "FHPS_PrePro";
|
StreamString signalName = "FHPS_PrePro";
|
||||||
ok = GetSignalIndex(InputSignals, fhpsPreProIndex, signalName.Buffer());
|
ok = GetSignalIndex(InputSignals, fhpsPreProIndex, signalName.Buffer());
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "FHPS_PrePro input signal shall be defined.");
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
}
|
"FHPS_PrePro input signal shall be defined.");
|
||||||
else {
|
} else {
|
||||||
TypeDescriptor inputType = GetSignalType(InputSignals, fhpsPreProIndex);
|
TypeDescriptor inputType = GetSignalType(InputSignals, fhpsPreProIndex);
|
||||||
ok = (inputType == Float32Bit);
|
ok = (inputType == Float32Bit);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Signal FHPS_PrePro shall be defined as float32.");
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
|
"Signal FHPS_PrePro shall be defined as float32.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -190,25 +196,28 @@ bool JARampupGAM::Setup() {
|
|||||||
TypeDescriptor inputType = GetSignalType(OutputSignals, 0);
|
TypeDescriptor inputType = GetSignalType(OutputSignals, 0);
|
||||||
ok = (inputType == Float32Bit);
|
ok = (inputType == Float32Bit);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Signal Output shall be defined as float32.");
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
|
"Signal Output shall be defined as float32.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ok) {
|
if (ok) {
|
||||||
TypeDescriptor inputType = GetSignalType(OutputSignals, 1);
|
TypeDescriptor inputType = GetSignalType(OutputSignals, 1);
|
||||||
ok = (inputType == UnsignedInteger32Bit);
|
ok = (inputType == UnsignedInteger32Bit);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
REPORT_ERROR(ErrorManagement::ParametersError, "Signal state shall be defined as float32.");
|
REPORT_ERROR(ErrorManagement::ParametersError,
|
||||||
|
"Signal state shall be defined as float32.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ok) {
|
if (ok) {
|
||||||
current_setpoint = reinterpret_cast<float32 *>(GetInputSignalMemory(currentspvIndex));
|
target_value =
|
||||||
target_value = reinterpret_cast<float32 *>(GetInputSignalMemory(targetvIndex));
|
reinterpret_cast<float32 *>(GetInputSignalMemory(targetvIndex));
|
||||||
rampup_time = reinterpret_cast<float32 *>(GetInputSignalMemory(timeIndex));
|
rampup_time = reinterpret_cast<float32 *>(GetInputSignalMemory(timeIndex));
|
||||||
start = reinterpret_cast<uint32 *>(GetInputSignalMemory(startIndex));
|
start = reinterpret_cast<uint32 *>(GetInputSignalMemory(startIndex));
|
||||||
standby = reinterpret_cast<uint32 *>(GetInputSignalMemory(standbyIndex));
|
standby = reinterpret_cast<uint8 *>(GetInputSignalMemory(standbyIndex));
|
||||||
isAuto = reinterpret_cast<uint32 *>(GetInputSignalMemory(isAutoIndex));
|
isAuto = reinterpret_cast<uint32 *>(GetInputSignalMemory(isAutoIndex));
|
||||||
FHPS_PrePro = reinterpret_cast<float32 *>(GetInputSignalMemory(fhpsPreProIndex));
|
FHPS_PrePro =
|
||||||
|
reinterpret_cast<float32 *>(GetInputSignalMemory(fhpsPreProIndex));
|
||||||
|
|
||||||
output = reinterpret_cast<float32 *>(GetOutputSignalMemory(0));
|
output = reinterpret_cast<float32 *>(GetOutputSignalMemory(0));
|
||||||
state = reinterpret_cast<uint32 *>(GetOutputSignalMemory(1));
|
state = reinterpret_cast<uint32 *>(GetOutputSignalMemory(1));
|
||||||
@@ -216,9 +225,12 @@ bool JARampupGAM::Setup() {
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JARampupGAM::PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName){
|
bool JARampupGAM::PrepareNextState(const MARTe::char8 *const currentStateName,
|
||||||
if(strcmp(nextStateName, "WaitHVON_PREP")==0 || strcmp(nextStateName, "WaitHVON_SDN_PREP")==0 ||
|
const MARTe::char8 *const nextStateName) {
|
||||||
strcmp(nextStateName, "WaitHVON")==0 || strcmp(nextStateName, "WaitHVON_SDN")==0){
|
if (strcmp(nextStateName, "WaitHVON_PREP") == 0 ||
|
||||||
|
strcmp(nextStateName, "WaitHVON_SDN_PREP") == 0 ||
|
||||||
|
strcmp(nextStateName, "WaitHVON") == 0 ||
|
||||||
|
strcmp(nextStateName, "WaitHVON_SDN") == 0) {
|
||||||
inWaitHVON = true;
|
inWaitHVON = true;
|
||||||
inWaitStandby = false;
|
inWaitStandby = false;
|
||||||
} else {
|
} else {
|
||||||
@@ -234,6 +246,7 @@ bool JARampupGAM::PrepareNextState(const MARTe::char8 * const currentStateName,
|
|||||||
|
|
||||||
bool JARampupGAM::Execute() {
|
bool JARampupGAM::Execute() {
|
||||||
using namespace MARTe;
|
using namespace MARTe;
|
||||||
|
float32 current_setpoint = *output;
|
||||||
if (!inWaitHVON) {
|
if (!inWaitHVON) {
|
||||||
if (*target_value <= 0.0f || *standby == 0u) {
|
if (*target_value <= 0.0f || *standby == 0u) {
|
||||||
*output = 0.0f;
|
*output = 0.0f;
|
||||||
@@ -254,7 +267,8 @@ bool JARampupGAM::Execute() {
|
|||||||
|
|
||||||
// Calcrate new rampup rate.
|
// Calcrate new rampup rate.
|
||||||
if (*rampup_time != 0 && resetFlag == true) {
|
if (*rampup_time != 0 && resetFlag == true) {
|
||||||
rampup_rate = (*target_value - *current_setpoint) / *rampup_time/1000.0f; // Volt/msec
|
rampup_rate = (*target_value - current_setpoint) / *rampup_time /
|
||||||
|
1000.0f; // Volt/msec
|
||||||
resetFlag = false;
|
resetFlag = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,8 +283,7 @@ bool JARampupGAM::Execute() {
|
|||||||
//*output = *target_value;
|
//*output = *target_value;
|
||||||
*state = 0u;
|
*state = 0u;
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (inRampup) {
|
||||||
else if (inRampup){
|
|
||||||
if (*output + rampup_rate < *target_value && *rampup_time != 0) {
|
if (*output + rampup_rate < *target_value && *rampup_time != 0) {
|
||||||
*output = *output + rampup_rate;
|
*output = *output + rampup_rate;
|
||||||
*state = 1u;
|
*state = 1u;
|
||||||
|
|||||||
@@ -97,8 +97,6 @@ public:
|
|||||||
const MARTe::char8 * const nextStateName);
|
const MARTe::char8 * const nextStateName);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Input signal containing current current_setpoint
|
|
||||||
MARTe::float32 *current_setpoint;
|
|
||||||
|
|
||||||
// Input signal containing the frequency of the waveform.
|
// Input signal containing the frequency of the waveform.
|
||||||
MARTe::float32 *target_value;
|
MARTe::float32 *target_value;
|
||||||
@@ -110,7 +108,7 @@ private:
|
|||||||
MARTe::uint32 *start;
|
MARTe::uint32 *start;
|
||||||
|
|
||||||
// Input signal PLC_STANDBY
|
// Input signal PLC_STANDBY
|
||||||
MARTe::uint32 *standby;
|
MARTe::uint8 *standby;
|
||||||
|
|
||||||
// MANUAL AUTO button
|
// MANUAL AUTO button
|
||||||
MARTe::uint32 *isAuto;
|
MARTe::uint32 *isAuto;
|
||||||
|
|||||||
Reference in New Issue
Block a user