Skip to content

Commit

Permalink
selected_energy_mode is a part of evdata
Browse files Browse the repository at this point in the history
  • Loading branch information
ikaratass committed May 20, 2024
1 parent bb095f5 commit e28b2f0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
9 changes: 8 additions & 1 deletion iso15118/secc/controller/ev_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
DCEVChargeParameter as DIN_DCEVChargeParameter,
)
from iso15118.shared.messages.din_spec.body import PreChargeReq as DIN_PreChargeReq
from iso15118.shared.messages.enums import AuthEnum, ControlMode, ServiceV20
from iso15118.shared.messages.enums import (
AuthEnum,
ControlMode,
EnergyTransferModeEnum,
ServiceV20,
)
from iso15118.shared.messages.iso15118_2.body import (
ACEVChargeParameter,
CurrentDemandReq,
Expand Down Expand Up @@ -243,6 +248,8 @@ def __init__(
# Sent in -2,-20 PreChargeReq
# and same as above
self.target_voltage: float = target_voltage
# The energy mode the EVCC selected.
self.selected_energy_mode: Optional[EnergyTransferModeEnum] = None

def update_ac_charge_parameters_v2(
self, ac_ev_charge_parameter: ACEVChargeParameter
Expand Down
1 change: 1 addition & 0 deletions iso15118/secc/states/din_spec_states.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ async def process_message(
ev_data_context.update_dc_charge_parameters(
charge_parameter_discovery_req.dc_ev_charge_parameter
)
ev_data_context.selected_energy_mode = self.comm_session.selected_energy_mode
await self.comm_session.evse_controller.send_rated_limits()
dc_evse_charge_params = (
await self.comm_session.evse_controller.get_dc_charge_parameters_dinspec() # noqa
Expand Down
6 changes: 6 additions & 0 deletions iso15118/secc/states/iso15118_20_states.py
Original file line number Diff line number Diff line change
Expand Up @@ -1350,6 +1350,9 @@ async def process_message(
ev_data_context.update_ac_charge_parameters_v20(energy_service, ac_cpd_req)
evse_data_context = self.comm_session.evse_controller.evse_data_context
evse_data_context.current_type = CurrentType.AC
ev_data_context.selected_energy_mode = (
self.comm_session.selected_energy_mode
)
await self.comm_session.evse_controller.send_rated_limits()
except UnknownEnergyService:
self.stop_state_machine(
Expand Down Expand Up @@ -1546,6 +1549,9 @@ async def process_message(
ev_data_context.update_dc_charge_parameters_v20(energy_service, dc_cpd_req)
evse_data_context = self.comm_session.evse_controller.evse_data_context
evse_data_context.current_type = CurrentType.DC
ev_data_context.selected_energy_mode = (
self.comm_session.selected_energy_mode
)
await self.comm_session.evse_controller.send_rated_limits()
except UnknownEnergyService:
self.stop_state_machine(
Expand Down
1 change: 1 addition & 0 deletions iso15118/secc/states/iso15118_2_states.py
Original file line number Diff line number Diff line change
Expand Up @@ -1353,6 +1353,7 @@ async def process_message(
ev_data_context = self.comm_session.evse_controller.ev_data_context

self.comm_session.selected_energy_mode = charge_params_req.requested_energy_mode
ev_data_context.selected_energy_mode = self.comm_session.selected_energy_mode
self.comm_session.selected_charging_type_is_ac = (
self.comm_session.selected_energy_mode.value.startswith("AC")
)
Expand Down

0 comments on commit e28b2f0

Please sign in to comment.