Skip to main content

Aspect Matrix

The Aspect Matrix plugin contains a snippet and a script template to calculate the running time for each train on each route, based on the combination of the entry and exit signals of the route.

Quick start

  1. Install or enable the Aspect Matrix plugin.
  2. Right-click the icon of a Scripted Simulation project, New, Other..., Aspect Matrix script.
  3. Customize the script.
    • rollingStock, timetable and micro: the projects to be used for the simulation
    • scenarioTemplate: (optional) template that defines the name of the simulation scenarios. Must be a single-quoted string. The avalable variables are: aspectPair, routeUnderTest, train.
    • routes: (optional) set that chooses on which routes to apply the aspects. If not defined, or if empty, the snippet applies the aspects to all the routes crossed by the trains.
    • In the default slot, you can configure other characteristics of the script. advanced
  4. Execute the script.

How it works

This is the template of the script:

snippet('lib/AspectMatrix',
// snippet configuration
rollingStock: 'RollingStock',
timetable:'Timetable',
micro: 'Micro'
) {
// default slot
}

All the logic is contained in the lib/AspectMatrix.snippet snippet, the body of the script contains only the configuration.

Firstly, each train is simulated independently, and the sequence of crossed routes and the running time for each of them is registered.

Then the list of scenarios is constructed, as the combination of aspect pairs seen by the train on the signals at the beginning and the end of the route to be analyzed. It's the product of the ['G', 'YY', 'Y', 'R'] x ['G', 'YY', 'Y', 'R'], excluding the impossible sequences: ['YY-R', 'G-R', 'G-Y']. For each train and crossed route, every combination of the aspects is simulated while changing some of the properties of the route to be analyzed appropriately, previous and next routes: Reservation depth, Reserve time e Distance to reservation point:

  • to see a double yellow, you must reserve at most two routes: reservationDepth = 2 two routes after the route to be analyzed.
  • to see a yellow, you must reserve at most one route: reservationDepth = 1 and a route after the route to be analyzed.
  • to see a red, you must reserve the route when you are a meter from the signal, till you stop: distanceToReservationPoint = 1 the route before, reservationDepth = 1 and reserveTime = 1 the route to be analyzed.

A log file is produced aspectMatrix.csv which lists all the operations executed on the route, with the following columns:

  • TrainNumber: the simulated train number
  • Test: the name of the analyzed route
  • AspectPair: the combination of the aspects, for example, Y-R
  • Route: the name of the route you are changing the configuration of
  • Parameter: the modified parameter
  • Value: the new value for the parameter

The scenario parameters are:

  • trainNumber
  • routeUnderTest
  • aspectPair

These parameters can be used, for example, to generate the Time Signal At Red output:

snippet('lib/AspectMatrix',
// snippet configuration
rollingStock: 'RollingStock',
timetable:'Timetable',
micro: 'Micro'
) {
// default slot
snippet('lib/TimeSignalAtRed', outputParams: [ 'trainNumber', 'routeUnderTest', 'aspectPair'])
}

Tutorials

Examples

Analysis of a single route

snippet('lib/AspectMatrix',
// snippet configuration
rollingStock: 'RollingStock',
timetable:'Timetable',
micro: 'Micro',
routes: ['166-160']
) {
// default slot
}

Minimum time, without stops

snippet('lib/AspectMatrix',
// snippet configuration
rollingStock: 'RollingStock',
timetable:'Timetable',
micro: 'Micro'
) {
// default slot
withTimetableTransformations {
timetableTransformations { setEntryType(pass).withEntryMatcher('not origin and not destination')}
}
}

In depth guide