[SOLVED] Action locomotive swap: works?

Moderator: dadolphs

Post Reply
erwin24
Posts: 122
Joined: 02.01.2010, 14:35
Location: Augsburg

[SOLVED] Action locomotive swap: works?

Post by erwin24 » 08.12.2010, 00:41

Dear Rob, hi all,

seems that a "ACTION locomotive: swap" does not work after the introduction of BLS???

In action.c 609: "LocOp.swapPlacing(lc, NULL, False);"
????

Cordially!
erwin
Last edited by erwin24 on 14.12.2010, 00:13, edited 1 time in total.

ron&bram
Posts: 2460
Joined: 11.06.2008, 19:34
Location: Heemskerk, Netherlands

Post by ron&bram » 08.12.2010, 20:32

Hi Erwin,

This command calls the swapplacing routine in loc.c (line 2286), with the following parameters: the loc object in question (lc), an empty command (NULL) and a false consists flag (False). This will swap the loc, also with blocksides. It swaps the loc, also with BLS and also the block enter side. The swapped placing will only come into effect when a changed velocity has to be sent to the loc.

erwin24
Posts: 122
Joined: 02.01.2010, 14:35
Location: Augsburg

Post by erwin24 » 08.12.2010, 22:32

Hi Ronald,
with 1667 and earlier the "action loc swap" worked smoothly and correctly, with BLS nothing seems to happen ... I will test it again ...
Thank you!
erwin

erwin24
Posts: 122
Joined: 02.01.2010, 14:35
Location: Augsburg

Post by erwin24 » 13.12.2010, 21:07

Hi Ronald,
nothing happens when the action "swap" is triggered...
immediatedly in the trace follows a manual "swap placing":
20101213.204331.734 r9999I cmdr030D OAction 0711 Action swap_loc [lc-BR 80:swap]
20101213.204331.734 r9999I cmdr030D OAction 0124 Action condition: [fb-fbGleis1:true]
20101213.204331.750 r9999I cmdr030D OAction 0320 Condition is true.
20101213.204331.750 r9999I cmdr030D OAction 0346 Action execution swap_loc [lc-BR 80:swap]
20101213.204331.750 r9999I cmdr030D OFBack 0170 action with counter=6, carcount=0, countedcars=0, wheelcount=0
20101213.204356.140 r9999I cmdr030D OLoc 1812 direction dep. cmd "go" for BR 80.
20101213.204356.296 r9999W 000017CC OLcDrive 0143 No destination found for [BR 80]; waiting...

manually "swap placing":
20101213.204403.093 r9999I cmdr030D OLoc 1812 direction dep. cmd "swap" for BR 80.
20101213.204403.093 r9999I cmdr030D OLoc 2462 block enter side for [BR 80] set to [-]
20101213.204403.093 r9999I cmdr030D OLoc 2305 placing for [BR 80] set to [REV] 20101213.204403.109 r9999W cmdr030D OLoc 1853 swap BR 80
20101213.204417.828 r9999I 000017CC OLcDrive 0123 Found destination for "BR 80": "Suedblock".
a bug??

ron&bram
Posts: 2460
Joined: 11.06.2008, 19:34
Location: Heemskerk, Netherlands

Post by ron&bram » 13.12.2010, 21:49

Hi Erwin,

Interesting, this is my trace for a swap action:

Code: Select all

20101213.214319.234 r9999I cmdr00EE OControl 0187 Sensor event...addr=8
20101213.214319.234 r9999I cmdr00EE OAction  0714 Action swap [lc-_br 103:swap]
20101213.214319.234 r9999I cmdr00EE OAction  0355 Action execution swap [lc-_br 103:swap]
20101213.214319.234 r9999I cmdr00EE OLoc     2442 block enter side for [_br 103] set to [-]
20101213.214319.234 r9999I cmdr00EE OLoc     2297 placing for [_br 103] set to [REV]
20101213.214319.234 r9999I cmdr00EE OFBack   0170 action with counter=4, carcount=0, countedcars=0, wheelcount=0
Beats me. This is the action definition from my plan and the action trigger (connected to a sensor):

Code: Select all

    <ac id="swap" prev_id="swap" timed="false" hour="0" min="0" cmd="swap" oid="_br 103" actiontime="0" param="" timer="0" type="lc"/>

Code: Select all

      <actionctrl id="swap" auto="true" manual="false" state="true" counter="2" carcount="0" countedcars="0" wheelcount="0" lcid="_br 103"/>
Since the line numbers in the traces differ between your trace and mine we are using different Rocrail versions, I made the test with version 2198.

erwin24
Posts: 122
Joined: 02.01.2010, 14:35
Location: Augsburg

Post by erwin24 » 14.12.2010, 00:10

Dear Ronald,

I have reinstalled 2208 (had a 'selfmade' version with modified action.c and loc.c) ... and - indeed - now it works in my BLS-layout:
20101213.234737.234 r9999I cmdr0290 OAction 0706 Action swap_loc [lc-BR 80:swap]
20101213.234737.234 r9999I cmdr0290 OAction 0124 Action condition: [fb-fbGleis1:true]
20101213.234737.250 r9999I cmdr0290 OAction 0320 Condition is true.
20101213.234737.250 r9999I cmdr0290 OAction 0346 Action execution swap_loc [lc-BR 80:swap]
20101213.234737.250 r9999I cmdr0290 OLoc 2446 block enter side for [BR 80] set to [-]
20101213.234737.250 r9999I cmdr0290 OLoc 2301 placing for [BR 80] set to [REV] .... yes!!!!!!!!!
with actioncontrol at feedback

Code: Select all

<actionctrl id="swap_loc" auto="true" manual="true" state="on" counter="3" carcount="0" countedcars="0" wheelcount="0" lcid="BR 80">
<actioncond id="fbGleis1" state="true" type="fb"/>
</actionctrl>
[[ not necessary: and at block (event: enter2in)

Code: Select all

<actionctrl id="swap_loc" auto="true" manual="true" state="true"/>
[/i] ]]
and the action itself:

Code: Select all

 <ac id="swap_loc" prev_id="swap_loc" timed="false" hour="0" min="0" cmd="swap" oid="BR 80" actiontime="0" param="" timer="0" type="lc"/>
In my testlayout "reverse_loop" the actioncontrol is bound to an output - I will change and test it ...

Many thanks to you! - this opens a lot of possibilities with BLS-mode
erwin

(next question would be how to start locdirection-independent schedules from a block...) ...

erwin24
Posts: 122
Joined: 02.01.2010, 14:35
Location: Augsburg

Post by erwin24 » 14.12.2010, 16:51

Dear Ron,
the swap action for a loc works. -
I have tried to use it practically - the loc reaches the swap block, swaps - but a former route is active, the new route in opposite dir is selected, but not activated -
could you please look at the following lines:

Code: Select all

20101214.161012.437 r9999I 00001664 OFBack   0170 action with counter=5, carcount=0, countedcars=0, wheelcount=0
20101214.161012.453 r9999I 00001664 OAction  0706 Action swap_loc [lc-:swap] 
20101214.161012.453 r9999I 00001664 OAction  0124 Action condition: [fb-fbGleis2:true] 
20101214.161012.453 r9999I 00001664 OAction  0320 Condition is true.
20101214.161012.453 r9999I 00001664 OAction  0346 Action execution swap_loc [lc-:swap] 
20101214.161012.453 r9999I 00001664 OModel   1968 try to find loco by addres [0]
20101214.161012.468 r9999I 00001664 OLoc     2446 block enter side for [215] set to [-]
SWAP OK ------- 20101214.161012.468 r9999I 00001664 OLoc     2301 placing for [215] set to [REV]                  20101214.161012.468 r9999I 00001664 OFBack   0170 action with counter=0, carcount=0, countedcars=0, wheelcount=0

former route
W1a-----20101214.161012.500 r9999c 215      OSwitch  0714 Switch [sw_G1G2_Wendel] will be set to [turnout,0,0]
W1a 20101214.161012.500 r9999c 000016A4 OP50x    0332 turnout 9 straight
W1a ---->>> 20101214.161012.921 r9999I 000016A4 OLcDrive 0181 Found destination for "215": "W1a" (from 02)
20101214.161012.921 r9999I 215      OModel   1565 sys: dcc
20101214.161012.921 r9999c 000016A4 OP50x    0393 loc 5 speed=114 lights=on dir=reverse
20101214.161012.265 r9999I 215      OLoc     2446 block enter side for [215] set to [+]
20101214.161013.468 r9999I 000016A4 OLcDrive 0099 wheel count Schattzuf02[0], 02[0] 
20101214.161013.500 r9999I 215      OModel   1565 sys: ulink
20101214.161013.500 r9999I 215      OModel   1571 informing 15 listeners of a system event...
20101214.161013.500 r9999I 215      OModel   1968 try to find loco by addres [0]

new route (in opp. dir) YES this is what I want
--- does not function... loc in wrong dir.
SbZu02  ---->>>20101214.161013.515 r9999I 215      ORoute   1092 unlocking route SchattenbahnhofZuf02 nach G2 by 215
...
20101214.161013.531 r9999I 215      OLoc     2446 block enter side for [215] set to [+]
20101214.161013.531 r9999I 215      OModel   1565 sys: dcc
20101214.161013.531 r9999c 000016A4 OP50x    0393 loc 5 speed=76 lights=on dir=reverse
...
20101214.161016.531 r9999c fbreader OP50x    0803 fb 3 = 0
20101214.161016.531 r9999I 00001664 OFBack   0174 action state does not match: [on-off/false]
20101214.161016.531 r9999I 00001664 OFBack   0174 action state does not match: [5-off/false]
20101214.161018.890 r9999c fbreader OP50x    0803 fb 47 = 1
20101214.161018.890 r9999W 00001664 OBlock   0364 locId not set in block Schattzuf02
20101214.161018.890 r9999I 00001664 OApp     0980 POWER OFF
20101214.161018.890 r9999c fbreader OP50x    0464 Power OFF
thanks!
erwin

ron&bram
Posts: 2460
Joined: 11.06.2008, 19:34
Location: Heemskerk, Netherlands

Post by ron&bram » 14.12.2010, 19:33

Hi Erwin,

Wenn activating autolevel trace, I see the following when the swap action is done

Code: Select all

OAction  0355 Action execution swap [lc-_br 103:swap]
OLoc     2442 block enter side for [_br 103] set to [-]
and then later, when Rocrail starts to search for a new destination

Code: Select all

OModel   3351 using saved loco enter block side [+]
Notice the difference in block enter sides.

ron&bram
Posts: 2460
Joined: 11.06.2008, 19:34
Location: Heemskerk, Netherlands

Post by ron&bram » 14.12.2010, 20:20

HI Erwin,

I think the in event triggers the loco driver routine to overwrite the block enter side after the swap. I used a little workaround. The block is set to wait, otherwise the next block in the original direction is already reserved. The swap action is triggered by either the block, when the status is occupied, or by the in sensor when it goes on. The trick is to delay the swap action with one second (set the timer value in the action to 1000), then the blockenterside is changed after the in event has taken place and no longer overwritten.

erwin24
Posts: 122
Joined: 02.01.2010, 14:35
Location: Augsburg

Post by erwin24 » 14.12.2010, 20:23

Hi Ron,

the block where the loc should swap, was defined as "commuter" - I'll change it and drive some rounds ...

Thanks,
erwin

erwin24
Posts: 122
Joined: 02.01.2010, 14:35
Location: Augsburg

Post by erwin24 » 14.12.2010, 21:39

Dear Ron,

you are totally on the right way - I have set a timer to the swap action (1000ms) ...
Ooops, just now the loc went in the previously select block ahead ...
I have to check the timer again ... I will test again ... Some rounds ...
But I am sure your solution is going to work!

Thanks and regards,
erwin

erwin24
Posts: 122
Joined: 02.01.2010, 14:35
Location: Augsburg

Post by erwin24 » 14.12.2010, 21:58

Dear Ron,

with 1000ms and 500ms the loc directions swaps as wished, but the next block keeps being locked.

Shouldn't erase a "swap" the former defined 'next route'? And shouldn't start the finding of new route again?

I 'll test it again with 1500ms...

Thank you for your patience,
erwin

erwin24
Posts: 122
Joined: 02.01.2010, 14:35
Location: Augsburg

Post by erwin24 » 14.12.2010, 22:18

I have adjusted my block waittimes (the old ones didn't produce a wait).
Now the loc waits - and after a swap - searches a new direction!
:D
Bravo!
Ganz herzlichen Dank!
Erwin

Post Reply

Return to “Basic topics”