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

Updates to store EV and EVSE limits shared in CPD and CL (-20 AC and DC). #279

Merged
merged 54 commits into from
Nov 5, 2023

Conversation

shalinnijel2
Copy link
Contributor

@shalinnijel2 shalinnijel2 commented Jul 21, 2023

In this PR:

  1. Save the ev/evse limits shared during AC/DC ChargeParameterDiscoveryReq/Res (tests added)
  2. Update/read these limits during charging loop. (tests added)

@shalinnijel2 shalinnijel2 marked this pull request as ready for review July 31, 2023 12:04
@shalinnijel2 shalinnijel2 changed the title Updates for DC/DC-BPT Updates to store EV and EVSE limits in separate dataclasses. Jul 31, 2023
@shalinnijel2 shalinnijel2 changed the title Updates to store EV and EVSE limits in separate dataclasses. Updates to store EV and EVSE limits shared in CPD and CL (-20 AC and DC). Jul 31, 2023
ikaratass
ikaratass previously approved these changes Jul 31, 2023
Copy link
Collaborator

@ikaratass ikaratass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


# Specific to ISO 15118-20 DC BPT
ev_max_discharge_current: Optional[float] = None
ev_min_discharge_current: Optional[float] = None
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iso15118/secc/controller/ev_data.py Outdated Show resolved Hide resolved
iso15118/secc/controller/ev_data.py Outdated Show resolved Hide resolved
iso15118/secc/controller/ev_data.py Outdated Show resolved Hide resolved
iso15118/secc/controller/ev_data.py Outdated Show resolved Hide resolved
iso15118/secc/controller/ev_data.py Show resolved Hide resolved
Comment on lines 118 to 119
ac_limits: Optional[ACLimits] = None
ac_bpt_limits: Optional[ACBPTLimits] = None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to separate ac_limits from the ac_bpt_limits? cant we have both together?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thinking was as cs limits splits these, this would make it easier for implementers. This would make it evident that the bpt bit could be skipped if not interesting.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But if I am not mistaken, if you use the BPT ones, you also need the regular ones...the BPT ones are supposed to be an extension of the regular ones, right?
And here, one could create a structure only with the BPT ones, neglecting the regular ones.
wont that be an issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if picking the bpt version, the non-bpt equivalent will also be required.
We can't make ac_limits non optional here as dc_limits also lives in the same RatedLimits dataclass.
One option is to let the bpt limits live as optional ones in the ac_limits/dc_limits dataclass. But splitting them makes it slightly easier to read I think. But as these rated limits are built from cs-config we can clarify (will have to be in the documentation though) that this is needed. Hmm, do we need add a post_init() to validate?

iso15118/secc/controller/evse_data.py Outdated Show resolved Hide resolved
iso15118/secc/states/iso15118_20_states.py Show resolved Hide resolved
@notion-workspace
Copy link

Comment on lines 1782 to 1786
await self.comm_session.evse_controller.send_charging_power_limits(
self.comm_session.protocol,
control_mode,
selected_energy_service.service,
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldnt we guard this with try except? what if it never returns or throws an exception?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, wrapped in try catch. The idea at the moment being any sort of error would be caught in the interface implementation, re-thrown as a timeout exception and the reason passed to the EV.

iso15118/secc/states/iso15118_20_states.py Outdated Show resolved Hide resolved
iso15118/secc/controller/evse_data.py Outdated Show resolved Hide resolved
iso15118/secc/controller/evse_data.py Outdated Show resolved Hide resolved


@dataclass
class EVSEACLimits(Limits):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we change the name to EVSEACCPDLimits and add a description to the class expanding the name

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, done.

iso15118/secc/controller/ev_data.py Outdated Show resolved Hide resolved
Comment on lines 144 to 145
ac_limits: Optional[EVACCLLimits] = None
dc_limits: Optional[EVDCCLLimits] = None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the purpose of these ones?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done - removed.

iso15118/secc/controller/ev_data.py Outdated Show resolved Hide resolved
iso15118/shared/messages/iso15118_20/common_types.py Outdated Show resolved Hide resolved
iso15118/shared/messages/iso15118_20/common_types.py Outdated Show resolved Hide resolved
@shalinnijel2 shalinnijel2 merged commit 556a097 into master Nov 5, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants