Tutorial 1 - csp
T1A1
a)
The pace of the controller-system is given by the events in the railway-system and the laws of physics. If there's a calculation running, the controller can't stop the real world until the calculation is finished, rather it has to finish in time e.g. before a train runs over a point switch.
Furthermore the controller-system has to take the continuity of the real world into account. Values read from sensors may be discretized and therefore may not represent the actual state or may slightly differ from each other, even if you might consider two states equal from sense of proportion.
b)
The controlling units are no computers you would find on an office desk. They have no monitor or mouse and keyboard. But especially they are restricted in resources like CPU power or RAM size.
c)
If the controller of the railway-system produces erroneous control-commands or doesn't finish in time, trains may crash. It's therefore important to get the right result in the right moment.
T1A2
First part: KH_ST_1 → IC_ST_1
Point switches to be set:
Point switch | value |
---|---|
4 | STRAIGHT |
3 | STRAIGHT |
2 | STRAIGHT |
1 | BRANCH |
0 | BRANCH |
16 | BRANCH |
17 | BRANCH |
18 | BRANCH |
20 | STRAIGHT |
Tracks:
Block | Direction |
---|---|
KH_ST_1 | REV |
KH_ST_0 | REV |
KIO_LN_0 | REV |
OC_ST_4 | REV |
IC_ST_0 | FWD |
IC_ST_1 | FWD |
Second part: IC_ST_1 → KH_ST_1
Point switches to be set:
Point switch | value |
---|---|
24 | STRAIGHT |
29 | BRANCH |
27 | STRAIGHT |
28 | STRAIGHT |
9 | BRANCH |
8 | STRAIGHT |
Tracks:
Block | Direction |
---|---|
IC_ST_1 | FWD |
IC_ST_4 | FWD |
OC_ST_0 | REV |
KIO_LN_1 | REV |
KH_ST_6 | REV |
KH_ST_1 | REV |
Plan
- Set points and tracks and (busy) wait for a entry contact event on target block.
- Lower speed and wait for the target contact event and brake the train.
- Wait 5 seconds and repeat for the way back.
Implementation
T1A3
Differences from initial expectation
- In opposite to points 16/17, points 27/28 have to be set STRAIGHT to cross the track.
- Numbering of contacts and signals.
- Waiting for only one entry-block-event isn't sufficient. The speed might be lowered before the train's locomotive fully entered the block (backwards travelling train) and raise a speed-mismatch-exception. Although not critical, it may produce unexpected results on the real railway-system.
- Events are buffered and must be "cleared" before waiting on a specific contact event.
Further expected differences
- Trains don't stop immediately.
- Contacts may not be triggered.
- Points may not switch correctly or even block.