RC-PID: a control algorithm suitable for precise rate determinations

RC-PID: a control algorithm suitable for precise rate determinations. Douglas R. James. J. Phys. Chem. , 1985, 89 (11), pp 2335–2339. DOI: 10.1021/ ...
0 downloads 0 Views 583KB Size
J . Phys. Chem. 1985,89, 2335-2339 other C1- concentrations. The value was found to be 0.185 times that for C12- or 0.46. The calculated curves in Figure 6 are seen to match the experimental points. Data for lower concentrations of Cl- were taken with the nitrogen laser and treated in the same way, but only that for the highest C1- concentration (200 mM) is shown. Because the calculated curve fits well here, including the time dependence, it is clear that no precursor (2Pl/2C1 atom) with a lifetime comparable to the pulse width (1 ns) can be involved. The absence of any delay in recombination on the 1-ns time scale is in agreement with the small quantum yield of dissociation which implies that the 2P1,2atom (which cannot react with C1to give C12-) does not have any significant lifetime even at the time scale of the diffusive separation of C1 and C1-. The other halides share the same state correlation diagram and have similar quantum yields so that relaxation of the 2Pl/zatom appears to be fast in all cases. In the case of I atom the gas-phase quenching of the 2Pl atom by H2OI4is slightly slower than in the case of C1 (calcuiated lifetime in liquid water 30 ps for I vs. 10 ps for Cl) which is not reflected in the quantum yield. Alternatively, as suggested above, relaxation of the excited state occurs before full separation into the two fragments. In no case was photodetachment observed even though a small yield was reported for C12- in the gas phase.2c On the one hand, solvation of the X2- will lower the energy of X2- and increase the energy necessary to detach the electron. Counter to this effect is the reduction in energy provided by the solvation of the eaqformed. (The photoionization of neutral species in water occurs at much lower energies than under vacuum.) In the case of C12-, where the vertical ionization potential is 4.0 eV,2dthe energy of the photon (3.49 eV) may not be enough to cause photodetachment in the liquid phase. The lowered electron affinity for Br2 and I2 would make detachment more likely in those cases although, in fact, none was seen. (14) Donovan, R. J.; Husain, D. Trans. Faraday SOC.1966, 62, 2023.

2335

Summary Photolysis of several radicals of the type XF in aqueous solution has been experimentally demonstrated. The results have proved to be of value in understanding the nature of the absorption bands. Dissociation has been found to be the main process with a quantum yield of -0.1-0.2 with no photodetachment detected in any case. Both absorption bands of 12- behave similarly and lead to dissociation. For each system it was possible to measure the rate constant for the recombination providing direct measurements in cases where such data had previously been obtained only indirectly. In the case of Cl,, the C1 atom produced also absorbs a photon yielding OH as shown by the effect of added acid on the absorption recovery kinetics. Observation of this reaction confirms the nature of the absorption observed for C1 as charge transfer from solvent. A direct implication of this result is that photolysis of the other atoms which were discussed by Treinin and Hayonlo (Br, I, and H ) would also lead to production of OH by oxidation of water. Oxidation of water by photolysis of H atom which is a reducing species is an interesting suggestion even though it would be difficult to establish because of the weak absorption and short wavelength (-200 nm). It is suggested that picosecond photolysis of X2would bring a number of new aspects to the discussion of recombination reactions because an excited electronic state of the halide atom is produced. In the widely studied example of I + I 12, the atoms are not produced in their excited states, and so electronic relaxation of atoms need not be considered.

-

Acknowledgment. For helpful discussions regarding C12-, we thank Doctors D. M. Chipman, I. Carmichael, and G. N. R. Tripathi of this laboratory as well as Professor A. Treinin of the Hebrew University. This research was supported by the Office of Basic Energy Sciences of the Department of Energy. Registry No. NaC1, 7647-14-5; KBr, 7758-02-3; KI, 7681-1 1-0; KSCN, 333-20-0; Clz-, 12595-89-0; Brc, 12595-70-9; 12-, 12190-71-5; (SCN),-, 34504-17-1.

RC-PID: A Control Algorithm Suitable for Precise Rate Determinationst Douglas R. James Photochemistry Unit, University of Western Ontario, London, Ontario, Canada N6A 5B7 (Received: September 12, 1984)

The RC-PID or rate-compensated proportional-integral-derivative control algorithm is an improvement to the usual PID algorithm. The RC-PID algorithm is analyzed by consideration of the system response function, and comparison is made to two common control functions. The applicability of the RC-PID algorithm to high-precision rate studies is considered, and comparison is made to an earlier implementation.

Introduction Direct titration of a chemical reaction in order to maintain an experimental observable constant yields, in principle, the reaction rate. A common application of this approach is the pH stat, where hydrogen ion or hydroxide ion produced by a chemical reaction is titrated by a standardized base or acid solution in a manner so as to keep the pH constant. This technique requires some form of feedback control in order to determine the appropriate rate of titrant addition. Such “X”-stat techniques are potentially powerful methods for determination of reaction rates, especially for those systems which do not have another convenient observable. Nevertheless, these techniques have not recently been popular. One reason for their underutilization has been the inaccuracies ‘This paper is No. 215 from the Laboratory for Biophysical Chemistry, University of Minnesota, Minneapolis, MN 55455.

0022-3654/85/2089-2335$01.50/0

attendant to the method of feedback control. Of the two common control functions, neither on/off nor simple proportional yields satisfactory rate estimates under all circumstances, as was recognized by Jacobsen et al.’ This problem leads to a significant operator dependence of the determined rates and thus the relegation of the device to lower accuracy applications. The development of suitable control functions has been hampered by the common use of only one titrant, with the notable exception of coulometric generation of both hydroxide ion and hydrogen ion in the same reaction vesseL2 Additionally, analog controllers lack the ability to “remember” the history of a given titration, which limits the potential sources of information available for control. (1) Jacobsen, C. F.; Leonis, J.; Linderstrom-Lang, K.; Ottesen, M. Methods Biochem. Anal. 1957, 4 , 171. (2) Adams, R. E.; Betso, S.R.; Carr, P. W. Anal. Chem. 1976, 48, 1989.

0 1985 American Chemical Society

James

2336 The Journal of Physical Chemistry, Vol. 89, No. 11, 1985 The use of laboratory computers makes possible the development of control functions which utilize chemical information other than only the deviation of the experimental observable from the set point. The availability of chemical and time-dependent information can be used to modify the proportional-integral-derivative or PID algorithm:* a control function normally used for static or slowly varying processes, into a precise and convenient rate-sensitive control function. The modified algorithm is the rate-compensated PID or RC-PID. A significant advantage to the RC-PID is the elimination from the measured rates the artifactual deviations inherent in the on/off or simple proportional control functions. Most importantly, the RC-PID algorithm is a general approach to closed-loop feedback control for systems which vary significantly with time. By use of the RC-PID, any source of chemical information such as absorbance, conductivity, specific ion electrodes, etc., and suitable titrants, including coulometry, may be used to construct an “X” stat. In this paper we will present a general analysis for control of a rate-monitoring instrument by the RC-PID algorithm which encorporates and extends the previous results of James and L ~ m r y . ~

Theory It is necessary to solve for the instrumental response functions pertaining to a chemical reaction being titrated by an “X” stat in order to demonstrate why the RC-PID algorithm is satisfactory for eliminating systematic errors in rate measurements. Define U(t)as the deviation of the experimental observable from the set point. For the example of a pH stat U(t) = pH(t) - pH,,,, where pH,,, is the set point pH. In general, the rate of change of U(t) is given by dU(t)/dt = -?At) - g(v) (1) wheref(t) is the rate of the chemical reaction, g(U) is the control function which adds titrant in order to keep U(t) constant, and y is the proportionality constant between the moles of product produced and the resulting change in U(t). It is possible to examine the time response of the various modes of control by choosing anf(t) which varies strongly with time. A first-order reaction provides a suitable example. Let f ( t ) = kMo exp(-kt) (2) where k is the first-order rate constant and Mo is the concentration of reactant at t = 0. Equation 2 gives the rate of reaction at any time, and insertion into eq 1 yields dU(t)/dt = -ykMo exp(-kt) - g(U) (3) Further analysis requires specific choices for g(U). (a) OnlOff Control. On/off control functions such that when U ( t )falls below some preset maximum, Urn,the “X” stat begins to inject titrant at a constant rate until U ( t ) 1 0 whereupon the injection stops. The cycle repeats indefinitely. If the reaction rate plus instrument response time lag (due primarily to reagent mixing times and inherent delays in the sensor) matches the titrant concentration, U(t) oscillates smoothly about zero. Under most circumstances, however, these conditions do not match and the average U ( t ) # 0 but rather U ( t ) = Uer(t).Moreover, if the reaction rate steadily changes during the time course of the titration, then U,,(t) continuously changes, with the result that the titrant addition rate does not match the reaction rate. Rather, the observed rate equals the reaction rate plus dU,,(t)/dt. On/off control may be discussed quantitatively by substituting the g ( v given by eq 4 into eq 3 C; L’ < U ( r ) < 0,starts when U = Urn

m = {0; u;

0

(4)

(3) Isenmann, R. “Digital Control Systems”; Springer-Verlag: New York,

1981.

(4) Murrill, P. W. “Automatic Control of Processes”; International Textbook Co.: Scranton, PA, 1967; Chapter 8. ( 5 ) Ogata, K. “Modern Control Engineering”; Prentice-Hall: Englewood Cliffs, NJ, 1970; Chapter 6 . (6) Anand, D. K. “Introduction to Control Systems”; Pergamon Press: New York, 1974; Chapter 6. (7) James, D. R.;Lumry, R. W. Methods Biochem. Anal. 1983, 29, 137.

.IO

-

.os

-

a

U

TIME

Figure 1. On/off control with y = IO4, k = 0.001, Urn= -0.05, Mo = 0.01, U (0) = 0.1, and C = 0.0003: (a) instantaneous response, 12.5 s/division; (b) 0.2-s response time lag, 25.0 s/division.

For this case, eq 3 is solved by numerical integration. A typical simulated result is given in Figure l a where nearly instantaneous mixing is assumed in order to illustrate that for a well-tuned on/off control function Uer(t) is approximately constant, hence dU,,(t)/dt = 0. Note that Uer(f) < 0 which may be of concern when pHdependent rate constants are determined. However, dU,,(t)/dt # 0 when the instrument response time is significant and C is large relative to the reaction rate. Figure 1b illustrates extending conditions of Figure l a to twice the time range and allowing a 0.2-s response time lag. The dashed line representing Uer(t) is seen to have a larger slope than in Figure la. In summary, rate measurements can be made with reasonable accuracy if the on/off mode of control is well tuned. However, the requisite matching of C and Urnto reaction rates may introduce significant day-to-day variability into rates determined by on/off control. ( b ) Simple Proportional Control. Proportional control derives its name from the mode of operation. If U(t) IUrn,titrant injection occurs at some externally adjustable maximum rate. If Urn < U ( t ) < 0, the titration rate is linearly proportional to U ( t ) / U m . g(U) for proportional control is g[u) =

1E

CU(r)/U,;

urn urn< U ( r ) < 0

U(r) < 0

< U(r)

(5)

It is apparent that for all cases titration attempts to force U(t) to zero, but in order for any titrant injection to occur U(t)cannot equal zero. Furthermore, as the reaction slows down, Uer(t) decreases. This leads to a titration rate equal to the sum of the reaction rate plus a necessarily varying dUor(t)/dt. Substitution of eq 5 into eq 3 and integrating numerically yield U(t). A typical simulated result is shown in Figure 2 where nearly instantaneous mixing is assumed and the experimental parameters are the same as in Figure 1. For a well-tuned value of C = 0.0035, the titration rapidly settles to a smoothly varying addition of titrant. Note that dU=(t)/dt has a positive slowly decreasing value. If Cis changed, both U(t) and dU,,(t)/dt were observed to change significantly in a manner which makes it very difficult to satis-

The Journal of Physical Chemistry, Vol. 89, No. 11, 1985 2331

RC-PID Control Algorithm

0 0

d

" oh'--.

t

-----I

--+-t--

-1!

u:\ -.5

-.IO

TIME

TIME

Figure 2. Simple proportional control, with conditions as in Figure la.

factorily tune the controller. Under these nearly optimal conditions dU,,(t)/dt is still larger than for on/off control. In summary, simple proportional control has the intrinsic properties that neither dU,(t)/dt nor U(t)ever equals zero. This yields rate estimates in error under all circumstances. Tuning the controller can only reduce errors, not eliminate them. Accordingly, on/off control has been the mode of choice for determining rates since both Ucr(t)and dU,(t)/dt are typically less than those for simple proportional control. However, both modes of control do have a finite varying U,,(t), the magnitude of which is dependent on C and Urn. This makes both control modes sensitive to operator-dependent bias, and therefore neither mode of control can yield a totally satisfactory estimate of the reaction rate. (c) PID Control. A useful control function is the proportional-integral-derivative or PID algorithm3

g(U) = KpU(t)- Kd dU(t)/dt

+ KiX'U(s) ds

(6)

where Kp, Kd, and Ki are adjustable constants. The algorithm functions by using three properties of U(t): the magnitude of U(t) (proportional), the rate of change of U ( t ) (derivative), and the time history of U(t) as measured by the integrated value of U(t) (integral). This algorithm is usually implemented in relatively static systems where a steady "loss" tends to force U ( t ) to be nonzero. Application of the PID algorithm to rate determinations requires two conditions to be met. Firstly, the system must behave smoothly near the set point otherwise both the integral and derivative terms become unstable and can cause oscillation. Secondly, the incremental response dg(U) must be small relative to g(U) otherwise small changes in U ( t )may cause large changes in g(U) leading to instability. This control function has the possibility for g(U) to be negative, as opposed to the on/off or proportional algorithms introduced above where g( v) is solely positive or zero. This allows eq 2 to be analytically integrated, yielding the instrumental response function in terms of U(t). Investigation of the PID algorithm for first-order kinetics can be broken down into the effects of adding each successive component to the algorithm. ( i ) Proportional Control. Proportional control, P = KqU(t), attempts to force U ( t ) to zero in a manner similar to simple proportional control except that P can be both greater or less than f i t ) . For an instantaneous response time dU(t)/dt = T k M o exp(-kt) - K,U(t) (7) which when integrated and solved for the initial boundary condition of U(0)= Uogives U(t) =

( -)

YkMo UO- k - K p

exp(-Kpt)

rkMo exp(-kt) +k - Kp

(8)

Realizable solutions to eq 8 require that 0 C K p and K p # k, Figure 3 shows U(t) from eq 8 plotted vs. time for various values of Kp,with all other conditions as in Figure 1. As K p increases,

Figure 3. Proportional control, showing response to various values of Kp: (a) 0.5, (b) 1.0, (c) 2.0, (d) 4.0, ( e ) 8.0.

the titration response to greater, converging at very large K 4c

Figure 5. RC-PID response to various of KiRat fixed values of Kp = 0.5, Kd = 0.5, and Ki = 5.0: (a) 0.1, (b) 0, (c) -0.1, (d) -0.2, (e) -0.3.

good early time control due to the inherent oscillations of a large Ki even though the long time behavior of U(t) is quite satisfactory. Removal of the early time oscillations would allow the PID algorithm to function satisfactorily for rate determinations. (io) Rate-Compensated PZD. Removal of the early time oscillations can be done by modifying the PID algorithm to give dU(t)/dt = -ykMoe-ki - KpU(t)

+ Kd dU(t)/dt

- K i s U ( s ) ds - KiR

(16) where KiR is a constant titration rate. Equation 16 can be solved by making the substitution

{

U ( t ) = e-(b/2)f(1 - bt/2)

(

ba 2(k - b/2)2 For bZ

< 4c

S ( t ) = s U ( s ) ds + R

Uo+ -

(17)

k:b/2)+

+

I

ak e-(k-bP)t (14) (k - b/2)2

where w = (4c - bZ)'i2/2. The specific equation describing U(t) is determined by the value of 6 = K: - 4Ki(l - Kd) such that if 6 is greater than zero, eq 13 applies, if 0 is equal to zero, then eq 14 applies, and if 6 is less than zero, eq 15 applies. Figure 4 shows U ( t ) for the PID algorithm plotted vs. time at various values of Ki, K p = 0.5, and Kd = 0.5, with all other conditions as in Figure 1. The critical value for Ki is 0.125. All solutions to Ki < 0.125 yield complex behaviors of U(t)corresponding to a triple-exponential decay, and this case is not a suitable control function for the determination of reaction rates. Where Ki L 0.125 there exist potentially satisfactory control functions. Figure 4 shows that the larger the value of Ki, the smaller the extrema observed in U ( t ) . Thus, although both Ki > 0.125 and Ki = 0.125 tend to singlaexponential decay, Ki > 0.125 provides the best possibility of minimizing the extreme in U(t). In practical use, the choice of a large Ki can cause significant oscillations inherent to the control function. This effect is worsened by any instrumental response time lag. The net result is the choice of Ki which is a compromise between minimizing U ( t ) and dU(t)/dt and preventing significant oscillation. In summary, K : - 4Ki(1 - K2) < 0 provides a satisfactory means for forcing U ( t ) to zero. However, this does not provide

and by using the substitutions of eq 11 and 12, yielding an equation of exactly the same form as eq 12. This equation is solved at the initial conditions S(0) = R and S'(0) = Uo.Since the general solution to eq 16 is the same as eq 12, eq 16 applies for determining V(t),and K: - 4Ki(1 - Kd) < 0 is the most useful solution to eq 16 which yields

Figure 5 shows the time response of eq 18 for various R's at Uo = 0, with all other conditions the same as in Figure 1. R = -0.2 yields a value of KiR = 1 which equals the initial rate for this sample. Curve d in Figure 5 demonstrates that when the initial reaction rate is compensated by a constant titration rate, U ( t ) is about zero. There is a slight maximum upon which the underlying oscillatory behavior is impressed, but the magnitude of the extrema in U ( t ) and dU(t)/dt are both significantly smaller than the corresponding values for either on/off or simple proportional control. Thus, the rate-compensated PID algorithm improves the early time behavior of U(t) for any choice of Kp, Kd, Ki, KiR = initial rate and K: - 4Ki(l - Kd) < 0. Although the above discussion has been solved for a first-order reaction, the results apply to other reaction orders. The range over which U ( t ) and dU(t)/dt varies for the zero-order kinetic case can be demonstrated by solving dU(t)/dt = -7k - K,U(t)

+ Kd dU(t)/dr

- KiJfU(s) ds - KiR (19)

where kMo exp(-kt) is replaced by k , a zero-order reaction.

RC-PID Control Algorithm Equation 19 is solved for the initial conditions of eq 16, yielding

U(t) =

where a = T k / ( l - Kd). Substitution of b = K p / ( l - kd) and wz = ( K i / ( l - &) - ( K p / ( l- Kd)/4) into eq 20 at U,, = 0 and R = k yields U ( t ) = 0; that is, the RC-PID produces no oscillations. If R # y k , U(t) oscillates to U(t) = 0. The difference in control between zero and first order at KiR equal to the initial rate is the growth of the small maximum for the first-order case. This implies that control varies from “perfect” for zero order to very small deviations for first order. Simulations performed by varying R show that acceptably rapid attainment of steady state occurs when KiR is within 5% of the initial rate. In summary, since most experimental reaction studies can be made to fall somewhere between zero and first order, the RC-PID provides a satisfactory algorithm for the determination of rates. The error of the initial rate is substantially lower than the errors expected from either the on/off or simple proportional control algorithms. Extension of the RC-PID algorithm to reaction orders greater than first will increase the errors in the rate estimate, but they will be less than for the other two modes.

Discussion Equation 16 (RC-PID) provides an improved control function over eq 1 1 (PID) as shown by the corresponding instrumental response function curves of Figures 5 and 4. Hence, the major objection to either the on/off or simple proportional control modes (of intrinsically inaccurate rate control) is removed by virtue of an analytically exact integral control mode which prevents any long-term deviations of U(t) from the set point coupled to an accurate initial rate of titration. Thus, the problem of implementing the RC-PID controller for rate measurements becomes one of accurately estimating the initial rate. James and Lumry’ approached this problem for the pH stat by suitably linearizing the pH gradient with a mixed buffer system and then determining the initial rate by measuring the time it took for the pH to change by a fixed amount after starting the reaction by rapid injection of a reagent. Due to the inaccuracies attendant to estimating the initial rate, James and Lumry also found it useful to begin titration of the reaction at a rate fixed by the initial rate estimate and then

The Journal of Physical Chemistry, Vol. 89, No. 11, 1985 2339 to correct the deviations from this fixed titration rate after a suitable delay. Control was then transferred to the PID in a manner which was similar to eq 16. From the results of this paper, it can be seen that it would be better to go immediately to the PID after the determination of R or at the most after one cycle of steady titration (so as to allow the system to stabilize). The above observation points out the difficulty in initializing accurately a system which has an appreciable response time lag. It is clear that this is the source of oscillations at early times, and extension of precise control to times earlier than ca. 10 s remains a problem. (Nevertheless, this is an improvement of ca. 10 over the other systems.) This start-up instability will occur for any system where the sensor has a time constant of the order of seconds. There are several potential solutions to this problem. The first is to use a sensor with a much faster time constant; pH electrodes with millisecond response times have been reported* and should improve results until the time constant for mixing becomes the limiting factor. The second solution is to use a suitable optical or conductivity measurement whereby there is no appreciable electronic delay. This solution requires a suitable observable and would be practical for many applications. A third solution is to determine the instrumental response function F to a step-function change of titrant and to use this information to effect a deconvolution of the observed changes, C, since it is true that

C ( t ) = x ‘ F ( t - s) V(s)ds

(21)

where U is the true error function. Although seemingly complicated, this procedure has merit because of the speed of computer calculations with a suitable look-up table. A less attractive alternative is to introduce a phase-shift parameter into eq 16 as this would force the analytical response into oscillation for a time period longer than that of the impulse response. In conclusion, James and Lumry’ presented a preliminary version of the RC-PID algorithm and presented experimental evidence for its utility. This paper presents a theoretical analysis of their algorithm and extends their results into a completely general control algorithm suitable for high-precision rate-monitoring instruments. Computer simulations utilizing the RC-PID algorithm correspond very well to results obtained previously by James and Lumry. (8) R. Berger, personal communication.