-
Notifications
You must be signed in to change notification settings - Fork 89
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
Reservation all connectors reserved (#958) #972
Reservation all connectors reserved (#958) #972
Conversation
44f3b63
to
ec79914
Compare
e7b1ad9
to
b359a9f
Compare
aace320
to
b1476a4
Compare
19ae787
to
37f9f0d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, added a few suggestions
interfaces/evse_manager.yaml
Outdated
The reservation id (should be added to the TransactionStarted event). Negative value if there was | ||
no specific reservation id for this evse (if there are 'global' reservations for 'any' evse). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reservation id (should be added to the TransactionStarted event). Negative value if there was | |
no specific reservation id for this evse (if there are 'global' reservations for 'any' evse). | |
The reservation id (should be added to the TransactionStarted event). Set tis to a negative value if there is | |
no specific reservation id for this evse but the evse should still move to a Reserved state because of total | |
global reservations. |
types/reservation.yaml
Outdated
@@ -54,11 +54,15 @@ types: | |||
Expired: When the reservation expired before the reserved token was used for a session | |||
Cancelled: When the reservation was cancelled manually | |||
UsedToStartCharging: When the reservation ended because the reserved token was used for a session | |||
GlobalReservationConnectorFree: When the reservation ended because there is a connector free and there are less | |||
reservations than available evse's (reservation is still there but it is not | |||
occupying the EVSE anymore). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
occupying the EVSE anymore). | |
occupying this EVSE anymore). |
types/reservation.yaml
Outdated
type: string | ||
enum: | ||
- Expired | ||
- Cancelled | ||
- UsedToStartCharging | ||
- GlobalReservationConnectorFree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since I was a little confused by the name.. maybe GlobalReservationRequirementDropped
?
test_controller.clear_error(1) | ||
|
||
await asyncio.sleep(1) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesnt look like its required at the end of the test case
test_controller.diode_fail() | ||
test_controller.raise_error("MREC6UnderVoltage", 1) | ||
|
||
await asyncio.sleep(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think that we have to sleep here since wait_for_and_validate
will wait for the error event already
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well I gave it a try and removed it again, but we have a race condition here. The statusnotification is sent earlier than the status is received by the auth handler so the reservation handler does not know of the state of the connector yet. :(
test_controller.raise_error("MREC6UnderVoltage", 1) | ||
|
||
await asyncio.sleep(1) | ||
|
||
t = datetime.utcnow() + timedelta(minutes=10) | ||
|
||
# Send a reserve new request | ||
await charge_point_v201.reserve_now_req( | ||
id=0, | ||
id_token=IdTokenType(id_token=test_config.authorization_info.valid_id_tag_1, | ||
type=IdTokenTypeEnum.iso14443), | ||
expiry_date_time=t.isoformat(), | ||
evse_id=1 | ||
) | ||
|
||
# which should return 'faulted' | ||
assert await wait_for_and_validate( | ||
test_utility, | ||
charge_point_v201, | ||
"ReserveNow", | ||
call_result201.ReserveNowPayload(ReserveNowStatusType.faulted), | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also here you can do drop the sleep if you do
raise_error
- wait and validate for StatusNotification.req(Faulted)
- ReserveNow
- wait and validate ReserveNow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here:
We have a race condition here. The statusnotification is sent earlier than the status is received by the auth handler so the reservation handler does not know of the state of the connector yet. :(
), | ||
) | ||
|
||
await asyncio.sleep(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can also be dropped.
@@ -400,6 +413,52 @@ bool ReservationHandler::has_reservation_parent_id(const std::optional<uint32_t> | |||
return false; | |||
} | |||
|
|||
ReservationEvseStatus ReservationHandler::check_number_global_reservations_match_number_available_evses() { | |||
ReservationEvseStatus evse_status; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ReservationEvseStatus evse_status; |
This looks like it is not used
9c9f185
to
0beb627
Compare
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
…s and notify evse manager. Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
…eserved if no more reservations can be made. Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
…rvation was made for connector 0. Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
… after a car stopped charging. Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
…a nullptr. Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
…t for now. Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
…ndler, only cancel it internally. The EVSE Manager will cancel the reservation itself. If the ReservationHandler is calling the callback, there will be race conditions with the evse manager not knowing there is a transaction yet, but the reservation is already cancelled. And some other bug fixes. Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
47b7f5d
to
4314efc
Compare
Describe your changes
When there are as many reservations as evse's available, all available evse's must go to 'reserved'. And back to 'available' when there are more evse's than reservations.
Also, added unittests.
See other related pull requests:
EVerest/libocpp#878
EVerest/everest-utils#171
Issue ticket number and link
#958
Checklist before requesting a review