Control of a Cold and Hot Water Constant-Volume Mixer​
​Authors: Housam Binous and Ahmed Bellagi

Figure below shows a sketch of a mixer.​​
​​Material balance is :​​
A
h
t
=
Cold
F
in
+
Hot
F
in
-
F
out
​​Energy balance is :​​
Ah
T
t
=
Cold
F
in
(
T
Cold
-T)+
Hot
F
in
(
T
Hot
-T)
​​The problem is a MIMO. However, if we assume
h
t
=0
(i.e. h is constant) then
F
out
=
Cold
F
in
+
Hot
F
in
and we recover a SISO problem.​Here, we propose to control the temperature of the mixer outlet stream,
T
Hot
, by manipulating the flow rate of the hot stream:
Hot
F
in
.​​
Hot
F
in
=
F
n
+
K
c
e(t)+
1
τ
I
e(t)twithe(t)=
T
sp
-T
​​Given: A=2 m2,
Cold
F
in
=0.25
l/min,
F
n
=0.5
l/min, V = 6 m3,
T
Cold
=25°C
and
T
Hot
=75°C
. We find h=3 m, the outlet steady-state temperature T=58.33 °C and
F
out
=0.75
l/min.​We suppose that the temperature of the cold water stream rises to 40 °C at t=100 min.​For each one of the scenarios below, we plot the outlet temperature and flow rate versus time.​1. there is no control action.​2. A P-controller is used to control the outlet water temperature. Controller gain is Kc = 0.1.
T
sp
=58.33
°C.​3. A PI-controller is used to control the outlet water temperature. Controller gain is Kc = 0.1 and the reset time is τI = 1 min. ​4. The cold water temperature is kept equal to 25 °C and the set point is fixed equal to 65 °C at t=100 min. A PI-controller is used to control the outlet water temperature. Controller gain is Kc = 0.1 and the reset time is τI = 1 min.​​References:​[1] Modelling of the Mixing Tank: Chemical Process Modelling and Simulation : https://www.youtube.com/watch?v=jP3P9psQkKA
In[]:=
A=2;FinCold=0.25;FinHot=0.5;Fn=0.5;THot=75;TCold=25;
In[]:=
ss=NSolve[{0FinCold(TCold-Ts)+FinHot(THot-Ts)},Ts]
Out[]=
{{Ts58.3333}}
In[]:=
h=V/A;V=6;Fn=0.5;
Open loop response or no control action
In[]:=
TCold=If[t<100,25,40]
Out[]=
If[t<100,25,40]
In[]:=
sol=NDSolve[{AhT'[t]FinCold(TCold-T[t])+FinHot(THot-T[t]),T[0]First@(Ts/.ss)},T,{t,0,500}]
Out[]=
TInterpolatingFunction
Domain: {{0.,500.}}
Output: scalar

In[]:=
Plot[T[t]/.sol,{t,0,200},FrameTrue,GridLinesAutomatic,PlotStyle{Thick,Darker@Blue},AspectRatio1,ImageSize400{1,1},FrameLabel{Style["time (min)",16,Italic],Style["temperature (°C)",16,Italic]}]
Out[]=
Closed loop response - proportional only control action
In[]:=
Kc=0.1;Tsp=58.33;
In[]:=
FinHot=Fn+Kc(Tsp-T[t])
Out[]=
0.5+0.1(58.33-T[t])
In[]:=
sol=NDSolve[{AhT'[t]FinCold(TCold-T[t])+FinHot(THot-T[t]),T[0]First@(Ts/.ss)},T,{t,0,500}]
Out[]=
TInterpolatingFunction
Domain: {{0.,500.}}
Output: scalar

In[]:=
Plot[T[t]/.sol,{t,0,200},FrameTrue,GridLinesAutomatic,PlotStyle{Thick,Darker@Red},AspectRatio1,ImageSize400{1,1},FrameLabel{Style["time (min)",16,Italic],Style["temperature (°C)",16,Italic]}]
Out[]=
In[]:=
offset=Abs[Tsp-First[T[t]/.sol/.t200]]
Out[]=
1.6676
Closed loop response - proportional-integral control action
In[]:=
Kc=0.1;Tsp=58.33;tauI=1;
In[]:=
FinHot=Fn+Kc(Tsp-T[t])+Kc/tauIIntErr[t]
Out[]=
0.5+0.1IntErr[t]+0.1(58.33-T[t])
In[]:=
sol=NDSolve[{AhT'[t]FinCold(TCold-T[t])+FinHot(THot-T[t]),IntErr'[t]Tsp-T[t],IntErr[0]0,T[0]First@(Ts/.ss)},{T,IntErr},{t,0,200}]
Closed loop response - proportional-integral control action - response to a set point change