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

Day 170 of 365 · Advanced · Month 6: Atmosphere and control

Inside and outside pressure

One sensor in the chamber, one outside: the outer door may only open once both read almost the same pressure. All limits sit as defines at the top.

Lesson 15 min Week 25

What you learn today

  • Measure chamber and outside pressure
  • Equalisation
  • Limits as defines

The airlock from the Moon comes along to Mars. On the Moon there is vacuum outside, so “below 1 kPa” means: chamber and outside are equal. On Mars there is a thin atmosphere outside. If you pump the chamber lower than the outside air, Martian air rushes in when the door opens, and you have wasted power and time. If it is still fuller, chamber air whistles out. So the airlock has to know how much pressure there is outside.

Two sensors

A gas sensor in the chamber measures the chamber pressure, a second one outside in front of the outer door the outside pressure. Both sit on the airlock's data network:

lbn chamber SENSOR HASH("Schleuse") Pressure Average
lbn outside SENSOR HASH("Aussen") Pressure Average

Both sensors have the same prefab hash; only the name tells them apart. With lb and no name you would get the average of chamber and outside air – a number that was measured nowhere.

Equalisation

The outer door may open when chamber and outside air are almost equal. “Almost equal” means: the difference is smaller than a tolerance.

sub diff chamber outside
abs diff diff            # magnitude: direction does not matter
slt free diff TOL        # 1 = equalised

On the Moon (0 kPa outside) and with a tolerance of 1 kPa this is exactly the rule “chamber below 1 kPa”.

The active vent can do the equalising itself. PressureExternal is its target pressure: in mode Vent.Inward it sucks until the room in front of it reaches that pressure, in mode Vent.Outward it blows until then. Give it the outside pressure as a target and it stops at the right value by itself. You write Mode only once and the target pressure inside the loop: every Mode change resets the pressures after the tick (day 51).

sbn VENT HASH("Schleuse") Mode Vent.Inward         # once, before the loop
start:
yield
sbn VENT HASH("Schleuse") PressureExternal outside # every tick
Note

For the vent, “external” means the room side – here the chamber – not the outside world of the planet. Never write NaN into it: if the outside sensor is missing, outside is NaN. Check with snanz first and leave the vent off in that case.

Warning

Without abs every negative difference would count as “small”. Chamber 0.2 kPa, outside 8 kPa gives −7.8 – and −7.8 is smaller than 2. The outer door would open against the pressure and outside air would shoot into the chamber.

Limits as defines

All limits belong at the top, each with a comment:

define FULL 100 # kPa: chamber full, inner door may open
define TOL 2 # kPa: allowed difference to the outside air
define FAULT -1 # display without sensor

If you move the base or the chamber is too slow for you, you change one line instead of five places in the code. And anyone reading the code sees at once what TOL means – with a bare 2 in the middle of the body they do not.

Exercise

Task

Two gas sensors measure the pressure: “Schleuse” in the chamber, “Aussen” in front of the outer door. Two wall lights show which door would be allowed to open, an LED display shows the difference.

  • “Differenz” shows the magnitude of chamber − outside in kPa.
  • “AussenFrei” lights up when the difference is smaller than TOL (2 kPa).
  • “InnenFrei” lights up when the chamber has at least FULL (100 kPa).
  • If the outside sensor is missing, “AussenFrei” is off; if the chamber sensor is missing, both are off. “Differenz” then shows −1.

Use the defines – no bare 100 or 2 in the body.

Hints

Hint 1

Difference: sub diff chamber outside, then abs diff diff.

Hint 2

Outside free: slt free diff TOL. Inside free: sge free chamber FULL.

Hint 3

Comparisons with NaN give 0 – the lights go off by themselves on a failure. Only the display needs snan and select.

Quiz

5 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