demandhandler typo fixed
This commit is contained in:
@@ -6,20 +6,20 @@
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
using namespace DemanHandlerConfig;
|
||||
using namespace DemandHandlerConfig;
|
||||
|
||||
bool DemandHandler::init() {
|
||||
bool initSuccess = true;
|
||||
|
||||
if (!midas::odb::exists(this->path + "/" + DemanHandlerConfig::DEMAND)) {
|
||||
if (!midas::odb::exists(this->path + "/" + DemandHandlerConfig::DEMAND)) {
|
||||
TMFE::Instance()->Msg(MERROR, __FUNCTION__,
|
||||
"Key at %s/%s doesn't exists", path.c_str(),
|
||||
DemanHandlerConfig::DEMAND.c_str());
|
||||
DemandHandlerConfig::DEMAND.c_str());
|
||||
|
||||
midas::odb o(this->path);
|
||||
std::vector<float> v;
|
||||
v.resize(static_cast<int>(ParameterIndex::MAXIMUM_PARAMETER_INDEX));
|
||||
o[DemanHandlerConfig::DEMAND] = v;
|
||||
o[DemandHandlerConfig::DEMAND] = v;
|
||||
|
||||
TMFE::Instance()->Msg(MERROR, __FUNCTION__,
|
||||
"Template generated at %s. Please fill it.",
|
||||
@@ -31,7 +31,7 @@ bool DemandHandler::init() {
|
||||
|
||||
// This is checked every start, in case of someone change the index in the
|
||||
// config header
|
||||
if (o[DemanHandlerConfig::DEMAND].size() <
|
||||
if (o[DemandHandlerConfig::DEMAND].size() <
|
||||
static_cast<int>(ParameterIndex::MINIMAL_PRESSURE)) {
|
||||
TMFE::Instance()->Msg(
|
||||
MERROR, __FUNCTION__,
|
||||
@@ -39,7 +39,7 @@ bool DemandHandler::init() {
|
||||
static_cast<int>(ParameterIndex::MINIMAL_PRESSURE), o.size());
|
||||
initSuccess = false;
|
||||
}
|
||||
if (o[DemanHandlerConfig::DEMAND].size() <
|
||||
if (o[DemandHandlerConfig::DEMAND].size() <
|
||||
static_cast<int>(ParameterIndex::MAXIMAL_PRESSURE)) {
|
||||
TMFE::Instance()->Msg(
|
||||
MERROR, __FUNCTION__,
|
||||
@@ -47,7 +47,7 @@ bool DemandHandler::init() {
|
||||
static_cast<int>(ParameterIndex::MAXIMAL_PRESSURE), o.size());
|
||||
initSuccess = false;
|
||||
}
|
||||
if (o[DemanHandlerConfig::DEMAND].size() <
|
||||
if (o[DemandHandlerConfig::DEMAND].size() <
|
||||
static_cast<int>(ParameterIndex::CONSTANTE_1)) {
|
||||
TMFE::Instance()->Msg(
|
||||
MERROR, __FUNCTION__,
|
||||
@@ -55,7 +55,7 @@ bool DemandHandler::init() {
|
||||
static_cast<int>(ParameterIndex::CONSTANTE_1), o.size());
|
||||
initSuccess = false;
|
||||
}
|
||||
if (o[DemanHandlerConfig::DEMAND].size() <
|
||||
if (o[DemandHandlerConfig::DEMAND].size() <
|
||||
static_cast<int>(ParameterIndex::CONSTANTE_2)) {
|
||||
TMFE::Instance()->Msg(
|
||||
MERROR, __FUNCTION__,
|
||||
@@ -63,7 +63,7 @@ bool DemandHandler::init() {
|
||||
static_cast<int>(ParameterIndex::CONSTANTE_2), o.size());
|
||||
initSuccess = false;
|
||||
}
|
||||
if (o[DemanHandlerConfig::DEMAND].size() <
|
||||
if (o[DemandHandlerConfig::DEMAND].size() <
|
||||
static_cast<int>(ParameterIndex::PRESSURE_CONTROL_MODE)) {
|
||||
TMFE::Instance()->Msg(
|
||||
MERROR, __FUNCTION__,
|
||||
@@ -71,7 +71,7 @@ bool DemandHandler::init() {
|
||||
static_cast<int>(ParameterIndex::PRESSURE_CONTROL_MODE), o.size());
|
||||
initSuccess = false;
|
||||
}
|
||||
if (o[DemanHandlerConfig::DEMAND].size() <
|
||||
if (o[DemandHandlerConfig::DEMAND].size() <
|
||||
static_cast<int>(ParameterIndex::SET_PRESSURE)) {
|
||||
TMFE::Instance()->Msg(
|
||||
MERROR, __FUNCTION__,
|
||||
@@ -93,7 +93,7 @@ bool DemandHandler::init() {
|
||||
}
|
||||
|
||||
bool DemandHandler::setHotlink() {
|
||||
midas::odb to_watch(this->path + "/" + DemanHandlerConfig::DEMAND);
|
||||
midas::odb to_watch(this->path + "/" + DemandHandlerConfig::DEMAND);
|
||||
to_watch.watch([&](midas::odb &arg) {
|
||||
switch (arg.get_last_index()) {
|
||||
case static_cast<int>(ParameterIndex::MINIMAL_PRESSURE):
|
||||
@@ -125,7 +125,7 @@ bool DemandHandler::setHotlink() {
|
||||
void DemandHandler::pullMinimalPressure() {
|
||||
midas::odb o(this->path);
|
||||
float minimalPressure =
|
||||
o[DemanHandlerConfig::DEMAND]
|
||||
o[DemandHandlerConfig::DEMAND]
|
||||
[static_cast<int>(ParameterIndex::MINIMAL_PRESSURE)];
|
||||
Event event = {EventType::MINIMAL_PRESSURE, minimalPressure};
|
||||
eventBus.publish(event);
|
||||
@@ -134,7 +134,7 @@ void DemandHandler::pullMinimalPressure() {
|
||||
void DemandHandler::pullMaximalPressure() {
|
||||
midas::odb o(this->path);
|
||||
float maximalPressure =
|
||||
o[DemanHandlerConfig::DEMAND]
|
||||
o[DemandHandlerConfig::DEMAND]
|
||||
[static_cast<int>(ParameterIndex::MAXIMAL_PRESSURE)];
|
||||
Event event = {EventType::MAXIMAL_PRESSURE, maximalPressure};
|
||||
eventBus.publish(event);
|
||||
@@ -142,7 +142,7 @@ void DemandHandler::pullMaximalPressure() {
|
||||
|
||||
void DemandHandler::pullConstante1() {
|
||||
midas::odb o(this->path);
|
||||
float constante1 = o[DemanHandlerConfig::DEMAND]
|
||||
float constante1 = o[DemandHandlerConfig::DEMAND]
|
||||
[static_cast<int>(ParameterIndex::CONSTANTE_1)];
|
||||
Event event = {EventType::CONSTANTE_1, constante1};
|
||||
eventBus.publish(event);
|
||||
@@ -150,7 +150,7 @@ void DemandHandler::pullConstante1() {
|
||||
|
||||
void DemandHandler::pullConstante2() {
|
||||
midas::odb o(this->path);
|
||||
float constance2 = o[DemanHandlerConfig::DEMAND]
|
||||
float constance2 = o[DemandHandlerConfig::DEMAND]
|
||||
[static_cast<int>(ParameterIndex::CONSTANTE_2)];
|
||||
Event event = {EventType::CONSTANTE_2, constance2};
|
||||
eventBus.publish(event);
|
||||
@@ -159,7 +159,7 @@ void DemandHandler::pullConstante2() {
|
||||
void DemandHandler::pullPressureControlMode() {
|
||||
midas::odb o(this->path);
|
||||
float pressureControlMode =
|
||||
o[DemanHandlerConfig::DEMAND]
|
||||
o[DemandHandlerConfig::DEMAND]
|
||||
[static_cast<int>(ParameterIndex::PRESSURE_CONTROL_MODE)];
|
||||
Event event = {EventType::PRESSURE_CONTROL_MODE, pressureControlMode != 0};
|
||||
eventBus.publish(event);
|
||||
@@ -167,7 +167,7 @@ void DemandHandler::pullPressureControlMode() {
|
||||
|
||||
void DemandHandler::pullSetPressure() {
|
||||
midas::odb o(this->path);
|
||||
float setPressure = o[DemanHandlerConfig::DEMAND]
|
||||
float setPressure = o[DemandHandlerConfig::DEMAND]
|
||||
[static_cast<int>(ParameterIndex::SET_PRESSURE)];
|
||||
Event event = {EventType::SET_PRESSURE, setPressure != 0};
|
||||
eventBus.publish(event);
|
||||
@@ -175,8 +175,8 @@ void DemandHandler::pullSetPressure() {
|
||||
|
||||
DemandHandler::DemandHandler(EventBus &eventBusReference,
|
||||
std::string equipmentName)
|
||||
: path(DemanHandlerConfig::PATH_PREFIX + equipmentName +
|
||||
DemanHandlerConfig::PATH_SUFFIX),
|
||||
: path(DemandHandlerConfig::PATH_PREFIX + equipmentName +
|
||||
DemandHandlerConfig::PATH_SUFFIX),
|
||||
eventBus(eventBusReference) {
|
||||
|
||||
eventBus.subscribe<itcPressureOptimizer::EquipmentInitEvent>(
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace DemanHandlerConfig {
|
||||
namespace DemandHandlerConfig {
|
||||
const std::string PATH_PREFIX = "/Equipment/";
|
||||
const std::string PATH_SUFFIX = "/Variables";
|
||||
const std::string DEMAND = "Demand";
|
||||
@@ -19,6 +19,6 @@ enum class ParameterIndex {
|
||||
MAXIMUM_PARAMETER_INDEX = 11
|
||||
};
|
||||
|
||||
}; // namespace DemanHandlerConfig
|
||||
}; // namespace DemandHandlerConfig
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user