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



co(t) :    excess hydrogen ion concentration in the effluent stream (mol/L)
cu(t) :    excess hydrogen ion concentration of the reagent (mol/L)
ci(t) :    excess hydrogen ion concentration in the influent stream (mol/L)
u(t) :    flow rate of the reagent (L/s)
q(t) :    flow rate of the influent stream (L/s)
V   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.


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   -10-2 mol/L
ci   10-3 mol/L
q   10 L/min
V   83.67 L
maximum reagent flow :  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.


You don't seem to have a Java enabled browser.


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