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

Day 131 of 365 · Advanced · Month 5: Memory and structure

Conditional calls: tolerance and devices

bapal, bnaal, bapzal, bnazal, bdseal and bdnsal call on tolerance or device conditions. There is no brXXal with a relative target.

Lesson 14 min Week 19

What you learn today

  • Bapal, bnaal, bapzal, bnazal, bdseal, bdnsal
  • There is no brXXal

The rest of the al family combines two things you already know: approximate comparisons from week 16 and device checks from week 15. On top of that there is a gap you have to know about.

Tolerance and devices

Instructioncalls if
bapal a b c targeta approximately equal to b (tolerance c relative)
bnaal a b c targeta clearly different from b
bapzal a c targeta practically exactly 0
bnazal a c targeta not practically exactly 0
bdseal device targetsomething hangs on the device
bdnsal device targetnothing hangs on the device
bdnsal probe noprobe               # fallback mode if the probe is missing
bapal temp TARGET TOL reached      # target temperature reached
bnaal temp TARGET TOL adjust       # clearly off

For the tolerance everything from week 16 applies: c is relative to the larger magnitude, and with bapzal and bnazal practically only the tiny fixed limit takes effect.

There is no brXXal

The relative branches from week 16 have no al form. breqal, brltal or a jral do not exist. The chip reports UnrecognisedInstruction when saving. Calling conditionally only works with an absolute target, that is with a label. And the only unconditional call is jal.

Safe on every path

A device that is missing cannot be read. That is why a jump that skips the reading comes after the call of the fallback handling:

bdnsal probe noprobe        # set the alarm
bdns probe output           # and do not read
l temp probe Temperature
Warning

With NaN neither bapal nor bnaal calls in the game: NaN is neither approximately equal nor clearly different. Whoever calls “adjust” with bnaal therefore does not adjust at all on sensor failure. Guard the reading beforehand, as above with bdns.

Tip

The device variants bdseal and bdnsal take a pin or a ReferenceId, not a name. For devices on the data network the NaN check remains.

Diagram

Calling and returning from a subroutine Main loop 2 l r0 d0 Temperature 3 jal celsius 4 s d2 Setting r1 5 l r0 d1 Temperature 6 jal celsius 7 s d3 Setting r1 8 j start celsius: sub r1 r0 273.15 j ra ra = 4 back to line ra
The al family only exists with an absolute target. Jumping relatively while setting ra is not possible.

Exercise

Task

A pipe analyzer at the boiler hangs on d0. Target: 80 °C, tolerance 1 % relative. Wall heater “Kessel”, wall light “Kessel Ziel”, flashing light “Kessel Alarm”.

  • If the probe is missing: call the subroutine noprobe with bdnsal (alarm on), heater off, read nothing.
  • Temperature approximately at the target: subroutine reached with bapal (light on).
  • Clearly off: subroutine adjust with bnaal – it heats if it is too cold.
  • Default state before the calls: everything off.

Hints

Hint 1

Everything to 0 first, then bdnsal probe noprobe and bdns probe output.

Hint 2

bapal temp TARGET TOL reached_sub and bnaal temp TARGET TOL adjust.

Hint 3

adjust only needs slt heat temp TARGET and j ra.

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