v1.10.0 #220
@ -70,8 +70,8 @@ void PayloadPcduHandler::stateMachineToNormal() {
|
|||||||
if (submode == plpcdu::NORMAL_ALL_ON) {
|
if (submode == plpcdu::NORMAL_ALL_ON) {
|
||||||
if (state == States::ON_TRANS_ADC_CLOSE_ZERO) {
|
if (state == States::ON_TRANS_ADC_CLOSE_ZERO) {
|
||||||
if (not commandExecuted) {
|
if (not commandExecuted) {
|
||||||
float waitTime = SSR_TO_DRO_WAIT_TIME;
|
float waitTime = DFT_SSR_TO_DRO_WAIT_TIME;
|
||||||
params.getValue(PlPcduParameter::SSR_TO_DRO_WAIT_TIME_K, waitTime);
|
params.getValue(PARAM_KEY_MAP[SSR_TO_DRO_WAIT_TIME], waitTime);
|
||||||
countdown.setTimeout(std::round(waitTime * 1000));
|
countdown.setTimeout(std::round(waitTime * 1000));
|
||||||
countdown.resetTimer();
|
countdown.resetTimer();
|
||||||
commandExecuted = true;
|
commandExecuted = true;
|
||||||
@ -89,8 +89,8 @@ void PayloadPcduHandler::stateMachineToNormal() {
|
|||||||
}
|
}
|
||||||
if (state == States::ON_TRANS_DRO) {
|
if (state == States::ON_TRANS_DRO) {
|
||||||
if (not commandExecuted) {
|
if (not commandExecuted) {
|
||||||
float waitTime = DRO_TO_X8_WAIT_TIME;
|
float waitTime = DFT_DRO_TO_X8_WAIT_TIME;
|
||||||
params.getValue(PlPcduParameter::DRO_TO_X8_WAIT_TIME_K, waitTime);
|
params.getValue(PARAM_KEY_MAP[DRO_TO_X8_WAIT_TIME], waitTime);
|
||||||
countdown.setTimeout(std::round(waitTime * 1000));
|
countdown.setTimeout(std::round(waitTime * 1000));
|
||||||
countdown.resetTimer();
|
countdown.resetTimer();
|
||||||
#if OBSW_VERBOSE_LEVEL >= 1
|
#if OBSW_VERBOSE_LEVEL >= 1
|
||||||
@ -111,8 +111,8 @@ void PayloadPcduHandler::stateMachineToNormal() {
|
|||||||
}
|
}
|
||||||
if (state == States::ON_TRANS_X8) {
|
if (state == States::ON_TRANS_X8) {
|
||||||
if (not commandExecuted) {
|
if (not commandExecuted) {
|
||||||
float waitTime = X8_TO_TX_WAIT_TIME;
|
float waitTime = DFT_X8_TO_TX_WAIT_TIME;
|
||||||
params.getValue(PlPcduParameter::X8_TO_TX_WAIT_TIME_K, waitTime);
|
params.getValue(PARAM_KEY_MAP[X8_TO_TX_WAIT_TIME], waitTime);
|
||||||
countdown.setTimeout(std::round(waitTime * 1000));
|
countdown.setTimeout(std::round(waitTime * 1000));
|
||||||
countdown.resetTimer();
|
countdown.resetTimer();
|
||||||
#if OBSW_VERBOSE_LEVEL >= 1
|
#if OBSW_VERBOSE_LEVEL >= 1
|
||||||
@ -133,8 +133,8 @@ void PayloadPcduHandler::stateMachineToNormal() {
|
|||||||
}
|
}
|
||||||
if (state == States::ON_TRANS_TX) {
|
if (state == States::ON_TRANS_TX) {
|
||||||
if (not commandExecuted) {
|
if (not commandExecuted) {
|
||||||
float waitTime = TX_TO_MPA_WAIT_TIME;
|
float waitTime = DFT_TX_TO_MPA_WAIT_TIME;
|
||||||
params.getValue(PlPcduParameter::TX_TO_MPA_WAIT_TIME_K, waitTime);
|
params.getValue(PARAM_KEY_MAP[TX_TO_MPA_WAIT_TIME], waitTime);
|
||||||
countdown.setTimeout(std::round(waitTime * 1000));
|
countdown.setTimeout(std::round(waitTime * 1000));
|
||||||
countdown.resetTimer();
|
countdown.resetTimer();
|
||||||
#if OBSW_VERBOSE_LEVEL >= 1
|
#if OBSW_VERBOSE_LEVEL >= 1
|
||||||
@ -156,8 +156,8 @@ void PayloadPcduHandler::stateMachineToNormal() {
|
|||||||
}
|
}
|
||||||
if (state == States::ON_TRANS_MPA) {
|
if (state == States::ON_TRANS_MPA) {
|
||||||
if (not commandExecuted) {
|
if (not commandExecuted) {
|
||||||
float waitTime = MPA_TO_HPA_WAIT_TIME;
|
float waitTime = DFT_MPA_TO_HPA_WAIT_TIME;
|
||||||
params.getValue(PlPcduParameter::MPA_TO_HPA_WAIT_TIME_K, waitTime);
|
params.getValue(PARAM_KEY_MAP[MPA_TO_HPA_WAIT_TIME], waitTime);
|
||||||
countdown.setTimeout(std::round(waitTime * 1000));
|
countdown.setTimeout(std::round(waitTime * 1000));
|
||||||
countdown.resetTimer();
|
countdown.resetTimer();
|
||||||
#if OBSW_VERBOSE_LEVEL >= 1
|
#if OBSW_VERBOSE_LEVEL >= 1
|
||||||
@ -429,71 +429,96 @@ void PayloadPcduHandler::checkAdcValues() {
|
|||||||
adcTransition = state == States::ON_TRANS_DRO and adcCountdown.isBusy();
|
adcTransition = state == States::ON_TRANS_DRO and adcCountdown.isBusy();
|
||||||
// Now check against voltage and current limits, depending on state
|
// Now check against voltage and current limits, depending on state
|
||||||
if (state >= States::ON_TRANS_DRO and not adcTransition) {
|
if (state >= States::ON_TRANS_DRO and not adcTransition) {
|
||||||
params.getValue(PlPcduParameter::NEG_V_LOWER_BOUND_K, lowerBound);
|
if (ssrToDroInjectionRequested) {
|
||||||
params.getValue(PlPcduParameter::NEG_V_UPPER_BOUND_K, upperBound);
|
handleFailureInjection("SSR to DRO", NEG_V_OUT_OF_BOUNDS);
|
||||||
|
ssrToDroInjectionRequested = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
params.getValue(PARAM_KEY_MAP[NEG_V_LOWER_BOUND], lowerBound);
|
||||||
|
params.getValue(PARAM_KEY_MAP[NEG_V_UPPER_BOUND], upperBound);
|
||||||
if (not checkVoltage(adcSet.processed[U_NEG_V_FB], lowerBound, upperBound,
|
if (not checkVoltage(adcSet.processed[U_NEG_V_FB], lowerBound, upperBound,
|
||||||
NEG_V_OUT_OF_BOUNDS)) {
|
NEG_V_OUT_OF_BOUNDS)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
params.getValue(PlPcduParameter::DRO_U_LOWER_BOUND_K, lowerBound);
|
params.getValue(PARAM_KEY_MAP[DRO_U_LOWER_BOUND], lowerBound);
|
||||||
params.getValue(PlPcduParameter::DRO_U_UPPER_BOUND_K, upperBound);
|
params.getValue(PARAM_KEY_MAP[DRO_U_UPPER_BOUND], upperBound);
|
||||||
if (not checkVoltage(adcSet.processed[U_DRO_DIV_6], lowerBound, upperBound,
|
if (not checkVoltage(adcSet.processed[U_DRO_DIV_6], lowerBound, upperBound,
|
||||||
U_DRO_OUT_OF_BOUNDS)) {
|
U_DRO_OUT_OF_BOUNDS)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
params.getValue(PlPcduParameter::DRO_I_UPPER_BOUND_K, upperBound);
|
params.getValue(PARAM_KEY_MAP[DRO_I_UPPER_BOUND], upperBound);
|
||||||
if (not checkCurrent(adcSet.processed[I_DRO], upperBound, I_DRO_OUT_OF_BOUNDS)) {
|
if (not checkCurrent(adcSet.processed[I_DRO], upperBound, I_DRO_OUT_OF_BOUNDS)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
adcTransition = state == States::ON_TRANS_X8 and adcCountdown.isBusy();
|
adcTransition = state == States::ON_TRANS_X8 and adcCountdown.isBusy();
|
||||||
if (state >= States::ON_TRANS_X8 and not adcTransition) {
|
if (state >= States::ON_TRANS_X8 and not adcTransition) {
|
||||||
params.getValue(PlPcduParameter::X8_U_LOWER_BOUND_K, lowerBound);
|
if (droToX8InjectionRequested) {
|
||||||
params.getValue(PlPcduParameter::X8_U_UPPER_BOUND_K, upperBound);
|
handleFailureInjection("X8 to TX", U_X8_OUT_OF_BOUNDS);
|
||||||
|
droToX8InjectionRequested = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
params.getValue(PARAM_KEY_MAP[X8_U_LOWER_BOUND], lowerBound);
|
||||||
|
params.getValue(PARAM_KEY_MAP[X8_U_UPPER_BOUND], upperBound);
|
||||||
if (not checkVoltage(adcSet.processed[U_X8_DIV_6], lowerBound, upperBound,
|
if (not checkVoltage(adcSet.processed[U_X8_DIV_6], lowerBound, upperBound,
|
||||||
U_X8_OUT_OF_BOUNDS)) {
|
U_X8_OUT_OF_BOUNDS)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
params.getValue(PlPcduParameter::X8_I_UPPER_BOUND_K, upperBound);
|
params.getValue(PARAM_KEY_MAP[X8_I_UPPER_BOUND], upperBound);
|
||||||
if (not checkCurrent(adcSet.processed[I_X8], upperBound, I_X8_OUT_OF_BOUNDS)) {
|
if (not checkCurrent(adcSet.processed[I_X8], upperBound, I_X8_OUT_OF_BOUNDS)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
adcTransition = state == States::ON_TRANS_TX and adcCountdown.isBusy();
|
adcTransition = state == States::ON_TRANS_TX and adcCountdown.isBusy();
|
||||||
if (state >= States::ON_TRANS_TX and not adcTransition) {
|
if (state >= States::ON_TRANS_TX and not adcTransition) {
|
||||||
params.getValue(PlPcduParameter::TX_U_LOWER_BOUND_K, lowerBound);
|
if (txToMpaInjectionRequested) {
|
||||||
params.getValue(PlPcduParameter::TX_U_UPPER_BOUND_K, upperBound);
|
handleFailureInjection("TX to MPA", U_TX_OUT_OF_BOUNDS);
|
||||||
|
txToMpaInjectionRequested = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
params.getValue(PARAM_KEY_MAP[TX_U_LOWER_BOUND], lowerBound);
|
||||||
|
params.getValue(PARAM_KEY_MAP[TX_U_UPPER_BOUND], upperBound);
|
||||||
if (not checkVoltage(adcSet.processed[U_TX_DIV_6], lowerBound, upperBound,
|
if (not checkVoltage(adcSet.processed[U_TX_DIV_6], lowerBound, upperBound,
|
||||||
U_TX_OUT_OF_BOUNDS)) {
|
U_TX_OUT_OF_BOUNDS)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
params.getValue(PlPcduParameter::TX_I_UPPER_BOUND_K, upperBound);
|
params.getValue(PARAM_KEY_MAP[TX_I_UPPER_BOUND], upperBound);
|
||||||
if (not checkCurrent(adcSet.processed[I_TX], upperBound, I_TX_OUT_OF_BOUNDS)) {
|
if (not checkCurrent(adcSet.processed[I_TX], upperBound, I_TX_OUT_OF_BOUNDS)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
adcTransition = state == States::ON_TRANS_MPA and adcCountdown.isBusy();
|
adcTransition = state == States::ON_TRANS_MPA and adcCountdown.isBusy();
|
||||||
if (state >= States::ON_TRANS_MPA and not adcTransition) {
|
if (state >= States::ON_TRANS_MPA and not adcTransition) {
|
||||||
params.getValue(PlPcduParameter::MPA_U_LOWER_BOUND_K, lowerBound);
|
if (mpaToHpaInjectionRequested) {
|
||||||
params.getValue(PlPcduParameter::MPA_U_UPPER_BOUND_K, upperBound);
|
handleFailureInjection("MPA to HPA", U_HPA_OUT_OF_BOUNDS);
|
||||||
|
mpaToHpaInjectionRequested = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
params.getValue(PARAM_KEY_MAP[MPA_U_LOWER_BOUND], lowerBound);
|
||||||
|
params.getValue(PARAM_KEY_MAP[MPA_U_UPPER_BOUND], upperBound);
|
||||||
if (not checkVoltage(adcSet.processed[U_MPA_DIV_6], lowerBound, upperBound,
|
if (not checkVoltage(adcSet.processed[U_MPA_DIV_6], lowerBound, upperBound,
|
||||||
U_MPA_OUT_OF_BOUNDS)) {
|
U_MPA_OUT_OF_BOUNDS)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
params.getValue(PlPcduParameter::MPA_I_UPPER_BOUND_K, upperBound);
|
params.getValue(PARAM_KEY_MAP[MPA_I_UPPER_BOUND], upperBound);
|
||||||
if (not checkCurrent(adcSet.processed[I_MPA], upperBound, I_MPA_OUT_OF_BOUNDS)) {
|
if (not checkCurrent(adcSet.processed[I_MPA], upperBound, I_MPA_OUT_OF_BOUNDS)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
adcTransition = state == States::ON_TRANS_HPA and adcCountdown.isBusy();
|
adcTransition = state == States::ON_TRANS_HPA and adcCountdown.isBusy();
|
||||||
if (state >= States::ON_TRANS_HPA and not adcTransition) {
|
if (state >= States::ON_TRANS_HPA and not adcTransition) {
|
||||||
params.getValue(PlPcduParameter::HPA_U_LOWER_BOUND_K, lowerBound);
|
if (allOnInjectRequested) {
|
||||||
params.getValue(PlPcduParameter::HPA_U_UPPER_BOUND_K, upperBound);
|
handleFailureInjection("All On", U_HPA_OUT_OF_BOUNDS);
|
||||||
|
allOnInjectRequested = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
params.getValue(PARAM_KEY_MAP[HPA_U_LOWER_BOUND], lowerBound);
|
||||||
|
params.getValue(PARAM_KEY_MAP[HPA_U_UPPER_BOUND], upperBound);
|
||||||
if (not checkVoltage(adcSet.processed[U_HPA_DIV_6], lowerBound, upperBound,
|
if (not checkVoltage(adcSet.processed[U_HPA_DIV_6], lowerBound, upperBound,
|
||||||
U_HPA_OUT_OF_BOUNDS)) {
|
U_HPA_OUT_OF_BOUNDS)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
params.getValue(PlPcduParameter::HPA_I_UPPER_BOUND_K, upperBound);
|
params.getValue(PARAM_KEY_MAP[HPA_I_UPPER_BOUND], upperBound);
|
||||||
if (not checkCurrent(adcSet.processed[I_HPA], upperBound, I_HPA_OUT_OF_BOUNDS)) {
|
if (not checkCurrent(adcSet.processed[I_HPA], upperBound, I_HPA_OUT_OF_BOUNDS)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -555,6 +580,91 @@ ReturnValue_t PayloadPcduHandler::serializeFloat(uint32_t& param, float val) {
|
|||||||
SerializeIF::Endianness::NETWORK);
|
SerializeIF::Endianness::NETWORK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReturnValue_t PayloadPcduHandler::getParameter(uint8_t domainId, uint8_t uniqueId,
|
||||||
|
ParameterWrapper* parameterWrapper,
|
||||||
|
const ParameterWrapper* newValues,
|
||||||
|
uint16_t startAtIndex) {
|
||||||
|
using namespace plpcdu;
|
||||||
|
switch (uniqueId) {
|
||||||
|
case (PlPcduParamIds::NEG_V_LOWER_BOUND):
|
||||||
|
case (PlPcduParamIds::NEG_V_UPPER_BOUND):
|
||||||
|
case (PlPcduParamIds::DRO_U_LOWER_BOUND):
|
||||||
|
case (PlPcduParamIds::DRO_U_UPPER_BOUND):
|
||||||
|
case (PlPcduParamIds::DRO_I_UPPER_BOUND):
|
||||||
|
case (PlPcduParamIds::X8_U_LOWER_BOUND):
|
||||||
|
case (PlPcduParamIds::X8_U_UPPER_BOUND):
|
||||||
|
case (PlPcduParamIds::X8_I_UPPER_BOUND):
|
||||||
|
case (PlPcduParamIds::TX_U_LOWER_BOUND):
|
||||||
|
case (PlPcduParamIds::TX_U_UPPER_BOUND):
|
||||||
|
case (PlPcduParamIds::TX_I_UPPER_BOUND):
|
||||||
|
case (PlPcduParamIds::MPA_U_LOWER_BOUND):
|
||||||
|
case (PlPcduParamIds::MPA_U_UPPER_BOUND):
|
||||||
|
case (PlPcduParamIds::MPA_I_UPPER_BOUND):
|
||||||
|
case (PlPcduParamIds::HPA_U_LOWER_BOUND):
|
||||||
|
case (PlPcduParamIds::HPA_U_UPPER_BOUND):
|
||||||
|
case (PlPcduParamIds::HPA_I_UPPER_BOUND):
|
||||||
|
case (PlPcduParamIds::SSR_TO_DRO_WAIT_TIME):
|
||||||
|
case (PlPcduParamIds::DRO_TO_X8_WAIT_TIME):
|
||||||
|
case (PlPcduParamIds::X8_TO_TX_WAIT_TIME):
|
||||||
|
case (PlPcduParamIds::TX_TO_MPA_WAIT_TIME):
|
||||||
|
case (PlPcduParamIds::MPA_TO_HPA_WAIT_TIME): {
|
||||||
|
handleDoubleParamUpdate(PARAM_KEY_MAP[static_cast<PlPcduParamIds>(uniqueId)], newValues);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (PlPcduParamIds::INJECT_SSR_TO_DRO_FAILURE): {
|
||||||
|
ssrToDroInjectionRequested = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (PlPcduParamIds::INJECT_DRO_TO_X8_FAILURE): {
|
||||||
|
droToX8InjectionRequested = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (PlPcduParamIds::INJECT_X8_TO_TX_FAILURE): {
|
||||||
|
x8ToTxInjectionRequested = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (PlPcduParamIds::INJECT_TX_TO_MPA_FAILURE): {
|
||||||
|
txToMpaInjectionRequested = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (PlPcduParamIds::INJECT_MPA_TO_HPA_FAILURE): {
|
||||||
|
mpaToHpaInjectionRequested = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (PlPcduParamIds::INJECT_ALL_ON_FAILURE): {
|
||||||
|
allOnInjectRequested = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
return DeviceHandlerBase::getParameter(domainId, uniqueId, parameterWrapper, newValues,
|
||||||
|
startAtIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PayloadPcduHandler::handleFailureInjection(std::string output, Event event) {
|
||||||
|
sif::info << "PayloadPcduHandler::checkAdcValues: " << output
|
||||||
|
<< " failure injection. "
|
||||||
|
"Transitioning back to off"
|
||||||
|
<< std::endl;
|
||||||
|
triggerEvent(event, 0, 0);
|
||||||
|
transitionOk = false;
|
||||||
|
transitionBackToOff();
|
||||||
|
droToX8InjectionRequested = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t PayloadPcduHandler::handleDoubleParamUpdate(std::string key,
|
||||||
|
const ParameterWrapper* newValues) {
|
||||||
|
double newValue = 0.0;
|
||||||
|
ReturnValue_t result = newValues->getElement<double>(&newValue, 0, 0);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
params.setValue(key, newValue);
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef FSFW_OSAL_LINUX
|
#ifdef FSFW_OSAL_LINUX
|
||||||
ReturnValue_t PayloadPcduHandler::extConvAsTwoCallback(SpiComIF* comIf, SpiCookie* cookie,
|
ReturnValue_t PayloadPcduHandler::extConvAsTwoCallback(SpiComIF* comIf, SpiCookie* cookie,
|
||||||
const uint8_t* sendData, size_t sendLen,
|
const uint8_t* sendData, size_t sendLen,
|
||||||
|
@ -111,6 +111,14 @@ class PayloadPcduHandler : public DeviceHandlerBase {
|
|||||||
bool adcCmdExecuted = false;
|
bool adcCmdExecuted = false;
|
||||||
bool periodicPrintout = false;
|
bool periodicPrintout = false;
|
||||||
bool jsonFileInitComplete = false;
|
bool jsonFileInitComplete = false;
|
||||||
|
|
||||||
|
bool ssrToDroInjectionRequested = false;
|
||||||
|
bool droToX8InjectionRequested = false;
|
||||||
|
bool x8ToTxInjectionRequested = false;
|
||||||
|
bool txToMpaInjectionRequested = false;
|
||||||
|
bool mpaToHpaInjectionRequested = false;
|
||||||
|
bool allOnInjectRequested = false;
|
||||||
|
|
||||||
PeriodicOperationDivider opDivider = PeriodicOperationDivider(5);
|
PeriodicOperationDivider opDivider = PeriodicOperationDivider(5);
|
||||||
uint8_t tempReadDivisor = 1;
|
uint8_t tempReadDivisor = 1;
|
||||||
Countdown countdown = Countdown(5000);
|
Countdown countdown = Countdown(5000);
|
||||||
@ -141,6 +149,8 @@ class PayloadPcduHandler : public DeviceHandlerBase {
|
|||||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||||
LocalDataPoolManager& poolManager) override;
|
LocalDataPoolManager& poolManager) override;
|
||||||
ReturnValue_t isModeCombinationValid(Mode_t mode, Submode_t submode) override;
|
ReturnValue_t isModeCombinationValid(Mode_t mode, Submode_t submode) override;
|
||||||
|
ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, ParameterWrapper* parameterWrapper,
|
||||||
|
const ParameterWrapper* newValues, uint16_t startAtIndex) override;
|
||||||
|
|
||||||
void handleExtConvRead(const uint8_t* bufStart);
|
void handleExtConvRead(const uint8_t* bufStart);
|
||||||
void handlePrintout();
|
void handlePrintout();
|
||||||
@ -149,7 +159,9 @@ class PayloadPcduHandler : public DeviceHandlerBase {
|
|||||||
void stateMachineToNormal();
|
void stateMachineToNormal();
|
||||||
bool checkVoltage(float val, float lowerBound, float upperBound, Event event);
|
bool checkVoltage(float val, float lowerBound, float upperBound, Event event);
|
||||||
bool checkCurrent(float val, float upperBound, Event event);
|
bool checkCurrent(float val, float upperBound, Event event);
|
||||||
|
void handleFailureInjection(std::string output, Event event);
|
||||||
ReturnValue_t serializeFloat(uint32_t& param, float val);
|
ReturnValue_t serializeFloat(uint32_t& param, float val);
|
||||||
|
ReturnValue_t handleDoubleParamUpdate(std::string key, const ParameterWrapper* newValues);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* LINUX_DEVICES_PLPCDUHANDLER_H_ */
|
#endif /* LINUX_DEVICES_PLPCDUHANDLER_H_ */
|
||||||
|
@ -35,6 +35,53 @@ enum PlPcduAdcChannels : uint8_t {
|
|||||||
NUM_CHANNELS = 12
|
NUM_CHANNELS = 12
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum PlPcduParamIds : uint8_t {
|
||||||
|
NEG_V_LOWER_BOUND = 0,
|
||||||
|
NEG_V_UPPER_BOUND = 1,
|
||||||
|
DRO_U_LOWER_BOUND = 2,
|
||||||
|
DRO_U_UPPER_BOUND = 3,
|
||||||
|
DRO_I_UPPER_BOUND = 4,
|
||||||
|
X8_U_LOWER_BOUND = 5,
|
||||||
|
X8_U_UPPER_BOUND = 6,
|
||||||
|
X8_I_UPPER_BOUND = 7,
|
||||||
|
TX_U_LOWER_BOUND = 8,
|
||||||
|
TX_U_UPPER_BOUND = 9,
|
||||||
|
TX_I_UPPER_BOUND = 10,
|
||||||
|
MPA_U_LOWER_BOUND = 11,
|
||||||
|
MPA_U_UPPER_BOUND = 12,
|
||||||
|
MPA_I_UPPER_BOUND = 13,
|
||||||
|
HPA_U_LOWER_BOUND = 14,
|
||||||
|
HPA_U_UPPER_BOUND = 15,
|
||||||
|
HPA_I_UPPER_BOUND = 16,
|
||||||
|
|
||||||
|
SSR_TO_DRO_WAIT_TIME = 17,
|
||||||
|
DRO_TO_X8_WAIT_TIME = 18,
|
||||||
|
X8_TO_TX_WAIT_TIME = 19,
|
||||||
|
TX_TO_MPA_WAIT_TIME = 20,
|
||||||
|
MPA_TO_HPA_WAIT_TIME = 21,
|
||||||
|
|
||||||
|
INJECT_SSR_TO_DRO_FAILURE = 30,
|
||||||
|
INJECT_DRO_TO_X8_FAILURE = 31,
|
||||||
|
INJECT_X8_TO_TX_FAILURE = 32,
|
||||||
|
INJECT_TX_TO_MPA_FAILURE = 33,
|
||||||
|
INJECT_MPA_TO_HPA_FAILURE = 34,
|
||||||
|
INJECT_ALL_ON_FAILURE = 35
|
||||||
|
};
|
||||||
|
|
||||||
|
static std::map<PlPcduParamIds, std::string> PARAM_KEY_MAP = {
|
||||||
|
{NEG_V_LOWER_BOUND, "negVoltLowerBound"}, {NEG_V_UPPER_BOUND, "negVoltUpperBound"},
|
||||||
|
{DRO_U_LOWER_BOUND, "droVoltLowerBound"}, {DRO_U_UPPER_BOUND, "droVoltUpperBound"},
|
||||||
|
{DRO_I_UPPER_BOUND, "droCurrUpperBound"}, {X8_U_LOWER_BOUND, "x8VoltLowerBound"},
|
||||||
|
{X8_U_UPPER_BOUND, "x8VoltUpperBound"}, {X8_I_UPPER_BOUND, "x9CurrUpperBound"},
|
||||||
|
{TX_U_LOWER_BOUND, "txVoltLowerBound"}, {TX_U_UPPER_BOUND, "txVoltUpperBound"},
|
||||||
|
{TX_I_UPPER_BOUND, "txCurrUpperBound"}, {MPA_U_LOWER_BOUND, "mpaVoltLowerBound"},
|
||||||
|
{MPA_U_UPPER_BOUND, "mpaVoltUpperBound"}, {MPA_I_UPPER_BOUND, "mpaCurrUpperBound"},
|
||||||
|
{HPA_U_LOWER_BOUND, "hpaVoltLowerBound"}, {HPA_U_UPPER_BOUND, "hpaVoltUpperBound"},
|
||||||
|
{HPA_I_UPPER_BOUND, "hpaCurrUpperBound"}, {SSR_TO_DRO_WAIT_TIME, "ssrToDroWait"},
|
||||||
|
{DRO_TO_X8_WAIT_TIME, "droToX8Wait"}, {X8_TO_TX_WAIT_TIME, "x8ToTxWait"},
|
||||||
|
{TX_TO_MPA_WAIT_TIME, "txToMpaWait"}, {MPA_TO_HPA_WAIT_TIME, "mpaToHpaWait"},
|
||||||
|
};
|
||||||
|
|
||||||
enum PlPcduPoolIds : uint32_t { CHANNEL_VEC = 0, PROCESSED_VEC = 1, TEMP = 2 };
|
enum PlPcduPoolIds : uint32_t { CHANNEL_VEC = 0, PROCESSED_VEC = 1, TEMP = 2 };
|
||||||
|
|
||||||
static constexpr size_t MAX_ADC_REPLY_SIZE = 64;
|
static constexpr size_t MAX_ADC_REPLY_SIZE = 64;
|
||||||
@ -83,35 +130,35 @@ static constexpr float SCALE_CURRENT_DRO = MAX122X_SCALE / (GAIN_INA169 * R_SHUN
|
|||||||
|
|
||||||
// TODO: Make these configurable parameters using a JSON file
|
// TODO: Make these configurable parameters using a JSON file
|
||||||
// Upper bound of currents in milliamperes [mA]
|
// Upper bound of currents in milliamperes [mA]
|
||||||
static constexpr double NEG_V_LOWER_BOUND = -6.5;
|
static constexpr double DFT_NEG_V_LOWER_BOUND = -6.5;
|
||||||
static constexpr double NEG_V_UPPER_BOUND = -2.7;
|
static constexpr double DFT_NEG_V_UPPER_BOUND = -2.7;
|
||||||
|
|
||||||
static constexpr double DRO_U_LOWER_BOUND = 5.0;
|
static constexpr double DFT_DRO_U_LOWER_BOUND = 5.0;
|
||||||
static constexpr double DRO_U_UPPER_BOUND = 7.0;
|
static constexpr double DFT_DRO_U_UPPER_BOUND = 7.0;
|
||||||
static constexpr double DRO_I_UPPER_BOUND = 40.0;
|
static constexpr double DFT_DRO_I_UPPER_BOUND = 40.0;
|
||||||
|
|
||||||
static constexpr double X8_U_LOWER_BOUND = 2.6;
|
static constexpr double DFT_X8_U_LOWER_BOUND = 2.6;
|
||||||
static constexpr double X8_U_UPPER_BOUND = 4.0;
|
static constexpr double DFT_X8_U_UPPER_BOUND = 4.0;
|
||||||
static constexpr double X8_I_UPPER_BOUND = 100.0;
|
static constexpr double DFT_X8_I_UPPER_BOUND = 100.0;
|
||||||
|
|
||||||
static constexpr double TX_U_LOWER_BOUND = 2.6;
|
static constexpr double DFT_TX_U_LOWER_BOUND = 2.6;
|
||||||
static constexpr double TX_U_UPPER_BOUND = 4.0;
|
static constexpr double DFT_TX_U_UPPER_BOUND = 4.0;
|
||||||
static constexpr double TX_I_UPPER_BOUND = 250.0;
|
static constexpr double DFT_TX_I_UPPER_BOUND = 250.0;
|
||||||
|
|
||||||
static constexpr double MPA_U_LOWER_BOUND = 2.6;
|
static constexpr double DFT_MPA_U_LOWER_BOUND = 2.6;
|
||||||
static constexpr double MPA_U_UPPER_BOUND = 4.0;
|
static constexpr double DFT_MPA_U_UPPER_BOUND = 4.0;
|
||||||
static constexpr double MPA_I_UPPER_BOUND = 650.0;
|
static constexpr double DFT_MPA_I_UPPER_BOUND = 650.0;
|
||||||
|
|
||||||
static constexpr double HPA_U_LOWER_BOUND = 9.4;
|
static constexpr double DFT_HPA_U_LOWER_BOUND = 9.4;
|
||||||
static constexpr double HPA_U_UPPER_BOUND = 11.0;
|
static constexpr double DFT_HPA_U_UPPER_BOUND = 11.0;
|
||||||
static constexpr double HPA_I_UPPER_BOUND = 3000.0;
|
static constexpr double DFT_HPA_I_UPPER_BOUND = 3000.0;
|
||||||
|
|
||||||
// Wait time in floating point seconds
|
// Wait time in floating point seconds
|
||||||
static constexpr double SSR_TO_DRO_WAIT_TIME = 5.0;
|
static constexpr double DFT_SSR_TO_DRO_WAIT_TIME = 5.0;
|
||||||
static constexpr double DRO_TO_X8_WAIT_TIME = 905.0;
|
static constexpr double DFT_DRO_TO_X8_WAIT_TIME = 905.0;
|
||||||
static constexpr double X8_TO_TX_WAIT_TIME = 5.0;
|
static constexpr double DFT_X8_TO_TX_WAIT_TIME = 5.0;
|
||||||
static constexpr double TX_TO_MPA_WAIT_TIME = 5.0;
|
static constexpr double DFT_TX_TO_MPA_WAIT_TIME = 5.0;
|
||||||
static constexpr double MPA_TO_HPA_WAIT_TIME = 5.0;
|
static constexpr double DFT_MPA_TO_HPA_WAIT_TIME = 5.0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current of the processed values is calculated and stored as a milliamperes [mA].
|
* The current of the processed values is calculated and stored as a milliamperes [mA].
|
||||||
@ -130,59 +177,31 @@ class PlPcduAdcSet : public StaticLocalDataSet<DATASET_ENTRIES> {
|
|||||||
|
|
||||||
class PlPcduParameter : public NVMParameterBase {
|
class PlPcduParameter : public NVMParameterBase {
|
||||||
public:
|
public:
|
||||||
static constexpr char SSR_TO_DRO_WAIT_TIME_K[] = "ssrToDroWait";
|
|
||||||
static constexpr char DRO_TO_X8_WAIT_TIME_K[] = "droToX8Wait";
|
|
||||||
static constexpr char X8_TO_TX_WAIT_TIME_K[] = "X8ToTxWait";
|
|
||||||
static constexpr char TX_TO_MPA_WAIT_TIME_K[] = "txToMpaWait";
|
|
||||||
static constexpr char MPA_TO_HPA_WAIT_TIME_K[] = "mpaToHpaWait";
|
|
||||||
|
|
||||||
static constexpr char NEG_V_LOWER_BOUND_K[] = "negVoltLowerBound";
|
|
||||||
static constexpr char NEG_V_UPPER_BOUND_K[] = "negVoltUpperBound";
|
|
||||||
|
|
||||||
static constexpr char DRO_U_LOWER_BOUND_K[] = "droVoltLowerBound";
|
|
||||||
static constexpr char DRO_U_UPPER_BOUND_K[] = "droVoltUpperBound";
|
|
||||||
static constexpr char DRO_I_UPPER_BOUND_K[] = "droCurrUpperBound";
|
|
||||||
|
|
||||||
static constexpr char X8_U_LOWER_BOUND_K[] = "x8VoltLowerBound";
|
|
||||||
static constexpr char X8_U_UPPER_BOUND_K[] = "x8VoltUpperBound";
|
|
||||||
static constexpr char X8_I_UPPER_BOUND_K[] = "x8CurrUpperBound";
|
|
||||||
|
|
||||||
static constexpr char TX_U_LOWER_BOUND_K[] = "txVoltLowerBound";
|
|
||||||
static constexpr char TX_U_UPPER_BOUND_K[] = "txVoltUpperBound";
|
|
||||||
static constexpr char TX_I_UPPER_BOUND_K[] = "txCurrUpperBound";
|
|
||||||
|
|
||||||
static constexpr char MPA_U_LOWER_BOUND_K[] = "mpaVoltLowerBound";
|
|
||||||
static constexpr char MPA_U_UPPER_BOUND_K[] = "mpaVoltUpperBound";
|
|
||||||
static constexpr char MPA_I_UPPER_BOUND_K[] = "mpaCurrUpperBound";
|
|
||||||
|
|
||||||
static constexpr char HPA_U_LOWER_BOUND_K[] = "hpaVoltLowerBound";
|
|
||||||
static constexpr char HPA_U_UPPER_BOUND_K[] = "hpaVoltUpperBound";
|
|
||||||
static constexpr char HPA_I_UPPER_BOUND_K[] = "hpaCurrUpperBound";
|
|
||||||
|
|
||||||
PlPcduParameter() : NVMParameterBase(""), mountPrefix("") {
|
PlPcduParameter() : NVMParameterBase(""), mountPrefix("") {
|
||||||
|
using namespace plpcdu;
|
||||||
// Initialize with default values
|
// Initialize with default values
|
||||||
insertValue(SSR_TO_DRO_WAIT_TIME_K, SSR_TO_DRO_WAIT_TIME);
|
insertValue(PARAM_KEY_MAP[SSR_TO_DRO_WAIT_TIME], DFT_SSR_TO_DRO_WAIT_TIME);
|
||||||
insertValue(DRO_TO_X8_WAIT_TIME_K, DRO_TO_X8_WAIT_TIME);
|
insertValue(PARAM_KEY_MAP[DRO_TO_X8_WAIT_TIME], DFT_DRO_TO_X8_WAIT_TIME);
|
||||||
insertValue(X8_TO_TX_WAIT_TIME_K, X8_TO_TX_WAIT_TIME);
|
insertValue(PARAM_KEY_MAP[X8_TO_TX_WAIT_TIME], DFT_X8_TO_TX_WAIT_TIME);
|
||||||
insertValue(TX_TO_MPA_WAIT_TIME_K, TX_TO_MPA_WAIT_TIME);
|
insertValue(PARAM_KEY_MAP[TX_TO_MPA_WAIT_TIME], DFT_TX_TO_MPA_WAIT_TIME);
|
||||||
insertValue(MPA_TO_HPA_WAIT_TIME_K, MPA_TO_HPA_WAIT_TIME);
|
insertValue(PARAM_KEY_MAP[MPA_TO_HPA_WAIT_TIME], DFT_MPA_TO_HPA_WAIT_TIME);
|
||||||
insertValue(NEG_V_LOWER_BOUND_K, NEG_V_LOWER_BOUND);
|
insertValue(PARAM_KEY_MAP[NEG_V_LOWER_BOUND], DFT_NEG_V_LOWER_BOUND);
|
||||||
insertValue(NEG_V_UPPER_BOUND_K, NEG_V_UPPER_BOUND);
|
insertValue(PARAM_KEY_MAP[NEG_V_UPPER_BOUND], DFT_NEG_V_UPPER_BOUND);
|
||||||
insertValue(DRO_U_LOWER_BOUND_K, DRO_U_LOWER_BOUND);
|
insertValue(PARAM_KEY_MAP[DRO_U_LOWER_BOUND], DFT_DRO_U_LOWER_BOUND);
|
||||||
insertValue(DRO_U_UPPER_BOUND_K, DRO_U_UPPER_BOUND);
|
insertValue(PARAM_KEY_MAP[DRO_U_UPPER_BOUND], DFT_DRO_U_UPPER_BOUND);
|
||||||
insertValue(DRO_I_UPPER_BOUND_K, DRO_I_UPPER_BOUND);
|
insertValue(PARAM_KEY_MAP[DRO_I_UPPER_BOUND], DFT_DRO_I_UPPER_BOUND);
|
||||||
insertValue(X8_U_LOWER_BOUND_K, X8_U_LOWER_BOUND);
|
insertValue(PARAM_KEY_MAP[X8_U_LOWER_BOUND], DFT_X8_U_LOWER_BOUND);
|
||||||
insertValue(X8_U_UPPER_BOUND_K, X8_U_UPPER_BOUND);
|
insertValue(PARAM_KEY_MAP[X8_U_UPPER_BOUND], DFT_X8_U_UPPER_BOUND);
|
||||||
insertValue(X8_I_UPPER_BOUND_K, X8_I_UPPER_BOUND);
|
insertValue(PARAM_KEY_MAP[X8_I_UPPER_BOUND], DFT_X8_I_UPPER_BOUND);
|
||||||
insertValue(TX_U_LOWER_BOUND_K, TX_U_LOWER_BOUND);
|
insertValue(PARAM_KEY_MAP[TX_U_LOWER_BOUND], DFT_TX_U_LOWER_BOUND);
|
||||||
insertValue(TX_U_UPPER_BOUND_K, TX_U_UPPER_BOUND);
|
insertValue(PARAM_KEY_MAP[TX_U_UPPER_BOUND], DFT_TX_U_UPPER_BOUND);
|
||||||
insertValue(TX_I_UPPER_BOUND_K, TX_I_UPPER_BOUND);
|
insertValue(PARAM_KEY_MAP[TX_I_UPPER_BOUND], DFT_TX_I_UPPER_BOUND);
|
||||||
insertValue(MPA_U_LOWER_BOUND_K, MPA_U_LOWER_BOUND);
|
insertValue(PARAM_KEY_MAP[MPA_U_LOWER_BOUND], DFT_MPA_U_LOWER_BOUND);
|
||||||
insertValue(MPA_U_UPPER_BOUND_K, MPA_U_UPPER_BOUND);
|
insertValue(PARAM_KEY_MAP[MPA_U_UPPER_BOUND], DFT_MPA_U_UPPER_BOUND);
|
||||||
insertValue(MPA_I_UPPER_BOUND_K, MPA_I_UPPER_BOUND);
|
insertValue(PARAM_KEY_MAP[MPA_I_UPPER_BOUND], DFT_MPA_I_UPPER_BOUND);
|
||||||
insertValue(HPA_U_LOWER_BOUND_K, HPA_U_LOWER_BOUND);
|
insertValue(PARAM_KEY_MAP[HPA_U_LOWER_BOUND], DFT_HPA_U_LOWER_BOUND);
|
||||||
insertValue(HPA_U_UPPER_BOUND_K, HPA_U_UPPER_BOUND);
|
insertValue(PARAM_KEY_MAP[HPA_U_UPPER_BOUND], DFT_HPA_U_UPPER_BOUND);
|
||||||
insertValue(HPA_I_UPPER_BOUND_K, HPA_I_UPPER_BOUND);
|
insertValue(PARAM_KEY_MAP[HPA_I_UPPER_BOUND], DFT_HPA_I_UPPER_BOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t initialize(std::string mountPrefix) {
|
ReturnValue_t initialize(std::string mountPrefix) {
|
||||||
|
Loading…
Reference in New Issue
Block a user