|What is it?|
PathControl allows you to specify path in your yards by specifying signals and junctions and their states. A path is blocked for other trains and will be freed automatically step by step when a train has passed. Path may be set by a driver command or by a second session rule, the PathTrigger. This will set path automatically when a train passes a trigger depending on the destination of the train.
This rule allows multiple signals per path, handles crossings, has a command interface in driver mode, frees junctions automatically as the train has passed them, works completely event driven, configuring a path is done by a semiautomatic interface, handles the 64kB limitation of session data per rule in TRS2004
How to use it?
Important: give your signals a name or the rule won't see them.
Now you can add a yard - yards are only for a better overview of your path, so a 'read' yard may have more than one yard in the path control rule, eg. one for the east side of the yard, another for the west.
Next klick on a yard and go to the yard detail view. This allows renaming the yard and - most important - add paths. Adding a path will ask you for a name, you may leave this unchanged because later on you can set this name by an automatic function. Now klick the 'edit' button and go to the path setup view.
Here you see a part of your route - if you have set a starting signal, for new path the is no starting signal, so no route. Set your start signal.
Below the signal you'll see a list of junctions, trackmarks, stations and maybe finally a signal.
Klick on the junction icon behind a junction name to switch the junction, this will change the route behind (below) the junction or will even stop it there if the junction is in the wrong direction for this way.
Trackmarks and stations are only for your information to find a way to the destination you want to go to.
If you have a signal at the end you may add this to your path - normally a path should only have one signal - the starting signal. However, dwarf signals or in germany 'Sperrsignale' shouldn't be starting signals, they are part of other paths. So if you have such a signal (don't forget to give it a name!) and want it to be a part of a path klick the plus icon behind it. Now the route behind this signal is visible and you can set the junctions as before. If you change your mind and want to remove a signal again, klick the minus icon behind the signal.
Before you save this path we should give it a automatic name if we haven't given it one already. If a signal is only a pre signal for another signal of the next path or no path at all you also need to add this signal to this path and set its lights to off (all lights off, klick 3 times on the icon) - this is needed to let the rule check the tracks behind the signal for a blocking train. Klick the icon behind the path's name at the top of the window. The automatic name will start with the name of the start signal and end with the last seen trackmark, platform or signal (in this order depending which was there).
Now save the path (klick save).
Back to the yard detail view you'll see all your paths of this yard. But stop, there is still more things to do for your new path: set the signal states.
When a new path is created all its signals are set to red - however, this doesn't make sense but is save. Klick the signal icon (or traffic light icon if you prefer this name) behind the signals of you path and set it to yellow of green. Finally there is another option here (this doesn't end, ugh?): behind the start signal is a second signal icon which is 'dark' be default. Klicking on this will show a red light. This is light is enabled all signals of this path will be set to red, if it is disabled the signal is the to automatic mode when no path is set. Automatic mode allows the driving algo (some call it AI driver) to manipulate the signal. However, autodriver can be irritated if a signal becomes red when a path is requested but could not be set and the signal was green.
And another special thing is missing - not required but usefull for the departure paths of a station: path groups or path aliases (one is used as a synonym for the other). You should add all departure paths of a station that direct a train to the same direction into one path group. On a small station with 2 tracks comming eg. from east and west you will have 2 groups eg. west and east. We will see where this can be used later.
Now, the path is ready, but there is another usefull thing, the so called MX junctions - however, this is an other complex thing so we describe this later - before we have a look how to set a path:
To set a path use the driver command PathControl or the PathTrigger rule.
The driver command has two ways of working: blocked and unblocked.
In blocked mode the command will wait until the requested path is set, in unblocked mode the command will request the path and return at once so the driver can do other things like open the doors or so. Use the WaitUntilNotRed rule to wait until the signal is green.
Remember this path group thing? Now this can be used. This driver command offers beside the yards and their path names another menu entry: yard'-palias' (palias=path alias). If you choose this entry the driver (or better the path control lib) will look for a matching path that starts at the next signal in the driving direction of the train and is part of the selected path group. So if you had added the departing paths for one direction into the same group and want a train to set the needed path to exit the station you can simply choose the path group for this direction and the train will search the path itself.
Ok, as promised, here is the MX junction thing...
MX means mutual exclusive and means here: if two or more want to get something only one will get it. Well, this is nothing magic, every junction can only be locked by one path. However, there are situations where two paths don't have junctions together but nevertheless they mustn't be set both at the same time.
A typical situation is a crossing: Two tracks cross each other but Trains don't care about that.The picture will help us to unterstand the next example. Here we have 2 tracks from A to B and C to D and 4 junctions j1 to j4. We have 4 path: A to B, A to D, C to B and C to D.
If 2 trains want to go from A to B and C to D, we have no problems, both path could be set. If one goes A to B and another C to B, no problem, only one path could be set because J2 is locked by one path. But if one goes A to D and the other C to B both path could be set because they have no junctions and tracks together that could be locked exclusivly. Here the MX junctions comes in.
Simply add to path A to D to junction J4 the MX junction J2. And all is fine!
What will this do? If path A to D is set (J1 and J4 are locked) J2 is also locked. So no other path can lock it until it is unlocked (that is done when J4 is unlocked because J2 is MX of J4). That's all, beleave me!
What happens, if C to B is already set and A to D is requested you might ask? Nothing, C to B has locked J2, so A to D can't get is, so path not set.