X-300 Script Simulator unofficial

5. Timers

Boilers and furnaces don't like being switched on again seconds after they've switched off. A minimum off time protects them. The X-300 has six countdown timers that make this easy.

' Short-cycle protection: once the heat goes off it stays off for at least
' 5 minutes. Timers count down in tenths of a second, so 3000 = 5 minutes.
' extvar0 = setpoint, extvar1 = swing.
do
  let c = temp1
  let b = extvar0 - extvar1
  if relay1 = 0 then
    if c < b then
      if t0 = 0 then
        let relay1 = 1
      end if
    end if
  else
    if c > extvar0 then
      let relay1 = 0
      let t0 = 3000
    end if
  end if
loop
end

Run it in the playground →

How timers work

The timers are t0 to t5. You set one to a number and it immediately starts counting down by one every tenth of a second, stopping at 0. So:

value time
10 1 second
600 1 minute
3000 5 minutes
36000 1 hour

A timer is just a number you can read, so "has 5 minutes passed?" becomes "is t0 back at 0?".

The pattern

  1. When the heat goes off, start the timer: let t0 = 3000.
  2. Before turning it on, also require t0 = 0.

Nothing else changes. When the timer is still running, the script simply doesn't turn the heat on yet; a later pass through the loop will, once the timer reaches 0.

Other uses

Try it

  1. Run at 1 min/s with the outside at 5°. With a tiny swing (0.2) the room would cycle quickly; the log shows the heat never coming back on within 5 minutes of going off.
  2. Change 3000 to 6000 (10 minutes), press Check & run, and watch the off periods on the chart get longer.