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