feature request - block additional event or sensor action ctrl retrieve block locoID Topic is solved

Post Reply
applor
Posts: 50
Joined: 10.06.2016, 00:30

feature request - block additional event or sensor action ctrl retrieve block locoID

Post by applor » 11.02.2019, 00:16

Hello,

I have a bit of a plan problem I need suggestions with or perhaps feature addition. It is best for me to explain the scenario:

There is a length of track with a stop signal and then a tunnel shortly after.
In rocrail I have a block configured with two sensors, an ENTER sensor and then an IN sensor at the signal - this allows a train to stop accurately at the signal.
I then have a third short sensor after the signal and just before the tunnel which I want to use to trigger the locomotive whistle/horn.

I cannot configure the sensor by itself as an action control because it does not know what loco to trigger the event for - it needs to be part of a Block event.

I have attached the plan. I am referring to Block 35 using sensors M2-6 for Enter and R3-12 for In. I want to use L3-14 to trigger the horn/whistle.
L3-14 is currently assigned as the Occupied event to Block 35 for testing but it does not work - as per documentation the IN event triggers Occupied action control.

Currently it appears the only solution is to configured a new Block for L3-14 as an Enter2In event but this would complicate things and cause problems because the block would be too short.

What I feel is missing is the ability for a sensor action control to retrieve the loco ID from a definable block OR an additional Block/route event that could be used to trigger an action.

Any thoughts on this problem?
You do not have the required permissions to view the files attached to this post.

rvooyen
Posts: 979
Joined: 08.12.2012, 11:31
Location: Netherlands (Hilversum)

Re: feature request - block additional event or sensor action ctrl retrieve block locoID

Post by rvooyen » 11.02.2019, 00:21

Sorry my post was not correct.

Robert
Last edited by rvooyen on 11.02.2019, 08:17, edited 1 time in total.

cds
Moderator
Posts: 5237
Joined: 03.02.2012, 19:24
Location: Tullnerbach, Austria

Re: feature request - block additional event or sensor action ctrl retrieve block locoID

Post by cds » 11.02.2019, 07:30

Hello!
Currently it appears the only solution is to configured a new Block for L3-14 as an Enter2In event but this would complicate things and cause problems because the block would be too short.
Maybe you would think of a crossing block?

peter&basti
Moderator
Posts: 6770
Joined: 09.01.2012, 22:09
Location: Vienna, Austria

Re: feature request - block additional event or sensor action ctrl retrieve block locoID

Post by peter&basti » 11.02.2019, 07:46

Hi Eric,
I then have a third short sensor after the signal and just before the tunnel which I want to use to trigger the locomotive whistle/horn.

I cannot configure the sensor by itself as an action control because it does not know what loco to trigger the event for - it needs to be part of a Block event.
I fully agree to this.

So this sensor should bounded to block 35 anyway. I suggest to add the L3-14 sensor as "exit" in the route definiton of block 35.

applor
Posts: 50
Joined: 10.06.2016, 00:30

Re: feature request - block additional event or sensor action ctrl retrieve block locoID

Post by applor » 12.02.2019, 22:11

cds wrote:
11.02.2019, 07:30
Hello!
Maybe you would think of a crossing block?
Crossing block events are not triggered (it does not register Enter or In events, sensor events are ignored on crossing blocks) so this does not allow you to trigger an action with it.
peter&basti wrote:
11.02.2019, 07:46
Hi Eric,
I then have a third short sensor after the signal and just before the tunnel which I want to use to trigger the locomotive whistle/horn.

I cannot configure the sensor by itself as an action control because it does not know what loco to trigger the event for - it needs to be part of a Block event.
I fully agree to this.

So this sensor should bounded to block 35 anyway. I suggest to add the L3-14 sensor as "exit" in the route definiton of block 35.
Exit sensor does not work to trigger the action. Exit sensor is designed to work in staging blocks. Even though you can configure L3-14 as 'Exit' and define the horn/whistle to activate on the Exit sensor, it does not trigger.

rjversluis
Site Admin
Posts: 42378
Joined: 10.04.2006, 08:48
Location: Speyer, Germany
Contact:

Re: feature request - block additional event or sensor action ctrl retrieve block locoID

Post by rjversluis » 13.02.2019, 09:01

XMLScript is your friend:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xmlscript>
  <query vr="lcid" table="bklist" id="cb4" get="locid"/>
  <fn id="@lcid" fnchanged="3" f3="true"/>
</xmlscript>

peter&basti
Moderator
Posts: 6770
Joined: 09.01.2012, 22:09
Location: Vienna, Austria

Re: feature request - block additional event or sensor action ctrl retrieve block locoID

Post by peter&basti » 13.02.2019, 09:09

Hi Eric,

1. call the script mentioned by Rob with a action on your sensor.
2. Replace in the query-statement the id "cb4" by the block-id where you want to get the loco (in your example the block before)
3. Replace the function# in the fn-statement by the function# of your loco-decoder you want to call.

applor
Posts: 50
Joined: 10.06.2016, 00:30

Re: feature request - block additional event or sensor action ctrl retrieve block locoID

Post by applor » 13.02.2019, 23:20

Hi Rob/Peter,

Thanks for your response and solution, though I am having some issues.

When I first implemented the XML script and virtual tested, it worked for the VT8.5 . However the Horn stayed on permanently so it needed a duration. Also, I need to use Function description rather than a function number since the horn or whistle is on different functions for different locomotives (the test VT8.5 happened to have the horn on F3)

After the initial test with the script you posted and with my blockID entered I have been unable to get the Horn to activate again when re-testing on that sensor, neither with the original script provided or with my changed one below.

I am not sure I understand the part of the script where it has fnchanged="3" when Function 3 is turned on directly with statement f3="on"?
From a logic point of view I would think you'd define the function and then define the state, rather the above seems to define the function (fnchanged=3) and then re-defines the function (f3) and its state (on)?!?

So with no previous XML experience and reading the documentation, I believe this is what I need to script:

<?xml version="1.0" encoding="UTF-8"?>
<xmlscript>
<query vr="lcid" table="bklist" id="35" get="locid"/>
<fn id="@lcid" fndesc="Horn,Whistle" fncmd="on" timer="500"/>
</xmlscript>

Is that correct? According to this page:
http://rocrail.net/software/rocrail-sna ... en.html#fn

I need to use fndesc. However I as per above I am confused about how to turn it on since I cannot use 'f3="true"' as I am turning the function on based on description and not number.
Therefore I must use fncmd?

Also, is there a reset period or something that will prevent the horn/whistle re-activating in the event of the sensor twitching off for a split second and back on?
You do not have the required permissions to view the files attached to this post.

applor
Posts: 50
Joined: 10.06.2016, 00:30

Re: feature request - block additional event or sensor action ctrl retrieve block locoID

Post by applor » 04.03.2019, 06:36

I found some time to work on this today and test. I have it working with the below script. This will activate the function for whistle or horn for a second for the loco leaving Block 35:

<?xml version="1.0" encoding="UTF-8"?>
<xmlscript>
<query vr="lcid" table="bklist" id="35" get="locid"/>
<fn id="@lcid" fndesc="Horn" fncmd="on"/>
<fn id="@lcid" fndesc="Whistle" fncmd="on"/>
<sleep time="1000"/>
<fn id="@lcid" fndesc="Horn" fncmd="off"/>
<fn id="@lcid" fndesc="Whistle" fncmd="off"/>
</xmlscript>

Post Reply

Return to “Automatic mode”