TrainEnter


Takes the train agent and places it on the railway track. Together with TrainExit, this block is used to model part of the train movement on a higher abstraction level, namely without detailed physical level rail traffic modeling.

Here are just two use cases of the TrainEnter - TrainExit bundle of blocks:


Demo model: Train Exits One and Enters Another Rail Yard

Parameters

Entry point defined as
Here you can choose how you will define the position on track where new trains will be placed.
There are two alternative options:
Position on track - Define the point graphically with specific space markup element Position on track.
Offset on the track - Define the point as the distance from the start or end point of the track to the front side of the first car of the train. You specify the offset in the parameter Offset of 1st car, see below.
Name: locationType
Position on track [dynamic]  
[Visible if Entry point defined as Position on track] Here you should choose the Position on track element defining the point of the track where new trains will be placed.
Value type: PositionOnTrack
Local variable: train – the train
Railway track [dynamic]  
[Visible if Entry point defined as Offset on the track]
The railway track where the newly created train will be placed (all cars should be fully located on a single track).
Value type: RailwayTrack
Local variable: train – the train
Offset from [dynamic]
[Visible if Entry point defined as Offset on the track] Choose here where to count the offset from: the end of the track or from the beginning of the track.
Value type: boolean
Default value: false (from the end of the track)
Local variable: train – the train
Offset of 1st car [dynamic]
[Visible if Entry point defined as Offset on the track.] The distance from the start or end point of the track to the front side of the first car of the train.
Value type: double
Local variables: double tracklength – the length of the track
             train – the train
Default value: tracklength - 10
Orientation on track [dynamic]
Defines the orientation of the train relative to the track:
Forward (first car is closer to the end of the track) – the train orientation is the same as the track has.
Backward (first car is closer to the beginning) – opposite orientation,
Syntax: boolean orientation
Default value: Forward (first car is closer to the end of the track) - true
Local variable: train – the train
Actions
On exit [code]
Code executed when the train exits the object.
Local variable: train – the train

Functions

long count() - Returns the number of trains passed through this TrainEnter.

Ports

in

The input port.

out

The output port.