What you learn today
- Green, yellow, red from two limits
- select cascade
- Colours on displays and lights
Whoever walks past the hall does not want to read 87.3 kPa and think about it. Green means “all good”, yellow “take a look”, red “act now”. One reading and two limits become a traffic light.
Two limits, three colours
For the hall pressure:
| Pressure | Colour |
|---|---|
| from 90 kPa | green |
| 70 to below 90 kPa | yellow |
| below 70 kPa | red |
The select cascade
Start with the most harmless colour and let every worse condition overwrite it:
move colour Color.Green
slt tmp press YELLOW
select colour tmp Color.Yellow colour
slt tmp press RED
select colour tmp Color.Red colour
The order matters: whatever comes later wins. Below 70 kPa “below 90” is true as well – first yellow, then red, and red stays. The other way round, yellow would overwrite the red again.
Failure belongs in there
A sensor that delivers nothing is a fault. So NaN gets a colour too – the worst one:
snan tmp press
select colour tmp Color.Red colour
select press tmp 0 press # display shows 0 instead of NaN
Where does the colour go?
- LED displays have the LogicType
Color. Number and colour on one device. - The small LED (
StructureDiode) hasColortoo – a pure signal light. - Wall lights and flashing lights have no
Color. You give them their colour with the spray can. For a traffic light made of lamps you paint three lamps and switch on the right one:
seq tmp colour Color.Red
sbn LIGHT HASH("Rotlicht") On tmp
Keep the colours the same across the whole base: green for fine, yellow for warning, red for danger, blue for “heating”. Then anyone reading an unfamiliar display understands it right away.
Diagram
Exercise
Task
A pressure traffic light for the hall. On the network: gas sensor “Halle”, LED display “Hallendruck”, LED “Ampel”, red-painted wall light “Rotlicht”.
- Green from 90 kPa, yellow below, red below 70 kPa – on display and LED.
- The display shows the pressure.
- The red light is on exactly when it is red.
- Sensor gone: red, display 0.
Hints
Hint 1
First move colour Color.Green, then slt and select twice.
Hint 2
Check NaN last so it overwrites yellow and green.
Hint 3
Red light: seq tmp colour Color.Red.
Quiz
4 questions. You pass from 60 % – the server does the grading.
Complete the day
- Passed the simulator exercise
- Passed the quiz with at least 60 %
Without an account progress is saved in this browser only.
Report a mistake in this lesson
Please sign in to report. Sign in