Files
JIMRI/help/en/html/tools/signaling/AspectSignaling.shtml
T
2026-06-17 14:00:51 +02:00

193 lines
11 KiB
Plaintext

<!DOCTYPE html>
<html lang="en">
<head>
<meta name="generator" content="HTML Tidy for HTML5 for Apple macOS version 5.8.0">
<!-- Copyright Bob Jacobsen 2008 -->
<title>JMRI: Aspect Signaling</title>
<meta name="Author" content="Bob Jacobsen, Egbert Broerse, Bob M.">
<meta name="Date.Modified" content="20191124"><!--#include virtual="/help/en/parts/Style.shtml" -->
</head>
<body>
<!--#include virtual="/help/en/parts/Header.shtml" -->
<div id="mBody">
<!--#include virtual="Sidebar.shtml" -->
<div id="mainContent">
<h1>JMRI: Aspect Signaling</h1>
<p class="subtitle">Controlling model signals in a prototypical manner</p>
<a href="images/Rule282.png"><img src="images/Rule282.png" height="241" width="159" class=
"floatRight" alt="rule 282"></a> Protoypical signal systems present "<a href=
"index.shtml#aspect">Aspects</a>" to the engineer to tell him how to run his train. The
"Stop" aspect, for example, is pretty simple: "Stop the train". The "Approach medium" aspect
indicates something more complicated: "Proceed approaching next signal at medium speed". Each
aspect has an associated "indication", which is usually codified in a railroad's Rule Book.
<p>The picture to the right shows an example, Rule 282 from the 1946 AAR rule book (Aspect:
Approach Medium).</p>
<h2>JMRI Support for Aspect Signaling</h2>
<p>A collection of plain instructions let you set up <a href="SignalingSetup.shtml">Signaling
in 7 Quick Steps</a>.</p>
<p>Aspect Signaling is supported in JMRI using three of the Signaling Tools:</p>
<ul>
<li>
<strong><a href="SignalMasts.shtml">Signal Mast</a></strong> objects represent an entire
signal with one or more Signal Heads. A Signal Mast can operate all its Heads, as
required to do full prototypical signaling based on aspects. When its Aspect is set to
e.g. "Approach medium", JMRI handles the layout communication needed to make the signal
on the layout display the right colors.<br>
<a href="../../../package/jmri/jmrit/beantable/images/SignalMasts-num.png"><img src=
"../../../package/jmri/jmrit/beantable/images/SignalMasts-num.png" width="309" height=
"83" class="floatRight" alt="signal mast table"></a> Signal Masts are configured through
the <a href="../../../package/jmri/jmrit/beantable/SignalMastTable.shtml">Signal Mast
Table</a>. You add new ones with the "Add..." button below the table, which takes you to
the <a href="../../../package/jmri/jmrit/beantable/SignalMastAddEdit.shtml">"Add Signal
Mast" window</a>. There you specify what kind of signaling system is to be used (see
<a href="#systems">the list below</a>), the specific signal type eg. "double searchlight"
or "double head dwarf" and which Signal Heads this Mast is going to drive.<br>
You can add a Signal Mast icon in the Panel Editor by right clicking at any location and
choosing "Add item &gt; Signal Mast".<br>
In Layout Editor enter the Signal Mast address and shift click on a turnout or anchor
point on the panel where you want to place a Signal. The Signal Mast icon will display
the images specified in the appearance definition for that particular Signal Mast type
and system. The Signal icons displayed on your panel are part of a Signal System and they
can't be changed individually by the user like Turnout icons.<br>
Image on the right: Rule 281 Signal Icons from the AAR-2 Signal System.
<!-- icons from AAR-2 xml appearance definition xml March 2014 -->
<a href="../../../../../xml/signals/AAR-1946/aspects.xml"><img src=
"images/AAR-2Clear.png" width="187" height="187" class="floatRight" alt=
"AAR rule 281"></a><br>
</li>
<li><strong><a href="SignalGroups.shtml">Signal Groups</a></strong> are used to define a
number of Signal Heads, where only one Signal Head can be illuminated at any given time,
depending upon the state of the associated Signal Mast and a set of conditions.<br>
Signal Groups would be used where additional indicators are used to support the main Signal
Mast, such as Junction, Route or Speed displays. These indicators provide additional
information to the driver (US: Engineer) that is not given by the main Signal Mast. Such
indicators are frequently seen in European and UK signaling.</li>
<li>The <strong><a href="SignalMastLogic.shtml">Signal Mast Logic</a></strong> tool allows
the Signaling Logic to be built up as pairs of conditionals between Signal Masts on the
layout. The Signal Mast Logic will use the states of Blocks, Turnouts, Sensors and adjacent
Signal Masts to determine what Aspect a Signal Mast should be displaying.<br>
If the layout has been drawn up using the Layout Editor and Signal Masts have been placed
on the panel using the various tools, then it is possible for all the Signal Mast Logic to
be dynamically built, with little user intervention. For panels created with Control Panel
Editor some of this information has to be entered manually.</li>
</ul>
<p><strong><a href="SignalHeads.shtml">Signal Head</a></strong> objects in JMRI are not aware
of their position on a mast and the Signaling System they are part of, so as individual
objects they can't show Signal Aspects. Individually they can only be set to specific
<a href="index.shtml#appearance">Appearances</a> (colors), either from the Signal Head Table
or via <a href="#logix">Logix</a>.</p>
<h3>How does it work?</h3>
<p>In short, a set of files for the selected Signaling System contains the basic code to
determine which combinations are available in the <a href="SignalMastLogic.shtml">Signal Mast
Logic</a> tool.<br>
In the xml/signals directory located in the JMRI program directory, there is a directory for
every Signaling System that has been defined, with one "aspects.xml" file which lists all of
the possible Aspects plus a number of "appearance..." files (i.e.
<em>appearance-one-searchlight.xml</em>), each of which describes the possible Aspects based
on one Signal Mast type. These essentially say "if the next signal has an 'x' aspect, then
the current one needs to show a 'y' aspect" (<a href="DefineNewAspects.shtml">more
details</a>).<br>
The Signal Mast Logic table is then used to check which Signal Mast pairs are active in the
Signal Mast Logic and whether the Aspect should <em>not</em> be 'Stop'. This is done by
looking at Turnout positions (if applicable), Block occupancy and - possibly - Sensors. On
the Signal Masts tab you might even specify additional Signal Masts to watch, e.g. for an
Interlocking. For any Signal Mast, there can be 1 to n destination Signal Masts, one of which
is active based on the positions of Turnouts connecting the protected Blocks.<br>
If everything is OK, then the appropriate "appearance..." file for this Signal Mast type will
be used by the Signal Mast Logic to assign a new Aspect based on the Aspect of the next
Signal Mast.<br>
This covers the basic workings in a very high level overview. (Thanks to Dave Sand)</p>
<img src="images/Panel1Stop.png" width="185" height="135" alt=""> <img src=
"images/Panel2Approach.png" width="185" height="135" alt=""><br>
Signal 4B showing the "Stop" Aspect when sensor OD1 is Active (at left) and "Approach
Diverging" when the block is empty (at right).
<h2 id="systems">Available Signaling Systems</h2>
<p>JMRI users have provided signaling systems for
<a href="../../../../../xml/signals/basic/index.shtml">Basic</a>,
<a href="../../../../../xml/signals/AAR-1946/index.shtml">AAR-1946</a>,
<a href="../../../../../xml/signals/BR-2003/index.shtml">BR-2003</a>
and many more.
The complete list is at
<a href=
"../../../../../xml/signals/">https://www.jmri.org/xml/signals/</a>.</p>
<p>To create your own Signaling System Definition follow these <a href=
"DefineNewAspects.shtml">Instructions</a>. If you do create a new definition for another
prototype railroad or era, after testing please contribute it back to the JMRI project so we
can distribute it with future releases of the project for others to use. Like Decoder
Definitions in DecoderPro, the more Signal System Definitions we have, the more useful the
program becomes, and the more people spend time to improve it. We all win that way!</p>
<h2>Code Access to Aspect Information</h2>
<h3 id="logix">Logix</h3>
<p>Signal Masts can be both tested (in Conditionals) and set (in Actions) via Logix. When
you're editing a Logix Conditional or Action, you have to type the Signal Mast name and hit
enter/return so that the program can look up the available Aspects for that particular Signal
Mast.</p>
<h3 id="mastscripting">Scripting</h3>
<p>A program (in Java or Python) can get access to Aspect information in two ways. If the
code has a reference to a specific Signal Mast "m", it can use</p>
<pre style="font-family: monospace;">
m.getValidAspects()
</pre>to get the list of aspect names that this Signal Mast can display. The program can then
access the Signal System definition with
<pre style="font-family: monospace;">
SignalSystem sys = m.getSignalSystem()
</pre>and then enquire about properties of the aspect:
<pre style="font-family: monospace;">
sys.getProperty("Clear","speed");
</pre>where the first argument is the aspect name (use, for example, <code>m.getAspect()</code> to
obtain the current one on the mast) and the second is a specific property. Properties can be
defined programmatically via e.g. <code>m.setProperty("Clear","speed","69");</code> or get loaded
automatically from elements in the <a href="DefineNewAspects.shtml">aspect.xml</a> file that
defines the specific signal system.
<p>In addition to the global properties for an Aspect, there can also be local properties to
a specific Signal Mast type. An example of this is the default icon image: The image for a
two-head Signal Mast is different from that for a one-head Signal Mast, even if they both
represent "Clear".</p>
<p>To get those:</p>
<pre style="font-family: monospace;">
m.getAppearanceMap().getProperty("Clear","imagelink");
</pre>In words, this is saying "Get the Appeance info for this Signal Mast, and then check the
imagelink property of the Clear aspect".
<p>Alternatively, if you know the name of the Signal System in use, a program can access it
directly via the InstanceManager:</p>
<pre style="font-family: monospace;">
SignalSystem sys = InstanceManager.getDefault(SignalSystemManager.class).getSystem("basic");
</pre>
<p>Back to the <a href="index.shtml">Signaling main help page</a>.</p>
<!--#include virtual="/help/en/parts/Footer.shtml" -->
</div>
</div>
<!-- close #mBody -->
<script src="/js/help.js"></script>
</body>
</html>