[OCPP] Add support for OCPP 2.1 Q11 and Q12#1852
Conversation
lib/everest/ocpp/lib/ocpp/v2/functional_blocks/smart_charging.cpp
Outdated
Show resolved
Hide resolved
| std::optional<std::int32_t> get_priority_from_configuration_slot(const int configuration_slot) const override; | ||
| const std::vector<int>& get_network_connection_slots() const override; | ||
| bool is_websocket_connected() override; | ||
| std::optional<std::chrono::time_point<std::chrono::steady_clock>> get_time_disconnected() const; |
There was a problem hiding this comment.
Why make this optional? It was not before so I don't think it should be. I think this also affects the construction of the time disconnected time point
There was a problem hiding this comment.
Before this change a value of 0s was used for 'time disconnected not set'. To me this is a use case for an optional where std::nullopt means 'time disconnected not set'. But if you like it more the way it was before, I can revert that change
There was a problem hiding this comment.
You are right. However, as it is implemented now this "feature" is not used anymore as we always set the disconnected time.
I think a good way to move forward would be to move this "not set" feature to where the old uses of time_disconnected were done and always update time_disconnected since it is now always needed by the new invalid offline profile functionality.
There was a problem hiding this comment.
The idea was that get_time_disconnected returns std::nullopt, if we are not disconnected at all. And if we are disconnected, it returns the corresponding time point. The same way time_disconnected had time_since_epoch() == 0s before when we were not disconnected.
The new invalid offline profile functionality treats it exactly this way.
Pietfried
left a comment
There was a problem hiding this comment.
Please also update the functional requirements in https://github.com/EVerest/everest-core/blob/main/lib/everest/ocpp/doc/v2/ocpp_2x_status.md
lib/everest/ocpp/lib/ocpp/v2/functional_blocks/smart_charging.cpp
Outdated
Show resolved
Hide resolved
…tivity manager Signed-off-by: Jan Bruchhaus <Jan.Bruchhaus@compleo-cs.com>
Signed-off-by: Jan Bruchhaus <Jan.Bruchhaus@compleo-cs.com>
Signed-off-by: Jan Bruchhaus <Jan.Bruchhaus@compleo-cs.com>
Signed-off-by: Jan Bruchhaus <Jan.Bruchhaus@compleo-cs.com>
Signed-off-by: Jan Bruchhaus <Jan.Bruchhaus@compleo-cs.com>
…ionals Signed-off-by: Jan Bruchhaus <Jan.Bruchhaus@compleo-cs.com>
Signed-off-by: Jan Bruchhaus <Jan.Bruchhaus@compleo-cs.com>
…ing the connected callback Signed-off-by: Jan Bruchhaus <Jan.Bruchhaus@compleo-cs.com>
1b3d211 to
ae63fda
Compare
…1 and Q12 Co-authored-by: Piet Gömpel <37657534+Pietfried@users.noreply.github.com> Signed-off-by: JB-CompleoCS <Jan.Bruchhaus@compleo-cs.com>
| std::optional<std::int32_t> get_priority_from_configuration_slot(const int configuration_slot) const override; | ||
| const std::vector<int>& get_network_connection_slots() const override; | ||
| bool is_websocket_connected() override; | ||
| std::optional<std::chrono::time_point<std::chrono::steady_clock>> get_time_disconnected() const override; |
There was a problem hiding this comment.
We should wrap this in a monitor as it can now be used from multiple threads
| if (this->device_model->get_value<int>(ControllerComponentVariables::OfflineThreshold) != 0) { | ||
| // Get the current time point using steady_clock | ||
| this->time_disconnected = std::chrono::steady_clock::now(); | ||
| } |
There was a problem hiding this comment.
There is a regression on this functionality as we now always set the time disconnected. We should most likely remove the optional from time_disconnected and a check on this variable when we do the reconnection check. See other comment
| this->connectivity_manager->confirm_successful_connection(); | ||
|
|
||
| if (this->time_disconnected.time_since_epoch() != 0s) { | ||
| if (const auto time_disconnected = this->connectivity_manager->get_time_disconnected(); |
There was a problem hiding this comment.
We should use the check on the variable here since we always set time disconnected
Describe your changes
Adds support for OCPP 2.1 use cases Q11 and Q12 to libocpp.
Issue ticket number and link
Checklist before requesting a review