Professional Documents
Culture Documents
Mixing Control in A ColdHot Water - AR
Mixing Control in A ColdHot Water - AR
Mixing Control in A ColdHot Water - AR
Objectives
Introduction
A water tank filled with hot and cold water — each in a separate container — is equipped with
a digital scale and a probe that measure temperature. The scale and the probe are connected
to a computer through a microcontroller.
In this experiment, the water tank is used to dispense a certain amount of cold and hot water in
order to get water with a desired temperature. The water is poured and mixed in a beaker glass
in which the probe is placed. A close loop proportional control is applied to the water tank
system, using the probe temperature measurement as the feedback.
A pseudo-code for open loop water temperature control is introduced at the end of this report.
Analysis
A. Weight Calibration
In the first experiment the digital scale is calibrated. A set of cylinder block mass is measured
using the water tank scale and a calibrated scale. The output value of the digital scale is
compared with the mass of the cylinder. The comparison is presented in Table 1.
Digital Scale
Cylinder Mass (g)
Output
0 195
100 214
200 233
300 251
400 270
500 289
600 308
700 327
800 346
900 365
1000 384
The relation between the mass of cylinder and the digital value is then analyzed. A linear
relationship between these two values is discovered and presented as Equation 1.
This equation is applied into a program that changes the digital scale output. The purpose of
this program is to calibrate the digital scale into a gram scale. The output value of the calibrated
digital scale and the mass it measured is displayed in Table 2.
Table 2 Cylinder Mass vs Calibrated Digital Scale Output
Calibrated Digital
Cylinder Mass (g)
Scale Output
0 0
100 100
200 200
300 300
400 394
500 494
600 594
700 694
800 794
900 894
1000 994
The distinctive feature of Table 2 is the errors with a value of 6 grams as the cylinder weighted
400 gram or more. This is possibly happens because of this two following reasons. First is the
rounding of the linear equation constants (as presented in Equation 1) when it is applied into
the program, and second the noise that affects the measurement.
After the digital scale is calibrated, a program is created to dispense water with a certain mass
into a beaker. The digital scale is use to detect the mass of the beaker and the water it is
contained. From this experiment it is observed that the digital scale has a fast response time
that makes it reliable for mixing control.
The Flowcode program for this experiment is shown in Figure 1. This program uses a while loop
to open the valve of the water tank. When the water in the beaker is below the set mass, the
valve is opened and water is poured into the beaker. When the water reached the set mass, the
while loop is exited and the valve closes.
Figure 1 Code to Dispense Water into Beaker
In Figure 1 it can be observed that the linear equation shown in Equation 1 is applied in the blue
calculation box of the program.
C. Temperature Calibration
Using the same method as in the digital scale calibration, the temperature measurement of the
probe is calibrated. The output value of the probe and the temperature of several water
mixtures that are measured using a digital thermometer are displayed in Table 3.
Table 3 Temperature vs Probe Output Value
A linear equation that describes the relationship of the temperature and the probe output is
formulated and presented in Equation [2]. This equation is essential in performing the closed
loop control of water temperature.
A closed loop proportional control is implemented in the water tank. A close loop system is a
system in which the latest output difference (between set values and actual values) is
considered to decide the next control action. The block diagram of a close loop system is shown
in Figure 2.
For a close loop water temperature proportional control the loop becomes,
Set Temperature
(v) error Proportional v Hot/Cold Water
+ Beaker
- Control (Kp) Water Valve
In this experiment the proportional gain (Kp) value is set as 10. The Flowcode program of this
experiment is displayed in Figure 4 and Figure 5.
The program in Figure 4 begins by assigning the initial temperature to be 23oC and zero initial
weight. After the first while-loop is started, an initial amount of cold water is poured into the
beaker glass. The DispenseWater() function is utilized for pouring the water. This function is
similar with what is shown in Figure 1 previously.
The proportional control is implemented inside the DispenseCold() and DispenseHot() function.
As stated earlier, the Proportional Gain (Kp) value assigned in this program is 10.
The result of this experiment is presented in Table 4. The table also verifies the probe
calibration which is discussed in section C.
The drawback of the probe system is that it only prints an integer value of the temperature
measurement. However, it still can be inferred from these results that the system has a good
accuracy, as the error between set and thermometer value never exceeds 5%. Another
drawback of this system is the slow response time of the probe. This problem is tackled by
putting bigger delay in the program.
Table 3 Set Values vs Probe vs Thermometer
Note:
%|Error| = (Set-Thermometer)/Set
In this section, a pseudo code of the open loop control is introduced. This code is created based
on the mathematical model of the mixture. The equation to define the temperature of a
mixture of two fluids in an insulated system (no mass and heat transfer to the environment) can
be calculated using Equation 3. Please consider that the value of T should be between T1 and
T2.
In which,
𝑇 − 𝑇𝑐
𝛼= [4]
(𝑇ℎ − 𝑇𝑐 )
In which,
Therefore the mass of the hot and cold water must be dispensed to reach a set temperature of
T can be defined as,
𝑇 − 𝑇𝑐
𝑚ℎ = 𝑀 [5]
(𝑇ℎ − 𝑇𝑐 )
𝑇ℎ − 𝑇
𝑚𝑐 = 𝑀 [6]
(𝑇ℎ − 𝑇𝑐 )
Where,
The pseudo-code for the open loop water temperature control is displayed in Figure 6. Please
note that in the program the temperature of hot water and cold water in the tank must be
measured first. The desired temperature and the total amount of water are the inputs of the
program.
//Inputs
//Outputs
The advantage of the open loop control is that is simpler and easier applied than the closed
loop. However open loop control is not suitable for system that has a lot of noise and
disturbance.
Graphs
To summarize all of the obtained data, the graph representations of each experiment is
included in this section.
Graph 1 and Graph 2 respectively displays the comparison between the mass of the cylinder
and the digital scale value before and after calibration. A linear trend line that describes the
relation between the weight and the digital scale output is generated. The linear equation of
the trend line is then used to calibrate the digital scale.
300
200
100
0
0 200 400 600 800 1000 1200
Mass of Cylinder (g)
1000
800
600
400
200
0
0 100 200 300 400 500 600 700 800 900 1000 1100
Mass of Cylinder (g)
Using a similar method as in the digital scale calibration, the water tank probe temperature
measurement is calibrated by comparing its output with a thermometer’s output. Graph 3 and
Graph 4 respectively presents the comparison between thermometer and probe output before
and after calibration.
Thermometer vs Probe
400
350 Probe = 7.663 Thermometer + 8.384
300
250
Probe
200
150
100
50
0
0 10 20 30 40 50
Thermometer (C)
Thermometer vs Probe
43
41
39
37
Probe (C)
35
33
31
29
27
25
25 27 29 31 33 35 37 39 41 43
Thermometer (C)
Conclusions
A water tank divided into two chambers with hot and cold water in each separate chamber is
used in this experiment. The goal is to get water with a certain temperature by dispensing and
mixing the hot and cold water in a beaker glass.
The water tank is equipped with a temperature measurement sensor and a digital scale. The
first experiment calibrates the digital scale using a calibrated scale. Cylinder blocks with
different mass are weighted on both scales to compare the output values of each scale. A linear
relationship between the scales values is then figured out from this comparison. A linear
equation is applied to the program in order to get a correct weight measurement output from
the water tank scale.
After that, a program is created to dispense the water with a certain mass into the beaker.
From this experiment it is observed that the digital scale has a fast response time that makes it
reliable for mixing control.
The second experiment – which is the calibration of the probe temperature measurement –
goes through a similar process. A calibrated thermometer and different mixture of hot and cold
water temperature is measured with both sensors to understand the relation of both sensors’
output values. The probe response time is much slower than the digital scale.
A closed loop control system algorithm is designed and tested using Flowcode software. The
program is explained thoroughly. Though it takes time to mix the water to reach the desired
temperature, the experiment result exhibits the high accuracy of the control system.
A pseudo-code for open loop control is introduced in the end of the report. The program works
by assuming that water has a same heat constant in every temperature, and that there is no
heat transfer between the water and its environment.