constante is without a e in English, add Enable in front of data type

This commit is contained in:
2026-07-28 11:19:39 +02:00
parent b55668f056
commit 4927bd73dd
9 changed files with 61 additions and 65 deletions
+25 -24
View File
@@ -48,19 +48,19 @@ bool DemandHandler::init() {
initSuccess = false;
}
if (o[DemandHandlerConfig::DEMAND].size() <
static_cast<int>(ParameterIndex::CONSTANTE_1)) {
TMFE::Instance()->Msg(
MERROR, __FUNCTION__,
"Constante 1 index is %i, where array size is %i.",
static_cast<int>(ParameterIndex::CONSTANTE_1), o.size());
static_cast<int>(ParameterIndex::CONSTANT_1)) {
TMFE::Instance()->Msg(MERROR, __FUNCTION__,
"Constant 1 index is %i, where array size is %i.",
static_cast<int>(ParameterIndex::CONSTANT_1),
o.size());
initSuccess = false;
}
if (o[DemandHandlerConfig::DEMAND].size() <
static_cast<int>(ParameterIndex::CONSTANTE_2)) {
TMFE::Instance()->Msg(
MERROR, __FUNCTION__,
"Constante 2 index is %i, where array size is %i.",
static_cast<int>(ParameterIndex::CONSTANTE_2), o.size());
static_cast<int>(ParameterIndex::CONSTANT_2)) {
TMFE::Instance()->Msg(MERROR, __FUNCTION__,
"Constant 2 index is %i, where array size is %i.",
static_cast<int>(ParameterIndex::CONSTANT_2),
o.size());
initSuccess = false;
}
if (o[DemandHandlerConfig::DEMAND].size() <
@@ -86,8 +86,8 @@ bool DemandHandler::init() {
this->pullMinimalPressure();
this->pullMaximalPressure();
this->pullConstante1();
this->pullConstante2();
this->pullConstant1();
this->pullConstant2();
this->pullPressureControlMode();
return true;
}
@@ -102,11 +102,11 @@ bool DemandHandler::setHotlink() {
case static_cast<int>(ParameterIndex::MAXIMAL_PRESSURE):
pullMaximalPressure();
break;
case static_cast<int>(ParameterIndex::CONSTANTE_1):
pullConstante1();
case static_cast<int>(ParameterIndex::CONSTANT_1):
pullConstant1();
break;
case static_cast<int>(ParameterIndex::CONSTANTE_2):
pullConstante2();
case static_cast<int>(ParameterIndex::CONSTANT_2):
pullConstant2();
break;
case static_cast<int>(ParameterIndex::PRESSURE_CONTROL_MODE):
pullPressureControlMode();
@@ -140,19 +140,19 @@ void DemandHandler::pullMaximalPressure() {
eventBus.publish(event);
}
void DemandHandler::pullConstante1() {
void DemandHandler::pullConstant1() {
midas::odb o(this->path);
float constante1 = o[DemandHandlerConfig::DEMAND]
[static_cast<int>(ParameterIndex::CONSTANTE_1)];
Event event = {EventType::CONSTANTE_1, constante1};
[static_cast<int>(ParameterIndex::CONSTANT_1)];
Event event = {EventType::CONSTANT_1, constante1};
eventBus.publish(event);
}
void DemandHandler::pullConstante2() {
void DemandHandler::pullConstant2() {
midas::odb o(this->path);
float constance2 = o[DemandHandlerConfig::DEMAND]
[static_cast<int>(ParameterIndex::CONSTANTE_2)];
Event event = {EventType::CONSTANTE_2, constance2};
[static_cast<int>(ParameterIndex::CONSTANT_2)];
Event event = {EventType::CONSTANT_2, constance2};
eventBus.publish(event);
}
@@ -161,7 +161,8 @@ void DemandHandler::pullPressureControlMode() {
float pressureControlMode =
o[DemandHandlerConfig::DEMAND]
[static_cast<int>(ParameterIndex::PRESSURE_CONTROL_MODE)];
Event event = {EventType::PRESSURE_CONTROL_MODE, pressureControlMode != 0};
Event event = {EventType::ENABLE_PRESSURE_CONTROL_MODE,
pressureControlMode != 0};
eventBus.publish(event);
}
@@ -169,7 +170,7 @@ void DemandHandler::pullSetPressure() {
midas::odb o(this->path);
float setPressure = o[DemandHandlerConfig::DEMAND]
[static_cast<int>(ParameterIndex::SET_PRESSURE)];
Event event = {EventType::SET_PRESSURE, setPressure != 0};
Event event = {EventType::ENABLE_SET_PRESSURE, setPressure != 0};
eventBus.publish(event);
}
+6 -6
View File
@@ -10,10 +10,10 @@ class DemandHandler {
enum class EventType {
MINIMAL_PRESSURE,
MAXIMAL_PRESSURE,
CONSTANTE_1,
CONSTANTE_2,
PRESSURE_CONTROL_MODE,
SET_PRESSURE
CONSTANT_1,
CONSTANT_2,
ENABLE_PRESSURE_CONTROL_MODE,
ENABLE_SET_PRESSURE
};
struct Event {
@@ -32,8 +32,8 @@ class DemandHandler {
*/
void pullMinimalPressure();
void pullMaximalPressure();
void pullConstante1();
void pullConstante2();
void pullConstant1();
void pullConstant2();
void pullPressureControlMode();
void pullSetPressure();
+2 -2
View File
@@ -14,8 +14,8 @@ enum class ParameterIndex {
SET_PRESSURE = 7,
MINIMAL_PRESSURE = 8,
MAXIMAL_PRESSURE = 9,
CONSTANTE_1 = 10,
CONSTANTE_2 = 11,
CONSTANT_1 = 10,
CONSTANT_2 = 11,
MAXIMUM_PARAMETER_INDEX = 11
};
+8 -10
View File
@@ -17,10 +17,10 @@ FeedbackHandler::FeedbackHandler(EventBus &eventBusReference,
[this](const DemandHandler::Event &e) {
generateOdbKeyIfNeeded();
switch (e.type) {
case DemandHandler::EventType::PRESSURE_CONTROL_MODE:
case DemandHandler::EventType::ENABLE_PRESSURE_CONTROL_MODE:
enablePressureControlMode(std::get<bool>(e.value));
break;
case DemandHandler::EventType::SET_PRESSURE:
case DemandHandler::EventType::ENABLE_SET_PRESSURE:
enableSetPressure(std::get<bool>(e.value));
break;
default:
@@ -48,8 +48,8 @@ FeedbackHandler::FeedbackHandler(EventBus &eventBusReference,
eventBusReference.subscribe<PressureCalculator::Event>(
[this](const PressureCalculator::Event &e) {
generateOdbKeyIfNeeded();
setConstante1(e.c1contrib);
setConstante2(e.c2contrib);
setConstant1(e.c1contrib);
setConstant2(e.c2contrib);
setPressureMinimum(e.uncapedPressure);
setPressureMaximum(e.uncapedPressure);
setPressure(e.cappedPressure);
@@ -109,11 +109,10 @@ void FeedbackHandler::setPressure(float value) {
updatePressure();
}
void FeedbackHandler::setConstante1(float value) {
void FeedbackHandler::setConstant1(float value) {
midas::odb o(path);
o[FeedbackHandlerConf::OUTPUT_VARNAME]
[static_cast<int>(FeedbackHandlerConf::RegisterIndex::CONSTANTE_1)] =
value;
[static_cast<int>(FeedbackHandlerConf::RegisterIndex::CONSTANT_1)] = value;
}
void FeedbackHandler::setAveragePower(float value) {
midas::odb o(path);
@@ -122,11 +121,10 @@ void FeedbackHandler::setAveragePower(float value) {
value;
}
void FeedbackHandler::setConstante2(float value) {
void FeedbackHandler::setConstant2(float value) {
midas::odb o(path);
o[FeedbackHandlerConf::OUTPUT_VARNAME]
[static_cast<int>(FeedbackHandlerConf::RegisterIndex::CONSTANTE_2)] =
value;
[static_cast<int>(FeedbackHandlerConf::RegisterIndex::CONSTANT_2)] = value;
}
void FeedbackHandler::setPressureMinimum(float value) {
+2 -2
View File
@@ -30,8 +30,8 @@ class FeedbackHandler {
void setPower(float value);
void setAveragePower(float value);
void setPressure(float value);
void setConstante1(float value);
void setConstante2(float value);
void setConstant1(float value);
void setConstant2(float value);
/*
Update pressure value
+2 -2
View File
@@ -19,8 +19,8 @@ enum class RegisterIndex {
PRESSURE = 5,
MINIMUM_PRESSURE = 8,
MAXIMUM_PRESSURE = 9,
CONSTANTE_1 = 10,
CONSTANTE_2 = 11,
CONSTANT_1 = 10,
CONSTANT_2 = 11,
MAXIMUM_REGISTRY_INDEX =
11 // Used as a safety guard for undersize array. Put this enum member
// always as the same value as the highest member
+1 -4
View File
@@ -58,9 +58,6 @@ void OutputHandler::update() {
isIndexValid = true;
}
//// SHOULD I CRASH IF KEY NOT VALID ?
//// FOR NOW, FAILED SILENTLY
if (isSetPressureEnable && isKeyValid)
o(OutputHandlerConfig::OUTPUT_VARIABLE)[outputPressureSPIndex] =
pressure;
@@ -71,7 +68,7 @@ OutputHandler::OutputHandler(EventBus &eventBusReference) {
eventBusReference.subscribe<DemandHandler::Event>(
[this](const DemandHandler::Event &e) {
switch (e.type) {
case DemandHandler::EventType::SET_PRESSURE:
case DemandHandler::EventType::ENABLE_SET_PRESSURE:
enableSetPressure(std::get<bool>(e.value));
break;
default:
+11 -11
View File
@@ -7,15 +7,15 @@
void PressureCalculator::update() {
double averagePower = average.getAverage();
double c2contrib = averagePower * cachedConstante2;
double c2contrib = averagePower * cachedConstant2;
double c1contrib =
cachedConstante1 * (cachedTemperature - cachedSP - c2contrib);
cachedConstant1 * (cachedTemperature - cachedSP - c2contrib);
double uncapedPressure = cachedMinimalPressure + c1contrib;
double cappedPressure = uncapedPressure;
if (c2contrib != 0) {
c2contrib = -c2contrib * cachedConstante1;
c2contrib = -c2contrib * cachedConstant1;
} else {
c2contrib = 0.0f;
}
@@ -48,11 +48,11 @@ PressureCalculator::PressureCalculator(EventBus &eventBusReference)
case DemandHandler::EventType::MAXIMAL_PRESSURE:
updateMaximalPressure(std::get<float>(e.value));
break;
case DemandHandler::EventType::CONSTANTE_1:
updateConstante1(std::get<float>(e.value));
case DemandHandler::EventType::CONSTANT_1:
updateConstant1(std::get<float>(e.value));
break;
case DemandHandler::EventType::CONSTANTE_2:
updateConstante2(std::get<float>(e.value));
case DemandHandler::EventType::CONSTANT_2:
updateConstant2(std::get<float>(e.value));
break;
default:
break;
@@ -108,12 +108,12 @@ void PressureCalculator::updateMaximalPressure(float value) {
update();
}
void PressureCalculator::updateConstante1(float value) {
cachedConstante1 = value;
void PressureCalculator::updateConstant1(float value) {
cachedConstant1 = value;
update();
}
void PressureCalculator::updateConstante2(float value) {
cachedConstante2 = value;
void PressureCalculator::updateConstant2(float value) {
cachedConstant2 = value;
update();
}
+4 -4
View File
@@ -26,8 +26,8 @@ class PressureCalculator {
float cachedMinimalPressure;
float cachedMaximalPressure;
float cachedConstante1;
float cachedConstante2;
float cachedConstant1;
float cachedConstant2;
/*
Internal value setters (from InputHandler)
@@ -40,8 +40,8 @@ class PressureCalculator {
*/
void updateMinimalPressure(float value);
void updateMaximalPressure(float value);
void updateConstante1(float value);
void updateConstante2(float value);
void updateConstant1(float value);
void updateConstant2(float value);
/*
Update pressure value