Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for ChargeParameterDiscovery get_evse_max_voltage #376

Merged
merged 2 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion iso15118/secc/controller/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,10 @@ async def get_evse_max_voltage_limit(self) -> PVEVSEMaxVoltageLimit:
- ISO 15118-2
"""
session_limits = self.evse_data_context.session_limits
voltage_limit = session_limits.dc_limits.max_voltage
if self.evse_data_context.current_type == CurrentType.AC:
voltage_limit = self.evse_data_context.nominal_voltage
else:
voltage_limit = session_limits.dc_limits.max_voltage
exponent, value = PhysicalValue.get_exponent_value_repr(voltage_limit)
return PVEVSEMaxVoltageLimit(
multiplier=exponent,
Expand Down
10 changes: 5 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions tests/shared/messages/test_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from iso15118.shared.messages.datatypes import (
PVEVSEMaxCurrent,
PVEVSEMaxCurrentLimit,
PVEVSEMaxVoltageLimit,
UnitSymbol,
)

Expand Down Expand Up @@ -207,3 +208,29 @@ async def test_get_evse_present_and_nominal_voltage_are_0(
limit = await evse_controller_interface.get_evse_max_current_limit()
assert isinstance(limit, PVEVSEMaxCurrent)
assert limit == expected_limit

async def test_get_evse_max_voltage_limit_ac(self, evse_controller_interface):
evse_controller_interface.evse_data_context.current_type = CurrentType.AC
evse_controller_interface.evse_data_context.nominal_voltage = 230
expected_limit = PVEVSEMaxVoltageLimit(
multiplier=0,
value=230,
unit=UnitSymbol.VOLTAGE,
)
limit = await evse_controller_interface.get_evse_max_voltage_limit()
assert isinstance(limit, PVEVSEMaxVoltageLimit)
assert limit == expected_limit

async def test_get_evse_max_voltage_limit_dc(self, evse_controller_interface):
evse_controller_interface.evse_data_context.current_type = CurrentType.DC
evse_controller_interface.evse_data_context.session_limits.dc_limits.max_voltage = ( # noqa: E501
1000
)
expected_limit = PVEVSEMaxVoltageLimit(
multiplier=0,
value=1000,
unit=UnitSymbol.VOLTAGE,
)
limit = await evse_controller_interface.get_evse_max_voltage_limit()
assert isinstance(limit, PVEVSEMaxVoltageLimit)
assert limit == expected_limit