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 3 Current »

Railway Interface

To interface with the railway or the simulator a wrapper interface around the so called Hoerman-API is used. It can be found in the repository at
/code/hostcode/controller.c and /code/hostcode/controller.h.

The interface provides shorter and simpler access to most of the railway components. To prevent conflicts with existing function names all functions in our interface are prefixed with rail.

Additionally, the interface handles the repeated reading of the reed contacts and persists these values for one tick to prevent side effects.

The interface also provides waiting timers for the stations and generates a random timing for each train and each station. The preferences for this can be found in /code/hostcode/train_preferences.h

Interaction

Quit, Pause and Cleanup

While running the following user inputs are provided by the controller:

  • CTRL+C (SIGINT) quits the controller
  • CTRL+\ (SIGQUIT) cleans up
  • CTRL+Z (SIGSTP) pauses and continues

Controller building / Make Script

The build process for the controller consists of two main tasks:

Compilation from SCChart to C-Code

The SCCharts for the Controller are compiled by KIELER. This can either be done in the usual GUI Version or with the KIELER Command Line Compiler.

Before trying to run the code the compiler output should be checked. The compiler generates C-Code even if the Controller isn't fully schedulable, so be careful when trying new controllers.

The generated C-Files should be stored in the /code/ part of the local working copy but not commited to the repository.

Compilation from C-Code to executable

To generate the final executable a python script is provided. This can be found at /code/make.py. The script takes care of including the required modules and adds the needed headers to the controller.

Calling the script with the first parameter rail and the path to the C-Code compiles the controller for the real railway installation.

python make.py rail railway/Tests/TestAll.c

With the parameter sim instead of rail the simulation is built.

python make.py sim railway/Tests/TestAll.c

The generated executables are located in the /code/build/ directory. These files should normally not be commited to the repository.

With the second parameter run the code is executed after finishing the compilation.

python make.py sim run railway/Tests/TestAll.c
  • No labels