¿ªÔÆÌåÓý

Locked Signal Heads, signal masts, main and advance signals.


 

Hi,

I am trying to figure out how signal heads, signal masts, main and advance signals (British: home/distant) work.

I'm trying to model Swiss Federal Railways (SBB/CFF/FFS) signalling - described in Wikipedia ( ). For simplicity I'm restricting myself to the four aspects which can be indicated on a four lamp advance signal; namely Halt, and Aspects 1-3. AFAIK they are the most common anyway.

I have two questions:
I have defined the various aspects for the main signal and the same for an advance signal. So far I've been able to create masts for the two signals separately which work as expected.
A common practice is to have a main signal and an advance signal (for the next main) on the same mast, as illustrated in the wikipedia article. Obviously they work independently (except if the main signal is showing Halt, then the advance signal is not lit). Do I need to code out the sixteen aspect combinations for the combined mast, or is there a way to reuse my existing definitions when defining a mast?


I put together a sandbox layout in Panelpro, where I added a main and advance signal. So far I have failed to persuade the two to work together. Individually they work, changing when clicked on. I wanted to have the advance signal follow the main signal. I've tried Simple Signal Logic (SSL), mast logic and Logix, all without success.

Here is the generated xml from Logixs:
<logixs class="jmri.managers.configurexml.DefaultLogixManagerXml">
<logix systemName="IX:AUTO:0001" userName="SBB Vorsignal" enabled="yes">
<systemName>IX:AUTO:0001</systemName>
<userName>SBB Vorsignal</userName>
<logixConditional systemName="IX:AUTO:0001C1" order="0" />
<logixConditional systemName="IX:AUTO:0001C3" order="1" />
<logixConditional systemName="IX:AUTO:0001C2" order="2" />
</logix>
</logixs>
<conditionals class="jmri.managers.configurexml.DefaultConditionalManagerXml">
<conditional systemName="IX:AUTO:0001C1" userName="SBB Vorsignal Halt" antecedent="R1" logicType="1" triggerOnChange="yes">
<systemName>IX:AUTO:0001C1</systemName>
<userName>SBB Vorsignal Halt</userName>
<conditionalStateVariable operator="4" negated="no" type="11" systemName="ih1" dataString="Red" num1="0" num2="0" triggersCalc="yes" />
<conditionalAction option="1" type="3" systemName="ih4" data="1" delay="0" string="Red" />
</conditional>
<conditional systemName="IX:AUTO:0001C2" userName="SBB Vorsignal FB2" antecedent="R1" logicType="1" triggerOnChange="yes">
<systemName>IX:AUTO:0001C2</systemName>
<userName>SBB Vorsignal FB2</userName>
<conditionalStateVariable operator="4" negated="no" type="12" systemName="ih1" dataString="Yellow" num1="0" num2="0" triggersCalc="yes" />
<conditionalAction option="1" type="3" systemName="ih4" data="4" delay="0" string="Yellow" />
</conditional>
<conditional systemName="IX:AUTO:0001C3" userName="SBB Vorsignal FB1" antecedent="R1" logicType="1" triggerOnChange="yes">
<systemName>IX:AUTO:0001C3</systemName>
<userName>SBB Vorsignal FB1</userName>
<conditionalStateVariable operator="4" negated="no" type="13" systemName="ih1" dataString="Green" num1="0" num2="0" triggersCalc="yes" />
<conditionalAction option="1" type="3" systemName="ih4" data="16" delay="0" string="Green" />
</conditional>
</conditionals>
Basically, what I wanted to achieve was: If the main signal (ih1) changes aspect, show the same aspect on the advance signal (ih4). How do I best achieve this?


Thanks in advance for your help
Otto Schreibke


 

For the first question, I suggest _not_ trying to combine them. Place two masts at the location, one defined to display as the ¡°home¡± for there, and separately one to show for the ¡°distant¡±.

To have one signal completely follow another, no changes at all, I suggest writing a script like (That one's for SignalHeads, but you could do it for SignalMasts two if you¡¯d like)

Bob


On Jun 16, 2017, at 6:46 AM, oschreibke@... [jmriusers] <jmriusers@...> wrote:

Hi,

I am trying to figure out how signal heads, signal masts, main and advance signals (British: home/distant) work.

I'm trying to model Swiss Federal Railways (SBB/CFF/FFS) signalling - described in Wikipedia (). For simplicity I'm restricting myself to the four aspects which can be indicated on a four lamp advance signal; namely Halt, and Aspects 1-3. AFAIK they are the most common anyway.

I have two questions:
I have defined the various aspects for the main signal and the same for an advance signal. So far I've been able to create masts for the two signals separately which work as expected.
A common practice is to have a main signal and an advance signal (for the next main) on the same mast, as illustrated in the wikipedia article. Obviously they work independently (except if the main signal is showing Halt, then the advance signal is not lit). Do I need to code out the sixteen aspect combinations for the combined mast, or is there a way to reuse my existing definitions when defining a mast?

...
Basically, what I wanted to achieve was: If the main signal (ih1) changes aspect, show the same aspect on the advance signal (ih4). How do I best achieve this?

--
Bob Jacobsen
rgj1927@...


 

Thanks, Bob, for your reply.

I think I was fixed on the physical appearance of the mast. I like the suggestion of placing the two masts at the same location: simple, elegant and avoids having to define out the various combinations.
I'll take a look at the script you mentioned, that should do the trick.

Thanks again
Regards
Otto


 

Hi Bob,

I tried to use the SignalFollower.py script, but get errors logged.


Information from the log:
PanelPro version 4.6-R81496dc starts under Java 1.8.0_77 on Linux amd64 v4.4.0-79-generic at Sat Jun 17 13:22:37 CEST 2017 [main]
Starting with profile Inglenook_Sidings_Simulator.3e3d4a8e [main]
...
Run file /home/user/.jmri/Inglenook_Sidings_Simulator/SignalFollower.py [main]
python 2.7 is provided by jython 2.7.0 [main]
ECMAScript ECMA - 262 Edition 5.1 is provided by Oracle Nashorn 1.8.0_77 [main]
ERROR - Error in script /home/user/.jmri/Inglenook_Sidings_Simulator/SignalFollower.py. [main]
javax.script.ScriptException: AttributeError: 'NoneType' object has no attribute 'addPropertyChangeListener' in <script> at line number 30


My Script:
# Has one SignalHead follow the state of another/
# Use this is you have e.g. a "repeater" signal head
# on the fascia that shows the appearance of a head
# on the layout
#
# Author: Bob Jacobsen, copyright 2016
# Part of the JMRI distribution

import jmri
import java

# Define the listener.
class SignalFollowerListener(java.beans.PropertyChangeListener):
def set(self, inputName, outputName) :
self.inSignal = signals.getSignalHead(inputName)
self.outSignal = signals.getSignalHead(outputName)
self.inSignal.addPropertyChangeListener(self)
return
def propertyChange(self, event):
self.outSignal.setAppearance(self.inSignal.getAppearance())
return

# Example of use - add a line like the following
# that includes system or user names for the signal head to be repeated,
# and the signal head to repeat it onto. These must already exist.
# SignalFollowerListener().set("CH2001","CH2001R")
# SignalFollowerListener().set("CH2002","CH2002R")

# SignalFollowerListener().set("ih1","ih4")
SignalFollowerListener().set("SBB Main 3","SBB Vorsignal")


I've tried with both the system name and the user name: both fail.

Have I missed something in the set up?
Do the scripts in the jython folder of JMRI.4.6 get run at start up? If so have I created a duplicate class?

Regards
Otto


 

Are you trying to use it with SignalHeads or SignalMasts?

If SignalHeads, make sure they¡¯re both defined before the script runs, e.g. in a panel file. It references the Heads without creating them.

If SignalMasts, change these lines (the arrows are indents, which should be the same as the original)

->self.inSignal = signals.getSignalHead(inputName)
->self.outSignal = signals.getSignalHead(outputName)

to

->self.inSignal = masts.getSignalMast(inputName)
->self.outSignal = masts.getSignalMast(outputName)

and

->self.outSignal.setAppearance(self.inSignal.getAppearance())

to

->self.outSignal.setAspect(self.inSignal.getAspect())

Sorry for the trouble. I¡¯ll add a script that does that shortly.

Bob

On Jun 17, 2017, at 5:23 AM, oschreibke@... [jmriusers] <jmriusers@...> wrote:

Hi Bob,

I tried to use the SignalFollower.py script, but get errors logged.

Information from the log:
PanelPro version 4.6-R81496dc starts under Java 1.8.0_77 on Linux amd64 v4.4.0-79-generic at Sat Jun 17 13:22:37 CEST 2017 [main]
Starting with profile Inglenook_Sidings_Simulator.3e3d4a8e [main]
..
Run file /home/user/.jmri/Inglenook_Sidings_Simulator/SignalFollower.py [main]
python 2.7 is provided by jython 2.7.0 [main]
ECMAScript ECMA - 262 Edition 5.1 is provided by Oracle Nashorn 1.8.0_77 [main]
ERROR - Error in script /home/user/.jmri/Inglenook_Sidings_Simulator/SignalFollower.py. [main]
javax.script.ScriptException: AttributeError: 'NoneType' object has no attribute 'addPropertyChangeListener' in <script> at line number 30

My Script:
# Has one SignalHead follow the state of another/
# Use this is you have e.g. a "repeater" signal head
# on the fascia that shows the appearance of a head
# on the layout
#
# Author: Bob Jacobsen, copyright 2016
# Part of the JMRI distribution

import jmri
import java

# Define the listener.
class SignalFollowerListener(java.beans.PropertyChangeListener):
def set(self, inputName, outputName) :
self.inSignal = signals.getSignalHead(inputName)
self.outSignal = signals.getSignalHead(outputName)
self.inSignal.addPropertyChangeListener(self)
return
def propertyChange(self, event):
self.outSignal.setAppearance(self.inSignal.getAppearance())
return

# Example of use - add a line like the following
# that includes system or user names for the signal head to be repeated,
# and the signal head to repeat it onto. These must already exist.
# SignalFollowerListener().set("CH2001","CH2001R")
# SignalFollowerListener().set("CH2002","CH2002R")

# SignalFollowerListener().set("ih1","ih4")
SignalFollowerListener().set("SBB Main 3","SBB Vorsignal")

I've tried with both the system name and the user name: both fail.

Have I missed something in the set up?
Do the scripts in the jython folder of JMRI.4.6 get run at start up? If so have I created a duplicate class?

Regards
Otto
--
Bob Jacobsen
rgj1927@...


 

There¡¯s now a signal _mast_ version of the script at:



Sorry for the delay in getting it posted.

Bob

On Jun 17, 2017, at 6:52 AM, Bob Jacobsen rgj1927@... [jmriusers] <jmriusers@...> wrote:

Are you trying to use it with SignalHeads or SignalMasts?

If SignalHeads, make sure they¡¯re both defined before the script runs, e.g. in a panel file. It references the Heads without creating them.

If SignalMasts, change these lines (the arrows are indents, which should be the same as the original)

->self.inSignal = signals.getSignalHead(inputName)
->self.outSignal = signals.getSignalHead(outputName)

to

->self.inSignal = masts.getSignalMast(inputName)
->self.outSignal = masts.getSignalMast(outputName)

and

->self.outSignal.setAppearance(self.inSignal.getAppearance())

to

->self.outSignal.setAspect(self.inSignal.getAspect())

Sorry for the trouble. I¡¯ll add a script that does that shortly.

Bob
--
Bob Jacobsen
rgj1927@...


 

Hi Bob,

I got the signal mast follower to work (almost).

I set the SignalMastFollower script to run at startup, where it fails with:
AttributeError: 'NoneType' object has no attribute 'addPropertyChangeListener'

If I open the panel then execute the script again, the signal mast following works.

Have I missed something in the set up? - it seems the script is being run too early.

BTW: There's an error in the script. On the last line (the example) it should read SignalMastFollowerListener and not SignalFollowerListener.

Regards
Otto


 

Hi Bob,

I fixed the error.

I wrote a script to load the panel and execute it on start up before the signal follower script.

the script:
import jmri
import java

jmri.InstanceManager.getDefault(jmri.ConfigureManager).load(java.io.File(jmri.util.FileUtil.getExternalFilename("preference:Inglenook_simulator.xml")))


Is this a sensible solution?

Regards
Otto


 

Otto,



You can arrange to order of all the startup actions using the preferences
window. It will let you move one up or down in the order. That has been
around since 4.4 I think. So if you make the panel the first line and the
other actions like loading scripts later, that should also take care of it.



-Ken Cameron, Member JMRI Dev Team

www.jmri.org

www.fingerlakeslivesteamers.org

www.cnymod.com

www.syracusemodelrr.org


 

Otto,
Look at the RTXINITIALIZER in LRoutes. It allows for a script to be run at startup.


I have used it for years in my client work for getting everything setup prior to Logix and other managers starting. Very useful for implementing CTC logix which sets the interlockings to Stop.


Chuck Catania
MRCS


 

Hi Otto



Looks like you are sorted now, but it is possible to use signalmast logic to do nearly all of this.


If you have created the home and distant parts of the mast as separate masts you just add the home masts to the layout editor turnouts and anchor points and discover the logic. You can then place the distant parts of the masts on the layout editor without connecting them to the track, but manually create the mast pairings to connect the distant mast with the home mast ahead.


The only extra bit you need to do which I cannot do in signalmast logic is to add a logix for each of the co-located distants to make the distant go dark when the co-located home is at halt.


The Luxembourg system is closer to the Swiss L system than the UK systems so might be worth looking at.


Suzie x


 

I'm reheating this three-year-old topic to report a form of closure (so far...). I've been off the air: other commitments got in the way.
Murphy's laws on technology: It's amazing how long something takes when you're not working on it.

I was able to get two examples working. Thanks to Ken Schamun for his youtube video? which got me started.
Both are based on the same layout. The Traunstein pre-made layout by Noch () which is reasonably simple but not totally trivial.
I've posted the signal and layout definitions to Github () in the hope working examples may help someone else.

A couple of learnings I gathered on the way:
  • Define the objects you need before building the layout diagram.
  • if you're using SML, place all the signals
  • Finally set the Signal Mast Logic: Discover and close the dialog is enough.
N. B. Both layouts exist only in JMRI. The next challenge will be to construct it and interface the hardware to JMRI.

Many thanks to those who helped.
Otto