# Layout flow (permanent offline)
This diagram shows the different layouts that should be shown to the user, and which internal messages that cause transitions between them. Numbers refer to the corresponding layout as it is named in Figma.
A configuration variable determines whether or not authorization is required before charging can start.
## Authorization not required
```plantuml
@startuml
hide empty description
state Ready as "1 Ready" #lightgreen
state Authorized as "1.1.1 Authorized" #lightgreen
state Preparing as "2 Preparing" #lightblue
[*] --> Ready
Ready --> Authorized: RFID swipe
Ready --> Preparing: EvPlugin
Authorized -left-> Ready: After 60 sec
Authorized --> Preparing: EvPlugin
@enduml
```
## Authorization required
There will be two different flows depending on whether the EV is plugged in before RFID is swiped, and vice versa. They are quite similar, but are split into separate diagrams here for clarity.
### EV plugged in first
```plantuml
@startuml
hide empty description
state Ready as "1 Ready" #lightgreen
state TapRFID as "1.1 Tap RFID" #lightgreen
state Authorizing as "1.1 Authorizing" #lightgreen
state NoAccess as "1.1.2 No access" #yellow
state Preparing as "2 Preparing" #lightblue
[*] --> Ready
Ready --> TapRFID: EVSEC::EVPluggedIn
TapRFID --> Authorizing: RFID swipe
Authorizing --> NoAccess: Authorization failed
Authorizing --> Preparing: Authorization successful
NoAccess --> Ready: After 5 sec
@enduml
```
### RFID swiped first
```plantuml
@startuml
hide empty description
state Ready as "1 Ready" #lightgreen
state Authorizing as "1.1 Authorizing" #lightgreen
state Authorized as "1.1.1 Authorized" #lightgreen
state NoAccess as "1.1.2 No access" #yellow
state Preparing as "2 Preparing" #lightblue
[*] --> Ready
Ready --> Authorizing: RFID swipe
Authorizing --> NoAccess: Authorization failed
Authorizing --> Authorized: Authorization successful
NoAccess --> Ready: After 5 sec
Authorized --> Preparing: EVSEC::EVPluggedIn
Authorized --> Ready: After 60 sec
@enduml
```
## Complete flow
The possible authorization flows are shown separately.
```plantuml
@startuml
hide empty description
state Ready as "1 Ready" #lightgreen
state AuthorizationProcedure as "<<Authorization procedure>>"
state Preparing as "2 Preparing" #lightblue {
Preparing: EVSEC::StartCharging\n(Bx)
}
state Charging as "3.0.0 Charging Default" #lightblue {
Charging: Relays closed (C2)
}
state ChargingPaused as "3.1.0 Charging Paused General"#lightblue {
ChargingPaused: Relays open\n(Bx or C1)
}
state Done as "4.0 Done" #lightgreen
state Error as "5.x Error" #red
[*] --> Ready: ChargingStationController in idle? B01 / setup complete?
'note on link
'NFC::NFCTag before EvPluggedIn?
'end note
Ready --> AuthorizationProcedure: RFID swipe
Ready --> AuthorizationProcedure: Ev plugin
AuthorizationProcedure --> Preparing
Preparing --> Charging: EVSEC::PowerPathClosed
Charging --> ChargingPaused: EVSEC::PowerPathOpen
Charging --> Done: EVSEC::EVUnplugged \nOR De-authorized
ChargingPaused --> Charging: EVSEC::PowerPathClosed
ChargingPaused --> Done: EVSEC::EVUnplugged
Done -up-> Ready: After 15 sec
@enduml
```
CSC: ChargingStationController
EVSEC: EvseController
- When "deauthorization" occurs in any state (RFID-/NFC swipe): Go to Done and then Ready
## Questions
- Transition to Error allowed from any state? Which state do we transition to after Error is resolved?
## Assumptions
- Charging is shown as long as there is electrical contact (C2). This does not mean that there is any energy transfer.
- If RFID is swiped, even if it is not required, go directly to authorized without informing user that the swipe was unnecessary.
## Information from Kanchan
Figma slide
A Available 1
B Authorizing (not connected) - 1.1
Access fails --> 1.1.2 --> 5 seconds --> go to 1
Access granted --> 1.1.1 --> Wait for 1 minute to connect the cable [check if OCPP 2.0.1 has a config parameter] --> go to 1
C Connected, not authorized (auth required) -->
Scan QR code 1.1 (if CSMS is not connected) / 1.1.0 (if CSMS connected)
RFID swiped --> Go to B
Connected, auth not required --> go to 2
D Preparing - 2
E EvNotDrawingCurrent - 3-car-paused
F Charging - 3
G EvOnHold - 3-charger-paused
H EvSleeping - 3 car paused
I Faulted state - 1.1.2 Error --Needs rework
J Unavailable - 5.4
K Unknown state - 1.1.2 Error - define an error code, ex: self test failed.
H WaitForEVStartChargingState - 3
I Finishing - 4.1 Done
# Layout flow (online)
***Note: This is stored here only as a reference for an online release.***
```plantuml
@startuml
hide empty description
state Ready #lightgreen
state ScanQr #lightgreen {
ScanQr: Also includes app etc.\n(B1)
}
state Authorizing #lightgreen {
Authorizing: Charging station controller decides\n(B1)
}
state NoAccess #yellow
state Preparing #lightblue {
Preparing: EVSEC::StartCharging\n(Bx)
}
state Charging #lightblue {
Charging: Relays closed (C2)
}
state ChargingPaused #lightblue {
ChargingPaused: Relays open\n(Bx or C1)
}
state EcoModeCharging #lightgrey
state Done #lightgreen
state Error #red
[*] --> Ready: ChargingStationController in idle? B01 / setup complete?
Ready --> ScanQr: EVSEC::EVPluggedIn /
Ready --> Authorizing
note on link
NFC::NFCTag before EvPluggedIn?
end note
ScanQr --> Authenticating: NFC::NFCTag
Authenticating --> Preparing: CSC::<<Authentication successful>>
Authenticating --> NoAccess: CSC::<<Authentication failed>>
NoAccess --> ScanQr: After 5 sec
Preparing --> Charging: EVSEC::PowerPathClosed
Charging --> ChargingPaused: EVSEC::PowerPathOpen
Charging --> Done: EVSEC::EVUnplugged \nOR De-authorized
ChargingPaused --> Charging: EVSEC::PowerPathClosed
ChargingPaused --> Done: EVSEC::EVUnplugged
Done -up-> Ready: After 15 sec
@enduml
```