Skip to content

Commit

Permalink
clang-format
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Lukas <[email protected]>
  • Loading branch information
SebaLukas committed Feb 14, 2025
1 parent beae6e3 commit c52a3b1
Show file tree
Hide file tree
Showing 24 changed files with 116 additions and 166 deletions.
12 changes: 4 additions & 8 deletions modules/DummyV2G/main/ISO15118_chargerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ void ISO15118_chargerImpl::handle_setup(
// your code for cmd setup goes here
}

void ISO15118_chargerImpl::handle_set_charging_parameters(
types::iso15118::SetupPhysicalValues& physical_values) {
void ISO15118_chargerImpl::handle_set_charging_parameters(types::iso15118::SetupPhysicalValues& physical_values) {
// your code for cmd set_charging_parameters goes here
}

Expand All @@ -29,8 +28,7 @@ void ISO15118_chargerImpl::handle_session_setup(std::vector<types::iso15118::Pay
// your code for cmd session_setup goes here
}

void ISO15118_chargerImpl::handle_certificate_response(
types::iso15118::ResponseExiStreamStatus& exi_stream_status) {
void ISO15118_chargerImpl::handle_certificate_response(types::iso15118::ResponseExiStreamStatus& exi_stream_status) {
// your code for cmd certificate_response goes here
}

Expand Down Expand Up @@ -64,13 +62,11 @@ void ISO15118_chargerImpl::handle_update_ac_max_current(double& max_current) {
// your code for cmd update_ac_max_current goes here
}

void ISO15118_chargerImpl::handle_update_dc_maximum_limits(
types::iso15118::DcEvseMaximumLimits& maximum_limits) {
void ISO15118_chargerImpl::handle_update_dc_maximum_limits(types::iso15118::DcEvseMaximumLimits& maximum_limits) {
// your code for cmd update_dc_maximum_limits goes here
}

void ISO15118_chargerImpl::handle_update_dc_minimum_limits(
types::iso15118::DcEvseMinimumLimits& minimum_limits) {
void ISO15118_chargerImpl::handle_update_dc_minimum_limits(types::iso15118::DcEvseMinimumLimits& minimum_limits) {
// your code for cmd update_dc_minimum_limits goes here
}

Expand Down
14 changes: 6 additions & 8 deletions modules/DummyV2G/main/ISO15118_chargerImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,13 @@ class ISO15118_chargerImpl : public ISO15118_chargerImplBase {

protected:
// command handler functions (virtual)
virtual void
handle_setup(types::iso15118::EVSEID& evse_id,
std::vector<types::iso15118::SupportedEnergyMode>& supported_energy_transfer_modes,
types::iso15118::SaeJ2847BidiMode& sae_j2847_mode, bool& debug_mode) override;
virtual void handle_setup(types::iso15118::EVSEID& evse_id,
std::vector<types::iso15118::SupportedEnergyMode>& supported_energy_transfer_modes,
types::iso15118::SaeJ2847BidiMode& sae_j2847_mode, bool& debug_mode) override;
virtual void handle_set_charging_parameters(types::iso15118::SetupPhysicalValues& physical_values) override;
virtual void handle_session_setup(std::vector<types::iso15118::PaymentOption>& payment_options,
bool& supported_certificate_service) override;
virtual void
handle_certificate_response(types::iso15118::ResponseExiStreamStatus& exi_stream_status) override;
virtual void handle_certificate_response(types::iso15118::ResponseExiStreamStatus& exi_stream_status) override;
virtual void handle_authorization_response(types::authorization::AuthorizationStatus& authorization_status,
types::authorization::CertificateStatus& certificate_status) override;
virtual void handle_ac_contactor_closed(bool& status) override;
Expand All @@ -53,8 +51,8 @@ class ISO15118_chargerImpl : public ISO15118_chargerImplBase {
virtual void handle_update_dc_maximum_limits(types::iso15118::DcEvseMaximumLimits& maximum_limits) override;
virtual void handle_update_dc_minimum_limits(types::iso15118::DcEvseMinimumLimits& minimum_limits) override;
virtual void handle_update_isolation_status(types::iso15118::IsolationStatus& isolation_status) override;
virtual void handle_update_dc_present_values(
types::iso15118::DcEvsePresentVoltageCurrent& present_voltage_current) override;
virtual void
handle_update_dc_present_values(types::iso15118::DcEvsePresentVoltageCurrent& present_voltage_current) override;
virtual void handle_update_meter_info(types::powermeter::Powermeter& powermeter) override;
virtual void handle_send_error(types::iso15118::EvseError& error) override;
virtual void handle_reset_error() override;
Expand Down
12 changes: 4 additions & 8 deletions modules/Evse15118D20/charger/ISO15118_chargerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,7 @@ void ISO15118_chargerImpl::handle_setup(
setup_steps_done.set(to_underlying_value(SetupStep::ENERGY_SERVICE));
}

void ISO15118_chargerImpl::handle_set_charging_parameters(
types::iso15118::SetupPhysicalValues& physical_values) {
void ISO15118_chargerImpl::handle_set_charging_parameters(types::iso15118::SetupPhysicalValues& physical_values) {
// your code for cmd set_charging_parameters goes here
}

Expand All @@ -370,8 +369,7 @@ void ISO15118_chargerImpl::handle_session_setup(std::vector<types::iso15118::Pay
setup_steps_done.set(to_underlying_value(SetupStep::AUTH_SETUP));
}

void ISO15118_chargerImpl::handle_certificate_response(
types::iso15118::ResponseExiStreamStatus& exi_stream_status) {
void ISO15118_chargerImpl::handle_certificate_response(types::iso15118::ResponseExiStreamStatus& exi_stream_status) {
// your code for cmd certificate_response goes here
}

Expand Down Expand Up @@ -424,8 +422,7 @@ void ISO15118_chargerImpl::handle_update_ac_max_current(double& max_current) {
// your code for cmd update_ac_max_current goes here
}

void ISO15118_chargerImpl::handle_update_dc_maximum_limits(
types::iso15118::DcEvseMaximumLimits& maximum_limits) {
void ISO15118_chargerImpl::handle_update_dc_maximum_limits(types::iso15118::DcEvseMaximumLimits& maximum_limits) {

std::scoped_lock lock(GEL);
setup_config.dc_limits.charge_limits.current.max = dt::from_float(maximum_limits.evse_maximum_current_limit);
Expand All @@ -452,8 +449,7 @@ void ISO15118_chargerImpl::handle_update_dc_maximum_limits(
setup_steps_done.set(to_underlying_value(SetupStep::MAX_LIMITS));
}

void ISO15118_chargerImpl::handle_update_dc_minimum_limits(
types::iso15118::DcEvseMinimumLimits& minimum_limits) {
void ISO15118_chargerImpl::handle_update_dc_minimum_limits(types::iso15118::DcEvseMinimumLimits& minimum_limits) {

std::scoped_lock lock(GEL);
setup_config.dc_limits.charge_limits.current.min = dt::from_float(minimum_limits.evse_minimum_current_limit);
Expand Down
14 changes: 6 additions & 8 deletions modules/Evse15118D20/charger/ISO15118_chargerImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,13 @@ class ISO15118_chargerImpl : public ISO15118_chargerImplBase {

protected:
// command handler functions (virtual)
virtual void
handle_setup(types::iso15118::EVSEID& evse_id,
std::vector<types::iso15118::SupportedEnergyMode>& supported_energy_transfer_modes,
types::iso15118::SaeJ2847BidiMode& sae_j2847_mode, bool& debug_mode) override;
virtual void handle_setup(types::iso15118::EVSEID& evse_id,
std::vector<types::iso15118::SupportedEnergyMode>& supported_energy_transfer_modes,
types::iso15118::SaeJ2847BidiMode& sae_j2847_mode, bool& debug_mode) override;
virtual void handle_set_charging_parameters(types::iso15118::SetupPhysicalValues& physical_values) override;
virtual void handle_session_setup(std::vector<types::iso15118::PaymentOption>& payment_options,
bool& supported_certificate_service) override;
virtual void
handle_certificate_response(types::iso15118::ResponseExiStreamStatus& exi_stream_status) override;
virtual void handle_certificate_response(types::iso15118::ResponseExiStreamStatus& exi_stream_status) override;
virtual void handle_authorization_response(types::authorization::AuthorizationStatus& authorization_status,
types::authorization::CertificateStatus& certificate_status) override;
virtual void handle_ac_contactor_closed(bool& status) override;
Expand All @@ -59,8 +57,8 @@ class ISO15118_chargerImpl : public ISO15118_chargerImplBase {
virtual void handle_update_dc_maximum_limits(types::iso15118::DcEvseMaximumLimits& maximum_limits) override;
virtual void handle_update_dc_minimum_limits(types::iso15118::DcEvseMinimumLimits& minimum_limits) override;
virtual void handle_update_isolation_status(types::iso15118::IsolationStatus& isolation_status) override;
virtual void handle_update_dc_present_values(
types::iso15118::DcEvsePresentVoltageCurrent& present_voltage_current) override;
virtual void
handle_update_dc_present_values(types::iso15118::DcEvsePresentVoltageCurrent& present_voltage_current) override;
virtual void handle_update_meter_info(types::powermeter::Powermeter& powermeter) override;
virtual void handle_send_error(types::iso15118::EvseError& error) override;
virtual void handle_reset_error() override;
Expand Down
3 changes: 1 addition & 2 deletions modules/EvseManager/Charger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1735,8 +1735,7 @@ void Charger::notify_currentdemand_started() {
}
}

void Charger::inform_new_evse_max_hlc_limits(
const types::iso15118::DcEvseMaximumLimits& _currentEvseMaxLimits) {
void Charger::inform_new_evse_max_hlc_limits(const types::iso15118::DcEvseMaximumLimits& _currentEvseMaxLimits) {
Everest::scoped_lock_timeout lock(state_machine_mutex,
Everest::MutexDescription::Charger_inform_new_evse_max_hlc_limits);
shared_context.current_evse_max_limits = _currentEvseMaxLimits;
Expand Down
67 changes: 33 additions & 34 deletions modules/EvseManager/EvseManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,47 +402,46 @@ void EvseManager::ready() {
}
});

r_hlc[0]->subscribe_d20_dc_dynamic_charge_mode(
[this](types::iso15118::DcChargeDynamicModeValues values) {
constexpr auto PRE_CHARGE_MAX_POWER = 800.0f;
r_hlc[0]->subscribe_d20_dc_dynamic_charge_mode([this](types::iso15118::DcChargeDynamicModeValues values) {
constexpr auto PRE_CHARGE_MAX_POWER = 800.0f;

bool target_changed{false};
bool target_changed{false};

if (values.min_voltage > latest_target_voltage) {
latest_target_voltage = values.min_voltage + 10; // TODO(sl): Check if okay
target_changed = true;
}
if (values.max_voltage < latest_target_voltage) {
latest_target_voltage = values.max_voltage - 10; // TODO(sl): Check if okay
target_changed = true;
}
if (values.min_voltage > latest_target_voltage) {
latest_target_voltage = values.min_voltage + 10; // TODO(sl): Check if okay
target_changed = true;
}
if (values.max_voltage < latest_target_voltage) {
latest_target_voltage = values.max_voltage - 10; // TODO(sl): Check if okay
target_changed = true;
}

const double latest_target_power = latest_target_voltage * latest_target_current;
const double latest_target_power = latest_target_voltage * latest_target_current;

if (latest_target_power <= PRE_CHARGE_MAX_POWER or values.min_charge_power > latest_target_power or
values.max_charge_power < latest_target_power) {
latest_target_current = static_cast<double>(values.max_charge_power) / latest_target_voltage;
if (values.max_charge_current < latest_target_current) {
latest_target_current = values.max_charge_current;
}
target_changed = true;
if (latest_target_power <= PRE_CHARGE_MAX_POWER or values.min_charge_power > latest_target_power or
values.max_charge_power < latest_target_power) {
latest_target_current = static_cast<double>(values.max_charge_power) / latest_target_voltage;
if (values.max_charge_current < latest_target_current) {
latest_target_current = values.max_charge_current;
}
target_changed = true;
}

if (target_changed) {
apply_new_target_voltage_current();
if (not contactor_open) {
powersupply_DC_on();
}

{
Everest::scoped_lock_timeout lock(ev_info_mutex,
Everest::MutexDescription::EVSE_publish_ev_info);
ev_info.target_voltage = latest_target_voltage;
ev_info.target_current = latest_target_current;
p_evse->publish_ev_info(ev_info);
}
if (target_changed) {
apply_new_target_voltage_current();
if (not contactor_open) {
powersupply_DC_on();
}
});

{
Everest::scoped_lock_timeout lock(ev_info_mutex,
Everest::MutexDescription::EVSE_publish_ev_info);
ev_info.target_voltage = latest_target_voltage;
ev_info.target_current = latest_target_current;
p_evse->publish_ev_info(ev_info);
}
}
});

// Car requests DC contactor open. We don't actually open but switch off DC supply.
// opening will be done by Charger on C->B CP event.
Expand Down
6 changes: 2 additions & 4 deletions modules/EvseManager/evse/evse_managerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ void evse_managerImpl::init() {
mod->mqtt.subscribe(fmt::format("everest_external/nodered/{}/cmd/emergency_stop", mod->config.connector_id),
[this](const std::string& data) {
if (mod->get_hlc_enabled()) {
mod->r_hlc[0]->call_send_error(
types::iso15118::EvseError::Error_EmergencyShutdown);
mod->r_hlc[0]->call_send_error(types::iso15118::EvseError::Error_EmergencyShutdown);
}
types::evse_manager::StopTransactionRequest request;
request.reason = types::evse_manager::StopTransactionReason::EmergencyStop;
Expand All @@ -101,8 +100,7 @@ void evse_managerImpl::init() {
mod->mqtt.subscribe(fmt::format("everest_external/nodered/{}/cmd/evse_utility_int", mod->config.connector_id),
[this](const std::string& data) {
if (mod->get_hlc_enabled()) {
mod->r_hlc[0]->call_send_error(
types::iso15118::EvseError::Error_UtilityInterruptEvent);
mod->r_hlc[0]->call_send_error(types::iso15118::EvseError::Error_UtilityInterruptEvent);
}
types::evse_manager::StopTransactionRequest request;
request.reason = types::evse_manager::StopTransactionReason::Other;
Expand Down
4 changes: 2 additions & 2 deletions modules/EvseManager/evse/evse_managerImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ class evse_managerImpl : public evse_managerImplBase {
virtual bool handle_resume_charging() override;
virtual bool handle_stop_transaction(types::evse_manager::StopTransactionRequest& request) override;
virtual bool handle_force_unlock(int& connector_id) override;
virtual void handle_set_get_certificate_response(
types::iso15118::ResponseExiStreamStatus& certificate_response) override;
virtual void
handle_set_get_certificate_response(types::iso15118::ResponseExiStreamStatus& certificate_response) override;
virtual bool handle_external_ready_to_start_charging() override;

// ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1
Expand Down
3 changes: 1 addition & 2 deletions modules/EvseManager/tests/EvseManagerStub.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ struct evse_managerImplStub : public evse_managerImplBase {
handle_switch_three_phases_while_charging(bool& three_phases) {
return types::evse_manager::SwitchThreePhasesWhileChargingResult::Success;
}
virtual void
handle_set_get_certificate_response(types::iso15118::ResponseExiStreamStatus& certificate_response) {
virtual void handle_set_get_certificate_response(types::iso15118::ResponseExiStreamStatus& certificate_response) {
}
virtual bool handle_external_ready_to_start_charging() {
return true;
Expand Down
12 changes: 4 additions & 8 deletions modules/EvseV2G/charger/ISO15118_chargerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,7 @@ void ISO15118_chargerImpl::handle_session_setup(std::vector<types::iso15118::Pay
}
}

void ISO15118_chargerImpl::handle_certificate_response(
types::iso15118::ResponseExiStreamStatus& exi_stream_status) {
void ISO15118_chargerImpl::handle_certificate_response(types::iso15118::ResponseExiStreamStatus& exi_stream_status) {
pthread_mutex_lock(&v2g_ctx->mqtt_lock);
if (exi_stream_status.exi_response.has_value() and not exi_stream_status.exi_response.value().empty()) {
v2g_ctx->evse_v2g_data.cert_install_res_b64_buffer = std::string(exi_stream_status.exi_response.value());
Expand Down Expand Up @@ -302,8 +301,7 @@ void ISO15118_chargerImpl::handle_stop_charging(bool& stop) {
}
}

void ISO15118_chargerImpl::handle_set_charging_parameters(
types::iso15118::SetupPhysicalValues& physical_values) {
void ISO15118_chargerImpl::handle_set_charging_parameters(types::iso15118::SetupPhysicalValues& physical_values) {

if (physical_values.ac_nominal_voltage.has_value()) {
populate_physical_value_float(&v2g_ctx->evse_v2g_data.evse_nominal_voltage,
Expand Down Expand Up @@ -333,8 +331,7 @@ void ISO15118_chargerImpl::handle_update_ac_max_current(double& max_current) {
v2g_ctx->basic_config.evse_ac_current_limit = max_current;
}

void ISO15118_chargerImpl::handle_update_dc_maximum_limits(
types::iso15118::DcEvseMaximumLimits& maximum_limits) {
void ISO15118_chargerImpl::handle_update_dc_maximum_limits(types::iso15118::DcEvseMaximumLimits& maximum_limits) {
if (maximum_limits.evse_maximum_current_limit > 300.) {
populate_physical_value_float(&v2g_ctx->evse_v2g_data.evse_maximum_current_limit,
maximum_limits.evse_maximum_current_limit, 1, iso2_unitSymbolType_A);
Expand All @@ -353,8 +350,7 @@ void ISO15118_chargerImpl::handle_update_dc_maximum_limits(
v2g_ctx->evse_v2g_data.evse_maximum_voltage_limit_is_used = 1;
}

void ISO15118_chargerImpl::handle_update_dc_minimum_limits(
types::iso15118::DcEvseMinimumLimits& minimum_limits) {
void ISO15118_chargerImpl::handle_update_dc_minimum_limits(types::iso15118::DcEvseMinimumLimits& minimum_limits) {

populate_physical_value_float(&v2g_ctx->evse_v2g_data.evse_minimum_current_limit,
static_cast<long long int>(minimum_limits.evse_minimum_current_limit), 1,
Expand Down
Loading

0 comments on commit c52a3b1

Please sign in to comment.