# Zone Heater Algorithm

Created: 13 Jan 1997 - DW
Updated: 19 Dec 2003 - DW
The LASCO zone heaters are controlled by the Instrument Controller Executive (ICE) software. The heaters are regulated by a Proportional-Integrator-Derivative (PID) algorithm. The PID algorithm produces a number of ticks out of the duty cycle that the heater is on during each duty cycle. The same code is used for all of the LASCO/EIT zone heaters.

At present the duty cycle is 64 seconds and each tick is 1/4 second, so that there are 256 ticks to each duty cycle. This corrects an error in the original heater algorithm which produced results similiar to your home thermostat; if the temperature was low, the heater would turn on until the temperature was at or above the desired reading with a 128 second samplng period.

The PID algorithm produces a number between 0 and 255 by adding three terms together. If the sum is greater than 255, the PID is set to 255. The three terms are:

Proportional term = P * (delta DN)

Integral term = I * (delta DN) + Iprev

Derivative term = D * (delta DN) - (previous derivative term)

where

P = proportional constant (uploadable from the ground)

I = integral constant (uploadable from the ground)

D = derivative constant (uploadable from the ground)

(thermistor reads from 0 - 255 where 0 = high temperature)

Iprev is the value of the Integral term during the last duty cycle.

## Examples:

Example 1:

For a delta DN = 1 (too cold), if P = 32 I = 0 and Iprev = 0 then PID = 32 ticks => 8 secs

Example 2:

For a delta DN = 1 (too cold), if P = 64 I = 0 and Iprev = 0 then PID = 64 ticks => 16 secs

Example 3:

For a delta DN = 1 if P=0, I=32, Iprev = 0 and D=0 then PID = 32 => 8 seconds If in the next cycle the delta DN is still one then PID will add 32 to the previous value and PID = 64 ticks => 16 seconds.

Example 4:

For a delta DN = -1 (too hot) P=5 I=2 D=0 then PID = -5 - 2 + Iprev. If Iprev is a large negative number (perhaps due to the zone being warmer than the setpoint during a bakeout) the heater will not turn on until PID is a positive number even if the zone gets too cold (DN > 0). This may take many heater cycles if the zone has been too hot for a long time. There is no way to reset Iprev except by rebooting ICE.

Users should consider setting the integral term to 0 or perhaps 1 to prevent Iprev from building up during a bakeout. Reset the integral term after bakeout.

## Notes:

1. Heaters and motors cannot be ON at the same time, so if a motor is moved during a heater ON part of the cycle, the heater will turn off while the motor is being moved and then turn on again for the remaining time left in the cycle. A request to read_position of a mechanism behaves in the same way as a motion in that the heaters are disabled during the read.

Example: The heater is to turn on for 30 seconds, but a motor is moved during the 9th and 10th seconds. The heater will be on for 8 seconds, the motor is moved for two seconds and then the heater will be on for the next 22 seconds.

2. If a motor is being moved or a read position is done at a time when the thermister is supposed to be sampled, the thermister is not sampled and the heater will be off. This means that heater cycles may be missed due to motor movements. Since the typical motor move takes only a few seconds, chances are that the next heater cycles will occur on time. In theory you could have a cadence of motor movements that matched the heater duty cycle and would always prevent the heaters from coming on. This has never been observed to happen.

Example: The thermistor is sampled at a 64 second cadence. But at t=64 seconds a motor is being moved so it is not sampled. The thermistor will next be sampled at t=128 seconds. 3. A status request to ICE for a mechanism does NOT change the heater cycle. The status request returns the table entry from the last move. A read position command however will disable the heaters for the time need to read the encoders.

Naval Research Lab - Code 7660 - DW