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

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

Project: room monitor

Project: watch three rooms at once, show the lowest pressure, raise an alarm and report failed sensors without letting them distort the result.

Project 30 min Week 6

What you learn today

  • Monitor three rooms at once
  • Show the worst value
  • Report sensor failure

Lab, storage, living area – when the pressure drops in one room, you want to know right away. The average does not help: if one room sinks to 40 kPa, the mean of the three is still 80. What matters is the worst value.

The setup

DeviceNameJob
3 gas sensors“Labor”, “Lager”, “Wohnen”pressure per room
LED display“Mindestdruck”lowest pressure of the three
LED display“Ausfall”number of failed sensors
flashing light“Druckalarm”on below 80 kPa
flashing light“Sensorfehler”on when a sensor is missing

The problem with NaN and min

If you read the three pressures separately and take min, one failed sensor ruins everything: min with NaN gives NaN. The fix: replace every NaN with plus infinity first. Infinity is never the minimum, so the room simply drops out of the calculation.

snan failed p1
select p1 failed pinf p1     # missing: pinf instead of NaN
snan tmp p2
add failed failed tmp        # count failures
select p2 tmp pinf p2

If all three fail, the minimum itself is pinf. Then the display shows 0 – and 0 is below 80 kPa, so the pressure alarm goes on. That is the safe direction: whoever knows nothing warns.

seq tmp low pinf
select low tmp 0 low

Milestones

  1. The display “Mindestdruck” shows the lowest pressure of the three rooms.
  2. Below 80 kPa the pressure alarm goes on.
  3. A failed sensor is reported: “Ausfall” counts it, “Sensorfehler” flashes.
  4. A failed sensor does not distort the minimum.
  5. If all sensors fail, “Mindestdruck” shows 0 and the pressure alarm is on.
Tip

pinf and ninf are the natural starting values for minimum and maximum searches. Starting with 0 always gives 0 as the minimum.

Note

Why not just lbn with Minimum over all three? Because the sensors have different names – and because Minimum returns 0 instead of NaN without a match. A failure would then look like a vacuum.

Diagram

Three readings, five batch modes Sensor “Raum” 300 K Sensor “Raum” 310 K Sensor “Raum” 250 K lbn Average 286.67 Sum 860 Minimum 250 Maximum 310 Count 3 Sum on temperatures: 860 K – the heater thinks there is a fire.
Three readings, one result: here the worst value counts, not the average.

Project task

Task

Build the room monitor from the lesson:

  • Read the pressures of the sensors “Labor”, “Lager”, “Wohnen” separately.
  • “Mindestdruck” shows the lowest pressure; failed sensors do not count; if all are missing, it shows 0.
  • “Druckalarm” on below 80 kPa.
  • “Ausfall” shows the number of missing sensors, “Sensorfehler” flashes as soon as one is missing.

Milestones

  1. Milestone 1: lowest pressure on the display
  2. Milestone 2: pressure alarm below 80 kPa
  3. Milestone 3: failed sensor is reported
  4. Milestone 4: failure does not distort the minimum
  5. Milestone 5: all sensors gone – 0 and alarm

Hints

Hint 1

Three lbn with Average, one per room.

Hint 2

Per pressure: snan, count the failure, select … pinf ….

Hint 3

At the end min twice, then replace pinf with 0.

Quiz

2 questions. You pass from 60 % – the server does the grading.

Complete the day

  • Passed all milestones of the project
  • 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