Derivation of model
According to the Arrhenius theory of acids and bases, when an acid is added to water, it
contributes an 𝐻+ ion to water to form the molar concentration of hydronium ion
𝐻3𝑂+ (often represented by 𝐻+ ). The higher the concentration of 𝐻3𝑂+ (or 𝐻+ ) in a
solution, the more acidic the solution is. An Arrhenius base is a substance that generates
hydroxide ions, 𝑂𝐻−, in water. The higher the concentration of 𝑂𝐻− in a solution, the more
basic the solution is, i.e.
𝐻2𝑂 ⇌ 𝐻+ + 𝑂𝐻−
pH is defined as the negative of the base–ten logarithm of the molar concentration of
hydronium ions present in the solution. The unit for the concentration of hydrogen ions
is Moles/Liter. 𝑝𝐻 can be determined as follows:
𝑝𝐻 = −log(𝐻+)
Consider the wastewater system outlined in Figure 1 that contains one single tank with
volume 𝑉. Let 𝐶𝐻(𝑡) (Moles/Liter) and 𝐶𝑂𝐻(𝑡) (Moles/Liter) denote the concentration of
𝐻+ and 𝑂𝐻− ions, respectively. 𝑞(𝑡) denotes flow rate. Let further subscript 𝐴 denote
acid, subscript 𝐵 denote base and no subscript denote the outlet stream. Material
balances for 𝐻+ and 𝑂𝐻−yields
𝑉 𝑑
𝑑𝑡 {𝐶𝐻(𝑡)} = 𝑞𝐴(𝑡)𝐶𝐻,𝐴 + 𝑞𝐵(𝑡)𝐶𝐻,𝐵 − 𝑞(𝑡)𝐶𝐻 + 𝑟𝑉
𝑉 𝑑
𝑑𝑡 {𝐶𝑂𝐻 (𝑡)} = 𝑞𝐴(𝑡)𝐶𝑂𝐻,𝐴 + 𝑞𝐵(𝑡)𝐶𝑂𝐻,𝐵 − 𝑞(𝑡)𝐶𝑂𝐻 + 𝑟𝑉
where 𝑟(moles/second . m3) is the rate for the reaction 𝐻2𝑂 ⇌ 𝐻+ + 𝑂𝐻− which for
completely dissociated (“strong”) acids and bases is the only reaction in which 𝐻+ and
𝑂𝐻− participate. We may eliminate 𝑟 from the equations by taking the difference to get a
differential equation in terms of the excess of acid
𝐶(𝑡) = 𝐶𝐻(𝑡) − 𝐶𝑂𝐻 (𝑡)
Page 6 of 12
Hence
𝑉 𝑑
𝑑𝑡 {𝐶(𝑡)} = 𝑞𝐴(𝑡)𝐶𝐴 + 𝑞𝐵(𝑡)𝐶𝐵 − 𝑞(𝑡)𝐶(𝑡) (1)
where
𝐶𝐴 = 𝐶𝐻,𝐴 − 𝐶𝑂𝐻,𝐴 and 𝐶𝐵 = 𝐶𝐻,𝐵 − 𝐶𝑂𝐻,𝐵
This is the material balance for mixing tank without reaction. The overall model is bilinear
due to the product of flow rate and concentration 𝑞(𝑡)𝐶(𝑡). Note that 𝐶(𝑡) will take on
negative values when pH is above 7. The acid and base feed concentrations 𝐶𝐴 and 𝐶𝐵
for both 𝐻+ and 𝑂𝐻− are assumed to be constants. Linearising equation (1) around a
steady–state nominal point (denoted with an asterisk)
𝑉 𝑑
𝑑𝑡 {𝐶(𝑡)} + 𝑞∗𝐶(𝑡) = 𝑞𝐴(𝑡)(𝐶𝐴
∗ − 𝐶∗) + 𝑞𝐵(𝑡)(𝐶𝐵
∗ − 𝐶∗)
* is used to denote steady–state values, and
𝑞∗ = 𝐶𝐴
∗ + 𝐶𝐵
∗ 𝐶∗ = 10−𝑝𝐻 − 10−14+𝑝𝐻
𝐶𝐴
∗ = 𝐶𝐻,𝐴 − 𝐶𝑂𝐻,𝐴 𝑎𝑛𝑑 𝐶𝐵
∗ = 𝐶𝐻,𝐵 − 𝐶𝑂𝐻,𝐵
Scaled variables for the input are introduced for the input, output and the disturbance as
follows
𝑦(𝑡) = 𝐶(𝑡)
𝐶𝑚𝑎𝑥
; 𝑑(𝑡) = 𝑞𝐴(𝑡)
𝑞𝐴𝑚𝑎𝑥
; 𝑢(𝑡) = 𝑞𝐵(𝑡)
𝑞𝐵𝑚𝑎𝑥
Tasks
1) Explain how the performance of pH level control system can be compliant with
environmental regulations and the treatment of wastewater. Provide two
examples to explain the importance of a stable pH and its role in minimizing
pollution in our ecosystem. [5 Marks]
2) For a neutral pH = 7 , using Laplace transforms and assuming zero initial
conditions, show that
𝑦̅ (𝑠) = 1
𝑠𝑇 + 1 [𝐶𝐴
∗ − 𝐶∗
𝑞∗ ∙ 𝑞𝐴𝑚𝑎𝑥
𝐶𝑚𝑎𝑥
𝑑̅ (𝑠) + 𝐶𝐵
∗ − 𝐶∗
𝑞∗ ∙ 𝑞𝐵𝑚𝑎𝑥
𝐶𝑚𝑎𝑥
𝑢̅ (𝑠)]
where the time constant is 𝑇 = 𝑉/𝑞∗
. [7 Marks]
Page 7 of 12
3) Construct a block diagram depicting an open loop arrangement for the signals
and transfer functions defined in 2). [3 Marks]
4) Assume zero initial conditions and a step input with magnitudes 𝛼 and 𝛽 for each
of 𝑑̅ (𝑠) and 𝑢̅ (𝑠) respectively. Find the concentration output 𝑦(𝑡). [10 marks]
5) Using MATLAB, produce a unit step response for the output 𝑦(𝑡) and verify the
result by comparing it with the analytical result derived in 4). Select the time scales
so that both the transients and the steady state output are visible. [10 marks]
6) Assuming 𝑑̅ (𝑠) = 0, specify the parameter values that needs to be changed for
the speed of the response to increase. Explain and justify your reasoning using
appropriate mathematical functions and step response plots? [5 marks]
7) Assuming a unity negative feedback loop, derive the following transfer functions
a. 𝐺𝑟𝑦(𝑠)
b. 𝐺𝑑𝑦(𝑠)
c. 𝐺𝑟𝑒(𝑠)
d. 𝐺𝑑𝑒(𝑠)
[8 marks]
8) Verify that the closed–loop system is stable by graphically computing the poles
and zeros. [4 marks]
9) Analytically calculate the steady state error due to the disturbance and the
reference signal. What can you infer from the values obtained? [7 marks]
10) Prove that the output 𝑦(𝑡) will only track steady–state targets if there is an
integrator in either a feedforward controller 𝐶(𝑠) or the plant 𝐺(𝑠). What other
condition is required? In addition, using a mathematical derivation, specify the
requirement for disturbance signals to be totally rejected, that is to have no steady–
state impact on the output? [12 marks]
11) Use MATLAB to investigate how offset and performance varies as you change the
scalar controller gain 𝐾𝑝. Give some generic conclusions based upon what you
observe. [7 marks]
12) Design two different feedforward controllers using MATLAB/SIMULINK to Page 8 of 12
• Reduce the steady state error as much as possible.
• Raise damping 𝜁 to an optimum.
• Minimize the response time to reach the steady state value.
You’ll find that a compromise between these multiple goals will be necessary, and
in some cases, you may not be able to meet all goals. Document your design
choices and explain how you arrived at your final design.
The controllers may consist of any combination of P, PI, PD and PID. Design is not
merely for the specified overshoot, but also ensures that the steady state error is
as small as possible. Start with the proportional controller first. You can combine
several compensators but remember that the number of compensator zeros must
never exceed the number of compensator poles (proper system)