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

Add external ready command to EvseManager #479

Merged
merged 4 commits into from
Dec 12, 2023
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
2 changes: 2 additions & 0 deletions config/config-sil-ocpp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ active_modules:
ac_hlc_enabled: false
ac_hlc_use_5percent: false
ac_enforce_hlc: false
external_ready_to_start_charging: true
connections:
bsp:
- module_id: yeti_driver_1
Expand Down Expand Up @@ -56,6 +57,7 @@ active_modules:
ac_hlc_enabled: false
ac_hlc_use_5percent: false
ac_enforce_hlc: false
external_ready_to_start_charging: true
connections:
bsp:
- module_id: yeti_driver_2
Expand Down
12 changes: 12 additions & 0 deletions interfaces/evse_manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ cmds:
description: The response raw exi stream and the status from the CSMS system
type: object
$ref: /iso15118_charger#/Response_Exi_Stream_Status
external_ready_to_start_charging:
description: >-
There are situations where another module needs to do some initialization after evse manager is in principle ready to start charging.
This command can be used (optimally in combination with a configuration option) to delay charging ready until the external module is done with its initialization
result:
description: Returns true if the signal was used by the evse manager implementation
type: boolean
vars:
session_event:
description: Emits all events related to sessions
Expand Down Expand Up @@ -179,6 +186,11 @@ vars:
description: Enforced limits for this node (coming from the EnergyManager)
type: object
$ref: /energy#/EnforcedLimits
waiting_for_external_ready:
description: >-
Signals that the EVSE Manager is in principle ready to start charging,
but delays sending its ready signal waiting for the external_ready_to_start_charging command.
type: boolean
ready:
description: Signals that the EVSE Manager is ready to start charging
type: boolean
Expand Down
8 changes: 8 additions & 0 deletions modules/EvseManager/EvseManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,14 @@ void EvseManager::ready() {
// start with a limit of 0 amps. We will get a budget from EnergyManager that is locally limited by hw
// caps.
charger->setMaxCurrent(0.0F, date::utc_clock::now() + std::chrono::seconds(10));
this->p_evse->publish_waiting_for_external_ready(config.external_ready_to_start_charging);
if (!config.external_ready_to_start_charging) {
// immediately ready, otherwise delay until we get the external signal
this->ready_to_start_charging();
}
}

void EvseManager::ready_to_start_charging() {
charger->run();
charger->enable(0);

Expand Down
3 changes: 3 additions & 0 deletions modules/EvseManager/EvseManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ struct Conf {
bool sae_j2847_2_bpt_enabled;
std::string sae_j2847_2_bpt_mode;
bool request_zero_power_in_idle;
bool external_ready_to_start_charging;
};

class EvseManager : public Everest::ModuleBase {
Expand Down Expand Up @@ -163,6 +164,8 @@ class EvseManager : public Everest::ModuleBase {
std::string selected_protocol = "Unknown";

std::atomic_bool sae_bidi_active{false};

void ready_to_start_charging();
// ev@1fce4c5e-0ab8-41bb-90f7-14277703d2ac:v1

protected:
Expand Down
14 changes: 14 additions & 0 deletions modules/EvseManager/evse/evse_managerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,5 +391,19 @@ void evse_managerImpl::handle_set_get_certificate_response(
mod->r_hlc[0]->call_certificate_response(certificate_reponse);
}

bool evse_managerImpl::handle_external_ready_to_start_charging() {
if (mod->config.external_ready_to_start_charging) {
EVLOG_info << "Received external ready to start charging command.";
mod->ready_to_start_charging();
return true;
} else {
EVLOG_warning
<< "Ignoring external ready to start charging command, this could be a configuration issue. Please check "
"if 'external_ready_to_start_charging' is set to true if you want to use this feature.";
}

return false;
}

} // namespace evse
} // namespace module
1 change: 1 addition & 0 deletions modules/EvseManager/evse/evse_managerImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class evse_managerImpl : public evse_managerImplBase {
handle_switch_three_phases_while_charging(bool& three_phases) override;
virtual void handle_set_get_certificate_response(
types::iso15118_charger::Response_Exi_Stream_Status& certificate_response) override;
virtual bool handle_external_ready_to_start_charging() override;

// ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1
// insert your protected definitions here
Expand Down
4 changes: 4 additions & 0 deletions modules/EvseManager/manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ config:
"EvseManager does not need to wait for energy from the energy manager after plug in."
type: boolean
default: false
external_ready_to_start_charging:
description: Enable the external ready to start charging signal that delays charging ready until it has been received
type: boolean
default: false
provides:
evse:
interface: evse_manager
Expand Down
Loading