Skip to content

Commit

Permalink
Updated logic flow to allow for variables to set the charging station…
Browse files Browse the repository at this point in the history
… offline, since a 'fake' online status can have the consequence of events being dropped

Signed-off-by: AssemblyJohn <[email protected]>
  • Loading branch information
AssemblyJohn committed Aug 8, 2024
1 parent 0ed12bc commit 8226e52
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/ocpp/v201/charge_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1758,9 +1758,6 @@ void ChargePoint::handle_variable_changed(const SetVariableData& set_variable_da
}

void ChargePoint::handle_variables_changed(const std::map<SetVariableData, SetVariableResult>& set_variable_results) {
// process all triggered monitors
this->monitoring_updater.process_triggered_monitors();

// iterate over set_variable_results
for (const auto& [set_variable_data, set_variable_result] : set_variable_results) {
if (set_variable_result.attributeStatus == SetVariableStatusEnum::Accepted) {
Expand All @@ -1774,6 +1771,9 @@ void ChargePoint::handle_variables_changed(const std::map<SetVariableData, SetVa
}
}
}

// process all triggered monitors, after a possible disconnect
this->monitoring_updater.process_triggered_monitors();
}

bool ChargePoint::validate_set_variable(const SetVariableData& set_variable_data) {
Expand Down
6 changes: 4 additions & 2 deletions lib/ocpp/v201/monitoring_updater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ std::chrono::time_point<std::chrono::system_clock> get_next_clock_aligned_point(

auto dbg_time_now = std::chrono::system_clock::to_time_t(sys_time_now);
auto dbg_time_aligned = std::chrono::system_clock::to_time_t(aligned_timepoint);
EVLOG_info << "Aligned time: " << std::ctime(&dbg_time_now) << " with interval: " << monitor_seconds.count()
<< " to next timepoint: " << std::ctime(&dbg_time_aligned);
EVLOG_debug << "Aligned time: " << std::ctime(&dbg_time_now) << " with interval: " << monitor_seconds.count()
<< " to next timepoint: " << std::ctime(&dbg_time_aligned);

return aligned_timepoint;
}
Expand Down Expand Up @@ -544,6 +544,8 @@ void MonitoringUpdater::process_monitors_internal(bool allow_periodics, bool all
}
}

EVLOG_debug << "Monitor: " << updater_monitor_meta.monitor_meta.monitor << " processed: " << should_process;

if (!should_process) {
if (updater_monitor_meta.type == UpdateMonitorMetaType::TRIGGER) {
// The triggers that are not active, should simply pe discarded
Expand Down

0 comments on commit 8226e52

Please sign in to comment.