SoC Calculator #754
@ -1,4 +1,3 @@
|
||||
|
||||
#include <mission/controller/PowerController.h>
|
||||
|
||||
PowerController::PowerController(object_id_t objectId, bool enableHkSets)
|
||||
@ -89,6 +88,9 @@ void PowerController::performControlOperation() {
|
||||
// if (mode != MODE_OFF) {
|
||||
sif::debug << "oh shit, now i gotta do something" << std::endl;
|
||||
calculateStateOfCharge();
|
||||
if (mode == MODE_NORMAL) {
|
||||
watchStateOfCharge();
|
||||
}
|
||||
// do something
|
||||
//}
|
||||
break;
|
||||
@ -204,9 +206,13 @@ void PowerController::calculateStateOfCharge() {
|
||||
}
|
||||
}
|
||||
|
||||
void PowerController::watchStateOfCharge() {
|
||||
// ToDo: FDIR
|
||||
}
|
||||
|
||||
ReturnValue_t PowerController::calculateOpenCircuitVoltageCharge() {
|
||||
float vBatCorrected = p60CoreHk.batteryVoltage.value - iBat * batteryInternalResistance;
|
||||
uint8_t lookUpTableIdx = 99;
|
||||
uint8_t lookUpTableIdx = LOOK_UP_TABLE_MAX_IDX;
|
||||
ReturnValue_t result = lookUpTableOcvIdxFinder(vBatCorrected, lookUpTableIdx);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
@ -289,7 +295,7 @@ ReturnValue_t PowerController::lookUpTableOcvIdxFinder(float voltage, uint8_t &i
|
||||
}
|
||||
|
||||
ReturnValue_t PowerController::calculateCoulombCounterChargeUpperThreshold() {
|
||||
uint8_t lookUpTableIdx = 99;
|
||||
uint8_t lookUpTableIdx = LOOK_UP_TABLE_MAX_IDX;
|
||||
ReturnValue_t result =
|
||||
lookUpTableOcvIdxFinder(coulombCounterVoltageUpperThreshold, lookUpTableIdx);
|
||||
if (result != returnvalue::OK) {
|
||||
|
@ -43,6 +43,7 @@ class PowerController : public ExtendedControllerBase, public ReceivesParameterM
|
||||
void performControlOperation() override;
|
||||
|
||||
void calculateStateOfCharge();
|
||||
void watchStateOfCharge();
|
||||
ReturnValue_t calculateOpenCircuitVoltageCharge();
|
||||
ReturnValue_t calculateCoulombCounterCharge();
|
||||
ReturnValue_t updateEpsData();
|
||||
@ -58,6 +59,7 @@ class PowerController : public ExtendedControllerBase, public ReceivesParameterM
|
||||
double maxAllowedTimeDiff = 0.5; // [s]
|
||||
|
||||
// OCV Look-up-Table
|
||||
static constexpr uint8_t LOOK_UP_TABLE_MAX_IDX = 99;
|
||||
float lookUpTableOcv[2][100] = {
|
||||
{0.00000000e+00, 3.16227766e-04, 4.52809661e-04, 6.48382625e-04, 9.28425483e-04,
|
||||
1.32942162e-03, 1.90361194e-03, 2.72580074e-03, 3.90310099e-03, 5.58888885e-03,
|
||||
|
Loading…
Reference in New Issue
Block a user