Overview
System
This use case focuses on managing Electric Vehicle (EV) charging stations using a serverless workflow. The system handles various events related to the charging process, including card scanning, charging session management, and error handling. The system interacts with the EV power supplier’s API to perform necessary operations like starting or ending sessions, locking and unlocking slots, processing payments, and handling errors.Actors
- EV Owner: The person using the charging station.
- Charging Station: The physical unit where vehicles are charged.
- EV Power Supplier API: The external system responsible for managing the charging process, slot availability, and session data.
Goals
- Automate Charging Station Operations: Automate the process of handling charging sessions, from card scanning to payment processing and error management.
- Improve User Experience: Provide a smooth and efficient charging experience by ensuring slots are managed effectively and errors are promptly addressed.
- Ensure System Integrity: Implement robust error handling to maintain service continuity and prevent misuse or unauthorized access.
Preconditions
- The charging station must be connected to the EV Power Supplier’s network.
- The card used for charging must be registered and valid.
- The charging station has two available slots, each capable of handling one vehicle at a time.
Scenario
Triggers
The workflow is triggered by two types of events:- Card Scanned Event: Occurs when a user scans their card at the charging station.
- Fault Event: Occurs when the charging station reports an error or fault.
Flow Breakdown
1. Initialization:
- Capture the event details and store them in the workflow context.
2. Handle Station Events:
- Depending on the event type, the workflow either attempts to manage a charging session or handles an error.
3. Try to Get Active Session:
- Check if there is an active session for the scanned card.
4. Handle Active Session:
- If a session is in progress, attempt to end it. If no session is in progress, try to acquire an available slot.
5. Try to Acquire Slot:
- If an available slot is found, start a new charging session. If no slots are available, make the station’s LED flicker red and end the workflow.
6. Start Session:
- Initialize a new charging session, lock the slot, and start the charging process.
7. End Session:
- End the charging session, process the payment, unlock the slot, and notify the user by flickering the LED.
8. Handle Error:
- Contact support, activate the red LED, and notify the system about the error.
Visualization
The following diagram represents the high-level flow of the workflow: