Actions

Using outputs to set routes

How to setup routes using two buttons, one at the beginning of a route and one at the end of a route.


If you press buttons left and 1 (the order makes no difference), Rocrail sets turnout T1 straight. If you press buttons right and 3, Rocrail sets turnouts T2 and T3 to turnout and so on. There are a lot of possibilities, you can also do left, 2 and right (but not just left and right, then nothing happens, the idea is to set a specific route, not to find any possible route from a to b, for that, there are other mechanisms in Rocrail).

The best way to find out how it is done is to have a look for yourself on how the actions and routes are defined in the tables and how the action controls and action conditions are set in the five sensor definitions. I tried to keep all names self-explanatory.

Remember, there is no more logic to it then described, no blocks and so on (without blocks the occupancy state of the route set will not change), but if you get the idea behind it you can also add more actions.

When you want to test/try, the attached zip file contains a rocrail.ini and the plan file. In the rocrail.ini I have set the route switch time to 1 second, this way there is a pause of 1 second after every turnout change (makes it easier to follow on the screen).



Simultaneously operated switches

The second example shows how to setup switches that are always operated together (both straight or both turnout) because the switch motors are connected to the same decoder output. In Rocrail one switch is defined with the real decoder address, the other switch with a virtual address using the virtual command station. The actions and conditions make sure that when one switch is operated, the other switch follows.


Display a variable in a text-element (e.g. 'counter')

1. define a text element, eg. “counter” (“zaehler”)
2. define a new action “display_counter” (“zaehler_anzeigen”), type=text”, parameter is the variable, e.g. ”%counter%”; command=“update”
3. assign this action to a feedback of a block (status=“on”)
now the variable is going to be shown …

Display image of a loco when block is entered

an action can display an image of a loco which enters a block (German example):
Blockbelegung als Lokbild

How to handle two short blocks in a row with long trains

This is not officially supported and is regarded as a work-around for a design flaw.
Just let long trains run by route permissions directly in block 1a using the two short blocks as crossing block.

This demo plan has -hopefully- self-explaining names for the objects. The idea behind this plan is that a (shadow)station can have two blocks behind each other. Each of these blocks 1a and 1b can contain a short train, whereas a long train will occupy both blocks, using a route to block 1b with block 1a as crossing block.

Without measures, after arrival of a long train in block 1b, block 1a is free again and Rocrail could send a train there. Also, when the long train departs from 1b, it might trigger sensors in block 1a, causing a ghost event in block 1a.

The plan uses a dummy loc, either assign this loc to the virtual command station or give the loc an unused address (and make sure that that address remains unused in future). For each “set” of blocks in a row you will need a seperate dummy loc, because one dummy can not occupy multiple blocks.
Four routes are made manually, named manual-[start]-[destination]. The rest of the routes were done by the analyzer. Some routes have permissions set, so that either only long or only short trains use that route.
Two of the manual routes have an action(control) in them and one has an action condition. One action puts the dummy loc in block 1a, the other action removes it again. Both actions are triggered at the end of the route, when the train has reached its destination block and the route is unlocked. Again, when more “sets” of blocks in a row exist, each set needs its own routes and actions.
By putting a dummy loc in block 1a, Rocrail does not care when the sensors in block 1a go on because the long train in 1b triggers them when driving to block 3. This prevents a ghost state of block 1a.
You can try it with the virtual command station, put the short train in block start2, the long train in block start and start both of them in automode. Train long will use the route from start to 1b with 1a as crossing block. After arrival in 1b, the dummy loc appears in block 1a by the action in the route. Train short will wait in block start, because block 1a is occupied by the dummy loc and block 2 is closed. After the wait in 1b, long will use the manual long route from 1b to 3. You can trigger the sensors of block 1a as much as you like, but because loc dummy is in it, no ghost will occur. After arrival in block 3, the second action removes the dummy loc from block 1a and train short will now go to block 1a.

Have a go at it.
two-short-blocks.zip


Personal Tools