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

Day 88 of 365 · Beginner · Month 3: First systems

Patterns of the beginner level

Hysteresis, NaN guard, display and timer: almost every control of the beginner level consists of these four building blocks. Here they are side by side.

Lesson 16 min Week 13

What you learn today

  • Hysteresis, NaN guard, display, timer compared
  • Which pattern when

Three months, many programs. Look closely and almost all of them consist of the same four building blocks. If you know them, you build new controls from parts instead of starting from scratch every time.

The four patterns

Hysteresis: two limits and a memory. For everything that should not flicker: heater, pump, generator.

slt tmp value UPPER
and on on tmp
slt tmp value LOWER
or on on tmp

NaN guard: every Average value can be NaN. Either the wording makes NaN fall into the safe direction by itself, or you catch it explicitly.

snan missing value
or alarm alarm missing

Display: convert values and write them to an LED, Kelvin to Celsius, ratio to percent.

sub c temp CELSIUSOFFSET
sbn DISPLAY HASH("Temp") Setting c

Timer: count ticks instead of sleep. Count up with reset for a delay, charge and count down for a run-on.

add t t 1
mul t t input

Which pattern when?

QuestionPattern
Should something stay calm between two values?hysteresis
Can a device be missing?NaN guard (almost always: yes)
Should a person see the value?display
Does duration matter, such as “only after 5 s” or “for another 10 s”?timer
Should a short event count instead of a state?edge

Most real controls need three or four of them at once. The order in the body is almost always the same: read → guard → decide → shape in time → write.

Warning

Patterns get in each other’s way when they use the same registers. Give each pattern its own registers and list them in the alias block. A tmp shared by two patterns may only be valid across two or three lines.

Tip

The templates in the IC10 coder are exactly these patterns, ready to use. Look at them again with this in mind.

Diagram

Temperature curve with hysteresis 21 °C 19 °C band: state is kept Heater on on off off On at 19 °C, off only at 21 °C – nothing switches in between.
Hysteresis is the building block that shows up most often: two limits, one memory, no flicker.

Exercise

Task

Server room with gas sensor “Serverraum”. Combine all four patterns:

  • hysteresis: wall cooler “Serverkuehler” on above 30 °C, off below 26 °C
  • timer: flashing light “Serverwarnung” on when it is above 35 °C for longer than 3 s (6 ticks)
  • display: LED “Servertemp” shows the temperature in °C
  • NaN guard: without a sensor cool, warn and show −999 on the display

Hints

Hint 1

Cooling is the reversed hysteresis: sgt instead of slt.

Hint 2

Timer: sgt tmp temp HOT, count up, multiply by tmp, compare with DELAY using sge.

Hint 3

Display: convert first, then select c missing NOVALUE c.

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