Virtual Temperature Control
Virtual Temperature Control (VTC) is a powerful learning/teaching tool that demonstrates the major concepts of automatic control systems. This user friendly software is a virtual experiment where the user controls the temperature of a fluid by pressing buttons like being in a lab without worrying about breaking any device. A high school student who is willing to learn about the fun of control engineering, an undergraduate student who wants to strengthen his understanding to the subject of control systems design, and the teacher or professor who likes to explain the concepts of automation to his students can all enjoy the benefits of this interesting software. The user can control the fluid temperature manually or watch the controller do it automatically. The temperature versus time curve is plotted. The parameters of the controller and fluid system can be set by the user. Thus, he/she will understand the effect of changing these parameters on the controller performance. You can try a simpler version of the software at
http://homepage.mac.com/sami_ashhab/courses/control/supplementary/lab/virtual_temperature/exp.html
Using The Software
Requirements:
To run this software you need to have Java J2SE 1.3 or higher installed on your machine. In the case you do not have it installed on your computer, you can download the J2SE from the Suns web site http://java.sun.com
Installation:
Download the VTC software folder and save it in the desired location on your computer. This folder contains all of the files that you need to run the application in addition to the user manual that you are now reading.
Startup:
To start the application go to the VTC folder and click on the run.bat icon (for Windows) or run the command ./run_unix (for Unix). The user interface will pop up and you are ready to enjoy the virtual temperature control software.
Software Layout (Full Version):
Figure 1 shows the software layout that pops up when you start the application. The layout contains four panels: Process, Voltage, Temperature and Buttons. We will now describe each of these panels

Figure 1: Software layout with manual control.
1) Process: This panel contains a sketch of the physical process that we would like to control. The system (or process) consists of a tank that contains fluid. The tank sits on a heater which supplies energy to the fluid. The energy supplied by the heater depends on the input voltage (from the voltage panel) to the heater. There is a gauge for the fluid temperature. Please refer to the theory section of this manual to study the relation between voltage and temperature.
2) Voltage: This is the panel that provides voltage to the process (heater). Manual or automatic options can be selected using the radio buttons at the top of the panel. If the user chooses the manual option as shown in Figure 1, he/she can adjust the voltage using the shown slider (voltage knob) or by typing the voltage value in the text field next to the slider. Note that the manual voltage ranges from 0 to 20 volts. If the user chooses the automatic option as shown in Figure 2, the voltage will be adjusted by an automatic controller, namely, proportional plus integral plus derivative (PID) controller. Note that the different values within the controller are displayed on this panel.
3) Temperature: In this panel the fluid temperature versus time curve is plotted in white color. In addition, the desired temperature that we would like to achieve is plotted in red color. The time axis range is from 0 to 150 seconds, whereas the temperature axis range is from 0 to 150 oC. The current time and temperature values are displayed at the top right corner of the panel.
4) Buttons: This panel is responsible for running the virtual temperature control software. It contains the following items:
- start button: starts the simulation (animation) from time zero.
- pause button: pauses the simulation.
- resume button: resumes the simulation after being paused.
- reset button: resets the system to time zero.
- simulation speed drop down menu: there are four different speeds 1, 5, 10 and 20 times.
- solve button: solves the system without animation.

Figure 2: Software layout with automatic control.
The parameters of the process and controller can be changed by clicking on the process and voltage panels, respectively. When the user clicks on the process and voltage panels the windows shown in Figure 3 will pop up. Please refer to the theory section of this manual to learn about the physical meaning of each item in these windows. The Cancel button closes the window and the OK button saves the values in the text fields.

Figure 3: Process and controller parameters panels.
Theory
Introduction
Virtual Temperature Control (VTC) is a virtual experiment. It is performed on the computer. We study temperature control of a fluid contained in a tank. Manual (human) and automatic control are available. The basic operation of the automatic PID (proportional plus integral plus derivative) controller is explored. The user can set the controller and fluid system parameters and thus study their effect on the controller performance.
Process (Plant): Fluid, Tank and Heater
The system (or process) that we will consider consists of a tank that contains fluid. The tank sits on a heater which supplies energy to the fluid. The energy supplied by the heater depends on the input voltage to the heater. Please refer to Figure 4 for a sketch of this thermal system.

Figure 4: Fluid, tank and heater thermal system.
In this application we are interested in regulating (controlling) the fluid temperature. The system can be represented by a block diagram as shown in Figure 5. The input to the system is the voltage to the heater, whereas the output of the system is the fluid temperature.

Figure 5: Block diagram of the thermal system or process.
Let us develop a mathematical model (differential equation) for this system which describes its dynamics. The different signals and components needed to derive a mathematical model for the thermal system are shown in Figure 6.
We first identify the input and output.
Input: voltage to heater, V, output: fluid temperature, T.

Figure 6: Diagram of the thermal system signals and components.
We apply the heat balance equation to obtain the differential equation of the system:
Energy supplied by the heater = Energy stored by fluid + Energy lost to the surrounding environment by conduction

where, k is the heater constant provided by the heater manufacturer, V is the voltage to the heater, C is thermal capacitance of the fluid , T is the fluid temperature, Ta is the ambient temperature (environment or outside), R is the thermal resistance of the tank wall (heat conduction) and t is the time. Equation (1) is the differential equation that describes the dynamics of our thermal system.
Important note: If the input voltage to the system is negative, the energy supplied by the heater will be equal to zero. This means that the effect of providing negative voltage is the same as the effect of providing zero voltage. The heater can only supply energy to the fluid. It cannot extract energy from the fluid. This is considered as a limitation of the system in the case an automatic controller is connected to the process.
Temperature Control (Feedback or Closed Loop System):
In order to control the fluid temperature in the thermal process we need to have a controller. The controller takes the difference between the desired (or reference) and measured temperatures and provides the voltage to the heater such that this difference becomes as close as possible to zero. The temperature measurement is obtained by connecting a sensor to the process. This measurement is fed back and compared with the desired temperature. The difference between the desired and measured temperatures is called the error. Figure 7 shows the block diagram of the closed loop system.

Figure 7: Block diagram of the closed loop system for temperature control.
The objective of the controller is to make the measured temperature follow (or track) the desired temperature. In other words, the controller tries to take the error to zero. If the error is positive, the desired temperature is larger than the measured temperature. The controller increases the voltage to the heater which results in a higher measured temperature and closer error to zero. If the error is negative, the desired temperature is less than the measured temperature. The controller reduces the voltage to the heater which results in a lower measured temperature and closer error to zero.
We will explore two types of controllers:
1. Human (Manual Control): see Figure 8
In this case the voltage to the heater is adjusted via a knob. The human uses his hand to change the knobs position. He/She watches the temperature gauge (sensor) such as a thermometer and adjusts the voltage so that the difference between the desired and measured temperatures is as close as possible to zero. Note that the sensor is the combination of humans eyes and temperature gauge. The controller is the humans brain.

Figure 8: Human or manual control of temperature.
2. Proportional plus Integral plus Derivative or PID (Automatic Control): see Figure 9
In this case the voltage to the heater is adjusted directly by an electronic controller. The controller is proportional plus integral plus derivative, PID. The input to the controller is the error e. The output of the controller is the voltage V to the heater. The voltage is given as
The controller parameters KP , KI , and KD are called the proportional, integral and derivative gains, respectively. The sensor is a device such as a thermocouple that converts every 1 / H oC to 1 Volt, that is, the measured temperature is equal to H*T, where H is the sensor gain. The PID controller drives the error to zero due to the integral action. Note that proportional and/or derivative control alone does not drive the error to zero.

Figure 9: PID automatic control of temperature.
More material on the theory of control systems can be found at our web site
http://www.eMechanica.com
Exercises
The following exercises help the user to learn about the VTC software and automation concepts. The user can then experiment with the software using his own exercises.
Exercise 1: Manual control with the default process parameters
1. Select the manual option for voltage.
2. Set the voltage to 10 volts by typing 10 in the text field in the voltage panel and pressing enter.
3. Hit the start button and let the simulation run until it stops.
4. Record the final (steady state) value of temperature.
5. Hit the reset button.
6. Set the voltage to 10 volts as in step 2.
7. Hit the start button.
8. Hit the pause button when the time is around 10 seconds.
9. Record the values of time and temperature.
10. Hit the reset button.
11. Hit the start button. Use the voltage knob (slider) to take the temperature as fast as you can to 60 oC and fix it there. Note that this is not very comfortable.
12. Sketch the resulting temperature-time curve.
14. Hit the reset button.
Questions:
1. Calculate the tank thermal resistance R.
2. Calculate the fluid thermal capacitance C.
Exercise 2: Automatic PI control (no derivative action)
1. Select the automatic option for voltage.
2. Select R = 6 (equivalent to desired temp = 60), KP = 2 and KI = 2.
3. Hit the start button.
4. Record the final values of error, measured temperature, proportional voltage and integral voltage.
5. Sketch the resulting temperature-time curve.
6. Hit the reset button.
7. Repeat steps 3 - 6 with R = 6, KI = 0 and KP = 0, 1, 2, 3, 4.
8. Repeat steps 3 - 6 with R = 6, KP = 0 and KI = 1, 2, 3, 4.
Questions:
1. For R = 6, KP = 2 and KI = 2
- Include the temperature-time sketch from step 5 in the procedure.
- What was final value of temperature.
- Which part of the controller provides the voltage to the heater when the temperature reaches its final value.
- Calculate the input energy qin to the fluid, and the energy loss qL to the environment when the temperature reaches its final value. Compare the two values. What do you note.
- Did the controller achieve its objective of driving the temperature to its desired value?
2. For R = 6, KI = 0 and KP = 0, 1, 2, 3, 4 (step 7 in the procedure)
- What was the final value of temperature for each value of KP.
- Calculate the input energy qin to the fluid, and the energy loss to the environment when the temperature reaches its final value for each value of KP. Compare the two values. What do you note.
- Did the controller achieve its objective of driving the temperature to its desired value? Why?
3. For R = 6, KP = 0 and KI = 1, 2, 3, 4 (step 8 in the procedure)
- What was the final value of temperature for each value of KI
- Calculate the input energy qin to the fluid, and the energy loss qL to the environment when the temperature reaches its final value for each value of KI. Compare the two values. What do you note.
- Did the controller achieve its objective of driving the temperature to its desired value? Why?