
π Railways & Public Transport Β· State Machine
The states of a train ticket from booking to journey, including RAC and waitlist confirmation and cancellation.
Drawing diagramβ¦
State machine for a PNR: Booked as Confirmed, RAC or Waitlisted. Waitlisted can move to RAC or Confirmed on cancellations. At chart preparation, still-waitlisted e-tickets are Cancelled with an automatic refund. Confirmed and RAC tickets become Travelled after the journey, or Cancelled by the passenger with a refund.
stateDiagram-v2 [*] --> Confirmed: Seat available [*] --> RAC: Shared berth only [*] --> Waitlisted: No seat Waitlisted --> RAC: Cancellations Waitlisted --> Confirmed: Cancellations RAC --> Confirmed: Cancellations Waitlisted --> AutoCancelled: Chart prepared, still waitlisted Confirmed --> Cancelled: Passenger cancels RAC --> Cancelled: Passenger cancels Confirmed --> Travelled: Journey done RAC --> Travelled: Journey done AutoCancelled --> [*] Cancelled --> [*] Travelled --> [*]
A railway reservation system in the style of IRCTC: seat inventory per train and class, waitlists, Tatkal quota, payments and e-tickets.
How a metro fare is charged with a smart card or bank card: tap in at the entry gate, tap out at the exit, fare by distance and balance update.
How a city bus app shows live bus positions and arrival times: GPS devices on buses, a prediction model and updates to apps and stop displays.
How a modern railway signalling network is connected: interlocking at stations, track circuits, train control radio and the central traffic control centre.
A journey planner that combines metro, bus, suburban train and last-mile options into one trip plan with a single ticket.
Tables for train operations: trains, routes, stations, scheduled stops, coaches and daily running with actual times.