JMRI: Edit Block Help
Author: Bob Jacobsen
Keywords: JMRI help Layout Editor Block

# Create/Edit Block

Blocks are sections of track whose occupancy may be individually monitored. Dividing track into blocks is optional. Blocks set up in a track diagram normally correspond to physical blocks on a layout. Block occupancy is indicated by the state of an occupancy sensor. When a layout's track is divided into blocks, all of the track need not belong to a block. For example, yard track is normally not in a block, whereas mainline track almost always would be divided into blocks. The main use of blocks is to facilitate signaling, but blocks may be used for other layout control and animation functions.

If a block name is entered in the Block: Name field of the tool bar prior to adding a turnout, level crossing, or track segment, the added item is assigned to that block; if a sensor name (system name or user name) was entered into the Occupancy Sensor field, that sensor will be assigned to the entered block. A turnout, level crossing, or track segment may also be assigned to a block by entering that block's name in the edit dialog accessed by selecting Edit... in that items popup menu. In either case, if a block with the entered name doesn't exist, one is created.

A block name may be any series of alphabetic or numeric characters that describe the block, for example, "Red Main 2", "Lake Siding", or "Moose Block". Once a block is created, its name may not be changed; attempting to change a block's name will create a new block having the new name. After all items assigned to the old block are changed to the new block, the block with the old name will be automatically deleted (see below).

Blocks may be viewed in the Block Table, that may be accessed using the Tools menu. Block information for a Layout Editor panel is kept in two parts, which are always linked together automatically. For each block, Layout Editor specific information is stored and managed in a Layout Editor specific part, and the generic part of the block information is stored in a JMRI Block. When a Layout Editor block is created, a corresponding JMRI Block is automatically created. The automatically created Block will have a system name IBnnn (where nnn is a number), and a user name the same as the block name mentioned above. It is the generic Blocks that are displayed in the Block Table. Avoid changing the user name in the Block Table, because this will break the link between the two parts of the block information.

Of interest in the Block Table is the "Value" column. The "Value" can be used to identify trains as they move around the layout. If a train is parked in a Block, and train identifying text is manually entered into the "Value" entry for that Block, the text will be propagated from Block to Block as the train is run around the layout. When the train enters a Block, the text "Value" of the block the train entered from will be copied into the "Value" of the entered Block; when the train exits a Block, the "Value" of the now empty block will be cleared. If a Memory Variable is assigned to the block (see below), the "Value" of the Memory Variable will be set to the "Value" of the block. So by placing a Memory Icon near the block, the identity of the train in the block can be displayed in the Layout Editor panel. Caution: Tracking trains using this method requires smoothly running block detection circuitry. False or flickering block detection can easily confuse things.

Turnout, level crossing, and track segment edit dialogs provide access to the Create/Edit Block dialog where information specific to a block may be entered or edited. The Occupancy Sensor: field in the Create/Edit Block dialog shows the name of the occupancy sensor currently assigned to the block, if there is one. To enter or change the occupancy sensor, enter the name (system name or user name) of a sensor in the Sensor Table in the Occupancy Sensor: field. A sensor may be assigned as the occupancy sensor of only one block; attempting to do otherwise will result in an error message. Normally, the state of an occupancy sensor is "Active" when a block is occupied, so "Active" for occupied sense is the automatic default. This can be changed by selecting "Inactive" in the Occupied Sense: selection box.

You can edit the sensor debounce options from this window, setting the Sensor Debounce helps to prevent false triggers of a sensor being passed into the system and triggering other events in the system.
Such false triggers could be due to a dirty piece of track or electrical interference. Use Global Debounce Values check box, allows you to select if the sensor will use the default sensor debounce values if configured.
Inactive Delay and Active Delay allow you to specify the amount of time in milliSeconds that the system waits before registering the state change of a sensor.

Block track colors are used instead of the default track color if a section of track is in a block. The track items in a block are drawn with different track colors for occupied and unoccupied states, allowing the track in a block to change color as a train enters and leaves that block. To set track colors, select the unoccupied track color in the Track Color: selection box, and select the occupied track color in the Occupied Track Color: selection box. An alternate unoccupied track color is provided for special uses. For example, Dispatcher has an option to use the alternate unoccupied track color for blocks that are allocated but unoccupied. Set the alternate unoccupied track color using the Alternate Track Color: selection box. When track color is set, Layout Editor will use the occupied track color if a block is occupied, then if not occupied, will use the alternate unoccupied track color if it has been requested, otherwise it uses the unoccupied track color.

The Memory Variable Name: field in the Create/Edit Block dialog shows the name of the memory variable currently assigned to the block, if there is one. To enter or change the memory variable, enter the name (system name or user name) of a memory variable in the Memory Table in the Memory Variable Name: field. Assigning a memory variable is optional. An assigned memory variable will contain as its "value" the "value" of the Block, and is useful in identifying trains as they are tracked around the layout (see above).

The Permissive Working Allowed check box allows the block to be set so that if it is already occupied, then another train is allowed to enter that block. This feature is mainly used within the SignalMast logic.

If layout block routing has been enabled for use with the Signalmast Logic additional fields will be presented.

The Block Metric assigns a cost against a particular block so it is possible to determine if the signal logic should use this block over another block if there are multiple paths. The lower the metric the more preferred it is. By default Main Line blocks have a value of 50, while a Side Track has a value of 200

The Attached Block fields represent each block that is connected to this one, here you can determine if a route to a next block can be used both ways or only in one direction in working out the signaling logic. The options are.
Bi-Directional traffic can flow freely between each block.
Send Only is where this block can only be used to send traffic to the neighboring block, the neighboring block can not send traffic to us.
Receive Only, this block can only receive traffic from the adjacent block we can not send traffic to it.
So for example you might have a passing loop on a single section of line, you can use this so that trains always use the left hand path.

Since blocks are items on the physical layout, the same block may be used in more than one panel. Consequently, block information is saved in the non- panel specific portion of the layout information, when panels are saved to a file on disk.

Blocks are deleted automatically when they are no longer used. Layout Editor keeps track of the number of track items (turnouts, track segments, and level crossings) that are assigned to a block. This count is displayed in the Create/Edit Block dialog as Current Use Count:. When panels are saved to disk, only those blocks with a use count greater than zero are saved.