You are on page 1of 5

On controlling pH

O.L.R. Jacobs, MA, PhD


W.A. Badran, BSc, MSc, DPhil
C.G. Proudfoot, BA, DPhil, CEng, MIEE
C. While, BSc(Eng), PhD, CEng, MIEE

Indexing terms: Process control, Control theory, Computer-aided design

modern methodology are summarised, including a CAD


Abstract: The paper summarises a recent investi- package which can be used to assess needs of specific
gation to find out what contribution could be problems.
made to pH regulation by modern algorithms for Discussion is primarily in terms of pH regulation in
online estimation and/or adaptive control. Topics processes which can be represented by the continuous
discussed include a mathematical model to stirred-tank reactor (CSTR) of Fig. 1, where an influent
account for nonlinearity; full-scale trials using self-
tuning controllers; a specially developed nonlinear
estimator; use of resulting estimates to drive a
feedback
suboptimal 'cautious' control law; and a special- y
purpose CAD package. It is concluded that pH
regulation is amenable to good engineering prac-
tice, and that whether or not this should include
modern algorithms is a problem-specific question
which can be answered using the CAD package.

1 Introduction

pH control is notoriously troublesome. It involves non-


linearities and uncertainties which can be so severe that
Fig. 1 pH control in CSTR
classical linear feedback does not always achieve satisfac-
tory performance. This paper summarises results of a
recent investigation to find out what contribution could stream of variable acidity and flow rate is neutralised by
be made to pH regulation by modern algorithms for mixing with concentrated reagent. A feedback signal in
online estimation and/or adaptive control. The investiga- the form of measured pH of effluent drives the controller
tion was in the form of a collaborative project combining which adjusts reagent flow rate. Feedforward signals
academic expertise at Oxford, with facilities for extended measuring influent acidity and flow rate may be available
full-scale experimental work at ICI. in some applications. Dynamics of the CSTR have trans-
Literature on pH is referenced in recent doctoral fer function of the form
theses [e.g. 1-3]. It includes two books [4, 5] giving a
clear account of the subject from the viewpoint of clas-
sical control engineering. One conclusion, confirmed in 1 + S7;
our investigation, is that pH control is amenable to good with time constant Ti mainly due to mixing, and dis-
engineering practice, in such matters as plant layout, tance-velocity lag T2 mainly due to pipe flows. Inline
sizing, instrumentation and instrument maintenance. An static mixing processes can be represented as CSTR with
important factor is the expectations of plant personnel; Tx 4 T2. Tx is proportional to reactor volume and can be
poor performance seems sometimes to occur for no better an interesting design parameter: large values have the
reason than that it is expected. good effect of smoothing out disturbances, but the bad
Whether or not good practice need include anything effect of requiring large, and consequently expensive,
beyond classical methods is a question whose answer is plant. T2 has the bad effect that it destabilises feedback
problem-specific. This paper discusses some of the deter- control, and has no good effects.
mining factors. Potential contributions from more Two full-scale CSTR were allocated to our investiga-
tion. They were interfaced, one at a time, to a dedicated
Paper 5284D (C8, C9) received 6th January 1986 PCP11/34 computer which was programmed in Fortran
Dr. Jacobs is with the Department of Engineering Science, University of to perform online data acquisition and storage, as well as
Oxford, Parks Road, Oxford 0X1 3PJ, United Kingdom implementing algorithms for real-time estimation and
Dr. Badran is with APV Automation Ltd., Manor Royal, Crawley,
Sussex RH10 2QB, United Kingdom control [2]. Work on the first CSTR, plant A, had by
Dr. Proudfoot is with Unilever Research, Port Sunlight Lab, Mersey- 1979 led to the general conclusion that 'modern control
side L63 2JW, United Kingdom technology can contribute substantially to pH control'
Dr. While is with ICI PLC, Engineering Department, Runcorn, [6]. Subsequent work on plant B, a waste brine neutral-
Cheshire WA7 4QG, United Kingdom isation vessel, included more detailed investigation of
196 IEE PROCEEDINGS, Vol. 134, Pt. D, No. 3, MAY 1987
what can be achieved by certain modern algorithms, as Such models underpinned most of our work. They
summarised here. Some dozen other full-scale CSTR were used to create lifelike simulations of full-scale plant
plants were also surveyed [2]. for developing acceptable control algorithms, and for the
Results and conclusions from our investigations
should be generally applicable to other pH control pro-
cesses not exactly conforming to Fig. 1.
Investigated applications of modern methodology are
summarised in the following five Sections of this paper.
Section 2 outlines use of a new variable, ionic concentra-
tion difference [7], to establish mathematical models
which conveniently and explicitly separate two different
factors causing nonlinearity in pH systems. Section 3 is
about our experiences using self-tuning controllers on
full-scale pH plant. Section 4 refers to a novel nonlinear
estimation which could be implemented in an online
computer to generate real-time estimates of unmeasured
plant variables. These estimates could help to determine
control action as discussed in Section 5, which also refers
-1
to a novel 'cautious' [8] control law for pH. Section 6
describes a computer-aided-design (CAD) package which -0.1 0.1
simulates the features of the preceding Sections and can
be used to answer design questions about specific plant, Fig. 2 Nonlinearity in the definition ofpH
including the question of whether classical methods will
be adequate.

2 Mathematical model of pH nonlinearity


One of the principal reasons why pH control is trouble-
some is that controlled processes have the severely non-
linear static characteristics of titration curves. Two
separate factors contribute to this nonlinearity. One is
the known logarithmic nonlinearity in the definition of
pH
+ 0.1
PH=-log10[H ] (1)
The other is the less nonlinear, but often more uncertain,
effect of reaction chemistry, which determines how
hydrogen ion concentration [ H + ] depends on composi- 0.1 0.2 0.3
tions and amounts of reagents.
We found that these two factors can usefully be
separated by taking as the primary variable to represent Fig. 3 Examples of nonlinearity due to chemistry
a Effluent 1
acidity, not [ H + ] , but the ionic concentration difference b Effluent 2
[7] X defined by c Strong acid
d Weak acid
X = [OH-]-[H+] (2)
Fig. 2, obtained by combining eqns. 1 and 2 with the CAD package. They also provided the starting point for
dissociation equation model-based estimation and control, as described in Sec-
tions 4 and 5.
[ H + ] [ O H " ] = constant (3)
shows how pH is related to X by the familiar S-shaped 3 Self-tuning controllers
titration curve of strong reagents. When reagents are
strong, the chemistry can be approximated [9] by Our work with self-tuning controllers contributes to the
repertoire of thorough studies of full-scale industrial
X = X, + X (4) applications of adaptive control. We confirmed the
where Xt, XR, Vt and VR are ionic concentration differ- general conclusion that if a controlled process can be
ences and volumes of influent and reagent, respectively. satisfactorily controlled by some fixed-parameter linear
When reagents are weak, or 'buffered', the chemistry controller, then a self-tuning algorithm can achieve the
gives rise to component-specific nonlinearities which may satisfactory performance and maintain it much more reli-
have significant effects on control performance or con- ably than can be done with hand-tuned conventional
troller design. These nonlinearities can be revealed by control. The principal condition for satisfactory per-
using the inverse of Fig. 2 to strip the known logarithmic formance to be so achievable is that the controlled
nonlinearity of pH measurement away from an experi- process be not severely nonlinear.
mental titration curve. Fig. 3 illustrates some typical pH systems can be not severely nonlinear, when they
results in terms of dimensionless variables {X — Xj)/XR are required to operate about points where the titration
and VJJVJ. It is the linearity of this representation of eqn. curve is fiat. This can happen for either or both of two
4 which makes ionic concentration difference X particu- reasons:
larly suitable for use as the primary variable in mathe- (i) the required operating point may be well away from
matical models. the neutral point, where severe nonlinearity mostly arises
IEE PROCEEDINGS, Vol. 134, Pt. D, No. 3, MAY 1987 197
(ii) buffering may be present to such an extent that controller. Each Figure shows two pairs of graphs, one
nonlinearities in the chemistry are severe and cancel out obtained from simulation and the other from the real
those of the pH measurement. waste brine plant. The records are of regulated pH, with
The waste brine process of plant B operated in such a
near-linear region: after our extended self-tuning trials, 10
the plant manager reported that his neutralisation plant
had been held from 0.5 to 1 pH nearer to neutrality,
resulting in considerable saving of reagent and money.
Simulations of plant A, which had little buffering and was 20
therefore severely nonlinear, confirmed that, although
self-tuning might be preferable to hand-tuning, it could lOo
o
not of itself achieve good performance about difficult
operating points. 24 h
The method of investigation was to establish a lifelike
simulation of the plant and to tune the self-tuners to give
good simulated performance before transferring them to
the real plant. The simulations were done offline in a
VAX computer, using Fortran as in the online computer,
so that source code for the online algorithms might be
directly transferrable.
A key step in obtaining agreement that simulations
were lifelike was the use of a recorded typical time
history of influent flow rate as a simulated plant dis-
turbance.
Three types of self-tuner were investigated [2, 10]: a
novel self-tuning PID algorithm [11], generalised k-
incremental and explicit pole-placement. The pole- Fig. 5 Waste brine neutralisation under self-tuning PI control
a RMS error = 0.059, b RMS error = 0.070
placement algorithm needed more computing power than
a CAD simulation
the other two implicit algorithms, but gave better per- b Real plant data
formance because it could handle the uncertain time
delays caused by fluctuating flow rate through the neu- set point 8.5, and of reagent (NaOH) flow which tracks
tralisation process. There was little to choose between changes in the effluent load for neutralisation. The step
the, still satisfactory, performances of the other two up in reagent flow shortly after half-time shows that all
algorithms: dynamics of the controlled process were suffi- cases were subject to similar, major, load disturbances. It
ciently simple that they could be well matched by the can be seen that the self-tuning controller reduces RMS
PID controller, and so there was little need for the poten- error by a factor of five, from about 0.33 to about 0.07
tial sophistications of the other more general algorithm. units of pH.
Figs. 4 and 5 show how the self-tuning PI algorithm
improves on performance of a classical hand-tuned PI
4 Special nonlinear estimators
Good control, whether of pH or any other quantity,
requires good information about exogenous variables
affecting a controlled process, and about its current inter-
nal state. In pH systems such as Fig. 1 the exogenous
variables are usually flow rate and concentration of the
influent stream, and the internal state is characterised by
the ionic concentration difference X. These are variables
whose values can be quite uncertain in practice, partly
-10
because instrumentation for the influent quantities is
often not installed, and partly because the pH measure-
ment of internal state is highly nonlinear and subject to
random errors as well as to systematic biases. We investi-
gated possible ways of using statistical estimation algo-
rithms to extract the required information from available
measurements.
Two types of algorithm were investigated: an online
implementation of Bayes' rule to handle the severe pH
nonlinearity [12], and an extended Kalman filter to esti-
mate the influent variables [1]. A novel linearisation was
developed to couple the first algorithm to the second
[13]. It was found that the Bayes' algorithm would be
well worth implementing if there were significant random
errors in pH measurement, and that the extended
Kalman filter would give valuable information about
Fig. 4 Waste brine neutralisation under classical PI control
a RMS error = 0.343, b RMS error = 0.337
influent variables, provided that the titration curve was
a Real plant data
known and there was no unknown bias on the pH mea-
b CAD simulation surement. Furthermore, it would be possible to estimate
198 IEE PROCEEDINGS, Vol. 134, Pt. D, No. 3, MAY 1987
and, hence, eliminate such a bias if measurements were (b) the corresponding mean square error E [(pH0
available of the influent variables. Observability prob- — pH(X))2] between pH(X) and a set point pH 0 depends
lems prevent simultaneous estimation of influent vari- on both Xl and a, and is not generally minimised by
ables and of bias. Xx = Xo (unless a = 0), where Xo is the internal state
If the pH measurement is free of significant errors, it corresponding to pH 0 .
becomes practicable to obtain the internal ionic concen-
tration by inverting the known pH nonlinearity, without For given set point pH0 and standard deviation a, the
using any statistical estimation. Such inversion can value of Xt which does minimise mean square error in
provide a linearisation of the titration characteristic, pH was determined numerically [1]. The results are sum-
which is adequate for purposes of feedback control when marised in Fig. 6, which shows how the internal state Xx
the chemistry is close to that of strong reagents [14]. P H 0 =10
The above conclusions are based on simulation
results, because the waste brine process had no influent
instrumentation and its pH measurement was subject to
bias. It therefore had the above-mentioned observability
problems, and was not amenable to statistical estima-
tions.

5 Control algorithms
Simulations showed that, in pH control systems where
statistical estimators can be expected to work, the 10
resulting estimates could provide a useful basis for
control action. In particular, synthetic feedforward based
on estimates of influent variables, or corrections to feed- Fig. 6 Suboptimal control with caution
back based on estimates of bias, could sometimes lead to
dramatic improvements in control performance. to be aimed at by the controller depends on pH 0 and also
Table 1 summarises simulation results showing the on a. When accuracy is good (small a), Xx is the value
Xo of ionic concentration difference corresponding to
Table 1: simulated RMS errors in pH under self-tuning PI pH 0 . As accuracy becomes bad (large a), Xx increases
feedback control away from neutrality and can be written
Plant A Plant B Xt ~ Xo + caution (5)
Feedback only 0.164 0.053 where the 'caution' [8], which grows with <r, is just what
Feedback plus synthetic feedforward 0.072 0.053
Feedback plus real feedforward 0.066 0.048
would be observed in the behaviour of an experienced
plant operator, who moves the set point away from neu-
trality as the process becomes difficult to control.
effect of RMS error in plants A and B of synthetic feed- The above conclusions are based on simulation results
forward with simultaneous feedback control in the form only. The waste brine process of plant B, as well as being
of self-tuning PI. For each plant, the set point was at a unsuitable for statistical estimations, was well buffered
typical non-neutral value. In plant A, most of the per- and could be satisfactorily controlled by linear control-
formance improvement which could have been achieved lers which ignored the titration nonlinearity.
by installing real feedforward instrumentation (reduction
of RMS error from 0.164 to 0.066, a factor of about 2.5) is 6 CAO package
obtained by using the synthetic feedforward (which Nonlinearities and uncertainties in pH systems are
reduces RMS error to 0.072). Plant B was buffered and usually so many and strong that controllers cannot be
operating in a near-linear region, where there was little designed by analysis alone, but must be developed using
need for real feedforward and no improvement to be a problem-specific simulation. A suitable CAD package
obtained by using synthetic feedforward. As the set points has been produced which uses the mathematical model of
move towards neutrality, both plants were found to Section 2 as a basis for simulating pH regulation in
become progressively harder to control: the next stage CSTR conforming to Fig. 1. All problem-specific features
after Table 1 was that plant A needed real feedforward (e.g. parameter values, noise variances, disturbance time
and plant B needed some feedforward. histories, titration curve) can be specified by the user and
At a more theoretical level, the question arises of how stored. A selection of conventional and modern algo-
to account for interaction between uncertainty about the rithms for classical control, adaptive control and sta-
current value of internal state X and the nonlinearity tistical estimation, including all the algorithms mentioned
pH(X) of Fig. 2. An early view of this interaction was the above, is simulated. Performances under the various
observation [15] that uncertainty about internal state algorithms can be compared and the likely return on
sets a limit to how close pH can be regulated toward their implementation costs can be assessed. The simula-
neutrality. tion is sufficiently accurate in detail, and well provided
The interaction can be further discussed by supposing with interactive features, that it can be used to design real
the value of X to be described by a normal probability plant. It can be applied in two different ways:
distribution, having mean value Xx and standard devi- (i) to design controllers for existing plant
ation a such as might appear from the statistical estima- (ii) to explore control aspects of proposed new plant.
tion of the preceding Section. Two consequences of the
nonlinearity are: The package and its applications are more fully described
(a) the corresponding expected value of pH(X) is not elsewhere [1, 16, 17]. It was used for the simulations
J (unless Xt = 0) reported here.
IEE PROCEEDINGS, Vol. 134, Pt. D, No. 3, MAY 1987 199
This package is written in Fortran 77 with curve of reagent against plant influent. This arises in such
(documented) source code of about 10000 lines. It con- applications as neutralisation of effluent from a large site,
sists of linked modules which use about 400 kbytes of where many different waste streams may contribute to
virtual memory, mainly for storing simulated time his- the final effluent. How to cope with it could be a subject
tories. Two implementations are available from the for further research.
authors, one to run on a VAX and one to run on an IBM
PC.
8 Acknowledgment
7 Conclusions The collaborative project was supported by SERC grant
pH control is amenable to good control engineering GR/A/90093.
practice. Good practice can relate to operation of existing
plant or to designs of new plant. For existing plant it 9 References
includes maintenance of accurate pH measurements,
accurate control of reagent flow, exploitation of feed- 1 BADRAN, W.A.: 'On designing algorithms for controlling pH'.
forward signals, linearisation to eliminate known nonlin- DPhil thesis, University of Oxford, 1984
earities, use of self-tuning controllers, use of more 2 PROUDFOOT, C.G.: 'Industrial implementation of on-line com-
complex 'modern' algorithms if suitable data is available. puter control of pH\ DPhil thesis, University of Oxford, 1983
3 GUSTAFSSON, T.K.: 'A study of modelling and control of pH\
Inexpensive online computers can be used to implement Doctoral thesis, Report 84-4, Abo Akademi, 1984
the foregoing prescriptions. For designs of new plant, 4 SHINSKEY, F.G.: 'pH and pION control' (Wiley, 1973)
good control engineering practice also influences choice 5 MOORE, R.L.: 'Neutralisation of waste water by pH control'
of system layout, sizing of mixing vessels and piping, pro- (Instrument Society of America, 1978)
vision and location and maintenance schedules of valves 6 JACOBS, O.L.R., HEWKIN, P.F., and WHILE, G: 'Online com-
puter control of pH in an industrial process', IEE Proc. D, Control
and measuring instruments. Theory & Appi, 1980,127, (4), pp. 161-168
A major determinant of performance is the expecta- 7 ORAVA, P.J., and NEIMI, A.J.: 'State model and stability analysis
tions of plant operators and management, which may of a pH control process', Int. J. Control, 1974, 20, pp. 557-567
8 JACOBS, O.L.R., and PATCHELL, J.W.: 'Caution and probing in
sometimes be unduly pessimistic. Given the will to stochastic control', ibid., 1972,16, pp. 189-199
achieve good pH control, it should be emphasised that 9 JACOBS, O.L.R.: 'pH regulation' 'Encyclopaedia of systems and
the modern algorithms which we investigated are not a control' (Pergamon, 1987)
substitute for standard good engineering practice, but 10 PROUDFOOT, C.G., CLARKE, D.W., JACOBS, O.L.R., and
can sometimes offer possibilities for further improve- TUFFS, P.S.: 'Comparative study of self-tuning controllers regulat-
ing pH in an industrial process'. IEE Conf. Publ. 252, 1985, Vol. 2,
ments in performance. pp. 359-364
Even with good practice there is a limit to how close 11 PROUDFOOT, C.G., GAWTHROP, P.J., and JACOBS, O.L.R.:
pH can be regulated toward neutrality in any one mixing 'Self-tuning PI control of a pH neutralisation process', IEE Proc. D,
stage. This limit depends on such factors as the titration Control Theory & Appi, 1983,130, (5), pp. 267-272
12 JACOBS, O.L.R., and BRIGGS, M.S.: 'Monte Carlo comparisons
chemistry, the availability and quality of online measure- of estimators for pH nonlinearity', Trans. Inst. Meas. & Control,
ments, the magnitude and rate of disturbances. It may 1984,6, (6), pp. 287-292
vary from plant to plant and can usually only be deter- 13 JACOBS, O.L.R.: 'Recursive estimation for nonlinear Wiener
mined by simulation or experiment. Some existing plants systems by online implementation of Bayes' rule', ibid., 1986, 7, (5),
may operate far from their limit. The CAD package pro- pp. 245-250
14 ROBERTS, P.D.: 'Non-linear control of a neutralisation process',
vides a tool for predicting performance limits in specific Meas. & Control 1971, 4, pp. T151-T157
cases, and, thus, for setting realistic expectations about 15 HEWKIN, P.F.: 'The control of pH using modern algorithms and
performance. It can be used to design controllers for online computers'. D.Phil, thesis, University of Oxford, 1979
existing plant and, also, to influence the layout and sizing 16 JACOBS, O.L.R., and BADRAN, W.A.: 'A computer package for
of proposed new plant. designing pH regulation systems'. Oxford University Engineering
Lab. Report 1506/3, 1983
One difficult feature of some pH problems, which has 17 JACOBS, O.L.R., and BADRAN, W.A.: 'CAD of pH control
not been investigated, is uncertainty about the titration systems'. 9th IFAC congress, Budapest, paper 11.2/D/2, 1984

200 IEE PROCEEDINGS, Vol. 134, Pt. D, No. 3, MAY 1987

You might also like