Skip to content

Commit cdf3ce6

Browse files
committed
feat(evse_manager)!: restructure charging state machine to simplify pause/resume and remove replug
Remove WaitingForEnergy, Replug states and related session events (ChargingResumed, ReplugStarted, ReplugFinished, WaitingForEnergy). Consolidate pause handling into ChargingPausedEVSE with reason tracking (Error, NoEnergy, UserPause) via new PauseChargingEVSEReasonEnum. Key changes in Charger state machine: - Replace WaitingForEnergy state with direct transitions through ChargingPausedEVSE, which now reports multiple concurrent reasons - Remove evse_replug command from BSP interface and all implementations - Remove EvseReplugStarted/Finished events from board_support_common - Add configurable hlc_charge_loop_without_energy_timeout_s for ISO sessions to handle no-energy scenarios gracefully in charge loop - Add dc_ramp_ampere_per_second config for DC current ramping - Change zero_power_ignore_pause default to true for better EV compatibility - Introduce StoppingCharging as proper transitional state that waits for contactor open before moving to paused or finished states - Use atomic flags (flag_authorized, flag_transaction_active, flag_ev_plugged_in, flag_paused_by_evse) for thread-safe state BREAKING CHANGE: Removes WaitingForEnergy, ChargingResumed, ReplugStarted, ReplugFinished session events and evse_replug BSP command. Consumers must handle ChargingPausedEVSE with reason tracking instead. Smoke tests: - Add pause/resume session commands to test controller interface - Add comprehensive smoke tests for pause/resume and no-energy scenarios - Remove deprecated startup_tests.py in favor of new probe-based tests Signed-off-by: Piet Gömpel <pietgoempel@gmail.com> Signed-off-by: Cornelius Claussen <cc@pionix.de> Signed-off-by: Sebastian Lukas <sebastian.lukas@pionix.de>
1 parent cd96d4d commit cdf3ce6

File tree

69 files changed

+1559
-933
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1559
-933
lines changed

applications/pionix_chargebridge/include/charge_bridge/everest_api/evse_bsp_api.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ class evse_bsp_api : public everest::lib::io::event::fd_event_register_interface
7373
void receive_cp_state_F(std::string const& payload);
7474
void receive_allow_power_on(std::string const& payload);
7575
void receive_ac_switch_three_phases_while_charging(std::string const& payload);
76-
void receive_evse_replug(std::string const& payload);
7776
void receive_ac_overcurrent_limit(std::string const& payload);
7877
void receive_lock();
7978
void receive_unlock();

applications/pionix_chargebridge/src/everest_api/evse_bsp_api.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,6 @@ void evse_bsp_api::dispatch(std::string const& operation, std::string const& pay
119119
receive_allow_power_on(payload);
120120
} else if (operation == "ac_switch_three_phases_while_charging") {
121121
receive_ac_switch_three_phases_while_charging(payload);
122-
} else if (operation == "evse_replug") {
123-
receive_evse_replug(payload);
124122
} else if (operation == "ac_overcurrent_limit") {
125123
receive_ac_overcurrent_limit(payload);
126124
} else if (operation == "lock") {
@@ -393,9 +391,6 @@ void evse_bsp_api::receive_allow_power_on(std::string const& payload) {
393391
void evse_bsp_api::receive_ac_switch_three_phases_while_charging(std::string const&) {
394392
}
395393

396-
void evse_bsp_api::receive_evse_replug(std::string const&) {
397-
}
398-
399394
void evse_bsp_api::receive_ac_overcurrent_limit(std::string const&) {
400395
}
401396

applications/utils/everest-testing/src/everest/testing/core_utils/controller/everest_test_controller.py

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ def plug_in(self, connector_id=1):
5353
def plug_in_ac_iso(self, connector_id=1):
5454
self._mqtt_client.publish(
5555
f"{self._mqtt_external_prefix}everest_external/nodered/{connector_id}/carsim/cmd/execute_charging_session",
56-
"sleep 1;iso_wait_slac_matched;iso_start_v2g_session AC 86400 0;iso_wait_pwr_ready;iso_draw_power_regulated 16,3;sleep 20;iso_stop_charging;iso_wait_v2g_session_stopped;unplug")
56+
"sleep 1;iso_wait_slac_matched;iso_start_v2g_session AC 86400 0;iso_wait_pwr_ready;iso_draw_power_regulated 16,3;sleep 60;iso_stop_charging;iso_wait_v2g_session_stopped;unplug")
5757

5858
def plug_in_dc_iso(self, connector_id=1):
5959
self._mqtt_client.publish(
6060
f"{self._mqtt_external_prefix}everest_external/nodered/{connector_id}/carsim/cmd/execute_charging_session",
61-
"sleep 1;iso_wait_slac_matched;iso_start_v2g_session DC 86400 0;iso_wait_pwr_ready;iso_wait_for_stop 20;iso_wait_v2g_session_stopped;unplug"
61+
"sleep 1;iso_wait_slac_matched;iso_start_v2g_session DC 86400 0;iso_wait_pwr_ready;iso_wait_for_stop 60;iso_wait_v2g_session_stopped;unplug"
6262
)
6363

6464
def plug_out(self, connector_id=1):
@@ -70,6 +70,36 @@ def plug_out_iso(self, connector_id=1):
7070
self._mqtt_client.publish(
7171
f"{self._mqtt_external_prefix}everest_external/nodered/{connector_id}/carsim/cmd/modify_charging_session",
7272
"iso_stop_charging;iso_wait_v2g_session_stopped;unplug")
73+
74+
def pause_session(self, connector_id=1):
75+
self._mqtt_client.publish(
76+
f"{self._mqtt_external_prefix}everest_external/nodered/{connector_id}/carsim/cmd/modify_charging_session",
77+
"pause;sleep 36000"
78+
)
79+
80+
def resume_session(self, connector_id=1):
81+
self._mqtt_client.publish(
82+
f"{self._mqtt_external_prefix}everest_external/nodered/{connector_id}/carsim/cmd/modify_charging_session",
83+
"draw_power_regulated 16,3"
84+
)
85+
86+
def pause_iso_session(self, connector_id=1):
87+
self._mqtt_client.publish(
88+
f"{self._mqtt_external_prefix}everest_external/nodered/{connector_id}/carsim/cmd/modify_charging_session",
89+
"iso_pause_charging;iso_wait_for_resume"
90+
)
91+
92+
def resume_iso_session_ac(self, connector_id=1):
93+
self._mqtt_client.publish(
94+
f"{self._mqtt_external_prefix}everest_external/nodered/{connector_id}/carsim/cmd/modify_charging_session",
95+
"iso_start_bcb_toggle 3;iso_wait_pwm_is_running;iso_start_v2g_session AC 86400 0;iso_wait_pwr_ready;iso_draw_power_regulated 16,3;iso_wait_for_stop 60"
96+
)
97+
98+
def resume_iso_session_dc(self, connector_id=1):
99+
self._mqtt_client.publish(
100+
f"{self._mqtt_external_prefix}everest_external/nodered/{connector_id}/carsim/cmd/modify_charging_session",
101+
"iso_start_bcb_toggle 3;iso_wait_pwm_is_running;iso_start_v2g_session DC 86400 0;iso_wait_pwr_ready;iso_dc_power_on;iso_wait_for_stop 60"
102+
)
73103

74104
def swipe(self, token, connectors=None):
75105
connectors = connectors if connectors is not None else [1]

applications/utils/everest-testing/src/everest/testing/core_utils/controller/test_controller_interface.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,36 @@ def plug_out_iso(self, connector_id):
4646
Plug out of an electric vehicle properly ending the ISO15118 session.
4747
"""
4848
raise NotImplementedError()
49+
50+
def pause_session(self, connector_id):
51+
"""
52+
Pause an ongoing charging session.
53+
"""
54+
raise NotImplementedError()
55+
56+
def resume_session(self, connector_id):
57+
"""
58+
Resume a paused charging session.
59+
"""
60+
raise NotImplementedError()
61+
62+
def pause_iso_session(self, connector_id):
63+
"""
64+
Pause an ongoing ISO15118 session initiated by the EV.
65+
"""
66+
raise NotImplementedError()
67+
68+
def resume_iso_session_ac(self, connector_id):
69+
"""
70+
Resume a paused ISO15118 session initiated by the EV.
71+
"""
72+
raise NotImplementedError()
73+
74+
def resume_iso_session_dc(self, connector_id):
75+
"""
76+
Resume a paused ISO15118 session initiated by the EV.
77+
"""
78+
raise NotImplementedError()
4979

5080
def plug_out(self):
5181
"""

config/config-CB-EVAL-DC.yaml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
settings:
22
telemetry_enabled: false
33
active_modules:
4+
packet_sniffer:
5+
module: PacketSniffer
6+
config_module:
7+
device: cb_plc
8+
session_logging_path: ""
9+
connections:
10+
evse_manager:
11+
- implementation_id: evse
12+
module_id: connector_1
413
auth:
514
config_module:
615
connection_timeout: 60
@@ -161,7 +170,7 @@ active_modules:
161170
config_module:
162171
cfg_heartbeat_interval_ms: 500
163172
module: over_voltage_monitor_API
164-
external_limits:
173+
external_energy_limits_consumer_api:
165174
connections:
166175
energy_node:
167176
- implementation_id: external_limits
@@ -170,3 +179,12 @@ active_modules:
170179
cfg_heartbeat_interval_ms: 1000
171180
cfg_communication_check_to_s: 0
172181
module: external_energy_limits_consumer_API
182+
evse_manager_consumer_api:
183+
module: evse_manager_consumer_API
184+
connections:
185+
evse_manager:
186+
- implementation_id: evse
187+
module_id: connector_1
188+
evse_bsp:
189+
- implementation_id: main
190+
module_id: cb_bsp

config/config-CB-SAT-AC.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
settings:
22
telemetry_enabled: false
33
active_modules:
4+
packet_sniffer:
5+
module: PacketSniffer
6+
config_module:
7+
device: cb_plc
8+
session_logging_path: ""
9+
connections:
10+
evse_manager:
11+
- implementation_id: evse
12+
module_id: connector_1
413
auth:
514
config_module:
615
connection_timeout: 60
@@ -128,3 +137,18 @@ active_modules:
128137
cb_bsp:
129138
connections: {}
130139
module: evse_board_support_API
140+
evse_manager_consumer_api:
141+
module: evse_manager_consumer_API
142+
connections:
143+
evse_manager:
144+
- implementation_id: evse
145+
module_id: connector_1
146+
evse_bsp:
147+
- implementation_id: main
148+
module_id: cb_bsp
149+
external_energy_limits_consumer_api:
150+
module: external_energy_limits_consumer_API
151+
connections:
152+
energy_node:
153+
- implementation_id: external_limits
154+
module_id: grid_connection_point

docs/source/reference/EVerest_API/evse_board_support_API.yaml

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,8 @@ channels:
6262
receive_ac_switch_three_phases_while_charging:
6363
address: 'e2m/ac_switch_three_phases_while_charging'
6464
messages:
65-
receive_ac_switch_three_phases_while_charging:
66-
$ref: '#/components/messages/receive_ac_switch_three_phases_while_charging'
67-
receive_evse_replug:
68-
address: 'e2m/evse_replug'
69-
messages:
70-
receive_evse_replug:
71-
$ref: '#/components/messages/receive_evse_replug'
65+
receive_ac_switch_three_phases_while_charging:
66+
$ref: '#/components/messages/receive_ac_switch_three_phases_while_charging'
7267
receive_ac_overcurrent_limit:
7368
address: 'e2m/ac_overcurrent_limit'
7469
messages:
@@ -205,12 +200,6 @@ operations:
205200
channel:
206201
$ref: '#/channels/receive_ac_switch_three_phases_while_charging'
207202
description: 'Direction: EVerest to Module'
208-
receive_evse_replug:
209-
title: 'Receive request for virtual replug sequence'
210-
action: receive
211-
channel:
212-
$ref: '#/channels/receive_evse_replug'
213-
description: 'Direction: EVerest to Module'
214203
receive_ac_overcurrent_limit:
215204
title: 'Receive over current limit'
216205
action: receive
@@ -384,23 +373,6 @@ components:
384373
- summary: ""
385374
payload:
386375
"ThreePhases"
387-
receive_evse_replug:
388-
name: receive_evse_replug
389-
title: 'Receive request for virtual replug sequence'
390-
summary: >-
391-
Optional, in case of doubt do not implement.
392-
Special command initiate a virtual replug sequence of adjustable duration without restarting
393-
session. Emits a EvseReplugStarted event if supported and started. BSP will
394-
take care to not emit other events such as CarPluggedIn/Out during that time.
395-
Once finished it will emit a EvseReplugFinished. This is mainly for testing purposes,
396-
don't implement for production use.
397-
contentType: application/json
398-
payload:
399-
$ref: '#/components/schemas/Duration'
400-
examples:
401-
- summary: ""
402-
payload:
403-
200
404376
receive_ac_overcurrent_limit:
405377
name: receive_ac_overcurrent_limit
406378
title: 'Receive over current limit'
@@ -624,8 +596,6 @@ components:
624596
- A-F: CP states as defined in IEC61851-1
625597
- PowerOn: Hardware confirms that contactors switched on correctly (typically mirror contacts indicated successful switch on)
626598
- PowerOff: Hardware confirms that contactors switched off correctly and are not welded (typically mirror contacts indicated successful switch off)
627-
- EvseReplugStarted: Special testing sequence: virtual replugging started
628-
- EvseReplugFinished: Special testing sequence: virtual replugging stopped
629599
- Disconnected: Only used on EV side: Not connected to a charging station. Do not use on EVSE side.
630600
enum:
631601
- 'A'
@@ -636,8 +606,6 @@ components:
636606
- 'F'
637607
- 'PowerOn'
638608
- 'PowerOff'
639-
- 'EvseReplugStarted'
640-
- 'EvseReplugFinished'
641609
- 'Disconnected'
642610
Current:
643611
description: Electrical current in milliampere (mA)

docs/source/reference/EVerest_API/evse_manager_consumer_API.yaml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,6 @@ components:
871871
- Disabled: EVSE is disabled on not available for energy transfer
872872
- Preparing: First user interaction occured, e.g. plug in of EV or authorization has been received
873873
- AuthRequired: EV is plugged in and EVSE is waiting for authorization
874-
- WaitingForEnergy: EVSE is waiting for energy. Occurs at the start of the session or when no energy is available
875874
- ChargingPausedEV: Session is paused by EV
876875
- ChargingPausedEVSE: Session is paused by EVSE
877876
- Charging: EV is charging
@@ -887,7 +886,6 @@ components:
887886
- Preparing
888887
- Reserved
889888
- AuthRequired
890-
- WaitingForEnergy
891889
- ChargingPausedEV
892890
- ChargingPausedEVSE
893891
- Charging
@@ -1320,7 +1318,7 @@ components:
13201318
charging_state_changed_event:
13211319
description: >-
13221320
Data for ChargingStateChangedEvent. Shall be set for the following SessionEventEnums:
1323-
ChargingStarted, ChargingResumed, ChargingPausedEV, Charging
1321+
ChargingStarted, ChargingPausedEV, Charging
13241322
type: object
13251323
$ref: '#/components/schemas/ChargingStateChangedEvent'
13261324
authorization_event:
@@ -1347,17 +1345,13 @@ components:
13471345
- PrepareCharging: EVSE started to prepare for charging. DC: CableCheck, PreCharge, PowerDelivery. AC: wait for the car to proceed to state C/D
13481346
- ChargingStarted: DC: CurrentDemand has started. AC: Auth is ok and car requested power (state C/D)
13491347
- ChargingPausedEV: Signaled when charging is paused by the EV
1350-
- WaitingForEnergy: Waiting for ernergy manager
13511348
- ChargingPausedEVSE: Signaled when charging is paused by the EVSE
1352-
- ChargingResumed: Charging has resumed from a pause
13531349
- StoppingCharging: EVSE has started to stop the charging process. DC: CurrentDemand has finished, now doing WeldingCheck etc, AC: Wait for car to return to state B or A
13541350
- ChargingFinished: Charging is finished. Essentially the same as TransactionFinished, but emitted for clarity
13551351
- TransactionFinished: Signaled when the transaction finished. Transaction finishes at the point where one of the preconditions for charging irrevocably becomes false: When a user swipes to stop the transaction and the stop is authorized.
13561352
- SessionFinished: Session finishes at the point that the EVSE is available again (no cable plugged)
13571353
- ReservationStart: Signaled when a reservation starts
13581354
- ReservationEnd: Signaled when a reservation ends
1359-
- ReplugStarted: Signaled when the EVSE Manager virtually replugs without interrupting the session or transaction
1360-
- ReplugFinished: Signaled when the virtual replug process has finished
13611355
- PluginTimeout: Signaled when an EV has been Plugged in but no authorization is present within specified ConnectionTimeout
13621356
- SwitchingPhases: Signals that 1ph/3ph switching was started on AC charging
13631357
- SessionResumed: Signaled when a session is resumed at startup (e.g. because of previous powerloss)
@@ -1374,16 +1368,12 @@ components:
13741368
- ChargingStarted
13751369
- ChargingPausedEV
13761370
- ChargingPausedEVSE
1377-
- WaitingForEnergy
1378-
- ChargingResumed
13791371
- StoppingCharging
13801372
- ChargingFinished
13811373
- TransactionFinished
13821374
- SessionFinished
13831375
- ReservationStart
13841376
- ReservationEnd
1385-
- ReplugStarted
1386-
- ReplugFinished
13871377
- PluginTimeout
13881378
- SwitchingPhases
13891379
- SessionResumed

interfaces/evse_board_support.yaml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,6 @@ cmds:
5959
value:
6060
description: 'True: switch to 3ph, False: switch to 1ph'
6161
type: boolean
62-
evse_replug:
63-
description: >-
64-
Optional, in case of doubt do not implement.
65-
Special command initiate a virtual replug sequence without restarting
66-
session. Emits a EvseReplugStarted event if supported and started. BSP will
67-
take care to not emit other events such as CarPluggedIn/Out during that time.
68-
Once finished it will emit a EvseReplugFinished. This is mainly for testing purposes,
69-
don't implement for production use.
70-
arguments:
71-
value:
72-
description: Time in ms for the duration of the replug sequence
73-
type: integer
7462
ac_set_overcurrent_limit_A:
7563
description: >-
7664
Many chargers implement a fast over current shutdown directly in the hardware that triggers if the EV draws more current than

lib/everest/everest_api_types/include/everest_api_types/evse_board_support/API.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ enum class Event {
1818
F,
1919
PowerOn,
2020
PowerOff,
21-
EvseReplugStarted,
22-
EvseReplugFinished,
2321
Disconnected,
2422
};
2523

0 commit comments

Comments
 (0)