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

Day 86 of 365 · Beginner · Month 3: First systems

Safe on failure

Define the safe direction for every device, keep NaN in mind on every line and go into a known state after a restart.

Lesson 15 min Week 13

What you learn today

  • Define the safe direction per device
  • Catch NaN everywhere
  • State after a restart

A sensor gets hit by a meteorite, a cable is cut, someone removes the wrong display. Something always fails. The only question is what your setup does then.

The safe direction per device

For every device your chip switches you decide beforehand: what is the safe state when the chip no longer knows anything?

Devicesafe on failurewhy
heateroffbetter cold than overheated
door to a dangerous areaclosed and lockedno unwanted loss of pressure
pump into a tankoffno overpressure
outdoor lightona dark path is more dangerous than a few watts
warning lampona failure itself is worth a message

There is no general rule like “everything off on failure”. An alarm that switches off on a failure is useless.

Catch NaN everywhere

Every value you read with Average can become NaN. One property helps here: every comparison with NaN is false. If you phrase a condition so that “true” is the unsafe direction, NaN lands in the safe state by itself:

slt heat temp LOWER      # NaN: 0 = heater off, safe
slt warn temp COLD       # NaN: 0 = no warning, wrong

The second line tips into the wrong direction on a failure. There you need an explicit snan:

snan missing temp
or warn warn missing     # no sensor: warning on

Go through every line that uses a reading and ask: what happens here with NaN?

State after a restart

In the game the chip keeps its registers when you upload new code or re-insert it. Only sp and the program line start at 0 again. So a state register can be sitting in the middle of an old step. That is why a block before the start label belongs in every script, bringing everything into a known state:

move step 0          # sequence idle
move heat 0          # heater off
start:
yield
Warning

The simulator on this site starts every test with zeros. A missing move before the start label therefore does not show here, but it certainly does in the game.

Tip

Test every control with a removed sensor. In the academy exercises this test is usually called “sensor fails”.

Exercise

Task

The workshop chip works in normal operation but is not safe on failure. Make it safe:

  • heater “Werkstattheizung”: hysteresis 18 to 20 °C, off on failure (already right)
  • flashing light “Werkstattwarnung”: on below 10 °C and on sensor failure
  • door “Werkstatttuer”: Lock = 1 below 80 kPa and on sensor failure

The gas sensor is called “Werkstatt”.

Hints

Hint 1

One snan missing temp right after reading covers both cases.

Hint 2

Warning: or warn warn missing.

Hint 3

Door: or lock lock missing.

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