User Tools

Site Tools


llat:link-locomotives-and-trains-en

Link Locomotives and Trains

Introduction

The word "train" will probably confuse us in the following description. Therefore the common word "train" and the Rocrail object "Rocrail-train" will be used. The "Rocrail-train" is a sequence of "cars".
Now that there are locomotives and Rocrail-trains they should be coupled to each other:

Operation Wiki Reference Description what it looks like examples
Consist Multiple Units couple a locomotive to a locomotive a) manual operated
b) by action
c) XML script
Assign Train Assign Train assign a "Rocrail-train" to a locomotive a) manual operated
b) by action
c) XML script
Link Train Link Train link another train to a train a) manual operated
b) by action
c) XML script

The examples will show the general process.
The examples will not show the coppling itself. This is up to the reader and its hardware.
The examples are limited to a maximum of two locomotives and two trains.

The description of the functionality of the examples can be found here.

The Rocrail workspace for the examples can be found here.

The corresponding inverse operations are not (yet) described here:

Operation (en) inverse operation (en) Operation (de) inverse Operation (de)
Consist Consist Mehrfachtraktion Mehrfachtraktion
Assign Train Release Train Zug zuordnen Zug lösen
Link Train Unlink Train Zug koppeln Zug entkoppeln

Additional Information

Some additional information to "link train":

time loco blockid train length consist details
before
before lc_03 bk51 op_03 200 -
before lc_04 bk52 op_04 300 -
after lc_03 bk53 op_03 500 op_04
after

More References

Examples (Rocrail plan)

The Rocrail plan does include the XML-coded examples for "consist", "assigntrain" and "linktrain".
The plan file may be used to play with "manual" operation and to play with "action" performed solutions.
The plan file may be used for executing the XML-scripts:
* there is an output button to initialize all predefined locomotives and trains.
* there are output buttons to start the examples for "consist", "assign train" and "linktain".
* there is an output button for generating "go" or "govirtual" commands for the locomotives.

Use the example as is. Use the example of your own risk! Make backups before using the examples. Have fun!

- zip-file of the Rocrail workspace - linklocosandtrains.zip
The zip-file includes:
* the Rocrail plan file "plan.xml"
* all XML script files "ac_llat_*.xml"
* the folder "images" with all loco images ("lc_*.png") and car images ("car*.png")

The plan file was edited using Rocrail version 15542.

- display of the Rocrail plan -

The trains are already predefined. Trains and locomotives have their predefined initial places.

locomotive init block train init block used for schedule cars
lc_01 bk31 - - consist - -
lc_02 bk32 - - consist - -
lc_01+lc_02 bk23 - - consist - -
lc_01+lc_02 - op_01 bk11 assigntrain sc_llat_l2t_23_11 car001, car002, car003
lc_03 bk41 op_03 bk42 assigntrain sc_llat_l2t_41_42 car031
lc_04 bk46 op_04 bk47 assigntrain sc_llat_l2t_46_47 car041,car042
lc_03+op_03 bk51 - - linktrain - -
lc_04+op_04 bk52 - - linktrain - -
lc_03+op_03+lc_04+op_04 bk53 - - linktrain - -


Examples (manual)

Consist (manual)

Couple a locomotive to a locomotive.

plan manual operation
position locos
drive the two locos to the blocks;
one block for each loco;
the two blocks are covert by a virtual block for the consist result.
consist
use "locomotive Properties / Multiple Units / Loco ID / Add" for the consist;
- locomotive "lc_01" will be the leading locomotive;
- locomotive "lc_02" does the consist

Assign Train (manual)

Assign a "Rocrail-train" to a locomotive.

plan manual operation
goto train
drive the loco into the block where the train is waiting
assign train

Link another train to a train.

plan manual operation
position locos with trains drive the two locos connected to the two trains to the blocks;
one block for each loco with train;
the two blocks are covert by a virtual block for the linktrain result.
linktrain

Examples (by action)

Consist (by action)

Couple a locomotive to a locomotive.

plan manual operation
position locos
drive the two locos to the blocks;
one block for each loco;
the two blocks are covert by a virtual block for the consist result.
consist
consist ready
drag loco "lc_01" into the virtual block "bk23"
The two locomotives have to be place into the virtual block manually.

Assign Train (by action)

Assign a "Rocrail-train" to a locomotive.

plan manual operation
goto train
drive the loco into the block where the train is waiting
assign train
define this action and call it at the IN event of the block the train is waiting in

Link another train to a train.
As an action it is available with Rocrail Version 15542+.

plan manual operation
preparation the two trains have been moved to blocks "bk51" and "bk52"
the virtual block "bk53" is required
link train The first train is identified by the loco.
The second train is identified by the Rocrail-train.
The action may be called by the IN event of the second train.

The trains of the two blocks "bk51" and "bk52" are connected
and they are automatically positioned into the virtual block "bk53".

Examples (XML script)

Consist (XML script)

Couple a locomotive to a locomotive.

plan XML-Script
position locos
<!-- Initialize -->
<!-- place the locos -->
<lc id="lc_01" cmd="block" blockid="bk31"/>
<model cmd="modify">
  <lc id="lc_01" blockenterside="false" />
</model>
<lc id="lc_02" cmd="block" blockid="bk32"/>
<model cmd="modify">
  <lc id="lc_02" blockenterside="false" />
</model>
<!-- make sure that there is no consist -->
<lc id="lc_01" cmd="consist" consist=""/> 
<lc id="lc_02" cmd="consist" consist=""/> 
start locos
<!-- Start -->
<!-- start the locos -->
<lc id="lc_01" cmd="gotoblock" blockid="bk21"/>
<lc id="lc_01" cmd="go"/>
<lc id="lc_02" cmd="gotoblock" blockid="bk22"/>
<lc id="lc_02" cmd="go"/> 
consist
<!-- Consist -->
<!-- loco 1 becomes a consist of loco 2 -->
<lc id="lc_01" cmd="consist" consist ="lc_02"/>
<lc id="lc_01" cmd="block" blockid="bk23"/> 

The two locomotives have to be place into the virtual block by the script.

Assign Train (XML script)

Assign a "Rocrail-train" to a locomotive.

plan XML-Script
initialize

<!-- Initialize -->
<!-- place the loco -->
<lc id="lc_04" cmd="block" blockid="bk46"/>
<model cmd="modify">
  <lc id="lc_04" blockenterside="false" />
</model>
<!-- no train should be assigned to the loco -->
<lc id="lc_04" cmd="releasetrain"/>
<!-- place the train -->
<operator id="op_04" cmd="block" location="bk47"/> 
goto train
<!-- let the loco drive to the train -->
<lc id="lc_04" cmd="useschedule" 
  scheduleid="sc_llat_l2t_46_47"/>
<lc id="lc_04" cmd="go"/> 
assign train
<!-- assign the train to the loco -->
<lc id="lc_04" cmd="assigntrain" train="op_04"/> 
<model cmd="modify"> 
  <operator id="op_04" swaplocoimage="false" />
</model> 
wait
<!-- drive to the waiting position -->
<lc id="lc_04" cmd="swap"/>
<lc id="lc_04" cmd="gotoblock" blockid="bk48"/>
<lc id="lc_04" cmd=go"/> 

Link another train to a train.

plan XML-Script
preparation
<!-- Preparation -->
<!-- place the two trains into blocks "bk51" and "bk52" -->
<!-- the virtual block "bk53" is required -->
 
link train
<!-- link the train to the train -->
<!-- The first train is identified by the loco. -->
<!-- The second train is identified by the Rocrail-train. -->
<lc id="lc_03" cmd="linktrain" train="op_04"/> 

The trains of the two blocks "bk51" and "bk52" are connected and they are automatically positioned into the virtual block "bk53".

llat/link-locomotives-and-trains-en.txt · Last modified: 2024/01/14 09:16 by rjversluis