Transits and the Transit Table
What is a Transit?
A Transit is a group of two or more connected Sections that describes a route around the layout of a train traveling in a given direction. A Section may be in multiple Transits, and may be in a given Transit multiple times. Sections are kept in order--the first Section is connected to the second, the second is connected to the third, etc. That means a Section in a Transit must be connected to the Section before it (if there is one) and to the Section after it (if there is one). The order of the Sections determines the direction of travel in the Transit. Trains travel from Sections with lower sequence numbers toward Sections with higher sequence numbers. Normally Transits would only be defined for mainline track, and sometimes staging yard track.
In user-specified areas of a Transit, alternate Sections may be designated. For example, to move between the "2nd" and "4th" Sections in a Transit, there may be multiple "3rd" Sections, any of which might be used to travel between the 2nd and 4th Sections. Alternate Sections provide for passing tracks and staging yards. Transits also provide for reverse loops. To provide for back-and-forth running, e.g. for trolley cars, an option is provided in Dispatcher to automatically reverse the direction of running through a Transit when the train reaches the end of its Transit, and have the train run in reverse to the beginning of its Transit.
Transits support both manual and automatic operation of trains. When a train is running in automatic mode, Transits provide for Actions to be activated when a train reaches a designated Section in the Transit. An Action may be initiated by a number of events, for example, when the train enters a Section, or when the train stops. A variety of actions are possible, such as pausing the train for a user-designated number of fast clock minutes (a station stop), reverting to manual mode for local manual operation, or sounding the horn on a sound decoder.
How are Transits Activated and Used?
Transits are static objects. They specify routes for trains to follow around the layout. Transits do not run trains, or keep track of running trains. A Transit becomes part of the train running process when it is activated by being assigned to an Active Train. Transits are saved as part of a panel/configuration file, only need to be set up once, and can be reused. Active Trains, on the other hand are dynamic and transient. Active Trains are not saved to disk, and must be set up each time they are used.
Transits are activated in the Dispatcher window, where a Transit is linked to a train to create an Active Train. When an Active Train is created, a Transit is selected, a Train is selected, and a starting Block (train location at start) and ending Block (train location when travel is complete) are specified, along with options. This process results in an Active Train, which can then be dispatched. A Transit may be used by only one Active Train at a time. When an Active Train is done, its Transit is deactivated, and may be reused for a subsequent Active Train.
A train may start from a Block outside of the Transit, but connected to a Block within the Transit, or a train may start from a Block within a Section in the Transit. A train moves through a Transit in only one direction--defined by the order in which Sections are included in the Transit. Trains move from lower sequence number Sections toward higher sequence number Sections. The only exception to this is the back-and-forth option that allows a train to run in reverse through its Transit back to the beginning of the Transit.
When an Active Train is initiated, an allocation request is placed for a starting Section. If the Section is free, the Section will be allocated to the train. Allocation means that the Section is assigned the Active Train, and the train is authorized by the dispatcher to proceed to the end of that Section.
When an Active Train is created, it may be activated for running by an engineer using a throttle, or automatically by a virtual engineer. Dispatching consists of allocating Sections, one by one, to the Active Train. The actual dispatching may be done by a dispatcher sitting at the computer running JMRI, or semi-automatically by the computer. If a requested Section is currently in use, a request for assignment is placed in the dispatcher's queue. When a Section is freed, the queue is scanned for the highest priority train requesting it.
Using the Transit Table to Set Up Transits
Transits are set up in the Transit Table. When set up, Transits are independent of the trains that use them.
All Transits that currently exist can be referenced using the Transits tool under Tables in the Tools menu of most JMRI programs. There are seven columns in the Transit Table:
- System Name - The system name is assigned to the Transit when it's created, and can't be changed.
- User Name - If you're interested in having your Transits carry "human readable" names, you can click in the "User Name" column and change that information to whatever you want.
- State - The state of a Transit tells whether a section is IDLE (available for activation and assignment to a train), or ASSIGNED (linked to a train to form an Active Train). The state of a newly added Transit is always IDLE.
- Comment - This column is for your use to record any comment you may want to use to keep track of your Transits. It is for information only.
- Click the Delete button in a specific row to delete the Transit in that row. Use this button with caution! Do not delete a running Transit.
- Click the Edit button in a row to view or change entered information for a Transit. System name cannot be changed. User name may be changed, Sections may be redefined, etc. Only one Transit may be edited at a time. A Transit may not be edited if another is being created, or if the Transit is not in the IDLE state.
- Click the Duplicate button in a row to add another Transit identical to this one. Clicking this button is similar to clicking the Add... button (see below) except the information from this Transit is copied into the Add/Edit Transit window. This option offers an easy way to enter multiple copies of a Transit when multiple trains must follow the same route at the same time.
To define a new Transit, click the Add... button. An Add/Edit Transit window will be brought up that will allow you to designate the Sections in the new Transit. (Obviously, Sections must be defined before any Transit can be created.) Since a Transit may be used in only one Active Train at a time, the Duplicate option (see above) may save time when creating multiple copies of the same Transit.
Using the Layout Editor to Set Up TransitsIf you are using the Layout Editor to define and generate the Logic for Signal Masts and Sections, it is possible to create a basic transit from the Layout Editor. To do this, bring up the context menu (right-click) of a Signal Mast on the panel, if things have been set up correctly then there be the option to Create Transit From Here, after selecting that option you can then progress along your route and select each facing SignalMast, bringing up the context menu on each and selecting Add to Transit. When you are at the destination SignalMast on your route select Add to Transit and Complete. Please note that you will have to manually save the transits to disk.
Setting up for Continuous Running
A Transit may be set up for continuous running, allowing an Active Train to travel through its Transit multiple times without being terminated and re-activated. Provided its Transit is set up for continuous running, each time an Active Train completes traveling through its Transit, the Active Train optionally may be automatically reset by Dispatcher so it is ready to run through its Transit again. For continuous running, an Active Train must start and end in the same Section, and must be pointed in the same direction when starting and when ending. For a Transit to be capable of continuous running, its first Section and its last Section must be the same, and both must be set up for running in the same direction. This applies to both manual running of trains and automatic running of trains. For more information on setting the continuous running option, visit the help file for the Activate New Train window.
Specifying Actions for Automatic Running
Transits support a variety of Actions that automatically happen when a train is run through the Transit in Automatic mode. One or more Actions may be specified with each Section in the Transit. Action are initiated when their associated Section in the Transit is entered by the automatically running train.
Each Action has two parts: a When part, that specifies when the Action is to be performed, and a What part, that specifies what task is to be performed. A commonly used Action, for example, is "When the train starts, turn on its headlight." More information on Actions is located in the Actions
Saving Transits to Disk
Use the Store item in the File menu to save Transit information to disk. This information is saved with the configuration in an XML file, along with control panel setup and similar items. To store your panels in the same file (recommended), select File -> Store > Store Configuration and Panels To File... or select Panels > Store panels... in the main JMRI window.