Simulator


  • Turnouts have three states: 1) Not in use/committed, 2) Clear, 3) Thrown. If a turnout is clear or thrown then it is in use by a train and a second train needing that turnout is blocked. When a loco is at the end of a block about to enter a turnout, if the turnout is not in use it is "set" to block other locos or it is blocked. The turnout is released in the next cycle.


In version #2 of the simulator I redesigned the retained state of the turnouts. Now there are four possible states: 1) In use/committed or not and 2) Clear or thrown. Reality being a physical turnout is either cleared or thrown whether in use or not. This way the turnout is in a known state whether in use or not. Two problems are solved:

    • The state of the turnout is always known so that the relevant signals can be set based on known conditions.
    • In the display, as with the signals, the true state of the turnout can be displayed. If the turnout is in use, the path can be shown in green and the unused path in gray. When the turnout is released the green path is displayed in black. The other option remains gray.


  • Signals Because turnouts not in use are in an unknown condition, both the mainline signal (top) and turnout signal (bottom) are Clear (Green). Of course, when the turnout is in use the signal for one of the two paths through the turn must be Stop (Red). This is why in the simulator idle or stopped state there are so many GREEN signals.


In version #2 of the simulator with the changes to turnout state above, the "physical" state of the turnout is known and can be used to set signals. One of the two signals on a poll before a turnout must be red. 'the other signal may be red, yellow or green depending on the state of things past the turnout.


Reality


  • Turnouts have six states: 1) In transit to Clear, 2) In transit to Thrown, 3) Clear, 4) Thrown, 5) Clear & in use, 6) Thrown & in use. Having chosen to use slow motion motors to move turnouts, there is a ~4 second time delay from one state (clear or thrown) to the other. Otherwise, the hardware is clear or thrown being in use or not. When a loco enters a block (is at the first sensor) headed towards a turnout, there are three possible conditions:
    • The turnout(s) is in the state needed and not in use (state 3 or 4).
      • The turnout state is changed to "in use" (state 5 or 6)
      • The loco proceeds to the second sensor
      • When the loco reaches the second sensor, the turnout state is checked and the loco proceeds through the turnout
      • The turnout state is changed back to state 3 or 4.
    • The turnout(s) is not in the state needed and not in use (state 3 or 4).
      • Command is sent to change turnout(s), timer set, and state is set to in transit (state 1 or 2).
      • The loco proceeds to the second sensor
      • When the timer expires, the turnout state is set to 5 or 6
      • When the loco reaches the second sensor, the turnout state is checked:
        • If the turnout is still in transit (state 1 or 2) the loco stops and waits for the state to change
        • When the state is in the needed position the loco proceeds
      • The turnout state is changed to the new state, unused (state 3 or 4)
    • The turnout(s) is in transit or in use (states 1 or 2 or state 5 or 6)
      • The loco stops at the first sensor and waits for the turnout to become state 3 or 4
      • See the two processes above.