ModMultiSim help v3.06 - 4.3.5. Room heater - PI controller

Download manual: HTML

4.3.5. Room heater - PI controller 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.)


(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 Room heater environment

The table below show the simple program underlying the simulation of the environment, which includes the temperature inside the room and outside of the building.

Table 8. Environment: temperatures

Property Name Statement
$$ + (3000 * $1$0 + 105 *
($OutsideTemp - $$)) * CycleTime / 15000

Notes Slave 1: room heater PI controller

The table below show the simple program underlying the simulation of the slave, in this example, a PI controller, which provides the most sophisticated control of heater output in the simulation examples.

Table 9. 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 
$1 Temp Set Point   SP
$2 PrevError $1 - $RoomTemp PrevError
$3 Heater OP Increment
0.3 * (($1 - $RoomTemp) - $2 +
0.1 * CycleTime * ($1 - $RoomTemp))
CO Increment


  • 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).

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