StianØyna

Software developer, Norway

Projects / 2026

Train control simulator

An interactive teaching simulation of a train control system, with a state machine, speed gauge and scenarios.

Open projectView source

A browser simulation of an imagined train control system, made to explain how such software is structured. It has no dependencies and no build step, and is written so it can be moved to TypeScript easily. The interface is in Norwegian.

The page follows the classic control loop: sensors (speed, position, doors, signals) feed a state estimator, a control system applies rules and regulation, and actuators drive traction, the service brake and the emergency brake.

What you can do:

  • Start, stop, trigger an emergency stop and open or close the doors, then watch the state machine move between Stopped, Ready, Running, Braking, EmergencyStop and Fault.
  • Set the target speed and the speed limit, and follow the live speed gauge, the train’s position between two stations and the speed graph with its braking profile.
  • Load scenarios: normal running, approaching a station, overspeed, sensor failure and an open door.
  • Read the matching code and an event log next to the simulation, and switch between dark and light themes.

This is a learning demo only. It is not safety-validated or real-time software, and is not meant for controlling real railway equipment.