0% found this document useful (0 votes)
98 views

PH Control Simulation

This document describes a pH control simulation for an industrial process. pH is controlled by mixing an acidic or basic influent liquid in a tank with a concentrated reagent. The simulation models the chemical reactions and control system used to maintain the effluent pH close to 7. It examines how the control system is affected by variations in influent flow rate, which introduces disturbances into the system. The document provides an overview of the simulation parts and includes an interactive Java applet to demonstrate the pH control system's response under different conditions.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
98 views

PH Control Simulation

This document describes a pH control simulation for an industrial process. pH is controlled by mixing an acidic or basic influent liquid in a tank with a concentrated reagent. The simulation models the chemical reactions and control system used to maintain the effluent pH close to 7. It examines how the control system is affected by variations in influent flow rate, which introduces disturbances into the system. The document provides an overview of the simulation parts and includes an interactive Java applet to demonstrate the pH control system's response under different conditions.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

http://csd.newcastle.edu.au/simulations/ph_sim.

html
You are here : Control System Design - Index | Simulations | pH Simulation

pH Control - Index
System Description
pH control is a common issue in many industrial processes. The basic idea to control the pH
variations in some liquid flow, usually making the pH as close to 7 as possible. This influent
liquid flows into a tank, where it is mixed with an amount of a concentrated reagent to alter
its pH. If the effluent is acidic with a pH of 4, the reagent would be basic with a pH larger
than 10. The reagent is more concentrated than the effluent, since it is desirable to as little
volume to the effluent as possible.
The pH is controlled in a tank - the effluent flows into the top of the tank, and the reagent is
also added to the top of the tank. The tank is well-stirred so that the pH is uniform throughout
the tank. The effluent is pumped out the bottom of the tank, as shown in the figure below.

Note that pH is a very difficult control problem due to the non-linearities. This example
simplifies the problem somewhat to highlight some points about control system design in
general.

Overview of the Example


It is recommended that you follow the example in order, but you may skip ahead if you wish:

Part 1

The basics

Part 2

Flow rate variations

Part 3

Control valve errors

Part 4

A 3 tank solution

Photos of the System


Below is a photo of an industrial pH neutralization system.

Previous

Up - Simulations

Next - Part 1

You are here : Control System Design - Index | Simulations | pH Simulation | Part 1

pH Control - Part 1

Before continuing, make sure you have read Chapter 19

System Model
From elementary mass balance considerations, it can be shown that an appropriate state space
model for the strong acid-strong base system is

(1)

where
co(t) :
cu(t) :
ci(t) :
u(t) :
q(t) :
V:

excess hydrogen ion concentration in the effluent stream (mol/L)


excess hydrogen ion concentration of the reagent (mol/L)
excess hydrogen ion concentration in the influent stream (mol/L)
flow rate of the reagent (L/s)
flow rate of the influent stream (L/s)
volume of the tank (L)

Normally, the reagent concentration is constant, and we control the effluent pH by varying
the reagent flow. Note that the concentrations are excess concentrations, meaning that they
measure the concentration of hydrogen ions in excess to that found in water. We can convert
an excess concentration C to pH using the following formula.

(2)

From this formula, we can see that an excess concentration of 0 gives a pH of 7 (which is the
pH of water, as expected). Also, negative excess concentrations correspond to basic pH, and
positive excess concentrations correspond to acidic pH.
NOTE: The reader should already be aware that if a weak acid or weak base is used, the
titration curve will be substantially different. The differential equation (1) represents the
dynamic equation for a strong acid-strong base titration curve. For any other acid-base
combination (e.g. weak acid-strong base), the system model will be substantially different, as
will equation (2) for finding concentration from pH. The graph below shows the titration
curve for a strong acid-strong base system.

Control Design
We assume that the tank system has a level controller which maintains a constant liquid
volume in the tank. The reagent flow is controlled using a simple PI controller as shown in
the figure below. Note that the control valve on the reagent pipe has a saturation, since it can
be fully open (giving a maximum flow rate) or fully closed (giving a minimum flow rate of
zero).

For the purposes of designing the controller, the plant is linearised by assuming that the
reagent flow is much smaller than the influent flow (since the reagent is more concentrated).
This results in the linear model shown below.

The controller is designed so that the closed-loop bandwidth is twice that of the open-loop
bandwidth. This way, the initial peak in reagent flow falls within the limits imposed by the
valve. It may seem logical to construct a larger valve so that a faster controller can be
implemented, but we will see later that this carries with it serious design tradeoffs which
mitigate against going too far in this direction.
For this example, we choose the parameter values as
cu :
ci :
q:
V:
maximum reagent flow :

-10-2 mol/L
10-3 mol/L
10 L/min
83.67 L
0.025 L/s

and design a PI controller with kp = 3q / cu and ki = 4q2 / Vcu. Note that the primary concern of
the controller is to reject disturbances rather than to follow a set-point, since the set-point will
always be a pH of 7. Also, we assume that the control valve allows a maximum reagent flow
rate of 1.5 L / min.
There is an inherent problem with the pH control system: the measured output is pH, but
what we want to control is hydrogen ion concentration (using pH as the control variable with
a set point of 7 would make the system even more non-linear than it already is). If we did not
know equation (2) for converting between ion concentration and pH, we would have to
attempt to estimate the titration curve, possibly linearising it to find ion concentration. The
pH curve looks almost vertical in the middle, but upon magnification we find that it is not
linear at all. Thus, linearising the titration curve has serious sensitivity ramifications for the
control system.
Fortunately, in this case we know the function for pH in terms of concentration, so we can
simply invert this equation to find the ion concentration for the measured pH. This is rarely
possible in practise.
Note that when measuring the effluent pH, there is a delay of the order of 5 seconds. It is safe
to ignore this delay considering the time scales we are looking at (i.e. with a plant time

constant of 500 seconds).

Java Applet Simulation


Below is a Java applet which simulates the above pH neutralisation system. The blue plot
shows the influent concentration and the green plot shows the effluent concentration. This
process is extremely slow, so the time scale is accelerated somewhat: 1250 simulated seconds
pass for each real second of the simulation, giving a horizontal scale of 2500 seconds per
division
Pressing the "Change Parameters" button brings up the parameters window allowing you to
change the controller values, the influent pH and the animation speed. The controller has
been implemented in the anti-windup form to avoid the effects of the saturation of the valve.
The animation speed can be 25, 12.5 or 6.25 frames per second. This speed is only the rate at
which the screen is refreshed - the simulation is unaffected. The speed function is available
for those with slower computers so that the simulations still appear in real-time (if somewhat
jerkier). Note that the applet does some auto-detection of the speed of your computer, so if
you select a speed that your computer cannot handle, the applet will reduce the speed
accordingly.

Things to try

Things to notice

Look at the initial step response.

Observe that the response is different


from a normal exponential response.

Change the influent pH to any value you like (the


simulation will allow only values between 11 and
7).

Watch the non-linear nature of the


system's response.

Design a faster controller.

Note the effect of the valve saturation


on the response.

The observed non-linear output response is due in part to the non-linear system. However,
most of the non-linearity arises from the fact that we are measuring pH which is a
logarithmic function of the excess ion concentration. It is hydrogen ion concentration that we
are concerned with controlling, but we measure pH since environmental laws specify the
acceptable effluent pH ranges (the tolerance could be as small as 0.5 of a pH).
In this simulation, it was assumed that both the influent flow and concentration were

constant, but this is rarely the case. The next page looks at the effect of varying the influent
flow rate.

Previous - Index

Up - pH Index

Next - Part 2

You are here : Control System Design - Index | Simulations | pH Simulation | Part 2

pH Control - Part 2
Flow Variations
If the system's influent flow is from some sort of industrial runoff, then it is highly likely that
the flow rate will vary, since the runoff will not be at a constant rate. The variation in influent
flow rate presents itself as an input disturbance in the plant model.

where q(t) is the flow rate signal. In this example, we model the fluctuations as a constant
flow plus some randomly varying noise. In particular, we set the average flow to the level
used in the last example (10 L/min), and the random variations range uniformly between -1
L/min and 1L/min.
We will use the same controller as in the last example, which is based on the nominal flow
rate of 10 L/min. However, we should note that allowing the q(t) input to vary with time
makes the system more non-linear than before.

Java Applet Simulation


Below is a Java applet which simulates the pH control system with influent flow rate
variations. The blue plot shows the influent concentration and the green plot shows the
effluent concentration. This process is extremely slow, so the time scale is accelerated
somewhat: 1250 simulated seconds pass for each real second of the simulation, giving a
horizontal scale of 2500 seconds per division
Pressing the "Change Parameters" button brings up the parameters window allowing you to
change the controller values, the influent pH and the animation speed. The controller has
been implemented in the anti-windup form to avoid the effects of the saturation of the valve.

The animation speed can be 25, 12.5 or 6.25 frames per second. This speed is only the rate at
which the screen is refreshed - the simulation is unaffected. The speed function is available
for those with slower computers so that the simulations still appear in real-time (if somewhat
jerkier). Note that the applet does some auto-detection of the speed of your computer, so if
you select a speed that your computer cannot handle, the applet will reduce the speed
accordingly.

Things to try

Things to notice

Look at the response of the system.

Observe the noisy output signal,


particularly as the output gets closer to a
pH of 7.

Change the influent pH to any value you like


(the simulation will allow only values between
11 and 7).

Watch the non-linear nature of the


system's response.

Design a faster controller.

Note the effect of the valve saturation on


the response.

The output variations occur because of the relative size of the tank and the influent valve. If
this valve is larger, the influent flow rate increases, and liquid flows through the entire system
at a faster rate. This means that the filtering effect of the tank is reduced somewhat. As you
might expect, increasing the tank volume would reduce the pH variations in the effluent.
However, building a bigger tank is expensive, and as we will see in the next example, errors
in the control valve reduce the effect of a bigger tank anyway.

Previous - Part 1

Up - pH Index

Next - Part 3

You are here : Control System Design - Index | Simulations | pH Simulation | Part 3
pH Control - Part 3
Control Valve Errors
Up until now, we have considered that the control valve was ideal - i.e. the valve provides
whatever reagent flow rate we desire (with saturation limits). In reality, things aren't that
simple, with most valves displaying backlash characteristics. You should recall the discussion
of backlash in the ball and plate control example.
For now, we will assume that the backlash error is 2% of the maximum flow rate allowed by
the valve. Often, the valve errors can be as large as 5% or 10%. The block diagram of this
new system is shown below:

With the influent flow variations discussed in the last example, there are now two sources of
error in the system. In order to understand them better, we will examine them separately.
Since the last example showed the effect of flow variations alone, we will now look at the
effect of the valve errors alone.
The nature of the valve hysteresis is such that a simple exponential step response will be
largely unaffected. Thus, to highlight the effect of the hysteresis, we will allow extremely
small influent flow variations. The influent flow q(t) is then the nominal 10 L/min plus a
small sinusoidal variation of amplitude 0.0003 L/min and period 10000 s.
Java Applet Simulation
Below is a Java applet which simulates the pH control system with control valve hysteresis.
The blue plot shows the influent concentration and the green plot shows the effluent
concentration. This process is extremely slow, so the time scale is accelerated somewhat:
1250 simulated seconds pass for each real second of the simulation, giving a horizontal scale
of 2500 seconds per division
Pressing the "Change Parameters" button brings up the parameters window allowing you to
change the controller values, the influent pH and the animation speed. The controller has
been implemented in the anti-windup form to avoid the effects of the saturation of the valve.
The animation speed can be 25, 12.5 or 6.25 frames per second. This speed is only the rate at

which the screen is refreshed - the simulation is unaffected. The speed function is available
for those with slower computers so that the simulations still appear in real-time (if somewhat
jerkier). Note that the applet does some auto-detection of the speed of your computer, so if
you select a speed that your computer cannot handle, the applet will reduce the speed
accordingly.
The parameters window also allows you to select whether you want flow variations or valve
errors. The possibilities are listed in the table below:
flow variations valve error description
off

on

The default state for the simulation, showing the valve error
characteristics as discussed above.

off

off

No valve errors are present, allowing you to see the effect of


the small sinusoidal flow variations alone.

on

off

Shows the effect of random flow variations, and is exactly


the same as in the previous example.

on

on

Shows the effect of the valve errors in the presence of the


random flow variations.

Things to try

Things to notice

Look at the response of the system


with valve errors and small
sinusoidal flow variations.

Notice that the effluent pH varies between about 8.5


and 5.5

Turn off valve errors (and flow


variations)

Observe the response of the small sinusoidal flow


variations alone, and compare the output to the
system with valve errors.

Recall the response from the previous example and


Turn off the valve errors, and turn on
note that this response is the same, with the output
the flow variations
again varying between 8.5 and 5.5
Turn on both the valve errors and the Note the effect of the both the valve hysteresis and
flow variations
the random flow variations.

Try the faster controller that you


designed in the previous example

Notice the limited effect of this controller.

The essential point in this example is that both sources of error produce output variations of
approximately the same size. If we were to construct a larger tank to reduce the error cause
by the influent flow, then the valve error would start to dominate. Since the valve errors are
of the same magnitude as the errors caused by the influent flow variations, increasing the
tank volume would have virtually no effect on the output variations.
The next idea might be to try to reduce the valve errors. The valve error is a percentage of the
valve's size, so to reduce the error, we need a smaller control valve. However, a smaller
control valve will not be able to provide the necessary reagent flow to neutralise the influent.
This highlights the need to consider both sources of error together, rather than trying to
eliminating them individually. The next example presents a solution which considers these
factors.

Previous - Part 2

Up - pH Index

Next - Part 4

You are here : Control System Design - Index | Simulations | pH Simulation | Part 4
pH Control - Part 4
Multiple Tanks
To overcome the flow variations and the valve hysteresis problems, we use a 3 tank system
where the tanks increase in volume. This setup is shown in the diagram below.

The influent flows into the first tank, which has a large valve to neutralise most of the
influent base. The set-point for this control system is set to a pH of 9.6, since the purpose of
the 3 tank system is to attack the problem in steps.
The effluent from the first tank flows directly into the second tank, which is 20 times larger.
The second tank uses a valve that is 20 times smaller than that used by the first tank. The setpoint for this control system is set to pH 8.3.
The effluent from the second tank flows directly into the third tank, which is 20 times larger
again. The third tank uses a valve that is 20 times smaller than that used by the second tank
(and thus 400 times smaller than the first tank). The set-point for this final tank is a pH of 7.
This scheme takes into account the comparable magnitude of the error sources. The first tank
is relatively small, since it requires a large valve to reduce the pH to 9.6. As the liquid flows
through the tanks, the variations reduce and the pH gets closer to 7. The final tank performs
only minor adjustments, since the second tank has reduced the pH to 8.3. At this final stage,
we are able to reduce the valve size and increase the tank volume with no adverse effects.
Having 3 tanks is more expensive than a one tank scheme, but we will see that the 3 tank
system is extremely effective. Also, the consideration of the magnitude of the errors ensures
that each tank is no larger than it needs to be.
For this simulation, we assume that the first tank has a volume of 83.67 L, and uses a valve
which allows a maximum reagent flow rate of 1.5 L / min. Also, the influent flow rate
variations are as before with the average flow to the level used in the last example (10
L/min), and the random variations range uniformly between -1 L/min and 1L/min.

Java Applet Simulation


Below is a Java applet which simulates the 3 tank pH control system. The plots shown in the
simulation are listed below:
blue

influent pH

green

effluent concentration for the first (smallest) tank

red

effluent concentration for the second tank

purple

effluent concentration for the third (largest) tank

This process is extremely slow, so the time scale is accelerated somewhat. There are two
speeds at which to view the simulation. The slow speed is the same as that used in the
previous simulations, with a horizontal scale of 2500 seconds per division. The fast speed has
10000 simulated seconds passing for each real second of the simulation, giving a horizontal
scale of 20000 seconds per division. The plot for the smallest tank loses a lot of information
in the fast speed.
Pressing the "Change Parameters" button brings up the parameters window allowing you to
change the controller values, the influent pH and the animation speed. The controller has
been implemented in the anti-windup form to avoid the effects of the saturation of the valve.
The animation speed can be adjusted as before.
Pressing the "Reset" at any time button resets the simulation to its initial state. Also, the
"Start/Stop" button allows you to start and stop the simulation at will.
Finally, the pH meter can be attached to any of the tanks in the system by clicking on the
appropriate tank in the lower right hand corner of the applet.

Things to try

Things to notice

With the speed set to slow, observe


the response of the three tanks

Notice that the effluent pH for the smallest two tanks


stays very close to the set point (in steady state)

Set the speed to fast

Notice that the effluent pH from the third and largest


tank stays very close to 7 (after an initial transient)

Change the set-point for the second


tank to something larger than 8.3
(such as 9)

Notice that the controller for the third tank can no


longer neutralise the base in the influent

Note that the controller for the second tank cannot


Change the set-point for all tanks to a
neutralise the effect of the widely varying pH in the
pH of 7
first tank's effluent
The three tank system works well when the set-points are uniformly spaced between a pH of
11 and 7. Note that a step of 1.3 in the logarithmic pH scale corresponds approximately to a
multiplicative factor of 20 - hence the scaling of the tanks and their valves.
The third tank uses a very small control valve, which is designed to make only the smallest
corrections to the pH. If the pH of the liquid coming into the third tank is too high, then the
controller will be neutralise the influent effectively, and the pH of the effluent will rise. This
comes directly from the saturation limits of the control valve.
Even though this simulation concludes the example, this is not the final solution of the
problem. There are many complex issues in industrial pH control, which will not be
discussed here.

Previous - Part 3

Up - pH Index

Next

You might also like