Show last authors
1 == Railway Interface ==
2
3 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
4 [[/code/hostcode/controller.c>>url:https://git.rtsys.informatik.uni-kiel.de/projects/PRAK/repos/14ss-railway/browse/code/hostcode/controller.c||shape="rect"]] and [[/code/hostcode/controller.h>>url:https://git.rtsys.informatik.uni-kiel.de/projects/PRAK/repos/14ss-railway/browse/code/hostcode/controller.h||shape="rect"]].
5
6 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//.
7
8 Additionally the interface handles the repeated reading of the reed contacts an persists these values for one tick to prevent side effects.
9
10 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>>url:https://git.rtsys.informatik.uni-kiel.de/projects/PRAK/repos/14ss-railway/browse/code/hostcode/train_preferences.h||shape="rect"]]
11
12 == Interaction ==
13
14 === Quit, Pause and Cleanup ===
15
16 While running the following user inputs are provided by the controller:
17
18 * **CTRL+C** (SIGINT)** **quits the controller
19 * **CTRL+\** (SIGQUIT)** **cleans up
20 * **CTRL+Z **(SIGSTP) pauses and continues
21
22 == Controller building / Make Script ==
23
24 The build process for the controller consists of two main tasks:
25
26 === Compilation from SCChart to C-Code ===
27
28 The SCCharts for the Controller are compiled by KIELER. This can either be done in the usual GUI Version or with the [[doc:KIELER.KIELER Compiler Console]].
29
30 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.
31
32 The generated C-Files should be stored in the ///code/// part of the local working copy but commited to the repository.
33
34 === Compilation from C-Code to executable ===
35
36 To generate the final executable a python script is provided. This can be found at [[/code/make.py>>url:https://git.rtsys.informatik.uni-kiel.de/projects/PRAK/repos/14ss-railway/browse/code/make.py||shape="rect"]].
37
38 Calling the script with the first parameter **rail** and the path to the C-Code compiles the controller for the real railway installation.
39
40 {{code language="bash"}}
41 python make.py rail railway/Tests/TestAll.c
42 {{/code}}
43
44 With the parameter **sim** instead of rail the simulation is built.
45
46 {{code language="bash"}}
47 python make.py sim railway/Tests/TestAll.c
48 {{/code}}
49
50 The generated executables are located in the /code/build/ directory. These files should normally not be commited to the repository.
51
52 With the second parameter **run** the code is executed after finishing the compilation.
53
54 {{code language="bash" collapse="true"}}
55 python make.py sim run railway/Tests/TestAll.c
56 {{/code}}