Matrix Route Indicator Display
mrg’s Multiple Junction Semaphores illustrate nicely the power of the Route Tag feature. Another situation where they come in very handy is when you have a signal arranged to display an illuminated number or letter corresponding to the route that has been set — what is usually called in British practice a “theatre indicator”(*).
This kind of indicator is also used in some countries (e.g. Germany) to display a number corresponding to the speed limit that applies from that signal.
There are already quite a few signal models available in Rail3D that include an indicator that can display one or two letters or numbers. The problem is that you would need endless numbers of models to get all the combinations of letters and numerals that can appear in real signalling situations. What we could do with for everyday modelling is a “one size fits all” route indicator, which can display arbitrary letters or numbers defined by the setting in the layout. Route tags give us the ability to do this in a simple, straightforward way, without the need for any local scripting in the layout.
What I’ve done is build a component with a 5×7 matrix of lamps that can be addressed individually by a script, via their ids. For the ids, I used the convention that lamp 100 is the bottom left, 104 the bottom right, 164 the top right, etc. As is well-known in the world of electronics, 5×7 is enough to display digits, upper-case letters and basic punctuation symbols recognizably. Real signals use bigger matrices nowadays, to give the driver a clearer indication, but 5×7 has been used in the past, and it is a manageable number of lamps to address in a simple script. I’ve built the indicator as a component, so that it can easily be included in different signal models.
The basic script works in exactly the same way as that for the Multiple Junction Semaphores — when the signal sets its lamps, the script looks for a route tag, puts it into the string sTag
, and then compares this to the strings defined for the display. I’ve set up the letters A-Z, digits 0–9, numbers 10 and 11, and the symbols < and > (addressed as “Left” and “Right”). Obviously you could extend this if you need more symbols. To reduce the need for tag mapping, the script truncates any unrecognised tag to its first letter, so the tag “Fast” will get you the indication “F” (but be careful: the tag “Platform 1″ will display “P”).
It’s important to make sure that the script blanks the display (by setting all lamps to 0,0,0,0) before creating a new indication, otherwise the display soon starts to look strange. I used constants for the lamp colour to make it easy to adapt the script if I need letters of a different colour in future (e.g. German signals use yellow for “speed at next signal”).
Obviously, for speed signalling you would replace the Signal.GetRouteLabel()
by a Signal.GetRouteLimit()
and code to convert the speed limit into a digit (e.g. 40 km/hr would display a “4″).
// Mark Hodson August 2008
// Script to control 5x7 matrix indicator using route tags
// Supported tags: 0-9, 10, 11, A-Z, Left(<), Right (>)
OnSetLamps()
{
int count=0;
int ID;
int iR=255; //red
int iG=255; //green
int iB=255; //blue
int iFlash=0; //flash status
//clear all indicator lamps
while(count<35)
{
ID=count/5;
ID=(ID*10);
ID=ID+100+(count%5);
Signal.SetLamp(ID,0,0,0,0);
count++;
}
if(!Signal.IsOn())
{
//Get route tag
string sTag=Signal.GetRouteLabel();
int iFound=0;
//test multi-letter tags
if(sTag=="10")
{
Signal.SetLamp(100,iR,iG,iB,iFlash);
Signal.SetLamp(110,iR,iG,iB,iFlash);
Signal.SetLamp(120,iR,iG,iB,iFlash);
Signal.SetLamp(130,iR,iG,iB,iFlash);
Signal.SetLamp(140,iR,iG,iB,iFlash);
Signal.SetLamp(150,iR,iG,iB,iFlash);
Signal.SetLamp(160,iR,iG,iB,iFlash);
Signal.SetLamp(103,iR,iG,iB,iFlash);
Signal.SetLamp(114,iR,iG,iB,iFlash);
Signal.SetLamp(124,iR,iG,iB,iFlash);
Signal.SetLamp(134,iR,iG,iB,iFlash);
Signal.SetLamp(144,iR,iG,iB,iFlash);
Signal.SetLamp(154,iR,iG,iB,iFlash);
Signal.SetLamp(163,iR,iG,iB,iFlash);
Signal.SetLamp(112,iR,iG,iB,iFlash);
Signal.SetLamp(122,iR,iG,iB,iFlash);
Signal.SetLamp(132,iR,iG,iB,iFlash);
Signal.SetLamp(142,iR,iG,iB,iFlash);
Signal.SetLamp(152,iR,iG,iB,iFlash);
iFound=1;
}
//other multi-letter tags omitted for brevity
if(iFound==0)
{
//whole tag not found: truncate to first letter, then match on single character tags
sTag=Left(sTag,1);
if(sTag=="1")
{
Signal.SetLamp(101,iR,iG,iB,iFlash);
Signal.SetLamp(102,iR,iG,iB,iFlash);
Signal.SetLamp(103,iR,iG,iB,iFlash);
Signal.SetLamp(112,iR,iG,iB,iFlash);
Signal.SetLamp(122,iR,iG,iB,iFlash);
Signal.SetLamp(132,iR,iG,iB,iFlash);
Signal.SetLamp(142,iR,iG,iB,iFlash);
Signal.SetLamp(152,iR,iG,iB,iFlash);
Signal.SetLamp(162,iR,iG,iB,iFlash);
Signal.SetLamp(151,iR,iG,iB,iFlash);
}
if(sTag=="A")
{
Signal.SetLamp(100,iR,iG,iB,iFlash);
Signal.SetLamp(110,iR,iG,iB,iFlash);
Signal.SetLamp(120,iR,iG,iB,iFlash);
Signal.SetLamp(130,iR,iG,iB,iFlash);
Signal.SetLamp(140,iR,iG,iB,iFlash);
Signal.SetLamp(151,iR,iG,iB,iFlash);
Signal.SetLamp(162,iR,iG,iB,iFlash);
Signal.SetLamp(153,iR,iG,iB,iFlash);
Signal.SetLamp(144,iR,iG,iB,iFlash);
Signal.SetLamp(134,iR,iG,iB,iFlash);
Signal.SetLamp(124,iR,iG,iB,iFlash);
Signal.SetLamp(114,iR,iG,iB,iFlash);
Signal.SetLamp(104,iR,iG,iB,iFlash);
Signal.SetLamp(121,iR,iG,iB,iFlash);
Signal.SetLamp(122,iR,iG,iB,iFlash);
Signal.SetLamp(123,iR,iG,iB,iFlash);
}
//rest of the alphabet and numbers omitted for brevity
}
}
}
Using the models
To use a signal including this indicator, just place the signal in a layout, make it controlled, and set up some route tags ahead of it. For instance, if the signal is on the approach to a station, you tag platform 1 with “1″, platform 2 with “2″, etc. The nice thing is that these tags apply to all signals capable of setting routes to these lines, so you only need to tag each track once.
Example
To try this out, I’ve built a model of York station. You can see these signals in action at various places, particularly at the southern end of the station. Trains approaching from Leeds or Doncaster see an indication at Holgate Junction corresponding to the platform they’re being routed to, or “G” if they’re being sent around the goods lines. Up trains leaving the station see “M” if they’re being routed to the Up Main, “L” for the Up Leeds, and “H” for Holgate Sidings. The same sort of thing applies at the other end of the station, and at the crossovers between Fast and Slow lines at Skelton and Skelton Bridge junctions.
Departure via Up Leeds
Download
You can find the demo layout using the new signals at: http://www.markhodson.nl/rail3d/2kdlayouts/York_Station04.trp (17.08.2008) - please note that the layout itself is “work in progress”, but it does illustrate the use of route indicators with tags pretty well.
(*)I was puzzled for years by this term: it turns out that it was a reference to the illuminated displays on the outside of the theatre where they could put up the name of the show using letter stencils.
import