We are currently experiencing issues with email delivery; this is being resolved as quickly as possible.

stationeers.de Mod workshop · Dominik1199
DE Sign in
  1. Home
  2. IC10 academy
  3. Hysteresis: heating without flicker

Chapter 5 · Control

Hysteresis: heating without flicker

One threshold is not enough. With two limits and a memory the heater runs calmly.

Lesson 12 of 18 12 min

The naive controller says “on below 20 °C, otherwise off”. In practice the temperature wobbles around 20 °C and the heater switches on and off every tick. That is annoying, and some devices wear out or eat start-up power.

Two limits

A hysteresis uses two thresholds:

  • below the lower limit: switch on
  • above the upper limit: switch off
  • in between: leave it as it is

For “leave it” the chip needs a memory – the register holding the current state.

The and/or pattern

alias temp r0
alias heat r1
alias tmp r2
# ...
slt tmp temp UPPER    # still below the upper limit?
and heat heat tmp     # if not: off. Otherwise keep the state
slt tmp temp LOWER    # below the lower limit?
or heat heat tmp      # then on in any case
sbn HEATER HASH("Heizung") On heat

Read it as: “The heater stays on as long as it is below UPPER. And it switches on as soon as it is below LOWER.” Four lines, no jump.

Tip

The same pattern works for cooling (with sgt instead of slt), pumps, generators and filters. The templates in the IC10 coder use it everywhere.

Sensor gone?

If the sensor returns NaN, both comparisons are false – heat becomes 0. So the heater switches off. That is the safe direction here: better cold than an overheated room.

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.
Below the lower limit the heater switches on, only at the upper limit off again. In between it keeps its state.

Exercise

Task

Gas sensor “Raum”, wall heater “Heizung” (both on the data network). Build a hysteresis controller:

  • below 19 °C (292.15 K) heater on
  • from 21 °C (294.15 K) heater off
  • in between keep the state
  • if the sensor fails, heater off

Hints

Hint 1

Four lines between lbn and sbn are enough: two slt, one and, one or.

Hint 2

First check whether it is still below UPPER and “and” that with the old state.

Hint 3

Then check whether it is below LOWER and “or” that in.

Esc
↑ ↓ selectEnter open/ opens search anywhere