stationeers.de Mod workshop · Dominik1199
DE Sign in
  1. Home
  2. IC10 academy
  3. Day 46

Day 46 of 365 · Beginner · Month 2: Order and data network

Traffic-light colours for readings

Green, yellow, red from two limits: a select cascade from the harmless case to the worst – on displays, on an LED and with painted lights.

Lesson 11 min Week 7

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:

PressureColour
from 90 kPagreen
70 to below 90 kPayellow
below 70 kPared

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) has Color too – 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
Tip

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

Comparison and select as a switch temp = 313 sgt r1 temp 303 r1 = 1 select Color.Red Color.Green 4 if r1 ≠ 0 if r1 = 0
Each select checks one condition and only overwrites the colour if it applies.

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

Esc
↑ ↓ selectEnter open/ opens search anywhere