Page tree
Skip to end of metadata
Go to start of metadata

General

This is the description of the environment SCChart, its inherent hierarchy and the handling of error messages.
The environment is simulated based on
the behavior of each train moving along the same railway, which is modeled using parallel SCChart regions. Except for some error cases described below, there is not much interaction between the separate trains. The environment was divided into a hierarchy, where the main SCChart, called environment, implements some variable bindings and checks misbehavior and errors. Also 11 parallel regions are modeled, each of them containing a copy of the train SCChart. The train SCChart again implements some error checking and bindings. Furthermore it imports the wagon SCChart twice, modeling front and rear wagons respectively. The wagon SCChart is the biggest model. Beside the usual error checking it implements the entire track layout and simulates the movements of one wagon on the track system according to the given inputs from the interface.

Wagon SCChart

Although this chart is the bottom most in the environment hierarchy, it is also the core and implements the entire movement of a single wagon along the tracks. For easier understanding of the functionality, it is also split into multiple steps, each handling a specific part and case.

The exact position of each wagon is tracked by three variables: 
track holds the track of the wagon (e.g. 25 standing for KH_ST_1, 39 standing for OC_LN_5, 32 standing for KIO_LN_1 etc. as described in the interface), pos is telling the position of the wagon on the track in mm, starting from the beginning of the track in its main travelling direction. A bit more complicated is the variable branch. It saves the position on a track with branches. Here the value stands for the track this branch is leading to (eg. the branch KH_LN_4 on the track KH_LN_2 is the branch that should be taken on the Kicking Horse Pass for every train driving forwards through it). Pieces of such tracks, that do not lead to another track are numbered with -1 as the main track piece and -2, -3 and -4 for further pieces not leading directly to another track. The values -2 to -4 only appear in the three stations, -2 being the short piece between points 1 and 2, -3 the one between points 2 and 3 and -4 being the last one between points 3 and 4 on KH_ST_0. This can represent every possible position a train can have on the railway.
An example:
track = 40, position = 10, branch = 32 represents a wagon standing on OC_ST_0 (track = 40), standing on the piece coming from the KIO_LN_1 (branch = 32) between the transition of the tracks and the diamond point with the numbers 27 and 28. On that piece it stands just 10mm in front of the beginning of the track (position = 10).

The wagon SCChart updates the pos value based on the power given to its track and updates the track. The pos and branch values are updated according to the track length and point position values for each possible case. If a contact position is crossed, a signal as defined in the interface will be forwarded.

Another big section of this SCChart is part of the error handling. Some errors can be checked at this level already. For instance a wagon crossing a point from two branches to one, with the point being branched to the incorrect branch. This deficient point state and some other errors are documented in the interface page under errors.

Train SCChart

This SCChart contains two references to the wagon chart representing the front and rear wagon of a train and thus defining the whole area a train will stretch over. Those two wagons are also the only ones with magnets activating the contacts, which is why they are the only ones modeled. This is a relatively lightweight implementation to track an entire train and all its interactions with the interface. 

Further error checking that is available at the level of the train is checked here. If a point that the train is occupying is branched while the train is standing on top of it, an error is thrown.
Likewise if the train has different power levels on two tracks it is positioned on, another error occurs. Details can be found in the error interface again.

Environment SCChart

This is the main chart to be executed when simulating the railway environment. It imports the train SCChart 11 times for the up to 11 trains that can drive on the railway simultaneously. Next to that the behavior of the railway crossing and collision error checking between trains is implemented here. Every other lamp, signal and similar values are also added just like mentioned in the interface and are forwarded from the input to an own output.

The trains' positions get set up here, as explained in the next section.

Usage

The project can be built the standard way by building it with KIELER, resulting in an executable Sim_environment. The simulation is best viewed using the railway visualization, which is described on its own page.

To use the environment,
train_setup has to be set before the initial tick. This variable determines which trains are used and where they stand initially (see also the Interface). Trains should only start on the tracks 8 to 10, 25 to 29 and 41 to 43 (IC, OC and KH stations) with negative values -25 to -29 standing for trains starting on the Kicking Horse station in reverse direction. Trains that should not be modeled should have their train_setup set to 0. The inputs track_speeds and points should then be set according to the desired movement of the trains. Testing a program with the environment first is safer, as errors and collisions are easily visible when viewing the error outputs or the visualization. Besides, it is far less costly when something badly programmed interacts with the modeled railway.

To get the environment executed in sync with the controller from this project, the file 
EnvCont.kisim or EnvCont_Linux.kisim has to be launched inside KIELER after both the environment and controller project have been imported and built successfully.


  • No labels