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

Day 107 of 365 · Advanced · Month 4: Network in detail

Relative against zero

breqz, brnez, brltz, brgtz, brlez, brgez and brnan compare relatively against zero. Build the deviation first, then the sign decides.

Lesson 14 min Week 16

What you learn today

  • Breqz, brnez, brltz, brgtz, brlez, brgez and brnan
  • Skip a line

Yesterday you compared two values relatively. Often one of them is zero: is the deviation negative? Has the counter run out? Is the reading NaN? That is what the z forms are for.

The family against zero

Instructionjumps by n lines if
breqz a na = 0
brnez a na ≠ 0
brltz a na < 0
brgtz a na > 0
brlez a na ≤ 0
brgez a na ≥ 0
brnan a na is NaN

brnan is the relative counterpart of bnan. There is no brnanz and no bnanz.

Skipping one line

The most common pattern: a default value comes first, one line changes it, and the relative branch decides whether that line runs.

sub dev TARGET press      # positive = too little pressure
move mode Vent.Inward     # default: extract
brlez dev 2               # not too little: leave the line out
move mode Vent.Outward    # too little: blow in

With brnan you guard a whole block. The distance then reaches past the block:

move on 0
brnan press 3             # no reading: leave out two lines
sub dev TARGET press
move on 1

Calculate first, then check against zero

The z forms show their strength when you build the deviation beforehand, such as sub dev target actual. After that only the sign decides. It is the same principle as the set instructions against zero from week 4.

Warning

With NaN no comparison jumps, not even brgez or brlez. Only brnan jumps. If the unsafe action sits in the skipped line, that is good. If it sits before it, it runs on NaN.

Tip

Note in the comment of every relative branch where it leads, such as # -> sbn. Whoever changes the code later then sees which distance has to move along.

Note

The chip writes Mode only when it changes: every write, even with the same value, resets the active vent's target pressures to their defaults (day 51). breqz old 2 then skips exactly that one line. The three branches before land on the comment and run into this block from there.

Diagram

Flow with a conditional jump start: yield · l r0 r0 > 303.15? hot: On 1 On 0 yes: bgt jumps no: next line j start
Default first, exception after it: the relative branch decides whether the one line with the exception runs.

Exercise

Task

Gas sensor “Lager” and active vent “Lagerlueftung” (StructureActiveVent). Target: 100 kPa, ±5 kPa without action.

  • below 95 kPa: On 1, Mode Vent.Outward (blow in)
  • above 105 kPa: On 1, Mode Vent.Inward (extract)
  • in between and on sensor failure: On 0

Use only relative branches against zero (breqz … brgez, brnan), no absolute comparison jumps.

Hints

Hint 1

brnan press … jumps on failure to the first sbn line – count the lines exactly.

Hint 2

Deviation: sub dev TARGET press. Whether it exceeds the band: abs, sub … BAND, then brlez.

Hint 3

Direction: brgtz dev 2 skips move mode Vent.Inward when there is too little pressure.

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