What you learn today
- Heater and cooler never at the same time
- Dead band between the bands
- One central target
On Mars it is freezing in the morning and too warm in the greenhouse at noon. A room then needs heating and cooling. If both run at the same time, they work against each other and eat power without anything changing. A dead band prevents that.
Four limits, one target
| Limit | value at target 21 °C | meaning |
|---|---|---|
| heater on | 19 °C | heat below this |
| heater off | 20 °C | stop heating from here |
| cooler off | 22 °C | stop cooling from here |
| cooler on | 23 °C | cool above this |
Between 20 and 22 °C lies the dead band: neither device switches on there. Whoever switches the heater on never gets near the cooling limit and vice versa.
Setting it centrally
Four separate defines quickly become inconsistent – whoever changes the target forgets a limit. Better: one target, two offsets, and the limits are computed once before the main loop. A define cannot compute with another define, so they end up in registers:
define TARGET 294.15 # 21 C
define BAND 1 # K: half the dead band
define HYST 1 # K: hysteresis per side
alias heatOff r4
alias heatOn r5
alias coolOff r6
alias coolOn r7
sub heatOff TARGET BAND # 20 C
sub heatOn heatOff HYST # 19 C
add coolOff TARGET BAND # 22 C
add coolOn coolOff HYST # 23 C
Now a single number moves everything: define TARGET 296.15 turns a 21 °C room into a 23 °C one.
Two hystereses
The heater gets the pattern with slt, the cooler the one with sgt:
slt tmp temp heatOff
and heat heat tmp
slt tmp temp heatOn
or heat heat tmp
sgt tmp temp coolOff
and cool cool tmp
sgt tmp temp coolOn
or cool cool tmp
The interlock
With properly ordered limits the two never run together. Still, a second safeguard belongs in there – for the day someone sets BAND to −3:
seqz tmp heat
and cool cool tmp # cooler only while the heater is off
The interlock gives the heater priority. For every pair, think about which device should win. In a greenhouse with sensitive plants that may well be the cooler.
If the sensor fails, all four comparisons are false: heater and cooler switch off. Here that is the safe direction.
Diagram
Exercise
Task
Heating and cooling with a dead band. On the network: gas sensor “Raum”, wall heater “Heizung”, wall cooler “Kuehler”.
- Target 21 °C as the only temperature define, compute the limits from it before the loop: heater on below 19 °C, off from 20 °C; cooler on above 23 °C, off from 22 °C downwards.
- Heater and cooler never run at the same time (interlock).
- Sensor gone: both off.
Hints
Hint 1
Before start: compute the four limits with sub and add from TARGET, BAND and HYST.
Hint 2
Heater with slt, cooler with sgt – one and/or pair each.
Hint 3
Interlock: seqz tmp heat, then and cool cool tmp.
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