diff --git a/modules/EvseManager/Charger.cpp b/modules/EvseManager/Charger.cpp index 3036eba338..ff9263b3fd 100644 --- a/modules/EvseManager/Charger.cpp +++ b/modules/EvseManager/Charger.cpp @@ -280,7 +280,7 @@ void Charger::run_state_machine() { if (config_context.charge_mode == ChargeMode::DC) { // Create a copy of the atomic struct types::iso15118_charger::DC_EVSEMaximumLimits evse_limit = shared_context.current_evse_max_limits; - if (not(evse_limit.EVSEMaximumCurrentLimit > 0 and evse_limit.EVSEMaximumPowerLimit > 0)) { + if (not(evse_limit.maximum_current > 0 and evse_limit.maximum_power > 0)) { if (not internal_context.no_energy_warning_printed) { EVLOG_warning << "No energy available, still retrying..."; internal_context.no_energy_warning_printed = true; diff --git a/modules/EvseManager/EvseManager.cpp b/modules/EvseManager/EvseManager.cpp index 772bcd2919..577f248eb4 100644 --- a/modules/EvseManager/EvseManager.cpp +++ b/modules/EvseManager/EvseManager.cpp @@ -955,14 +955,15 @@ void EvseManager::setup_fake_DC_mode() { r_hlc[0]->call_update_dc_present_values(present_values); types::iso15118_charger::DC_EVSEMaximumLimits evseMaxLimits; - evseMaxLimits.EVSEMaximumCurrentLimit = 400; - evseMaxLimits.EVSEMaximumPowerLimit = 200000; - evseMaxLimits.EVSEMaximumVoltageLimit = 1000; + evseMaxLimits.maximum_current = 400; + evseMaxLimits.maximum_power = 200000; + evseMaxLimits.maximum_voltage = 1000; r_hlc[0]->call_update_dc_maximum_limits(evseMaxLimits); types::iso15118_charger::DC_EVSEMinimumLimits evseMinLimits; - evseMinLimits.EVSEMinimumCurrentLimit = 0; - evseMinLimits.EVSEMinimumVoltageLimit = 0; + evseMinLimits.minimum_current = 0; + evseMinLimits.minimum_voltage = 0; + evseMinLimits.minimum_power = 0; r_hlc[0]->call_update_dc_minimum_limits(evseMinLimits); const auto sae_mode = types::iso15118_charger::SAE_J2847_Bidi_Mode::None; @@ -1004,9 +1005,9 @@ void EvseManager::setup_v2h_mode() { if (powersupply_capabilities.max_import_current_A.has_value() and powersupply_capabilities.max_import_power_W.has_value() and powersupply_capabilities.max_import_voltage_V.has_value()) { - evseMaxLimits.EVSEMaximumCurrentLimit = -powersupply_capabilities.max_import_current_A.value(); - evseMaxLimits.EVSEMaximumPowerLimit = -powersupply_capabilities.max_import_power_W.value(); - evseMaxLimits.EVSEMaximumVoltageLimit = powersupply_capabilities.max_import_voltage_V.value(); + evseMaxLimits.maximum_current = -powersupply_capabilities.max_import_current_A.value(); + evseMaxLimits.maximum_power = -powersupply_capabilities.max_import_power_W.value(); + evseMaxLimits.maximum_voltage = powersupply_capabilities.max_import_voltage_V.value(); r_hlc[0]->call_update_dc_maximum_limits(evseMaxLimits); charger->inform_new_evse_max_hlc_limits(evseMaxLimits); } else { @@ -1016,8 +1017,9 @@ void EvseManager::setup_v2h_mode() { if (powersupply_capabilities.min_import_current_A.has_value() and powersupply_capabilities.min_import_voltage_V.has_value()) { - evseMinLimits.EVSEMinimumCurrentLimit = -powersupply_capabilities.min_import_current_A.value(); - evseMinLimits.EVSEMinimumVoltageLimit = powersupply_capabilities.min_import_voltage_V.value(); + evseMinLimits.minimum_current = -powersupply_capabilities.min_import_current_A.value(); + evseMinLimits.minimum_voltage = powersupply_capabilities.min_import_voltage_V.value(); + evseMinLimits.minimum_power = evseMinLimits.minimum_current * evseMinLimits.minimum_voltage; r_hlc[0]->call_update_dc_minimum_limits(evseMinLimits); } else { EVLOG_error << "No Import Current, Power or Voltage is available!!!"; @@ -1370,8 +1372,8 @@ bool EvseManager::powersupply_DC_set(double _voltage, double _current) { if (config.hack_fix_hlc_integer_current_requests) { auto hlc_limits = charger->get_evse_max_hlc_limits(); - if (hlc_limits.EVSEMaximumCurrentLimit - (int)current < 1.) - current = hlc_limits.EVSEMaximumCurrentLimit; + if (hlc_limits.maximum_current - (int)current < 1.) + current = hlc_limits.maximum_current; } if (config.sae_j2847_2_bpt_enabled) { diff --git a/modules/EvseManager/EvseManager.hpp b/modules/EvseManager/EvseManager.hpp index 5feff5cb14..ea2ef0f797 100644 --- a/modules/EvseManager/EvseManager.hpp +++ b/modules/EvseManager/EvseManager.hpp @@ -209,8 +209,9 @@ class EvseManager : public Everest::ModuleBase { r_hlc[0]->call_set_charging_parameters(setup_physical_values); types::iso15118_charger::DC_EVSEMinimumLimits evseMinLimits; - evseMinLimits.EVSEMinimumCurrentLimit = powersupply_capabilities.min_export_current_A; - evseMinLimits.EVSEMinimumVoltageLimit = powersupply_capabilities.min_export_voltage_V; + evseMinLimits.minimum_current = powersupply_capabilities.min_export_current_A; + evseMinLimits.minimum_voltage = powersupply_capabilities.min_export_voltage_V; + evseMinLimits.minimum_power = evseMinLimits.minimum_current * evseMinLimits.minimum_voltage; r_hlc[0]->call_update_dc_minimum_limits(evseMinLimits); // HLC layer will also get new maximum current/voltage/watt limits etc, but those will need to run through @@ -221,9 +222,9 @@ class EvseManager : public Everest::ModuleBase { // Inform charger about new max limits types::iso15118_charger::DC_EVSEMaximumLimits evseMaxLimits; - evseMaxLimits.EVSEMaximumCurrentLimit = powersupply_capabilities.max_export_current_A; - evseMaxLimits.EVSEMaximumPowerLimit = powersupply_capabilities.max_export_power_W; - evseMaxLimits.EVSEMaximumVoltageLimit = powersupply_capabilities.max_export_voltage_V; + evseMaxLimits.maximum_current = powersupply_capabilities.max_export_current_A; + evseMaxLimits.maximum_power = powersupply_capabilities.max_export_power_W; + evseMaxLimits.maximum_voltage = powersupply_capabilities.max_export_voltage_V; if (charger) { charger->inform_new_evse_max_hlc_limits(evseMaxLimits); } diff --git a/modules/EvseManager/energy_grid/energyImpl.cpp b/modules/EvseManager/energy_grid/energyImpl.cpp index 4c957e1e20..ef254411d9 100644 --- a/modules/EvseManager/energy_grid/energyImpl.cpp +++ b/modules/EvseManager/energy_grid/energyImpl.cpp @@ -433,64 +433,64 @@ void energyImpl::handle_enforce_limits(types::energy::EnforcedLimits& value) { // current limit is too low, i.e. charging will not reach the actual watt value. // FIXME: we could use some magic here that involves actual measured voltage as well. if (actual_voltage > 10) { - evseMaxLimits.EVSEMaximumCurrentLimit = + evseMaxLimits.maximum_current = value.limits_root_side.value().total_power_W.value() / actual_voltage; } else { - evseMaxLimits.EVSEMaximumCurrentLimit = + evseMaxLimits.maximum_current = value.limits_root_side.value().total_power_W.value() / target_voltage; } } else { - evseMaxLimits.EVSEMaximumCurrentLimit = powersupply_capabilities.max_export_current_A; + evseMaxLimits.maximum_current = powersupply_capabilities.max_export_current_A; } - if (evseMaxLimits.EVSEMaximumCurrentLimit > powersupply_capabilities.max_export_current_A) - evseMaxLimits.EVSEMaximumCurrentLimit = powersupply_capabilities.max_export_current_A; + if (evseMaxLimits.maximum_current > powersupply_capabilities.max_export_current_A) + evseMaxLimits.maximum_current = powersupply_capabilities.max_export_current_A; if (powersupply_capabilities.max_import_current_A.has_value() && - evseMaxLimits.EVSEMaximumCurrentLimit < -powersupply_capabilities.max_import_current_A.value()) - evseMaxLimits.EVSEMaximumCurrentLimit = -powersupply_capabilities.max_import_current_A.value(); + evseMaxLimits.maximum_current < -powersupply_capabilities.max_import_current_A.value()) + evseMaxLimits.maximum_current = -powersupply_capabilities.max_import_current_A.value(); - // now evseMaxLimits.EVSEMaximumCurrentLimit is between + // now evseMaxLimits.maximum_current is between // -max_import_current_A ... +max_export_current_A - evseMaxLimits.EVSEMaximumPowerLimit = value.limits_root_side.value().total_power_W.value(); - if (evseMaxLimits.EVSEMaximumPowerLimit > powersupply_capabilities.max_export_power_W) - evseMaxLimits.EVSEMaximumPowerLimit = powersupply_capabilities.max_export_power_W; + evseMaxLimits.maximum_power = value.limits_root_side.value().total_power_W.value(); + if (evseMaxLimits.maximum_power > powersupply_capabilities.max_export_power_W) + evseMaxLimits.maximum_power = powersupply_capabilities.max_export_power_W; if (powersupply_capabilities.max_import_power_W.has_value() && - evseMaxLimits.EVSEMaximumPowerLimit < -powersupply_capabilities.max_import_power_W.value()) - evseMaxLimits.EVSEMaximumPowerLimit = -powersupply_capabilities.max_import_power_W.value(); + evseMaxLimits.maximum_power < -powersupply_capabilities.max_import_power_W.value()) + evseMaxLimits.maximum_power = -powersupply_capabilities.max_import_power_W.value(); - // now evseMaxLimits.EVSEMaximumPowerLimit is between + // now evseMaxLimits.maximum_power is between // -max_import_power_W ... +max_export_power_W - evseMaxLimits.EVSEMaximumVoltageLimit = powersupply_capabilities.max_export_voltage_V; + evseMaxLimits.maximum_voltage = powersupply_capabilities.max_export_voltage_V; // FIXME: we tell the ISO stack positive numbers for DIN spec and ISO-2 here in case of exporting to // grid. This needs to be fixed in the transition to -20 for BPT. - if (evseMaxLimits.EVSEMaximumPowerLimit < 0 || evseMaxLimits.EVSEMaximumCurrentLimit < 0) { + if (evseMaxLimits.maximum_power < 0 || evseMaxLimits.maximum_current < 0) { // we are exporting power back to the grid if (mod->config.hack_allow_bpt_with_iso2) { - if (evseMaxLimits.EVSEMaximumPowerLimit < 0) { - evseMaxLimits.EVSEMaximumPowerLimit = -evseMaxLimits.EVSEMaximumPowerLimit; + if (evseMaxLimits.maximum_power < 0) { + evseMaxLimits.maximum_power = -evseMaxLimits.maximum_power; mod->is_actually_exporting_to_grid = true; } else { mod->is_actually_exporting_to_grid = false; } - if (evseMaxLimits.EVSEMaximumCurrentLimit < 0) { - evseMaxLimits.EVSEMaximumCurrentLimit = -evseMaxLimits.EVSEMaximumCurrentLimit; + if (evseMaxLimits.maximum_current < 0) { + evseMaxLimits.maximum_current = -evseMaxLimits.maximum_current; mod->is_actually_exporting_to_grid = true; } else { mod->is_actually_exporting_to_grid = false; } } else if (mod->sae_bidi_active) { - if (evseMaxLimits.EVSEMaximumPowerLimit < 0) { + if (evseMaxLimits.maximum_power < 0) { mod->is_actually_exporting_to_grid = true; } else { mod->is_actually_exporting_to_grid = false; } - if (evseMaxLimits.EVSEMaximumCurrentLimit < 0) { + if (evseMaxLimits.maximum_current < 0) { mod->is_actually_exporting_to_grid = true; } else { mod->is_actually_exporting_to_grid = false; @@ -498,8 +498,8 @@ void energyImpl::handle_enforce_limits(types::energy::EnforcedLimits& value) { } else { EVLOG_error << "Bidirectional export back to grid requested, but not supported. Enable " "ISO-20 or set hack_allow_bpt_with_iso2 config option."; - evseMaxLimits.EVSEMaximumPowerLimit = 0.; - evseMaxLimits.EVSEMaximumCurrentLimit = 0.; + evseMaxLimits.maximum_power = 0.; + evseMaxLimits.maximum_current = 0.; } } else { mod->is_actually_exporting_to_grid = false; @@ -508,7 +508,7 @@ void energyImpl::handle_enforce_limits(types::energy::EnforcedLimits& value) { session_log.evse( true, fmt::format("Change HLC Limits: {}W/{}A, target_voltage {}, actual_voltage {}, hack_bpt {}", - evseMaxLimits.EVSEMaximumPowerLimit, evseMaxLimits.EVSEMaximumCurrentLimit, + evseMaxLimits.maximum_power, evseMaxLimits.maximum_current, target_voltage, actual_voltage, mod->is_actually_exporting_to_grid)); mod->r_hlc[0]->call_update_dc_maximum_limits(evseMaxLimits); mod->charger->inform_new_evse_max_hlc_limits(evseMaxLimits); diff --git a/modules/EvseV2G/charger/ISO15118_chargerImpl.cpp b/modules/EvseV2G/charger/ISO15118_chargerImpl.cpp index 94b43c4ab9..cd92fd64df 100644 --- a/modules/EvseV2G/charger/ISO15118_chargerImpl.cpp +++ b/modules/EvseV2G/charger/ISO15118_chargerImpl.cpp @@ -329,21 +329,21 @@ void ISO15118_chargerImpl::handle_update_ac_max_current(double& max_current) { void ISO15118_chargerImpl::handle_update_dc_maximum_limits( types::iso15118_charger::DC_EVSEMaximumLimits& maximum_limits) { - if (maximum_limits.EVSEMaximumCurrentLimit > 300.) { + if (maximum_limits.maximum_current > 300.) { populate_physical_value_float(&v2g_ctx->evse_v2g_data.evse_maximum_current_limit, - maximum_limits.EVSEMaximumCurrentLimit, 1, iso1unitSymbolType_A); + maximum_limits.maximum_current, 1, iso1unitSymbolType_A); } else { populate_physical_value_float(&v2g_ctx->evse_v2g_data.evse_maximum_current_limit, - maximum_limits.EVSEMaximumCurrentLimit, 2, iso1unitSymbolType_A); + maximum_limits.maximum_current, 2, iso1unitSymbolType_A); } v2g_ctx->evse_v2g_data.evse_maximum_current_limit_is_used = 1; - populate_physical_value(&v2g_ctx->evse_v2g_data.evse_maximum_power_limit, maximum_limits.EVSEMaximumPowerLimit, + populate_physical_value(&v2g_ctx->evse_v2g_data.evse_maximum_power_limit, maximum_limits.maximum_power, iso1unitSymbolType_W); v2g_ctx->evse_v2g_data.evse_maximum_power_limit_is_used = 1; populate_physical_value_float(&v2g_ctx->evse_v2g_data.evse_maximum_voltage_limit, - maximum_limits.EVSEMaximumVoltageLimit, 1, iso1unitSymbolType_V); + maximum_limits.maximum_voltage, 1, iso1unitSymbolType_V); v2g_ctx->evse_v2g_data.evse_maximum_voltage_limit_is_used = 1; } @@ -351,10 +351,10 @@ void ISO15118_chargerImpl::handle_update_dc_minimum_limits( types::iso15118_charger::DC_EVSEMinimumLimits& minimum_limits) { populate_physical_value_float(&v2g_ctx->evse_v2g_data.evse_minimum_current_limit, - static_cast(minimum_limits.EVSEMinimumCurrentLimit), 1, + static_cast(minimum_limits.minimum_current), 1, iso1unitSymbolType_A); populate_physical_value_float(&v2g_ctx->evse_v2g_data.evse_minimum_voltage_limit, - static_cast(minimum_limits.EVSEMinimumVoltageLimit), 1, + static_cast(minimum_limits.minimum_voltage), 1, iso1unitSymbolType_V); } diff --git a/types/iso15118_charger.yaml b/types/iso15118_charger.yaml index f14288a1f4..b4c5e7f299 100644 --- a/types/iso15118_charger.yaml +++ b/types/iso15118_charger.yaml @@ -161,47 +161,73 @@ types: minimum: 0 maximum: 10000 DC_EVSEMaximumLimits: - description: Maximum Values (current, power and voltage) the EVSE can deliver + description: Maximum Values the EVSE can deliver type: object additionalProperties: false required: - - EVSEMaximumCurrentLimit - - EVSEMaximumPowerLimit - - EVSEMaximumVoltageLimit + - maximum_current + - maximum_power + - maximum_voltage properties: - EVSEMaximumCurrentLimit: + maximum_current: description: Maximum current the EVSE can deliver in A type: number minimum: -10000 maximum: 10000 - EVSEMaximumPowerLimit: + maximum_power: description: Maximum power the EVSE can deliver in W type: number minimum: -1000000 maximum: 1000000 - EVSEMaximumVoltageLimit: + maximum_voltage: description: Maximum voltage the EVSE can deliver in V type: number minimum: 0 maximum: 1500 + maximum_discharge_current: + description: Maximum discharge current the EVSE can deliver in W + type: number + minimum: 0 + maximum: 10000 + maximum_discharge_power: + description: Maximum discharge power the EVSE can deliver in W + type: number + minimum: 0 + maximum: 1000000 DC_EVSEMinimumLimits: - description: Minimum Values (current and voltage) the EVSE can deliver + description: Minimum Values the EVSE can deliver type: object additionalProperties: false required: - - EVSEMinimumCurrentLimit - - EVSEMinimumVoltageLimit + - minimum_current + - minimum_voltage + - minimum_power properties: - EVSEMinimumCurrentLimit: + minimum_current: description: Minimum current the EVSE can deliver with the expected accuracy in A type: number minimum: 0 maximum: 10000 - EVSEMinimumVoltageLimit: + minimum_voltage: description: Minimum voltage the EVSE can deliver with the expected accuracy in V type: number minimum: 0 maximum: 1500 + minimum_power: + description: Minimum power the EVSE can deliver with the expected accuracy in W + type: number + minimum: 0 + maximum: 1000000 + minimum_discharge_current: + description: Minimum discharge current the EVSE can deliver in W + type: number + minimum: 0 + maximum: 10000 + minimum_discharge_power: + description: Minimum discharge power the EVSE can deliver in W + type: number + minimum: 0 + maximum: 1000000 SetupPhysicalValues: description: >- Initial physical values for setup a AC or DC charging session