-
Notifications
You must be signed in to change notification settings - Fork 77
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 changes for 2.0.1 #943
Conversation
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
…d added a request to check if there is a reservation for a specific token. Reservations are done on evse level, not on connector level. Further implementation of reservations. Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
…th tests. Some changes in connector availability. Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
… connector type and evse's with different connector types. Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
…ector type. 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]>
…ed. If a reservation is made and there is already an existing one with the same reservation id, cancel that reservation. Add reservation timer. Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
…on. Fix bug with expired reservation. 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]>
…se state after submitting an event. Change set_evse_available to set_evse_state and the same for connector state. Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
…s with Auth tests. Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
… evse index. Fix start reserved session with parent id for 'global' reservation. Change return value of cancel reservation callback so it returns true or false if a reservation could or could not be cancelled. Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
…ce. Add tests for storing and loading reservations. Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
…ions. 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]>
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.
Looks good for Bazel.
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
…king a reservation if the evse manager rejects the reservation. Make sure the evse manager can make the reservation if it is overwritten (same reservation id). Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
…in timed out (swipe of rfid but never a plugin of a connector) Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
modules/OCPP201/manifest.yaml
Outdated
@@ -98,6 +98,10 @@ requires: | |||
interface: display_message | |||
min_connections: 0 | |||
max_connections: 1 | |||
reservation: | |||
interface: reservation | |||
min_connections: 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.
@Pietfried Is it ok that this is mandatory?
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 have discussed this with Cornelius and Kai , lets make it optional to allow compatability of older configs
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
if (evse_reservations.count(evse_id) != 0 && evse_reservations[evse_id].connector_type.has_value() && | ||
(connector_it->type == evse_reservations[evse_id].connector_type.value() || | ||
connector_it->type == types::evse_manager::ConnectorTypeEnum::Unknown || | ||
evse_reservations[evse_id].connector_type.value() == types::evse_manager::ConnectorTypeEnum::Unknown)) { | ||
cancel_reservation(evse_reservations[evse_id].reservation_id, true, | ||
types::reservation::ReservationEndReason::Cancelled); | ||
return; | ||
} |
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.
nit: I find that quite hard to read. Id prefer something like:
bool reservation_exists = evse_reservations.count(evse_id) != 0;
bool reserved_connector_specified = evse_reservations[evse_id].connector_type.has_value();
bool connector_type_matches =
connector_it->type == evse_reservations[evse_id].connector_type.value();
bool connector_type_unknown =
connector_it->type == types::evse_manager::ConnectorTypeEnum::Unknown ||
evse_reservations[evse_id].connector_type.value() == types::evse_manager::ConnectorTypeEnum::Unknown;
if (reservation_exists && reserved_connector_specified && (connector_type_matches || connector_type_unknown)) {
cancel_reservation(evse_reservations[evse_id].reservation_id,
true,
types::reservation::ReservationEndReason::Cancelled);
return;
}
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.
Hmm I did this, but the order is important because of the optionals. I tried what happens if I keep those bools but it's a lot extra checks and I don't know if it will be more readable.
*/ | ||
void init_connector(const int connector_id, const int evse_index); | ||
void init_evse(const int evse_id, const int evse_index, const std::vector<Connector>& connectors); |
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.
yes you can make this assumption and add this requirement to the documentation in the index.rst
with something like
The module connections of the evse_manager requirement must be connected in the correct order in the EVerest config file, i.e. the module representing the EVSE with evse id 1 must listed first, EVSE with evse id 2 second and so on.
types::reservation::ReservationResult | ||
get_evse_state(const uint32_t evse_id, | ||
const std::map<uint32_t, types::reservation::Reservation>& evse_specific_reservations); | ||
|
||
/// | ||
/// \brief Helper function to check if the connector of a specific EVSE is available. | ||
/// \param evse_id The evse id the connector belongs to. | ||
/// \param connector_type The connector type to check. | ||
/// \return The `ReservationResult` to return fot his specific connector. | ||
/// | ||
types::reservation::ReservationResult | ||
is_connector_available(const uint32_t evse_id, const types::evse_manager::ConnectorTypeEnum connector_type); |
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.
it looks better now 👍
That is just a SIL issue, the system module doesnt remember the reset reason.
Probably unrelated to this PR
We need to investigate.
Probably unrelated to this PR
Great that all OCPP1.6 PASS ! TC_049_CS can fail in my view since we can configure |
Yes all the identified issues were not for this pull request, only some we indeed need to investigate.
I wonder if it is our bug of a bug in OCTT.
Yep I also wonder here if it isn't an OCTT bug. Or some feature I don't understand (yet).
Yes you'd already taken a look.
We need to investigate this one as well.
All other tests pass except this one indeed. |
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
…P cancels the reservation. Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
…that id to -1. Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
…and id token. Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
…d_for_connector_callback for OCPP module. Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
interfaces/reservation.yaml
Outdated
Returns true if there is a reservation for the given evse id and token or group id token. If there is an | ||
evse id given, it will also return true if a reservation with this token was made for evse id 0. |
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 description is still based on the bool return type
std::map<int, std::unique_ptr<module::EVSEContext>>& evses; | ||
/// \brief Recursive mutex for the evse map (shared with AuthHandler). | ||
std::recursive_mutex& evse_mutex; | ||
// std::map<uint32_t, Evse> evses; |
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.
// std::map<uint32_t, Evse> evses; |
modules/Auth/lib/Connector.cpp
Outdated
occupied = true; | ||
} | ||
if (connector.get_state() != ConnectorState::UNAVAILABLE && connector.get_state() != ConnectorState::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.
if (reservation_result == ReservationResult::Accepted) { | ||
this->mod->auth_handler->call_reserved(connector_id, reservation.reservation_id); | ||
if (!this->mod->auth_handler->call_reserved(request.reservation_id, request.evse_id)) { | ||
return ReservationResult::Rejected; |
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.
Do we need to cancel the reservation in this case, since it was placed before?
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 that was because you said the evse manager always has the last saying about the reservation. So if the reservation is made but the evse manager sais it is not possible, it is cancelled again.
I don't like that behaviour as well.
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.
Yes but I can not see where the reservation is canceled if the evse manager rejects it
modules/Auth/CMakeLists.txt
Outdated
@@ -21,6 +21,7 @@ target_link_libraries(${MODULE_NAME} | |||
date::date | |||
date::date-tz | |||
everest::timer | |||
nlohmann_json::nlohmann_json |
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 be removed?
nlohmann_json::nlohmann_json |
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 removed it (and will check if it still builds). But it is auto generated so it will be put back in again later probably?
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 part is not autogenerated
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
Describe your changes
Implement reservation changes for ocpp 2.0.1 (connector type, reservation for not specific evse)
OCTT tests:
OCPP 2.0.1
Passed:
TC_H_01_CS
TC_H_02_CS
TC_H_03_CS
TC_H_04_CS
TC_H_06_CS
TC_H_07_CS
TC_H_09_CS
TC_H_10_CS
TC_H_12_CS
TC_H_13_CS
TC_H_16_CS
TC_H_17_CS
TC_H_18_CS
TC_H_19_CS
TC_H_22_CS
TC_H_23_CS
Failed:
TC_B_24_CS: After reset, BootNotification should have reason 'RemoteReset', but is 'PowerUp'.
TC_H_08_CS: Did not receive expected status change to 'Available'.
TC_H_14_CS: Two 'global' reservations and 2 evse's, should set them both to 'reserved'.
TC_H_15_CS: Did not receive expected status change to 'Available'. ??? -> Reservation is 'Cancelled', there is no reservation status update sent.
TC_H_21_CS: When evse is set to Unavailable and a reservation is cancelled, evse should go to 'Unavailable' directly, but it first goes to 'Available'.
TC_H_24_CS: Received unexpected request message: ReservationStatusUpdateRequest (Waiting for StatusNotificationRequest; NotifyEventRequest) ????
OCPP 1.6
Passed:
TC_046_1_CS
TC_046_2_CS
TC_047_CS
TC_048_2_CS
TC_048_3_CS
TC_048_4_CS
TC_050_2_CS
TC_050_3_CS
TC_051_CS
TC_052_CS
TC_053_CS
Failed:
TC_049_CS: Test makes a reservation for connector id 0. Expects a StatusNotification.req with 'Reserved'. Is the test wrong or should we send a StatusNotification.req with connector id 0 and status reserved????
Issue ticket number and link
Checklist before requesting a review