Train evaluators
These expressions can be used in reports or Groovy scripts. They return a typed value corresponding to some attribute of a train, trainset, entry, etc.
Certain attributes can return an undefined value, for example, when requesting the departure time from the last entry of a train an undefined value would always be returned. The or operator allows the concatenation of more evaluators, and it returns the first defined value that was found. For example, departure time at LIVST or arrival time at LIVST returns the arrival time, if the departure time is not defined.
Trains
The trains of the planned timetable.
Train number
Returns the train number
train number
Category
Returns the name of the train category
category
Collection
Returns the name of the train collection
collection
Operator
Returns the name of the train's operator
operator
Service class
The service class is the first digit or letter of the train number.
service class
Origin
Returns the code of the train's origin station
origin
Destinazione
Returns the code of the train's destination station
destination
Bundle
Returns the bundle (folder/name) of the train
bundle
Bundle name
Returns the folder of the train's bundle.
bundle name
Bundle folder
Returns the name of the train's bundle
bundle folder
Running time
Returns the running time in seconds, as the difference between the departure time from the origin and the arrival time at the destination.
running time
Freight train
Returns true for freight trains, as defined in the Treno category. If a train does not have a defined category, it returns `false.
freight
Passenger train
Restituisce true per i treni non-merci ^[In treno non è possibile specificare un treno passeggeri. Tutti i non-merci sono ritenuti passeggeri, anche se in realtà potrebbero essere treni di servizio o locomotive isosolate], come definiti sulla categoria in Treno. Se un treno non ha una categoria definita, restituisce false.
passenger
Revenue train
Both passenger and freight trains in revenue services:
revenue
Empty train
Empty coaching stock or freight wagons:
empty
Trainset
These expressions are valid only if the trainset is unique across the whole train voyage.
trainset parts /* count of units in the trainset */
trainset length /* in meters */
trainset weight /* total weight with choosen load percentage, in tons */
trainset gross weight /* total weight, including full load, in tons */
trainset tare weight /* total weight, without load, in tons */
trainset net weight /* full load weight */
trainset maximum speed /* in m/s */
trainset name
Path entries
There are five ways to select an entry of a train's path.
-
First entry at the station with the specified code:
<expression> at LIVST
<expression> not in (LIVST, BOWJ) -
Nth entry at the station with the specified code; for example, on a loop train, the first and the second entries at LIVST:
<expression> at LIVST#1
<expression> at LIVST#2 -
Origin entry:
<expression> at origin -
Destination entry:
<expression> at destination -
The previous / next entry / stop / pass / arrival / departure / station track / station stop from the specified station.
stopmatches both intermediate stops and origin or destination entries.arrivalmatches intermedia stops or destination entries.departurematches origin entries or intermediate stops.station trackmatches any entry at a station track, i.e. a track with a name, belonging to a station. In Treno v3.2, only Stations may have named track, Junction, Halts or other kind of control points have only unnamed tracks. From a microscopic perspective, Station tracks are marked by a Station track joint. Unnamed tracks may only have Station reference joints.station stopmatches a stop on a station track.
<expression> at previous stop from LIVST
<expression> at next pass from LIVST
Stop time
Planned stop time at the entry
stop time at ILFORD
Arrival time
Returns the arrival time at the entry, in seconds from midnight of the first day of the simulation.
arrival time at LIVST
Departure time
Returns the departure time from the entry, in seconds from midnight of the first day of the simulation.
departure time from LIVST
Station code
Returns the station code from the entry.
station at origin
Station track code
Returns the station track's code from the entry.
station track at LIVST
Entry type
Returns the type of entry.
type at LIVST
To write expressions more fluently, there are some aliases available.
Stopping
Stopping returns true if the train stops at the specified entry.
stopping at ILFORD
Calling
Calling returns true if the train is a passenger train at the specified entry.
Calling
Describing a passenger train stopping at a station to allow passengers to alight or board.
calling at ILFORD
Non stopping
Returns true if the train does not stop at the specified entry
passing through SHENFLD
Arriving at / departing from
Returns true if the train stops or ends at the specified station:
arriving at SHENFLD
Returns true if the train stops or begins at the specified station:
departing from SHENFLD
Origin / destination / turnback
Returns true if the train begins at the specified entry:
origin at SHENFLD
Returns true if the train ends at the specified entry:
destination at SHENFLD
Returns true if the train turns back at the specified entry:
turnback at SHENFLD
Trainset change
trainset change at ILFORD
Connection
In Treno and Trenissimo, connections are attach, detach and turnaround activities.
connection at ILFORD
Interpolation
Treno planning tool can automatically interpolate missing passing times, when importing timetables from other systems or tools.
interpolated at ILFORD
Line or line track
inbound line at ILFORD
inbound line track at ILFORD
outbound line at ILFORD
outbound line track at ILFORD
Peak hour
In Treno you can define the rush hours.
peak hour
Path sections
integerSectionAttribute
:
;
durationSectionAttribute
: 'running time'
| 'actual running time'
| 'running time delay'
;
stringSectionAttribute
: 'line' # lineSectionAttribute
| 'trainset' # trainsetSectionAttribute
| 'service code' # serviceCodeSectionAttribute
;
booleanSectionAttribute
: 'no stop'
| 'stopping'
| 'calling'
;
Simulation trains
The trains of the input timetable of the simulation, cropped on the simulation area, and replicated in order to conver all the days of the simulation.
Run index, run key
Day index, course index
Date
Actual trains
The output trains of the simulation, with the effective times and delays.
Arrived, departed
Delays
Actual path entries
Arrived, departed, stopped
Actual times
Delays
Estimated delays
Headway
Current trainset
Trainset currently in use by a running train. Has the train already arrived at the destination, the current trainset is the inbound trainset at the destination.
trainset parts /* count of units in the trainset */
trainset length /* in meters */
trainset weight /* in tons */
trainset maximum speed /* in m/s */
trainset name
Actual path sections
Actual running time
Running time delay
Complete grammar
macroTrainEvaluator
: trainEvaluator EOF
| trainEvaluator (OR trainEvaluator)+ EOF
;
trainEvaluator
: left=integerTrainAttribute
| left=durationTrainAttribute
| left=stringTrainAttribute
| left=sectionEvaluator BETWEEN from=stringValue AND to=stringValue
| left=entryEvaluator AT scope=stringValue
| left=entryEvaluator AT 'origin'
| left=entryEvaluator AT 'destination'
| left=entryEvaluator AT scope=stringValue HASH index=integerValue
| left=booleanTrainAttribute
;
integerTrainAttribute
: 'day index'
| 'course index'
| 'run index'
;
durationTrainAttribute
: 'running time'
/* MacroActualTrainCourse */
| ( 'delay' | 'current delay' | 'currentDelay' )
| ( 'delay at destination' | 'delayAtDestination' )
| ( 'delay at origin' | 'delayAtOrigin' )
| ( 'max delay' | 'maxDelay' )
| ( 'min delay' | 'minDelay' )
;
stringTrainAttribute
: ('number' | 'train number')
| 'category'
| 'collection'
| 'operator'
| ('serviceClass' | 'service class')
| 'origin'
| 'destination'
| 'bundle'
| 'bundle name'
| 'bundle folder'
/* MacroTrainCourse */
| 'date'
| 'run key'
;
booleanTrainAttribute
: 'passenger'
| 'freight'
| 'empty'
| 'revenue'
/* MacroActualTrainCourse */
| 'arrived'
| 'departed'
;
sectionEvaluator
: left=integerSectionAttribute
| left=durationSectionAttribute
| left=stringSectionAttribute
| left=booleanSectionAttribute
| 'trainset' expr=trainsetEvaluator
;
integerSectionAttribute
:
;
durationSectionAttribute
: 'running time'
| 'actual running time'
| 'running time delay'
;
stringSectionAttribute
: 'line' # lineSectionAttribute
| 'trainset' # trainsetSectionAttribute
| 'service code' # serviceCodeSectionAttribute
;
booleanSectionAttribute
: 'no stop'
| 'stopping'
| 'calling'
;
trainsetEvaluator
: left=integerTrainsetAttribute
| left=stringTrainsetAttribute
| left=booleanTrainsetAttribute
| left=lenghtTrainsetAttribute
| left=speedTrainsetAttribute
;
integerTrainsetAttribute
: 'parts'
;
stringTrainsetAttribute
: 'name'
| 'speed' 'type'
;
booleanTrainsetAttribute
:
;
lenghtTrainsetAttribute
: 'length'
;
speedTrainsetAttribute
: 'maximum' 'speed'
;
entryEvaluator
: left=entryEvaluator AT direction=relativeEntryDirection
classifier=relativeEntryClassifier
| left=integerEntryAttribute
| left=lenghtEntryAttribute
| left=durationEntryAttribute
| left=timeEntryAttribute
| left=stringEntryAttribute
| left=booleanEntryAttribute
| 'station' left=stationEvaluator
| 'outbound'? 'trainset' expr=trainsetEvaluator
| 'inbound' 'trainset' expr=trainsetEvaluator
;
relativeEntryDirection
: 'previous'
| 'next'
;
relativeEntryClassifier
: 'entry'
| 'stop'
| 'departure'
| 'arrival'
| 'pass'
;
integerEntryAttribute
:
;
durationEntryAttribute
: 'stop time'
/* su MacroTrainActualPathEntry */
| 'delay'
| ( 'arrival delay' | 'arrivalDelay' )
| ( 'departure delay' | 'departureDelay' )
| ( 'arrival headway' | 'inbound headway' )
| ( 'departure headway' | 'outbound headway' )
| ( 'estimated arrival delay' | 'estimatedArrivalDelay' )
| ( 'estimated departure delay' | 'estimatedDepartureDelay' )
| 'last known delay'
| ( 'dwell time delay' | 'stop time delay' )
| 'departure'? 'primary delay'
| 'departure'? 'secondary delay'
;
timeEntryAttribute
: 'arrival time'
| 'departure time'
/* su MacroTrainActualPathEntry */
| 'actual arrival time'
| 'actual departure time'
;
stringEntryAttribute
: 'station'
| ( 'track' | 'station track' )
| 'type'
| 'inbound line track'
| 'inbound line'
| 'outbound line track'
| 'outbound line'
;
booleanEntryAttribute
: 'stopping'
| 'calling'
| 'arriving'
| 'departing'
| 'passing'
| 'origin'
| 'destination'
| 'interpolated'
| 'peak hour'
| ( 'turnback' | 'turn back' )
| 'trainset change'
| 'connection'
/* su MacroTrainActualPathEntry */
| 'arrived'
| 'departed'
| 'stopped'
;