Skip to content

Commit b878758

Browse files
committed
Update to EcoG-io/iso15118 version 0.28.3
2 parents 21b1210 + 676b315 commit b878758

33 files changed

Lines changed: 705 additions & 314 deletions

.env.dev.local

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ FREE_CERT_INSTALL_SERVICE=True
1212
ALLOW_CERT_INSTALL_SERVICE=True
1313
USE_CPO_BACKEND=False
1414
SECC_ENFORCE_TLS=False
15-
#PROTOCOLS=ISO_15118_20_AC,DIN_SPEC_70121,ISO_15118_2
15+
#PROTOCOLS=DIN_SPEC_70121,ISO_15118_2,ISO_15118_20_AC,ISO_15118_20_DC
1616
EVCC_CONFIG_PATH=iso15118/shared/examples/evcc/iso15118_2/evcc_config_eim_ac.json
1717
# LOG Settings
1818
LOG_LEVEL="DEBUG"

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
44
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
55

66
## [Unreleased]
7+
## [0.28.3] - 2024-06-18
8+
* Fix/min charge current is missing by @ikaratass in https://github.com/SwitchEV/iso15118/pull/421
9+
10+
## [0.28.2] - 2024-06-06
11+
* Added missed param in ev data by @shalinnijel2 in https://github.com/SwitchEV/iso15118/pull/412
12+
* session limits are rearranged according to rated limits by @ikaratass in https://github.com/SwitchEV/iso15118/pull/415
13+
14+
## [0.28.1] - 2024-05-21
15+
* Fixed pydantic issues. by @shalinnijel2 in https://github.com/SwitchEV/iso15118/pull/405
16+
* Modify cable check contactor status check by @shalinnijel2 in https://github.com/SwitchEV/iso15118/pull/404
17+
* Fixed comment. by @shalinnijel2 in https://github.com/SwitchEV/iso15118/pull/407
18+
* selected_energy_mode is a part of evdata by @ikaratass in https://github.com/SwitchEV/iso15118/pull/408
19+
20+
## [0.28.0] - 2024-05-02
21+
* fix typo in SECC interface.py by @M4GNV5 in https://github.com/SwitchEV/iso15118/pull/398
22+
* Update .env.dev.local, ISO_15118_20_DC is not implemented for use by @lwollinger in https://github.com/SwitchEV/iso15118/pull/395
23+
* Share cpd params with CS. by @shalinnijel2 in https://github.com/SwitchEV/iso15118/pull/400
24+
* Share display params with CS. by @shalinnijel2 in https://github.com/SwitchEV/iso15118/pull/401
25+
* Relaxed contactor status check for DC. by @shalinnijel2 in https://github.com/SwitchEV/iso15118/pull/402
726

827
## [0.27.0] - 2024-04-17
928
* ScheduleExchangeRes parsing fix by @heavyweight87 in https://github.com/SwitchEV/iso15118/pull/391

iso15118/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.27.0"
1+
__version__ = "0.28.3"

iso15118/evcc/comm_session_handler.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
from iso15118.shared.messages.enums import (
3535
AuthEnum,
3636
DINPayloadTypes,
37+
EnergyTransferModeEnum,
3738
ISOV2PayloadTypes,
3839
ISOV20PayloadTypes,
3940
Namespace,
@@ -138,7 +139,8 @@ def __init__(
138139
# "Caching" authorization_req. (Required in ISO15118-20)
139140
# Avoids recomputing the signature, eim, pnc params during authorization loop.
140141
self.authorization_req_message: Optional[AuthorizationReq] = None
141-
142+
# The energy mode the EVCC selected (ISO 15118-2)
143+
self.selected_energy_mode: Optional[EnergyTransferModeEnum] = None
142144
self.is_tls = False
143145

144146
self.sae_j2847_active: int = 0
@@ -191,9 +193,11 @@ def create_sap(self) -> Union[SupportedAppProtocolReq, None]:
191193
priority += 1
192194
app_protocol_entry = AppProtocol(
193195
protocol_ns=protocol.ns.value,
194-
major_version=2
195-
if protocol in [Protocol.ISO_15118_2, Protocol.DIN_SPEC_70121]
196-
else 1,
196+
major_version=(
197+
2
198+
if protocol in [Protocol.ISO_15118_2, Protocol.DIN_SPEC_70121]
199+
else 1
200+
),
197201
minor_version=0,
198202
schema_id=schema_id,
199203
priority=priority,

iso15118/evcc/states/evcc_state.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
This module contains the abstract class for an EVCC-specific state,
33
which extends the state shared between the EVCC and SECC.
44
"""
5+
56
import logging
67
import time
78
from abc import ABC

iso15118/evcc/states/iso15118_20_states.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,9 +458,9 @@ async def process_message(
458458
service_discovery_res.service_renegotiation_supported
459459
)
460460

461-
req_energy_services: List[
462-
ServiceV20
463-
] = await self.comm_session.ev_controller.get_supported_energy_services()
461+
req_energy_services: List[ServiceV20] = (
462+
await self.comm_session.ev_controller.get_supported_energy_services()
463+
)
464464

465465
for energy_service in service_discovery_res.energy_service_list.services:
466466
for requested_energy_service in req_energy_services:

iso15118/evcc/states/iso15118_2_states.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,9 @@ async def process_message(
198198
await self.select_energy_transfer_mode()
199199

200200
charge_service: ChargeService = service_discovery_res.charge_service
201-
offered_energy_modes: List[
202-
EnergyTransferModeEnum
203-
] = charge_service.supported_energy_transfer_mode.energy_modes
201+
offered_energy_modes: List[EnergyTransferModeEnum] = (
202+
charge_service.supported_energy_transfer_mode.energy_modes
203+
)
204204

205205
if self.comm_session.selected_energy_mode not in offered_energy_modes:
206206
self.stop_state_machine(

iso15118/secc/comm_session_handler.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,9 @@ def __init__(
203203
# The comm_sessions dict keys are of type str (the IPv6 address), the
204204
# values are a tuple containing the SECCCommunicationSession and the
205205
# associated ayncio.Task object (so we can cancel the task when needed)
206-
self.comm_sessions: Dict[
207-
str, Tuple[SECCCommunicationSession, asyncio.Task]
208-
] = {}
206+
self.comm_sessions: Dict[str, Tuple[SECCCommunicationSession, asyncio.Task]] = (
207+
{}
208+
)
209209

210210
async def start_session_handler(
211211
self, iface: str, start_udp_server: Optional[bool] = True

iso15118/secc/controller/ev_data.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@
1010
DCEVChargeParameter as DIN_DCEVChargeParameter,
1111
)
1212
from iso15118.shared.messages.din_spec.body import PreChargeReq as DIN_PreChargeReq
13-
from iso15118.shared.messages.enums import AuthEnum, ControlMode, ServiceV20
13+
from iso15118.shared.messages.enums import (
14+
AuthEnum,
15+
ControlMode,
16+
EnergyTransferModeEnum,
17+
ServiceV20,
18+
)
1419
from iso15118.shared.messages.iso15118_2.body import (
1520
ACEVChargeParameter,
1621
CurrentDemandReq,
@@ -213,9 +218,9 @@ def __init__(
213218
self.max_soc: Optional[int] = max_soc # 0-100
214219
self.max_v2x_energy_request: Optional[float] = max_v2x_energy_request
215220
self.min_v2x_energy_request: Optional[float] = min_v2x_energy_request
216-
self.remaining_time_to_target_soc: Optional[
217-
float
218-
] = remaining_time_to_target_soc # noqa: E501
221+
self.remaining_time_to_target_soc: Optional[float] = (
222+
remaining_time_to_target_soc # noqa: E501
223+
)
219224
# In -2 is FullSOC
220225
self.remaining_time_to_max_soc: Optional[float] = remaining_time_to_max_soc
221226
self.remaining_time_to_min_soc: Optional[float] = remaining_time_to_min_soc
@@ -243,6 +248,8 @@ def __init__(
243248
# Sent in -2,-20 PreChargeReq
244249
# and same as above
245250
self.target_voltage: float = target_voltage
251+
# The energy mode the EVCC selected.
252+
self.selected_energy_mode: Optional[EnergyTransferModeEnum] = None
246253

247254
def update_ac_charge_parameters_v2(
248255
self, ac_ev_charge_parameter: ACEVChargeParameter
@@ -689,6 +696,9 @@ def _update_common_dc_charge_parameters_v20(
689696
dc_rated_limits.max_charge_current = (
690697
params.ev_max_charge_current.get_decimal_value()
691698
) # noqa: E501
699+
dc_rated_limits.min_charge_current = (
700+
params.ev_min_charge_current.get_decimal_value()
701+
) # noqa: E501
692702
dc_rated_limits.max_voltage = (
693703
params.ev_max_voltage.get_decimal_value()
694704
) # noqa: E501

iso15118/secc/controller/evse_data.py

Lines changed: 50 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -173,21 +173,21 @@ def __init__(
173173
self.max_power_asymmetry: Optional[float] = max_power_asymmetry
174174

175175
# Optional in 15118-2 CPD
176-
self.current_regulation_tolerance: Optional[
177-
float
178-
] = current_regulation_tolerance
176+
self.current_regulation_tolerance: Optional[float] = (
177+
current_regulation_tolerance
178+
)
179179
self.peak_current_ripple: Optional[float] = peak_current_ripple
180180
self.energy_to_be_delivered: Optional[float] = energy_to_be_delivered
181181
# Metering
182-
self.present_active_power: Optional[
183-
float
184-
] = present_active_power # Optional in AC Scheduled CL
185-
self.present_active_power_l2: Optional[
186-
float
187-
] = present_active_power_l2 # Optional in AC Scheduled CL
188-
self.present_active_power_l3: Optional[
189-
float
190-
] = present_active_power_l3 # Optional in AC Scheduled CL
182+
self.present_active_power: Optional[float] = (
183+
present_active_power # Optional in AC Scheduled CL
184+
)
185+
self.present_active_power_l2: Optional[float] = (
186+
present_active_power_l2 # Optional in AC Scheduled CL
187+
)
188+
self.present_active_power_l3: Optional[float] = (
189+
present_active_power_l3 # Optional in AC Scheduled CL
190+
)
191191

192192
# Required for -2 DC CurrentDemand, -20 DC CL
193193
self.present_current: Union[float, int] = present_current
@@ -218,34 +218,56 @@ def update_ac_charge_parameters_v2(
218218
) -> None:
219219
"""Update the EVSE data context with the AC charge parameters."""
220220
self.current_type = CurrentType.AC
221-
rated_limits = self.rated_limits.ac_limits = EVSEACCPDLimits()
222-
self.session_limits.ac_limits = EVSEACCLLimits()
221+
if self.rated_limits.ac_limits is None:
222+
self.rated_limits.ac_limits = EVSEACCPDLimits()
223+
rated_limits = self.rated_limits.ac_limits
224+
if self.session_limits.ac_limits is None:
225+
self.session_limits.ac_limits = EVSEACCLLimits()
226+
session_limits = self.session_limits.ac_limits
223227
self.nominal_voltage = (
224228
ac_charge_parameter.evse_nominal_voltage.get_decimal_value()
225229
) # noqa: E501
226230
rated_limits.max_current = (
227231
ac_charge_parameter.evse_max_current.get_decimal_value()
228232
)
233+
229234
rated_limits.max_charge_power = rated_limits.max_current * self.nominal_voltage
235+
rated_limits.max_charge_power_l2 = rated_limits.max_charge_power
236+
rated_limits.max_charge_power_l3 = rated_limits.max_charge_power
230237
rated_limits.max_discharge_power = 0
231238
rated_limits.min_charge_power = 0
232239
rated_limits.min_discharge_power = 0
233240
# Create the session limits based on the rated limits
234-
self.session_limits.ac_limits.update(rated_limits.as_dict())
241+
# without exceeding the rated limits
242+
for value in vars(rated_limits):
243+
if hasattr(session_limits, value):
244+
rated_value = getattr(rated_limits, value)
245+
session_value = getattr(session_limits, value)
246+
try:
247+
if not session_value or (session_value > rated_value):
248+
setattr(session_limits, value, rated_value)
249+
except TypeError:
250+
pass
235251

236252
def update_dc_charge_parameters(
237253
self, dc_charge_parameter: DCEVSEChargeParameter
238254
) -> None:
239255
"""Update the EVSE data context with the DC charge parameters."""
240256
self.current_type = CurrentType.DC
241-
rated_limits = self.rated_limits.dc_limits = EVSEDCCPDLimits()
242-
self.session_limits.dc_limits = EVSEDCCLLimits()
257+
if not self.rated_limits.dc_limits:
258+
self.rated_limits.dc_limits = EVSEDCCPDLimits()
259+
rated_limits = self.rated_limits.dc_limits
260+
if not self.session_limits.dc_limits:
261+
self.session_limits.dc_limits = EVSEDCCLLimits()
243262
rated_limits.max_charge_power = (
244263
dc_charge_parameter.evse_maximum_power_limit.get_decimal_value()
245264
)
246265
rated_limits.max_charge_current = (
247266
dc_charge_parameter.evse_maximum_current_limit.get_decimal_value()
248267
)
268+
rated_limits.min_charge_current = (
269+
dc_charge_parameter.evse_minimum_current_limit.get_decimal_value()
270+
)
249271
rated_limits.max_voltage = (
250272
dc_charge_parameter.evse_maximum_voltage_limit.get_decimal_value()
251273
)
@@ -264,8 +286,17 @@ def update_dc_charge_parameters(
264286
self.energy_to_be_delivered = (
265287
dc_charge_parameter.evse_energy_to_be_delivered.get_decimal_value()
266288
)
267-
# Create the session limits based on the rated limits
268-
self.session_limits.dc_limits.update(rated_limits.as_dict())
289+
# Create the session limits based on the rated limits
290+
# without exceeding the rated limits
291+
for value in vars(rated_limits):
292+
if hasattr(self.session_limits.dc_limits, value):
293+
rated_value = getattr(rated_limits, value)
294+
session_value = getattr(self.session_limits.dc_limits, value)
295+
try:
296+
if not session_value or (session_value > rated_value):
297+
setattr(self.session_limits.dc_limits, value, rated_value)
298+
except TypeError:
299+
pass
269300

270301
def update_ac_charge_parameters_v20(
271302
self,

0 commit comments

Comments
 (0)