ModSlaveSim help v3.04 - 4.3.5. Room heater - PI controller

Download manual: HTML

4.3.5. Room heater - PI controller

4.3.5.1. Introduction and Guide

This example is similar to the Room Heater - proportional controller, but uses a PI controller (using the velocity algorithm template) to remove the residual error. (The environment is identical and is explained in the first simulation.)

GUIDE:

(To load this simulation select the file Room heater PI controller from File->Simulation Examples....)

When ready to start press Run Slave Simulation. Press it again to stop or pause the simulation.

Notice, when you run the simulation, that the heater output has already stabilized and the room temperature has also stabilized, but this time at the desired temperature (Temp Set Point) of 20 (unlike the proportional controller, which can only get close to the desired temperature).

Now try changing either the outside temperature to -5, or the desired temperature to 30. The room temperature reaches the desired temperature, but overshoots and oscillates around the desired temperature before eventually becoming steady again.

For further guidelines see Running Example Simulations

The program listing and explanatory notes for the simulation follow. Before looking at them, please read the short sections Introduction to programming simulations and Language: Quick Start Guide

4.3.5.2. Slave 1: room heater PI controller

The table below shows the simple program underlying the simulation.

Table 6. Slave 1: heater controller
Register Address Register Name Statement Notes
$0 Heater Output
if $$ + $3 < 0 then 0 else if $$ +
$3 > 1.0 then 1.0 else $$ + $3 
CO
$1 Temp Set Point   SP
$2 PrevError $1 - $41 PrevError
$3 Heater OP Increment
0.3 * (($1 - $41) - $2 +
0.1 * CycleTime * ($1 - $41))
CO Increment
$40 OutsideTemp    
$41 RoomTemp
$$ + (3000 * $0 + 105 * 
($40 - $$ )) * CycleTime / 15000
 

Notes

  • Heater OP. As in the previous simulation the upper and lower limits are implicit here as constants 0 and 1 - there is no separate register for 'CO Min' or 'CO Max' as in the template program for the PI controller (using the velocity algorithm).

  • Heater OP Increment. The constant 0.4 in the statement is the controller gain Kc, and the constant 0.1 is the integrating constant Ki (see technique PI controller using the velocity algorithm).

  • OutsideTemp, RoomTemp See on-off controller example for an explanation.

The correspondence between register names and names in the techniques section is contained in the Notes column.