Copyright © 2009, Oliver Barrett
All rights reserved.
--see readme file for contact information
THE APPLICATION CONTROLS A SIMULATED RAILROAD INTERLOCKING CONSISTING OF PASSENGER STATION TRACKS, A GRADE CROSSING BETWEEN TWO RAILROADS AND A RAILROAD SWING BRIDGE.
All switches and track signals are controlled for the purpose of safely lining one train movement through interlocking at a time. Simulated occupancy of each track section by a train movement is displayed.
Interlocking operator can select the following functions from the application screen:
1. Line a selected track switch for movement into or out of the passenger station siding tracks.
2. Line one of five preconfigured interlocking configurations (eastbound, westbound, northbound, southbound or Stop), in preparation for a simulated movement in the same direction (movement will wait outside interlocking limits if configuration at Stop).
3. Select a movement direction and initiate a simulated train movement through interlocking.
A simulated movement (begun by clicking on the Initiate button) will not proceed completely through the interlocking unless the latter is configured for the same direction as the direction of movement. Such a movement may progress partway until it encounters a red signal and will then stop. It may be restarted by first lining the interlocking for the proper direction and then clicking on Initiate again.
Track signal indications will update in real-time to reflect occupancy condition (unless overriden by current interlocking configuration). The indicator for an occupied track section appears orange, otherwise green.
Each signal indicates PROCEED (green) or STOP (red). One or more signals will be forced to display STOP as part of a preconfigured interlocking movement direction (irrespective of track occupancy).
The application uses a Producer-Consumer (Events) design pattern. The interlocking function requests are handled by the producer loop, with separate consumer loops for lining a siding switch, configuring an interlocking direction and initiating a simulated train movement. A separate display loop executes in parallel.
Separate queues are used to pass operator requests for lining a track switch, configuring an interlocking direction and selecting a direction for simulated train movement, using a different enum typedef for each. State machine design patterns are used within the track switch lining, interlocking configuration and interlocking movement subVIs.
Four functional global variables are used for all state data involving track occupancy, switch and bridge states, signal override states (the latter used for lining a given interlocking direction) and current relative movement location/movement direction.
The display loop is initialized by a notifier at the beginning of application execution and runs in parallel to continuously update track occupancy display along with switch and bridge states and all signal indications reflecting interlocking conditions.
SubVIs are used in the display loop to read the binary state word supplied by the functional global variables associated with the track occupancy states, switch/bridge position states and signal override states.
1.0.0: Initial release of the code.