some fixes for pl pcdu

This commit is contained in:
Robin Müller 2022-03-03 19:34:52 +01:00
parent 42d3ebe1b0
commit b44442b282
6 changed files with 20 additions and 13 deletions

View File

@ -6,8 +6,8 @@
#include "OBSWConfig.h"
#include "fsfw/timemanager/Countdown.h"
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
#include "mission/utility/Timestamp.h"
#include "mission/utility/ProgressPrinter.h"
#include "mission/utility/Timestamp.h"
StrHelper::StrHelper(object_id_t objectId) : SystemObject(objectId) {}

View File

@ -204,7 +204,7 @@ void PayloadPcduHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
}
}
void PayloadPcduHandler::doShutDown() { transitionBackToOff(); }
void PayloadPcduHandler::doShutDown() { transitionBackToOff(false); }
ReturnValue_t PayloadPcduHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
switch (adcState) {
@ -388,7 +388,7 @@ void PayloadPcduHandler::enablePeriodicPrintout(bool enable, uint8_t divider) {
opDivider.setDivider(divider);
}
void PayloadPcduHandler::transitionBackToOff() {
void PayloadPcduHandler::transitionBackToOff(bool notifyFdir) {
States currentState = state;
gpioIF->pullLow(gpioIds::PLPCDU_ENB_HPA);
gpioIF->pullLow(gpioIds::PLPCDU_ENB_MPA);
@ -401,8 +401,9 @@ void PayloadPcduHandler::transitionBackToOff() {
state = States::PCDU_OFF;
adcState = AdcStates::OFF;
setMode(MODE_OFF);
// Notify FDIR
triggerEvent(TRANSITION_BACK_TO_OFF, static_cast<uint32_t>(currentState));
if (notifyFdir) {
triggerEvent(TRANSITION_BACK_TO_OFF, static_cast<uint32_t>(currentState));
}
}
void PayloadPcduHandler::checkAdcValues() {
@ -443,6 +444,10 @@ void PayloadPcduHandler::checkAdcValues() {
}
params.getValue(PlPcduParameter::DRO_I_UPPER_BOUND_K, upperBound);
if (not checkCurrent(adcSet.processed[I_DRO], upperBound, I_DRO_OUT_OF_BOUNDS)) {
#if OBSW_VERBOSE_LEVEL >= 1
sif::warning << "Detected out of bounds current for DRO: " << adcSet.processed[I_DRO]
<< ", Raw: " << adcSet.channels[I_DRO] << std::endl;
#endif
return;
}
}
@ -524,7 +529,7 @@ bool PayloadPcduHandler::checkVoltage(float val, float lowerBound, float upperBo
serializeFloat(p2, val);
triggerEvent(event, tooLarge, p2);
transitionOk = false;
transitionBackToOff();
transitionBackToOff(true);
return false;
}
return true;
@ -536,7 +541,7 @@ bool PayloadPcduHandler::checkCurrent(float val, float upperBound, Event event)
serializeFloat(p2, val);
triggerEvent(event, true, p2);
transitionOk = false;
transitionBackToOff();
transitionBackToOff(true);
return false;
}
return true;

View File

@ -128,7 +128,7 @@ class PayloadPcduHandler : public DeviceHandlerBase {
void doStartUp() override;
void doShutDown() override;
// Main FDIR function which goes from any PL PCDU state back to all off
void transitionBackToOff();
void transitionBackToOff(bool notifyFdir);
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t* id) override;
void fillCommandAndReplyMap() override;
@ -145,6 +145,7 @@ class PayloadPcduHandler : public DeviceHandlerBase {
void handleExtConvRead(const uint8_t* bufStart);
void handlePrintout();
void checkAdcValues();
void handleOutOfBoundsPrintout();
void checkJsonFileInit();
void stateMachineToNormal();
bool checkVoltage(float val, float lowerBound, float upperBound, Event event);

View File

@ -70,7 +70,7 @@ static constexpr float R_SHUNT_HPA = 0.008;
static constexpr float R_SHUNT_MPA = 0.015;
static constexpr float R_SHUNT_TX = 0.05;
static constexpr float R_SHUNT_X8 = 0.015;
static constexpr float R_SHUNT_DRO = 0.022;
static constexpr float R_SHUNT_DRO = 0.22;
static constexpr float V_POS = 3.3;
static constexpr float VOLTAGE_DIV_U_NEG = (49.9 + 27.4) / 27.4;
static constexpr float MAX122X_SCALE = MAX122X_VREF / MAX122X_BIT;
@ -88,7 +88,8 @@ static constexpr double NEG_V_UPPER_BOUND = -2.7;
static constexpr double DRO_U_LOWER_BOUND = 5.0;
static constexpr double DRO_U_UPPER_BOUND = 7.0;
static constexpr double DRO_I_UPPER_BOUND = 40.0;
// Max Current DRO + Max Current Neg V | 40 + 15
static constexpr double DRO_I_UPPER_BOUND = 55.0;
static constexpr double X8_U_LOWER_BOUND = 2.6;
static constexpr double X8_U_UPPER_BOUND = 4.0;

View File

@ -1,11 +1,11 @@
#include "ProgressPrinter.h"
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
ProgressPrinter::ProgressPrinter(std::string name, uint32_t numSteps)
: name(name), numSteps(numSteps) {}
ProgressPrinter::~ProgressPrinter() {
}
ProgressPrinter::~ProgressPrinter() {}
void ProgressPrinter::print(uint32_t currentStep) {
float progressInPercent = static_cast<float>(currentStep) / static_cast<float>(numSteps) * 100;

2
tmtc

@ -1 +1 @@
Subproject commit 37c1a68da1b465514e84403b06ce40d035e4ad88
Subproject commit 9a487c7407eb450e3d07e1ddf3649a267ced99c2