Model Railroad System
2.2.1
|
This folder contains a collection of example siding CTC panels
The Azatrax_Siding.tcl file contains a simple passing siding using Azatrax devices for block occupancy detection, turnout activation, and turnout point state detection. It uses code from MRD2_Block.tcl and SR4_MRD2_Switch.tcl.
This is the Schematic of the track work, which is a simple siding with a passing siding.
This is the CTC Panel for the siding, which is simply a switch plate and code button for each of the turnouts.
Using the Abstract Data Types (Classes) MRD2_Block and SR4_MRD2_Switch almost all of the code is embeded in these Abstract Data Types, which makes the code here very simple. Specificly, we create a MRD2_Block object for the main and siding tracks:
Then create a connection to the SR4 for use by the two turnouts:
Then we create a SR4_MRD2_Switch object for each turnout, linking them to the main and siding tracks.
Then connect the main and siding MRD2_Block objects to the SR4_MRD2_Switch objects.
Finally, we create a pair of CodeButton objects for the code buttons.
When we assembled the track work and control panel, we set the scripts to run the various callback methods: For the Main straight block, the "Occupied Script" would be "main occupiedp". For the Siding it would be "siding occupiedp". For Switches, "State Script" would be set to "switchN pointstate" and "Occupied Script" would be set to "switchN occupiedp". For the switch plates, the "Normal Script" would be "switchN motor normal" and the "Reverse Script" would be "switchN motor reverse". Finally the code buttons would have an "Action Script" of "codeN code". Thus everything is tied together. The main loop 'invokes' the track work elements, which runs the occupency methods.
The code buttons will run the switch plate functions which in turn will activate the switch machines.