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

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

We compose our railway controller from several train controllers, combined with controllers for mutual exclusion.

Mutual Exclusion

Normal segments

For each block we generate one mutex controller, similar to the following pattern.

For each controlled train one state and the corresponding transitions are added.

For a free track the *_perm variable is set to -1 and all tracks, apart from starting positions, are initialised with -1. For the starting positions the *_perm variables are set to the corresponding train number and the *_req variable for the train is set to true.

A train must not enter a segment or alter the settings of a segment without holding the lock for the segment. No exceptions from this rule are allowed.

Kicking Horse Pass

To prevent collisions on the track, a special controller manages the rights to enter or leave the Kicking Horse Pass.

The controller splits the pass into two parts, left and right, corresponding to the track layout chart. (Simplified track layout)

Each part has two operational modes, in and out, being active when trains are allowed to either enter or leave the pass. When entering the pass the controller counts the entering trains and only lets two trains enter (one after the other). When leaving the pass the trains are removed from the counter, making space for the next train.

Train controller

Each train controller is set in a separate region with a referenced state. This state has the following interface

    input int *_perm;         # All permission variables (Tracks)
input bool *_perm # KH permission variables
  input int trainNum;
    input bool cleanup;
input bool debug;
output bool *_req[]; # All request variables

The train controller is composed of several Station-2-Station controllers. These are combined to form a complete schedule. Additionally the cleanup signal has to be watched to abort the schedule and return back to the initial position.

Station-2-Station controller

Each station-2-station controller realizes the movement from one of the stations (IC,OC,KH) to a second station. All controllers using IC or OC parts have to respect the traveling directions. For the Kicking Horse Pass two separate controllers, forwards and backwards, are used.

The controllers starting from Kicking Horse Pass Station make an assumption of the direction the train is standing. These are dependent of the directions of the inner or outer circle, e.g. the KHIC controller starts backwards because this is the only valid direction to travel this path. To drive a train from the Kicking Horse Station (facing forward) to the Inner Circle we have to combine the KHOC and OCIC controllers.

  • No labels