Mixing Control in A ColdHot Water - AR

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 13

Mixing Control in a Cold/Hot

Water Tank System


By: Arief Ramadhan

Objectives

The objectives of this experiment are:

1. Calibrate the digital scale of the water tank


2. Calibrate the probe temperature sensor of the water tank
3. Perform a closed loop water temperature control
4. Create a pseudo-code for open loop water temperature control

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.

Table 1 Actual Weight vs Digital Scale Output of Cylinder Blocks

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.

𝑆𝑐𝑎𝑙𝑒 𝑂𝑢𝑡𝑝𝑢𝑡 = 0.1889 × 𝑊𝑒𝑖𝑔ℎ𝑡 + 194.82 [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.

B. Dispense a Certain Amount of Water

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

Thermometer (oC) Probe Output


23.5 188
33.8 266
35.5 283
38.3 302
45.6 357

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.

𝑃𝑟𝑜𝑏𝑒 𝑂𝑢𝑡𝑝𝑢𝑡 = 7.663 × 𝑇𝑒𝑚𝑝𝑒𝑟𝑎𝑡𝑢𝑟𝑒 + 8.383 [2]

D. Closed Loop Control System

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.

Figure 2 Close Loop Control

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

v Actual Temperature (oC)


Probe

Figure 3 Closed Loop Diagram of a Proportional Water Temperature Control

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.

Figure 4 Closed Loop Program Segment 1


After that, the program goes inside another while-loop that stops when the probe has reached
within 1 degree from its set temperature or the water exceeds 600 grams (to avoid the water
exceeding the capacity of the beaker). Inside the loop either the DispenseCold() or
DispenseHot() function is executed, depending on the current temperature of the water. A
segment of this program is presented in Figure 5.

Figure 5 Closed Loop Program Segment 2

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

Set (oC) Probe (oC) Thermometer (oC) % |Error|


26 26 26.9 3.46
30 30 30.4 1.33
30 30 30.2 0.67
30 30 29.2 2.67
34 34 34.2 0.59
35 35 35.3 0.86
37 37 37.7 1.89
37 37 37.2 0.54
41 41 40.7 0.73

Note:

%|Error| = (Set-Thermometer)/Set

E. Open Loop Control

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.

𝑚1. 𝑐1. 𝑇1 + 𝑚2. 𝑐2. 𝑇2


𝑇= [3]
𝑚1. 𝑐1 + 𝑚2. 𝑐2

In which,

T = Temperature of the mixed fluids (oC);

T1,2= Temperature of fluid 1,2 (oC);

m1,2 = mass of fluid 1,2 (kg);

c1,2 = specific heat of substances 1,2 (J/kg oC);


For the open loop program, this equation is expressed in terms of the fraction of amount hot
water and cold water required for the water to get a certain value. This fraction, which is
symbolized as alpha (α), is depicted in Equation 4. In this equation the specific heat of water is
assumed to be similar for every temperature.

𝑇 − 𝑇𝑐
𝛼= [4]
(𝑇ℎ − 𝑇𝑐 )
In which,

α = Fraction of hot water that must be dispensed by the water tank

T = Desired temperature (oC);

Th = Temperature of hot water in the tank (oC);

Tc = Temperature of cold water in the tank (oC);

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,

M = Total mass of the dispensed water (kg);

mh = Mass of hot water should be dispensed (kg);

mc = Mass of cold water should be dispensed (kg);

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

M = 500g; //Total mass of dispensed water

Th =60 ; //Temperature of hot water in the tank

Tc = 23; //Temperature of cold water in the tank

T = 27; //Desired water temperature

Mh = (T-Tc)*M/(Th-Tc); //Amount of hot water dispensed

Mc = (Th-T)*M/(Th-Tc); // Amount of cold water dispensed

//Outputs

DispenseCold(Mc) //Dispense Mc grams of cold water

DispenseHot(Mh) //Dispense Mh grams of hot water

Figure 6 Pseudo-code for Open Loop Water Temperature Control

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.

Graph 1 Digital Scale Mass Measurement before Calibration

Mass of Cylinder vs Digital Scale


500

400 Digital Scale = 0.1889 Mass + 194.82


Digital Scale

300

200

100

0
0 200 400 600 800 1000 1200
Mass of Cylinder (g)

Graph 2 Digital Scale Mass Measurement after Calibration

Mass of Cylinder vs Callibrated Digital


Scale
1200
Callibrated Digital Scale (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.

Graph 3 Probe Output Value before 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)

Graph 4 Probe Output Value after Calibration

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.

You might also like