Controller - Usage Hardware Controller 

Page / - last modified by stu115775 on 2025/01/30 12:17 

Usage Hardware Controller 
last modified by stu115775
on 2025/01/30 12:17

Table of Contents
1st Step
2nd Step
3rd Step
Options and Commands:
Commandline options (order matters):
Commands:

1st Step
Import and build Controller_SCTx in KIELER.
2nd Step
Run run_manual.sh in code/girlsday
In the simulation this command also loads the train configuration and starts the controller with those positions.
Note: this uses any Controller.c file it finds in code/Controller_SCTx/ as tick file and accesses files in code/interface/
3rd Step
Run RailController in code/girlsday
Options and Commands:
Notes:
•	Train 10 has special ICE-handling, so the ICE should always be assigned to this number, other Trains with this number stop for a while before parking.
•	The home position of each train is hardcoded into the Controller
•	The Controller tries to connect to a WebProvider on localhost:8089
•	The Clear-Mode by the WebProvider overrides any destination in each tick and can currently not be disabled by the console
•	The JSON kivis file is in the current execution folder: 'json_output.simin'
•	The Controller uses ANSI-Escape sequences to color the output and overwrite recived contact messages.
•	The entered characteres are most likely not all visible since there may be quite some output while typing, so these commands are typed blind in this case
Commandline options (order matters):
RailController [+] [s<fast_speed> [s<slow_speed>]] [<train1_pos> [<train2_pos> [...] | DEFAULT] | DEFAULT]

+	if present then there will be no startup hardware check which turns on the lamps and
switches each point twice and cycles thrue signal colors with some delay	
fast_speed	pre-sets the global driving speed for the trains. Default: 70	
slow_speed	pre-sets the global parking speed for the trains. Default: 59	
trainX_pos	sets the position of the train X, caseinsensitive, prefixed with '-' for reversed on bidirectional tracks,
valid only for segments (not for ex.: IC_JCT_0)
examples: KH_ST_2, K2, 26, -KH_LN_3, IC_ST_3, I3, 10, OC_LN_4	
DEFAULT	fills the remaining positions with the home Positons of each train	

Valid track identifier are the Track names (IC_ST_2, OC_LN_4), their numbers (9, 38) and for stations the short versions (I1, I2, I3, O1, O2, O3, K1, K2, K3, K4, K5).
If reverse is a possible information then a preceeding '-' signals this. All Track inputs should be case insensitive.
The Program will ask for positions if there aren't enough positions provided. Invalid Positions count as "Not placed on the Track"
Commands:
There is a handful of debug and settings commands, each has to be submitted with enter, commands with spaces in them need exactly one space between their words.
<train_num> <target>	sets the target of a train	
sc | schedule	print requested locks for each train	
c	set destination of each train to their starting position	
reset trains	set destinbation of each train to their home position	
toggle bell	toggles the crossings-gate-bell On and Off	
toggle lamp <range>	toggles selected lamps On and Off	
enable lamp <range>	turns selected lamps On	
disable lamp <range>	turns selected löamps Off	
print tick	toggles the output of the current tick number each tick On and Off	
r	toggles randommode	
x	reconnects to the hardware	
t	prints positions of each train	
s | speeds	prints the speeds for each track	
st | " "	(second option is only a space)  toggles stop mode, which sets all hardware speeds to 0	
pt <point_num>	toggles a Point, only works when the point isn't locked	
ts	prints the 4 speeds of each train (2nd and 4th number are the used slow and fast speeds)	
setspeed [t<train_num>] <fast_speed> [slowspeed]	sets the global or train specific speeds	
reach_t <track>	(DEBUG)sends a reached signal from this track	
reach <train_num>	(DEBUG) sends a reached signal for given train	
sim [s|e]<track>	(DEBUG) simulates the contacts on a track. s: only the first contact, e: only the second contact (no space after s or e)	
dest	prints entered destination for each train	
time	prints maximum and average time for different loop parts (stdin, input, tick, output), partition may not be fully accurate	
trains	prints for each track the train ontop	
move [on|off]	toggles or sets moveing mode, which sends some trains to two toggeling destinations, with some time waiting in a station	
move_time <time>	sets waiting time in stations for moveing mode in ms (1000 = 1s)	
clear	sets each destination to 0 (= IC_JCT_0 => Invalid, no Destination)	
deb	currently has no effect, may be used for requested debug output	
block <train_num>	toggles the 'dont_force_destination' input for the train. If enabled, this train would not start moveing to make space for another train	
webprovider debug	toggles webprovider communication debug outputs	
json output	toggles the creation of a '.simin' JSON file for kivis every 2s	

Examples for ranges:
3
3-7
2-9,11,13-19