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

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

Airlock as a sequence

The airlock as a step sequence from week 20: close, pump, open – and back. An abort button brings everyone back into the base.

Lesson 20 min Week 25

What you learn today

  • Steps close–pump–open
  • Way back
  • Abort

So far the airlock recomputes every tick which door may open. For a trip at the push of a button you want to know more: is the inner door shut yet? Is pumping still going on? Is someone coming in right now? For that you use the step sequence from week 20. The current step sits as a number in a register.

The steps

StepNameInner doorOuter doorVentnext when
0Ready insideopenshutoffbutton “Zyklus” pressed → 1
1Close inner doorshutshutoffinner door reports shut → 2
2Pump downshutshutsuckspressure below 1 kPa → 3
3Ready outsideshutopenoffbutton “Zyklus” pressed → 4
4Close outer doorshutshutoffouter door reports shut → 5
5Fillshutshutblowspressure from 100 kPa → 0

Steps 0 to 2 are the way out, 3 to 5 the way back. After step 5 the sequence starts again at 0.

Transitions

You reach the right section through the comparison chain: beq step 2 pumpDown and so on. Each section only checks its own condition for moving on. If it is met, it counts up by one:

pumpDown:
slt tmp press EMPTY      # 1 = empty
add step step tmp        # then on to 3
j output

A button counts as pressed when Activate is greater than 0. sgtz tmp cycle then returns 1 – and 0 for NaN.

Outputs only from the step

Doors and vent are written by one single section at the end, and it looks only at the step:

output:
seq tmp step 0
sbn DOOR HASH("Innentuer") Open tmp
seq tmp step 3
sbn DOOR HASH("Aussentuer") Open tmp

That rules out mixed states: the inner door is open exactly in step 0, the outer door exactly in step 3 – never both. The vent runs in steps 2 and 5; Mode is 1 (Vent.Inward) in step 2, otherwise 0.

Abort

Someone standing in the chamber who changes their mind presses “Abbruch”. In steps 1 and 2 the sequence then jumps to step 5: fill the chamber again, inner door open. Here abort always means: back into the base. In the other steps the button does nothing – so it cannot flip back and forth while someone holds it down.

Warning

Write every transition so that it only moves on when the condition is clearly met. slt tmp press EMPTY is 0 for NaN – the sequence stays where it is. A bge press EMPTY wait, on the other hand, does not jump for NaN, falls through and moves on: the outer door would open without a sensor.

Tip

Show the step on an LED display. If the airlock hangs, you see at once where. With a counter from week 20 you can also detect pumping that makes no progress.

Note

One exception to “all outputs every tick”: the chip writes the vent's Mode only when it changes. Every write resets its target pressures (day 51). That is why it reads the current Mode and jumps over the sbn when they are equal.

Exercise

Task

The airlock runs as a step sequence with steps 0–5 from the table. Inputs and outputs are already in the starter code – the transitions (section 2) are missing.

  • 0 → 1 and 3 → 4 when the button “Zyklus” is pressed.
  • 1 → 2 when the inner door reports Open 0; 4 → 5 when the outer door reports Open 0.
  • 2 → 3 below EMPTY (1 kPa), 5 → 0 from FULL (100 kPa).
  • Button “Abbruch” in step 1 or 2: continue with step 5.
  • No transition may move on when the sensor is missing.

The output section already switches the vent off when the sensor is missing.

Hints

Hint 1

Comparison chain: beq step 0 readyIn, beq step 1 closeIn … and at the end j fill for step 5.

Hint 2

Button pressed: sgtz tmp cycle, then add step step tmp. For NaN the sequence stays put.

Hint 3

Door shut: lbn door DOOR HASH("Innentuer") Open Average, seqz tmp door, then count up.

Hint 4

Abort: bgtz abort back in steps 1 and 2; at back: there is move step 5.

Hint 5

Fill: sge tmp press FULL, then select step tmp 0 step – after that the code runs on into output:.

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