process-model-based control of wastewater ph a …
TRANSCRIPT
PROCESS-MODEL-BASED CONTROL OF WASTEWATER pH
by
GAYLON LYNN WILLIAMS, B.S.
A THESIS
IN
CHEMICAL ENGINEERING
Submitted to the Graduate Faculty of Texas Tech University in
Partial Fulfillment of the Requirements for
the Degree of
MASTER OF SCIENCE
IN
CHEMICAL ENGINEERING
Approved
Accepted
August, 1989
• f • •«
T5
ACKNOWLEDGEMENTS
I am deeply indebted to Dr. R. Russell Rhinehart, chairman of
my advisory committee, for his valuable advice, direction, and
financial support. I also express a sincere appreciation to Dr. J.
B. Riggs, my other committee member, for his suggestions and criti
cisms throughout this work.
I want to thank Dr. Rhinehart and Dr. Riggs for giving me
permission to quote portions of their works. Appreciation is
extended to Mrs. Sue Willis for her clerical assistance throughout
my graduate program and, finally, I wish to take the opportunity to
thank ray parents for their constant encouragement and dedicated
guidance.
11
/
TABLE OF CONTENTS
PAGE
ACKNOWLEDGEMENTS ii
LIST OF TABLES vi
LIST OF FIGURES vii
LIST OF SYMBOLS ix
CHAPTER 1 INTRODUCTION 1
CHAPTER 2 FUNDAMENTALS 5
2 .1 The Interpretation of pH 5
2.2 The Titration Curve and Its
Influence on the Process 6
2.3 Rangeability and Sensitivity 10
2.4 Characteristics of Strong and Weak Acids (or Bases) and Buffering Effect 14
CHAPTER 3 LITERATURE REVIEW 18
3.1 Conventional Approaches to pH Control 18
3.2 Process Model-Based Control Strategy 21
3.3 Overview of Process Model-Based
Control 30
3.3.1. PMBC Advantages 31
3.3.2 PMBC Disadvantages 34
3.4 Previous PMBC Wastewater pH
Control Work 36
CHAPTER 4 PROCESS SIMULATOR 44
4.1 Introduction to the Simulator
Development 44 iii
PAGE
CHAPTER 5
CHAPTER 6
4.2 Simulating the Reaction Mechanics...
4.3 Simulating the Mixer Fluid Dynamics
4.4. Simulating Instnomentation Noise....
4.5 Simulating Instrumentation Response Time Lag
4.6 Simulating Nonstationary Wastewater Disturbances
CONTROLLER MODEL AND STRATEGY
5.1 Model Parameter Identification
5.2 Control Strategy
5.3 Options and Variations
RESULTS AND DISCUSSION
6.1 Regulatory Control
6.2 Step Upset
6.3 Ramp Upset
6.4 Large Finishing Blender
6.5 Model Mismatch and Calibration Errors
6.6 Varied Set Ratios for Base Split...
6.7 Variable Base Split Ratio
6.8 Weighting Factors in the Least Squares Minimization
6.9 pH Setpoints Other than Seven
44
45
47
49
50
51
51
53
56
60
60
69
76
79
82
84
86
90
95
IV
PAGE
CHAPTER 7 CONCLUSIONS AND RECOMMENDATIONS 97
7.1 Conclusions 97
7 .2 Reconmiendations 98
LIST OF REFERENCES 101
APPENDIX A IONIZATION CONSTANT OF WATER 9CRC, 1983) 104
APPENDIX B MULTI-VARIABLE NEWTON' S METHOD 106
APPENDIX C RANDOM NOISE 108
APPENDIX D AUTOREGRESSIVE DRIFT 109
APPENDIX E FILTERING PROCESS VARIABLES AND
SIMULATING INSTRUMENTATION TIME LAG 110
APPENDIX F LEAST SQUARES MINIMIZATION 112
APPENDIX G SPLIT CALCULATOR 116
APPENDIX H FILTERED STANDARD DEVIATION 117
APPENDIX I COMPUTER CODE 118
LIST OF TABLES
PAGE
Table 2.1: Titration Curve Slopes (process gain)
Table 6.1: Initial Wastewater Composition for Figure 6.1
Table 6.2
Table 6.3
Table 6.4
Wastewater Compositions for Figure 6.7.
Wastewater Compositions for Figure 6.10
lAE Results for Modeling Errors Introduced Into the Step Change Conditions of Section 6.2
Table 6.5: lAE Results for Various Base Split Ratios...
Table 6.6: lAE Results for Various Tuning Parameters for the Step Change Conditions Presented in Section 6.2
12
63
71
78
85
87
Table A.l Water Ionization Constant.
94
105
VI
LIST OF FIGURES
PAGE
Figure 2.1: The Process Gain Illustrated for a Simple Weak Acid Plus Salt in Water Titrated with NaOH at 2980K 8
Figure 2.2: The Characteristic Curves of Several Wastewater Compositions 9
Figure 2.3: The Process Gain Change for the Weak Acid System of Figure 2.1 11
Figure 3.1: The Chemistry of a Hypothetical Acidic Wastewater 38
Figure 3.2: The Chemistry of a Single Weak Acid and Strong Base Reaction System 41
Figure 4.1: The Actual Wastewater Neutralization System 48
Figure 5.1: Functional Diagram for PMBC of an In-line pH Neutralization System 56
Figure 6.1: Simulator Results for Controlled Effluent pH for a System with Normal Nonstationary Process Behavior 61
Figure 6.2: Comparison of Titration Curves for the
Process versus the Model for Figure 6.1 64
Figure 6.3: Weak Acid Concentration for Figure 6.1 65
Figure 6.4: Strong Acid Concentration for Figure 6.1 66
Figure 6.5: Coimnon Ion Salt Concentration for Figure 6.1 67
Vll
PAGE
Figure 6,6: Weak Acid AG of Dissociation for Figure 6.1 68
Figure 6.7: Controlled Effluent pH Response to Step Changes 70
Figure 6.8: Comparison of Titration Curves for the Process versus the Model for Times of 30 and 600 Seconds on Figure 6.7 74
Figure 6.9: Comparison of Titration Curves for the Process versus the Model for Times of 600 and 1350 Seconds on Figure 6.7 75
Figure 6.10: Controlled Effluent pH Response to a Ramp Change 77
Figure 6.11: Comparison of Titration Curves for the Process versus the Model for Times of 30 and 1500 Seconds on Figure 6.10 80
Figure 6.12: Comparison of pH of Finishing Blender to pH of Effluent from the Neutralization Process 81
Figure 6.13: Base Flow Split Ratio Calculated by Controller versus Time 89
Figure 6.14: Comparison of Effluent pH's for Two Different Weighting Factor Sets 92
Vlll
LIST OF SYMBOLS
Alphabetical
ajj - activity of H+ ion in solution
X - amount of weak acid dissociated, mol/lit
Y - vector of measurable process outputs
Af - fictitious acid concentration, mol/lit
Ka - chemical reaction equilibrium constant for the acid-base
reaction
K^ - water ionization constant
pH - wastewater pH
R - universal gas constant
T - wastewater or reagent base temperatures
Greek
a - initial concentration of strong acid, mol/lit
^ - initial concentration of weak acid, mol/lit
8 - mount of hydrogen ionized from H2O, mol/lit
e - base concentration, mol/lit
7 - initial concentration of salt, mol/lit
AG - Gibbs free energy of change, cal/gmol
AGf - fictitious Gibbs free energy of change, cal/gmol
p - density
IX
Acronvms
AF - acid flow rate
BOH - base
CSTR - continuous stirred tank reactor
HA - acid
HW - weak acid
MW - salt
PI - proportional-integral
PMBC - process model based control
SISO - single input single output
^
CHAPTER 1
INTRODUCTION
Chemical process wastewater typically contains several weak
and strong acids and their salts and must be neutralized before
discharge into the environment. The level of acidity in the ef
fluent is conventionally measured with a pH meter and the acid is
easily neutralized by the addition of a relatively small amount of
a strong but inexpensive base.
The composition of a wastewater stream can vary considerably.
The freestanding acids and bases (sulfuric acid, sodium hydroxide,
etc.) are typically encountered, yet some industries also produce
"combined" acidic or basic salts, which form weak acids or bases by
hydrolysis upon dilution of the waste by the receiving water
(Patterson, 1975). Therefore, for control of the effluent stream
pH, the acidic and basic salts must be treated along with the
freestanding acids and bases in the wastewater stream. The waste
water treatment processes employed for the neutralization of the
freestanding acids and bases are simultaneously effective in con
trolling the acidic and basic salts. However, control of waste
water neutralization is subject to several difficulties, including:
1) The pH response to base addition is a highly nonlinear 'S'
shaped curve and process gain can change by 10 orders of magnitude.
2) The multicomponent system is a buffer solution making the
process gain a complicated function, a) dependent on the non-
stationary wastewater composition, b) and dependent on temperature.
Finally, 3) the rate of base addition depends on the plant effluent
rate. For these reasons, control by a conventional PID feedback
mechanism is ineffective and, industrially, neutralization of such
waste requires either sequential neutralization steps and interme
diate hold ponds or batch operations (Shinskey, 1983; Moore, 1978).
The capital and expense associated' with such techniques make a
continuous flow-through process attractive. Additionally, a better
controller would reduce the magnitude and frequency of pH discharge
events.
Some of the many pH control applications include: boiler
water treatment, chemical and biological reactions, municipal waste
digestion, acid pickling and etching, cooling tower water treat
ment, electrohydrolysis, and coagulation/precipitation. However,
wastewater treatment is the most difficult due to the pH - 7 target
and the unknown and non-stationary fluid composition. Consequent
ly, demonstration of a strategy for wastewater neutralization
suggest effectiveness for pH control of these other processes.
The subject of this study is the simulation of a new in-line
pH control strategy for a multicomponent process wastewater.
Neutralization is accomplished by splitting the base flow into two
streams and sequentially injecting it into the wastewater line.
The supervisory controller then generates a titration curve from
the on-line measurable data and uses this titration curve to pre
dict the required base flow rate setpoint. A conventional Single
Input Single Output (SISO) Proportional-Integral (PI) controller
is used to control the base flow rate. The supervisory controller
generates the titration curve by using a process model that is
based on the phenomena of the process, and is coined nonlinear
Process Model Based Control (nonlinear PMBC).
New opportunities are developing in process control because of
the increasing potential and availability of computers in the work
place. One of these opportunities is the nonlinear PMBC control
ler. Nonlinear PMBC controllers use a phenomenological model of
the process with adaptive parameters; overcome many of the disad
vantages of the 3-term PID controllers; and have advantages over
other modern linear controllers in speed, accurate decoupling,
setpoint tracking, and both steady-state and dynamic optimization.
Specifically, this study is directed toward the application of
a PMBC control strategy for pH control of wastewater. Current pH
control strategies are difficult to implement and are either labor
or capital intensive and prone to pH discharge "events." There
fore, an "intelligent" controller for a continuous process could
reduce the cost of maintaining pH control and reduce the frequency
and magnitude of environmental upsets. This intelligent controller
would require adaptive parameters, be computationally fast, and
reflect the true phencnicna of the actual process.
In general, process control applications are made difficult by
the process characteristics of nonlinearity, dead-time, and multi-
variable coupling. The successful technique development and demon
stration of PMBC on wastewater pH control would intimate its effi
cacy in other process control applications. Some of the chemical
process applications would include reactors, distillation columns,
extractors, heat exchangers, and pH neutralization; some of the
non-chemical process control applications would include robotics
and missile guidance.
CHAPTER 2
FUNDAMENTALS
Modeling of acid/base neutralization requires xise of kinetic,
thermodynamic, and process dynamic behaviors; and, before
attempting to solve a pH neutralization problem, these fundamental
aspects must be understood. This section will also review control
valve rangeability and characteristics of reagents in solution,
both of which are pertinent to the research.
2.1 The Interpretation of pH
The operational definition of pH is:
pH - -Logio(aH * [H+]) (2.1.1)
where ajj is the hydrogen ion activity, and [H^] is the hydrogen ion
concentration (gmole/liter). The hydrogen ion activity is
approximately equal to 1.0 liters/gmole, and is usually not shown
in pH calculations; leaving us with the familiar definition of pH
as
pH - -Logio[H+]. (2.1.2)
Therefore, pH is, a unitless measure because of the hidden units
left from the hydrogen ion activity, which we chose not to show in
the definition of pH.
The measurement of pH is a meaningful measure of hydrogen ion
concentration only for dilute concentrations of an acid or alkali
dissolved in water. This limitation on concentration exists
because only at high dilution is Henry's law valid, and only then
does concentration become equal to hydrogen ion activity (which is
the characteristic actually being measured in a pH probe).
Industrial wastewater, however, is usually sufficiently dilute;
therefore, the application of Henry's law can be justified.
Some acids dissociate readily in water. These are known as
strong acids (hydrochloric acid, sulfuric acid, etc.). There are
some acids, however, that resist hydrolysis and do not dissociate
readily in water. These are known as weak acids. Water also
dissociates and adds hydrogen ions such that [H''"][OH'] = lO' ' .
Thus, as an equilibrium constraint, the dissociation of water
molecules participates in the equilibrium balance of all reactions
in aqueous solution. Pure water has a pH of 7 at 24°C, 0.IN HCl
has a pH of 1.1 at 25^0, and 0. IN NaOH has a pH of 13.0 at 25^0,
for example (CRC Handbook, 1983).
2.2 The Titration Curve and Its Influence on the Process
There is usually a single waste treatment facility for an
entire plant, and, therefore, the treatment facility must handle a
mixture of many streams that contain a variety of chemicals. For
single strong acids and bases the reagent demand can be
theoretically calculated from a single pH measurement. Most
treatment facilities, however, must handle a mixture of reagents
and various metal ions. For these cases, the reagent demand can
best be determined by evaluating an actual wastewater titration
curve. Therefore, the basic information required for pH control
system design is the titration curve, sometimes referred to as the
characteristic curve of the equalization curve.
If the identification, concentration, and equilibrium
constraints of each specie in the wastewater stream were known, the
titration curve could be calculated. Since acid/base/salt
reactions are extremely rapid compared to the time scales of other
dynamic process effects, such as mixing, one can assume that the
reactions are in thermodynamic equilibrium. Using thermodynamic
equilibrium, the initial component concentrations can be used to
calculate hydrogen ion concentrations, which can be converted to pH
by the logarithmic relationship. The titration curve of Figure 2.1
shows pH for a simple acid solution as a function of base addition.
Effluent pH is the measured variable and base flow rate is the
manipulated quantity in a neutralization control system; and the
slope of the titration curve at any pH setpoint is, therefore, the
apparent steady state process gain. The titration curves of Fig
ures 2.1 and 2.2 illustrate the extreme nonlinearity (change in
8
O
o o o
u 41
CO -^
en « o E 00
- < N ^ <9 U
C V u c o
CO »> oa
- -^
<
CO O O 00
3 ON CM
o p-i iJ a « e •^ X ui O « z U X O iJ
T3 O • « U 0) 4 4J Wi (Q
0) iJ 3 "^
^ H ^ i-t U
« C 4-1
« IS o c CO "f^ QB 0) 4J O .-^ O « U CO
0U CO
« 3
«
3 60
1.1 at >
in
> tfl u c 3 O
O - •
o — i-t O
— E u o
u 03 u <q
• •
CN
CM
u 3 CO
K) CN
^
10
gain) which may be encountered in pH control. Figure 2.3 shows
chac this gain changes from 81.2 to 1588.7 when pH changes from 6.0
to 8.3. Around pH 7 small pH measurement error can lead Co big
mistakes in Judging process gain. As wastewater composition
varies, both the shape and location of the titration curve (and
consequently gain) change must be updated. A good example of
process gain change for an actxial plant wastewater is presented in
Table 2.1 (Piovoso and Williams, 1985).
2.3 Rangeability and Sensitivity
The control of pH, as countless articles, papers, and
textbooks point out, is characterized by extreme rangeability and
sensitivity. Rangeability is the ratio of the maximxim to minimum
flow rate which must be controllably delivered. Flow control
devices xised in manufacturing a product ordinarily do not require a
wide range of flow rate. They are operated at some process optimum
condition, profitable production rate, and use feedstocks of
relatively consistent quality (Shinskey, 1983). Treatment of
waste, however, is another matter. If the plant manufactures
piecework, or if some of its areas operate discontinuously, wide-
ranging composition and flow rate of the plant effluent are likely
to be encountered. Often the base flow rate required for
11
<
CO
IS
00 c ^
9i o U
C 4
V
3 00
CO N t o ir> '^ K> c s T — I — I — I — I — I — r O O C O N C D i O ' ^ r O c s
u
Q. O = S
\
12
Table 2.1: Titration Curve Slopes (process gain)
Sample pH - 6.5 pH - 8.5
1 2.5 2.15
2 1.0 0.53
3 0.47 0.46
4 0.91 0.62
5 1.42 0.75
6 1.49 0.56
7 1.49 0.63
8 0.82 0.87
9 0.27 0.26
Note: where gain is in pH (meq/1) and samples were taken at nine consecutive hourly intervals.
13
neutralization varies over a 50:1 range, which is a problem because
control valves normally show effective control only over a 10:1
flow range.
The pH scale corresponds to hydrogen ion concentration from
10° to 10'^^ moles per liter. The measuring electrodes can respond
to changes as small as 0.001 pH, so that some instruments can track
hydrogen ion concentration changes as small as 5*10"^^ moles per
liter at 7 pH (McMillan, 1984). No other common measurement has
such tremendous sensitivity. Sensitivity is the ratio of the
maximum value of a measurement to the minimxim detectable change,
5*10"^0/100 - 5*10-12, for the above example. The implication of
such great rangeability and sensitivity can be illustrated by
considering a continuous feedback neutralization system for a
strong acid and a strong base. The reagent flow should essentially
be proportional to the difference between the hydrogen ion
concentration of the process fluid and that of the set point. A
reagent control valve must therefore have a rangeability greater
than 10:1 for a set point of pH 7 when the influent stream
fluctuates between 0 and 7 pH. Moreover, uncertainties in the
control valve stroke translate directly into pH errors, such that a
valve hysteresis of only 0.00005Z can cause an offset of 1 pH unit
for a 7 pH set point (McMillan, 1984).
14
2.4 Characteristics of Strong and Weak Acids (or Bases) and Buffering Effect
The words "strong" and "weak" have dual meaning when applied
to acidic and basic materials. As previously discussed, "strong"
when applied to pH measurement refers to the degree of completion
of the hydrolysis (ionic dissociation) of the material when added
to water. Another definition of "strong" refers to the
concentration of the material, e.g., a 95Z acid solution is
"stronger" than a 4Z acid solution. Increasing acid strength, in
the sense of the latter definition, is seen to move the titration
curve horizontally to the right if the acid becomes stronger in
concentration, or to the left if the acid becomes weaker (Moore,
1978). Increasing strength in the former definition, however, adds
a severe complexity to the regulation of pH by moving the titration
curve vertically upward if the degree of ionization (hydrolysis)
decreases, or downward if the degree of ionization (hydrolysis)
increases. From now on, to prevent the confusion about the degree
of acidity, the following terms will be used, "strong" as "easily
hydrolyzed," "weak" as "not easily hydrolyzed," "concentrated" as
"high concentration," and "dilute" as "low concentration."
It has been pointed out that the measurement of pH is not only
a measure of the total acid components or total base components of
the solution, nor of only the degree of ionization (Moore, 1978);
15
rather, pH is a measure of hydrogen ion concentration which itself
depends on many factors, including degree of ionization and
component concentrations. Strong acids and strong bases ionize
almost completely when dissolved in water. Therefore, if
equivalent amounts of the strong acid and strong base were added to
the water, the resulting solution would be neutral. The hydroxyl
ions from the base would combine with the hydrogen ions from the
acid, and would form salts, which would have a pH of 7, or are
neutral.
The situation is quite different when a weak acid is titrated
with a strong base. A weak acid dissociates in an aqueous solution
to yield a small amount of hydrogen ions.
(i) HA -^—^ H+ + A".
When hydroxyl ions are added, they are neutralized by the
hydrogen ions to form water.
(ii) OH- + H+ -*-^ H2O.
The removal of the hydrogen ions disturbs the equilibrium
between the weak acid and its ions. Consequently, more HA ionizes
to reestablish the equilibrium. The newly produced hydrogen ions
can then be neutralized by more hydroxyl ions and so on until all
16
of the acid hydrogen originally present is neutralized. The
overall result, the sum of reactions (i) and (ii), is the
titration of HA with hydroxyl ions.
(iii) HA + OH" -•—^ H2O + A".
The number of equivalents of hydroxyl ions stoichiometrically
required, equals the total number of equivalents of hydrogen
present (as hydrogen ions plus HA) and not simply the number of
hydrogen ion equivalents initially present. However, the pH at the
exact indolent (equivalence) of the titration is not 7. The pH is
higher because of the hydrolysis of the A" ion, because reaction
(iii) itself is an equilibrium reaction. In the absence of any
remaining HA, the A" ion reacts with the water to produce hydroxyl
ions and the undissociated weak acid, HA. (Because thermodynamic
equilibrium conditions must always be satisfied in solutions of
acids and bases, the hydrogen ion concentration and pH during the
titration can be calculated from K^ expressions.)
Similarly, if equivalent amounts of a strong base and a weak
acid (or a strong acid and a weak base) are mixed together, the
resulting solution will not be neutral because the undissociated
weak acid (or base) will not neutralize the "excess" strong base
(or acid) . As a result of this phenomenon, it will always require
more of the strong reagent to neutralize the weak reagent than the
17
original pH of the weak reagent would indicate. For example, a
sample of wastewater with a pH of 2 will require more of a strong
basic reagent to neutralize if the acidity is caused by acetic acid
(a weak acid) than if by hydrochloric acid (a strong acid).
Buffering is the capacity of a solution to resist changes in
pH. A weak reagent buffers by holding a reserve of undissociated
acid or base. Further, the amount of reserve ions is dependent on
the availability of companion ions. For example, consider a weak
acid being neutralized by a strong base. At low pH values, the
acid has a great capacity to absorb hydroxyl ions from the base
because of the reserve of the undissociated acid. As the base is
titrated into the solution, hydroxyl ions are neutralized, the
equilibrium of the reaction shifts, releasing more hydrogen ions,
and resulting in little change in pH. Thus buffered solutions
resist change in pH. However, as more caustic is added, pH will
finally approach a point where the reserve capacity of ions is used
up. At this point, pH will begin to change very rapidly with the
addition of caustic. Buffering, then, provides a built-in pH
regulation that is both helpful and detrimental to control (Moore,
1978). It is helpful wherein resistance to pH change makes the pH
titration curve much less sensitive. However, it is detrimental
because the solution is seldomly neutralized with the base flow set
point which is evaluated from the apparent process pH.
CHAPTER 3
LITERATURE REVIEW
3.1 Conventional Approaches to pH Control
Linearization attempts, adaptive control, and gain scheduling
are three methods that have been discarded as likely control strat
egies for pH neutralization since those strategies do not compen
sate well for the extreme nonlinearities of the process. If the
wastewater titration curve was known, a supervisory controller
could then feedforward a base flow rate setpoint from the measured
input pH (Gray, 1984). Such a controller is now commercially
available (Leeds and Northrup, 1984). However, it is inefficient
because the input pH is relatively insensitive to acid
concentration, and the titration curve must be determined off-line.
Their controller cannot automatically respond to these temporal
composition changes.
Another commercially available controller divides the pH
region into three sections with a different controller gain chosen
for each pH section (LFE, 1987; OMEGA, 1987). As the measured
effluent pH moves among the three sections, the controller switches
to the appropriate controller gain for optimum control. Again,
however, as the influent composition changes, the gain for each of
the three sections must be manually reset. The fact that special
18
19
controllers are commercially available shows the widespread impor
tance and difficulty of pH control.
Balhoff and Corripio (1983) and Jeffreson (1983), in separate
works, addressed some of the control related aspects through simu
lations , of different adaptive proportional-integral-derivative
(PID) controllers. However, both works retained the PID controller
structure (and its limitations) and neither addressed typical
industrial complications of measurement and modeling errors.
Shinskey (1983) discusses several PID controller applications. He
thoroughly documented the process gain characteristics and dis
cussed the control difficulties. He uses conventional linear
control theory (transfer function notation) and indicated some
additional measures (sequential controllers, holding tanks) re
quired for adequate control.
Such conventional PID control schemes show several problems:
(i) The controller responds only after an upset occurs,
(ii) Detection of a pH upset causes the response of
increasing the base addition rate until the pH is at
target (pH—7). The final base rate is unknown, so
for process/controller stability the response is
slow. Until the final addition rate is reached, the
pH is out of specification.
20
(iii) Several controller parameters have to be adjusted,
most of them manually, to accommodate the changes in
the process.
Gustafsson and Waller (1983, 1986) reported on the problems
and dangers of feedforward pH control and attempted to find a
reaction invariant model suitable for a linear control strategy.
Since a prior knowledge of both the reaction invariant model and
some of the chemical content is needed, an off-line identification
step is necessary. Because the reaction invariant model is
constant their controller is not adaptive to residence time
changes. The changes in the time constant are caused by such
factors as the varying reactor throughput or aging electrodes.
Albert and Kurz (1985) experimented with a model reference
adaptive control system which adjusted PI controller gain. A
superimposed adaptive control loop alters the gain of the main
control algorithm so that in the case of a control deviation the
pH-value of the effluent stream approaches its set point by a pre
scribed trajectory. The prescribed trajectory has nothing to do
with the prediction of the titration curve, but is based on the
speed of the control deviation. For stability reasons the integral
decreasing function of the trajectory curve must decrease slowly;
therefore, it cannot handle a fast changing process.
21
Self-tuning PI control with a linear first order process model
was investigated by Proudfoot and McGreavy (1983) who developed a
conventional direct-digital control algorithm using Z-transform
notation. Since their linearized model does not represent the
highly nonlinear process, it does not take into account the fast
pH-dependent variations of the process gain.
3.2 Process Model-Based Control Strategy
Although the majority of the advanced control literature
pertains to strategies that use linear process models, such as
Internal Model Control (IMC) and Djmamic Matrix Control (DMC),
there is a growing body of Process Model-Based Control (PMBC)
publications in the open literature. Additionally, there are
considerable applications working within industry for which the
open literature presents only a glimpse. This subsection is to
first highlight multivariable control based upon linear models,
then to highlight the PMBC literature and our knowledge of indus
trial activities. By doing so, we illustrate the need for a re
search program focused on the unique PMBC aspects. Throughout the
reference citings, an asterisk (*) indicates an author's affilia
tion to the industrial sector and is an indication of the practi
tioner's interest.
Garcia and Morari (1981) presented a unifying review of sev
eral IMC-type control schemes. Among them are: Dynamic Matrix
22
Control (Cutler* and Ramaker*, 1980), Inferential Control (Joseph
and Brosilow, 1978), and Model Predictive Control (Richalet, et
al., 1978). Note that each scheme is based on a linear process
model.
An advantage of linear controllers is the computational speed
and definable stability; however, accurate identification of para
meters of a generic linear model requires statistically significant
process upsets. As an alternative, phenomenological process models
have been used to update constants for the linear process model of
a linear IMC type controller. In addition, the process model can
also be adaptively updated from measurable process data. Klumper*
and Tobias (1986) have applied this approach to simulate the con
trol of an in situ leaching process using IMC. Lee (1987) demon
strated that for control of wastewater pH a reduced phenomenologic
al model could be used for the prediction of the process gain, and
for adjusting the controller parameters.
Along a similar vein, McDonald (1987) investigated the use of
a steady-state model of a high purity distillation column to pre
dict process gain for a DMC controller on a detailed dynamic column
simulator. She found that such a method of "gain scheduling" of
the dynamic controller allowed it to adapt to the process dynamics
rapidly and effectively, and set point tracking control was much
improved over the set point tracking obtained through conventional
recursive least squares DMC adaptation.
23
Adaptive model control usually uses a linear process model or
possibly a pre-set nonlinear form in which the parameters are
periodically updated. A thorough description of adaptive model
control was presented by Seaborg (1983).
Juba* and Hamer* (1986) applied PMBC to the control of a batch
reactor for a highly exothermic polymerization reaction. Using an
energy balance on the reactor and an estimate of the activation
energy of the reaction, they formulated a model of the heat genera
tion from the reaction mixture. However, because of the difficulty
and complexity of deriving an accurate heat transfer model, the
heat removal system was modeled empirically. Their PMBC equations
comprise both phenomenological and empirical model approaches as
they sought to use the simplest model that was sufficiently accu
rate to represent the phenomena. They found that a steady-state
(asymptotic) model of the process was sufficient. With their
controller, they found they were able to effectively contain tem
perature runaway. The authors state that the use of time-varying
nonlinear process models is a key element in the future advance of
batch reactor control.
The growing importance of process-based models in the indus
trial practice of process control is stated by Richalet* and
Congalidis* (1983) as they describe their efforts to synthesize a
combination feedforward and feedback controller of a continuous
recycle polymerization reactor. The feedforward portion was defined
24
by component mass balances and the PI feedback parameters and
input-output pairings were defined from modeled dynamic system
behavior. Simulated tests demonstrated control ability and econom
ic benefits. Such use of models eliminates the on-line, often
expensive, generation of process transfer functions and controller
sjmthesis and tuning.
Parrish and Brosilow (1986) simulate the results of a nonlin
ear inferential controller (NLIC) to control the output concentra
tion of a CSTR. In their strategy, a phenomenological model was
used to infer the non-measurable output concentration from other
measurable data, and control action was then taken on the inferred
value. The model contained an adjustable coefficient which was
adjusted to match measurable data. One interesting aspect of their
investigation was that in spite of intentional model/mismatch, the
simulation indicated that NLIC control was much better than PI
control.
Gardner* (1984) reported the results of an application of PMBC
for a commercial-scale reactor system which consisted of three
fixed-bed reactors with intercoolers. One control difficulty of
this system was the 1.8:1 ratio of dead-time to reactor response
time. Any disturbance that entered the reactor caused its effect
before the results were detected at the exit of the reactor.
Another difficulty was the process gain changed by a factor of ten
over the operating range due to the strongly exothermic nature of
25
the reaction. The third difficulty was the unpredictability of the
catalyst activity decay. Gardner used a process model in a Smith
predictor configuration. In addition, the model was used in a
supervisory steady-state optimizer to choose set points to produce
optimum yield from the system. From on-line data, the process
model was adaptively updated every 15 minutes to reflect the
catalyst activity of each reactor bed. The model was then used for
economic optimization and determination of the process input
setpoints. The control system is privately reported to have been
in operation for over 3 1/2 years with greatly improved control and
efficiency for the unit. In fact, Gardner cites a severe control
action example in which the unit feed was changed from 70% to 60%
to 20% to 40% in a 30-minute period and the process was still under
stable control. Additionally, when output instrumentation fails or
is being calibrated the controller continues to function normally
(except that the parameterization step is bypassed).
Cott*, et al. (1986) applied PMBC to a binary distillation
column simulator with a first order response and a 40-minute time
constant. They compared the control of two PMBC models to PI
control, and internal material balance (1MB) strategy, and DMC.
Their choice for the adjustable model parameters were the number of
stages in the stripping and in the rectification sections of the
column. Since the model parameterization and control calculation
steps were on a 10-minute schedule, they added two normal PI SISO
26
loops to trim higher frequency disturbances and to guarantee no
off-set. PMBC out-performed the other three methods in their
simulations. In fact, since a significant feed rate change was
used to compare methods, DMC actually yielded very poor oscillatory
behavior. Subsequently, Cott*, et al. (1986) applied the PMBC
algorithm to a commercial depropanizer unit and found it "to pre
dict new steady-state operating conditions, reduce response time
and effectively eliminate overshoot." An interesting aspect of
their work was the use of steady state as opposed to dynamic models
for PMBC. Their idea being steady state models are computationally
faster and, therefore preferred for on-line control calculations.
However, the steady-state models do not reflect process dynamics
and, during a transient, the column input-output state does not
match the steady state model pairing. To account for the error,
their algorithm used the measurable column output data to calculate
a fictitious input composition which was decayed in a first-order
response to the actual value. In this way the steady-state model
dynamically compensated itself to match the process. The choice of
a first order decay and the decay rate were made from observed
column behavior.
Lu (1987) reported on the application of a PMBC strategy to
control a continuous casting step in metal processing. He over
views the development of a phenomenological dynamic model of the
distributed parameter, moving boundary layer, metal solidification
27
step of an ingot handling process. Then he describes the results
when the model is used for a supervisory setpoint calculation for
DDC controllers of a production pusher type reheating furnace of a
steel mill: Heating uniformity improved significantly, fuel con
sumption was reduced 9%, and steel losses were reduced 0.18%. He
does not comment on the ability of the model to use process data
feedback to adapt the model, so one presumes that the model is
stationary.
Proceedings of the 1987 American Control Conference report on
the development of phenomenological dynamic models of automobile
engines toward the objective of engine efficiency optimization at
local driving conditions. One explicitly stated that the model
parameters change with operating state and that the model must be
locally parameterized to be valid. An objective explicitly stated
in another, is that the model is "compact enough to run in real
time and can be used as an imbedded model with a control algorithm
or an observer." In both works the nonlinear form of the process
is preserved in the model, but the methods of on-line adaption,
choice of adjustable parameters, method of model inverse
calculation or process optimization are not addressed.
Economou and Morari (1986) present an extension of IMC to
nonlinear systems. Their approach uses a nonlinear process model,
an inverse of the nonlinear model, and a nonlinear filter in the
28
IMC configuration. The calculation of the inverse from the process
model can become quite tedious. Specifically, the model inversion
procedure that they used involved a linearization of the nonlinear
process model.
Rhinehart (1985) and Rhinehart, et al. (1986) have applied
PMBC for setpoint tracking of a pressurized pilot scale fluidized
bed coal gasification reactor. There were several specific problem
sin the four by four coupled nonlinear MIMO reaction system: One
of the controlled variables could neither be measured during the
continuous fed batch run nor inferred directly from measurable
data; and secondly, the process characteristics changed over a
several hour period as leak rates, heat loss rates, feed coal
moisture, and instrument calibration changed. In their trials,
three parameters in a dynamic process model were determined to make
the modeled output match the measurable process output, then with
the locally valid (timewise) inverse of the process model the
reactor was moved to the desired state in one control action.
Lee and Sullivan (1988) have presented a method for implement
ing PMBC that has a proportional type and an integral type action.
Their approach is called Generic Model Control (GMC) and is a
single-step control law that usually requires the solution of a
system of algebraic equations for its implementation. Lee and
Sullivan show that GMC is similar in many ways to single-loop PI
control, feedforward and decoupling control, time horizon matrix
29
controllers, and IMC; but GMC uses the dynamic process model di
rectly without any linearization steps.
Riggs and Rhinehart (1988) compared GMC and the NLIMC strategy
of Economou and Morari (1986) for a wide range of exothermic CSTR
control problems and found that GMC and NLIMC yielded essentially
the same control performance. They pointed out that the GMC
control law has an explicit numerical formulation while NLIMC has
an implicit one; therefore, GMC is considerably easier to implement
and requires less computational effort. Another comparison by
Riggs showed insignificant differences between the performances of
GMC and the (nonlinear predictive model control) NLPMC strategy of
Parrish and Brosilow (1986) applied to the start-up of an open
loop unstable, exothermic CSTR. Therefore, results to date
indicate that there is insignificant difference between performance
of these PMBC methods. In fact, the major difference between the
various PMBC methods is the way in which offset is removed: GMC-
integral term; NLIMC-setpoint bias; and NLPMC adjustment to
disturbances. These results suggest that using the approximate
model is more important than the way it is applied. Therefore,
since GMC is the most advanced form of PMBC, and since other PMBC
methods are actually subsets of GMC, GMC will be used for the
research proposed here.
30
In a review of industrial reactor control Seaborg, (1983)
conclude with the statement,
Problems of recycle, interaction between units, pathological disturbances, as well as start-ups and shut-downs are important industrial problems. Feedforward control is a tool heavily used to solve these disturbance problems... Nonlinear model-based control strategies are also becoming important in industry.
Published work from academia and industry have shown the
potential for PMBC. The work proposed here is aimed at studying
some of the fundamental questions associated with PMBC so that it
can be effectively applied in the future.
3.3 Overview of Process Model-Based Control
PMBC has only a few adjustable parameters so that it is rapid
ly parameterized with statistical confidence and continuously true
to the process. Compared with other model-based controllers, the
model of a PMBC controller expresses the functional form of the
process response over a broad operating range and is excellent for
setpoint tracking and instrument fault detection.
The majority of process control problems can be solved effec
tively using conventional PID controllers, but there is a signifi
cant class of process control applications that are better handled
by more advanced control strategies. These processes are usually
highly nonlinear with a significant degree of coupling between
31
process variables. Currently, in these cases, PID controllers are
usually used. Even though control performance may be marginal, PID
controllers are a familiar technology to the practicing engineer
and operator, are standard practice, are inexpensive, and to the
industrial manager represent a balancer of cost to performance and
reliability. The technology of many of the modern internal model
controllers is not familiar to industry and creates a wary view in
a "can't afford to fail" atmosphere. By contrast, process models
are the college's tool of unit operations, are used for design and
optimization by the practicing engineer, and are familiar to him.
Since the performance to cost ratio of computing power has
increased dramatically in the past five years, it is now economi
cally possible to use a model-based control algorithm. One class
of such advanced control algorithms are based upon a linearized
model of the process, have been applied to some nonlinear process,
and are currently the basis for much academic investigation. But,
the low cost computing power has also made it feasible to use
control strategies based upon phenomenological process models
(i.e., PMBC). Advantages and disadvantages of PMBC compared with
control algorithms based upon linearized models are listed below.
3.3.1 PMBC Advantages
(i) PMBC should perform better on highly nonlinear, coupled
nrocesses. For example, if a controller "knows" that the rate of
32
chemical reaction varies with the exponential of inverse tempera
ture, it should be able to more efficiently track setpoint changes
and handle larger load changes, whereas an algorithm based upon
linear process models can seriously underestimate the effect of
temperature on reaction rate because of the lack of knowledge of
the process nonlinearity. Similar statements can be made with
regard to processes with coupling between control variables as well
as those with large process dead-times that might change with
operating conditions. The following two models visualize the
difference between a linear model and a nonlinear
(phenomenological) model:
Y - ax (i)
Y - exp(bx) (ii)
where a and b are model parameters.
Suppose Equation (ii) is a phenomenological model of a real pro
cess, while Equation (i) is a linearized process model. Due to the
closeness of the phenomenological model to the real process,
modeled output Y is "globally valid" for any input x once model
parameter b is evaluated. Equation (i), however, is only valid for
a particular input x or small x deviation. It is "locally valid."
For a highly noisy process or where state changes occur, output y
33
of Equation (i) is always deviated from the real process. For this
reason, PMBC can be superior to IMC.
(ii) PMBC interfaces well with process optimization schemes
an plant-wide optimization algorithms. PMBC uses a currently valid
process model for control; therefore, the process model can also be
used for optimization purposes. Since the model is not simply
locally valid, it is useful for global optimization of an inte
grated process.
(iii) PMBC should generate acceptance by the practicing
engineer. Because he is familiar with the model and because the
control strategy is simple, it should gain industry acceptance, and
more easily become a part of standard practice.
(iv) The model is quickly and easily parameterized. General
ly there are only two or three adjustable model parameters which
must be evaluated to keep the process-based model true to the
process, and parameterization can be achieved on-line without
process upsets. Most parameters, even rate parameters, can be
obtained by fitting the model to steady state process data. Time
constants and process dead-time can be estimated from flow rates
and process geometry.
By contrast, values of the many parameters of the linear model
must be obtained by process upsets. Commonly, at installation and
at intervals appropriate to account for changes in process charac
teristics, the process must be repeatedly and significantly upset
34
to parameterize the linear controller model with a necessary degree
of statistical confidence. Even so, the model is only locally
valid, and when a nonlinear process makes a significant state
change the model can become invalid. To prevent the need for
process changes, one scheme is to use a recursive least squares
method to update model parameters from process input "noise" and
output trends. Such practice, however, often results in a model of
low statistical confidence, and again, locally valid at best.
(v) Process and instrument fault detection are facilitated.
Because the model is based on the process phenomena the model
parameters, even the adjustable parameters, have phenomenologically
expected values. If model parameters must be too far from their
expected values to make the model reproduce the measured process
data, then a fault is indicated. The model conservation equations
can locate the fault: "there is an inconsistency in the mass
balance" the computer might tell the operator, "please check the
calibration of the flow and concentration meters."
3.3.2 PMBC Disadvantages
(i) Each application of PMBC must be "tailor-fit" to the
particular purpose. The advanced control strategies which are
based upon linear process models are generic in their approach and,
as a result, can be applied in nearly the same manner to each
35
process. By contrast, a PMBC controller requires the engineer to
obtain and maintain a model specific to the process. Although
apparently a major disadvantage, such a model is probably available
from the process design stage.
(ii) Little experience with PMBC is available to guide the
control engineer. Although the idea of PMBC is not new, develop
ments in computer hardware have only recently made it feasible. As
a result, there is little experience to guide the practitioner,
e.g. ,
How much mismatch between the model and the process can one
tolerate?
How does one choose an approximate model and what parameters
should one choose to be adjustable?
How often should one re-parameterize the model?
How does one tune (if that be the appropriate term) the con
troller?
How is the controller configured to handle constraints?
How nonlinear does the process have to be to warrant use of
PMBC?
How to account for dead-time (transport delay)?
How to incorporate anti-windup features?
With regard to the first disadvantage, it becomes a question
as to whether PMBC provides improvements that outweigh the effort
of implementation. (This is also true of any advanced control
\
36
strategy.) Considering that the PMBC model is a better description
of the nonlinear, coupled, and dead-time characteristics of the
process, it would seem that PMBC would offer significant potential
for improved control performance over locally valid models. Since
a large number of chemical processes are highly nonlinear, have
large throughputs, are subject to significant drifts, and are
subject to daily state changes; PMBC should have significant poten
tial for improving process efficiency and controllability. Addi
tionally, the phenomenological model of a PMBC controller can be
used in supervisory on-line calculations to improve the accuracy of
both process optimization and data reconciliation efforts.
Part of the overall research program at Texas Tech University
is the investigation of such implementation concerns as were men
tioned above. Once these implementation concerns have been ad
dressed, and satisfactory results have been obtained, such control
lers may gain user acceptance.
3.4 Previous PMBC Wastewater pH Control Work
Rhinehart and Choi (1988) investigated an equilibrium reaction
model that adequately described the actual wastewater neutraliza
tion reactions, and then simplified this model for use as the
phenomenological model of a PMBC control strategy. This reduced
model retained the pertinent phenomena of the process, yet was
37
simple enough to facilitate the mathematical manipulations required
for development of a control algorithm.
Figure 3.1 illustrates the chemistry of a hypothetical acidic
wastewater. The letters x and 8 represent the amount of weak
acid and water dissociated, respectively. The weak acid concentra
tion, therefore becomes fi-x. The strong acid, the salt and
strong base each fully dissociate so that their initial concentra
tions stoichiometrically describe ion concentrations. From the
definition of chemical reaction equilibrium:
K - Exnr AG/RT^ - ["" H 'l . (a+X+g)(x+7) /o 4 .) K^ - Exp(-AG/RT) - ^ j - ^^_^^ . (3.4.1)
Regardless of the source of each species, molecules and ions of
that species are indistinguishable, and the individual total amount
of [H"*"] , [ W ] , and [HW] must be used in the K^ expression. The
ionization constant of water, K , is available from tabulated data
as a function of temperature (refer to Appendix A):
K - 10'^^*^^ - [H'^][0H'] - (a+x+5)(5+c) (3.4.2) w
where f(T) at T - 25°C is the familiar 14 giving neutral water a pH
of 7. From the definition of pH:
pH - -Log^QlH"^] - - Log^Q(a+x+5) . (3.4.3)
38
Initial Concentration Reaction
HS • aK^ + aS
0
7
S
(fi-x) HW < > xH+ + xW
MW < > 7M+ + 7W
H2O < > 5H+ + 50H-
BOH •7 B + OH
where HS is a strong acid HW is a weak acid MW is a common ion salt BOH is a strong base (titrant)
Figure 3.1: The Chemistry of a Hypothetical Acidic Wastewater
39
A generalized function is then developed which relates the equilib
rium pH phenomena to the species concentrations and solution tem
perature. From Equation (3.4.3):
a+x-l-5 - 10"P" (3.4.4)
Inserting Equation (3.4.4) into Equation (3.4.2), gives
6 - K * loP" - e . (3.4.5)
w
and from Equation (3.4.4),
X - 10"P" - a - 6 - 10"P" - a - K * 10^" + e . (3.4.6)
w
Substituting Equations (3.4.4), (3.4.5), and (3.4.6) into Equation
(3.4.1), one gets (loP" )(10"P" - a - K /10"P" + € + 5)
Exp(-AG/RT) - — — (3.4.7)
a + ;9 V^° • ' - °
To use Equation (3.4.7) for a control model one would simply find
the value of e, the base concentration, that satisfies Equation
(3.4.7) when pH-7. However, the controller cannot know either a,
fi, -y or AG (measures of wastewater composition) and therefore
cannot use Equation (3.4.7) for control.
In the work done by Rhinehart and Choi (1988), however, the
process was represented by a single weak acid and base reaction
40
system, and such a reduced phenomenological model is used to simu
late the real system for control purposes. The reduced model
suggested is in Figure 3.2. Paralleling the development of Equa
tion (3.4.7), for the single acid system
•" IjW I _ 1X4 4U1 " r\
K^ - EKp(..C,/RX - i a ^ - ^ ^ ^
where AGf is the Gibbs free energy of dissociation of the ficti
tious weak acid. Additionally,
k - 10'^^^^ - [H'*"][0H'] - (x+5)(5+e) . (3.4.9) w
pH - - Log^Q[H"^] - - Log^Q(x+5) . (3.4.10)
Combining Equations (3.4.8), (3.4.9) and (3.4.10), gives the
equilibrium behavior of the simplified neutralization process
(10"P")(10"P" -K^*10P" + 0 f(A., AG )=Exp(-AG /RT) - — — - 0 .
^ ^ ^ (A^ - lO'P - K *10"P-£) (3.4.11) f w
Equation (3.4.11) has two unknowns (model parameters): Af, the
concentration of the single fictitious weak acid and AGf, the
Gibbs free energy of dissociation of the fictitious acid. Each
were determined in the Rhinehart/Choi work from the measurable
input pH (at no base addition) and output pH (at the base concen
tration in the outlet) values and the base and acid flow rates.
41
Initial Concentration
Af
8
Reaction
(Af-x) HW ^ > xH+ -H xW-
H2O < > 5H+ + 50H"
BOH -> €B+ + €0H-
where Af is the fictitious weak acid concentration.
Figure 3.2: The Chemistry of a Single Weak Acid and Strong Base Reaction System
42
While their controller worked, sometimes either dramatic
changes in the process composition or measurement noise would lead
to invalid parameter identification. Consequently, base flow rate
setpoints were occasionally considerably different from those
actually required.
The rigorous model developed to describe the actual wastewater
neutralization reactions, however, as stated earlier, was shown to
be an adequate simulator of the experimental system. This same
type reaction model was also investigated by McAvoy, et al. (1972)
for acetic acid titrated with a base in a CSTR. They, too, showed
that a model developed with such equilibrium thermodynamic basics
adequately simulated the experimental system results.
This controller research investigation will therefore utilize
this same rigorous reaction model. This work will also follow the
same development of the reduced model as was done by Rhinehart and
Choi, except that the base flow stream will be split into two
portions and sequentially inject them into the acidic wastewater
line to achieve neutralization. This technique will yield three
data pairs (inlet-pH, flow rate, and temperature; after first base
injection-pH and flow rate (from mass balances); and outlet-pH,
flow rate (from mass balances), and temperature) vs the two data
pairs used by the controller developed by Rhinehart and Choi. With
three data pairs and only two unknowns, there is enough data to
43
allow the use of a least squares optimization procedure for calcu
lation of the unknown parameters.
^
CHAPTER 4
PROCESS SIMULATOR
4.1 Introduction to the Simulator Development
This section develops a rigorous process simulator for the
investigation of a nonlinear PMBC pH neutralization controller
strategy. This simulator must yield results as close to the actual
process as possible so that relatively accurate process responses
to many different system compositions and upsets may be obtained.
With a reliable process simulator, many different aspects of the
proposed nonlinear PMBC pH neutralization controller can be studied
without the expense and time associated with running a wide variety
of tests on a pilot scale operation.
The process simulator will use the reaction mechanism and
equilibrium equations developed by Rhinehart and Choi (1988), as
shown in Chapter III. Many of the other phenomena of a wastewater
pH neutralization system will be modeled; such as flow dynamics,
instrumentation noise and lags, nonstationary composition effects,
and others.
4.2 Simulating the Reaction Mechanics
Usually the reaction rates for acid-base reactions between
dissolved components are extremely high (Gustafsson and Waller,
1983) and such rates are much faster than the mixing rate. For
44
45
such fast acid-base reactions, equilibrium conditions are ap
proached sufficiently to justify these conditions for use as addi
tional algebraic state equations. Figure 3.1 illustrates the
chemistry of the hypothetical acidic wastewater system, and since,
as stated, this system is assumed to be near equilibrium, we can
use Equations (3.4.1) and (3.4.2) to describe the relevant reaction
phenomena of the system. If the influent compositions are fixed
then a and 7 become known values. Equations (3.4.1) and
(3.4.2), thus, have only two unknowns, x and 8. We can then
solve for the unknowns x and 8 by iteratively applying the multi-
variable Newton's Method to the system functions. Equations (4.2.1)
and (4.2.2), which are developed from Equations(3.4.1) and (3.4.2)
refer to Appendix B).
fl - Ka(;3-x) - (a+x-H5)(x+7) (4.2.1)
and f2 - Kv - (a+x+S)(S+€) (4.2.2)
With the variables x and 8 now known, we can determine the pH of
the system by applying Equation (3.4.3).
4.3 Simulating Instrumentation Noise
We must also model the fluid dynamics of mixing the reaction
invariant species due to adding titrant into the wastewater stream.
46
This phenomena will be modeled as a small ideal CSTR with a volume
of 0.02 liters and the wastewater and titrant streams as inputs.
In general the mass balance is:
V ^ir^ - F. * [x]. -F ^ * [x] ^ (4.3.3) dt in "• •• m out *• ' out
where x represents any reaction invariant species. Equation
(4.3.3) is used to simulate the composition transients of weak
acid, strong acid, coimnon ion salt, and the reagent base added for
neutralization.
Additionally, a similar energy balance is used to simulate
process temperature. If the assumptions of constant density,
constant heat capacity, and negligible heat of reaction are made
(all due to the dilute nature of the wastewater system), the gen
eral energy balance reduces to:
(AF*T + BF*T )
V^^ - . T * fAF + BF) C4 3 4") dt (AF + BF) 3 ^ ^ k"*-^-"*)
where AF represents the wastewater flow rate in, BF represents the
strong base (titrant) flow rate in, and T^, T2, and T3 represent
the temperatures of the wastewater stream in, the titrant stream
in, and the resulting outlet stream, respectively. Equation
(4.3.4) is used to simulate the temperature behavior of the neu
tralization system.
47
The rigorous process simulator will model the actual waste
water neutralization system shown in Figure 4.1. This simulator
will first calculate the pH of the influent by the method stated
above using influent compositions and temperature supplied by the
programmer. The simulator will then model the injection of a
portion of the strong base (titrant) and use the fluid dynamic
modeling equations to determine the resulting compositions and
temperature. Next, the reaction equilibrium equations are reap
plied to determine the pH of the waste stream after the first base
injection. The remainder of the strong base is then injected, and
again the mixing effects are calculated for the resulting stream
after the final base injection. The reaction equilibrium equations
are reapplied to determine the effluent pH of the wastewater
stream.
The basics of the neutralization process have, therefore, been
modeled and now other factors that come into play in an actual
system can be added to the simulator. These factors can be very
important in the investigation of the controller and must be mod
eled if we are to obtain realistic results for comparison of con
troller performance.
4.4 Simulating Instrumentation Noise
Measurement noise is common to all process instruments. This
simulator incorporates the measurement noise as a Gaussian
48
3
<u
<u
3
a (U 4J CO >
CO
C
o
cd
(0 V4 4J 3 <U
z lU 4-)
<u 4J (0 CO 3
cd 3 4J o <
X H
0)
u 3 00
49
distributed random variable with a mean of zero which is added to
all measured process variables (see Appendix C). A standard
deviation of 0.12 pH units is used and results in the simulated pH
meters having a 95% confidence interval of 0.48 pH units. The
simulated flow meter standard deviation is 0.0005 liters/minute
which results in a 95% confidence interval of 0.002 liters/minute.
Measurement noise was not added to the simulated temperature probes
because the noise for these instruments is small and the
temperature effect on the process pH is small, therefore simulated
temperature noise would be inconsequential.
4.5 Simulating Instrumentation Response Time Lag
Another phenomenon common to all process instruments is re
sponse time lag (the time the instrument reading takes to travel
from its beginning value to the new value) . The turbine flow
meters simulated for this system have a first order response with a
time constant of approximately 2.5 seconds (see Appendix E). The
pH meters simulated, on the other hand, have a first order time
constant of approximately 7 seconds. Another factor that must be
modeled is the response of the final control element to set point
changes. Due to valve dynamics, the base flow rate follows the
base flow rate set point in a first order lag with a 2.5-second
time constant.
50
4.6 Simulating Nonstationary Wastewater Disturbances
Earlier it was stated that the programmer supplies the initial
influent composition, flow rate, and temperature. However, the
nonstationary nature of these process variables must also be simu
lated. The weak acid, strong acid, common ion salt concentrations
drift with time, as does the Gibbs energy of dissociation of the
weak acid. The influent wastewater flow rate and temperature also
drift with time. This nonstationary condition is simulated by
applying a second order auto-regressive moving average disturbance
to each variable (refer to Appendix D). This results in a nonsta
tionary process nature in which each input independently drifts
about an average value, and therefore more realistically simulates
the real process.
CHAPTER 5
CONTROLLER MODEL AND STRATEGY
If the rigorous process simulator were used as the control
model, one would use Equation (3.4.7) and simply find the value
of c, the base concentration, that satisfies the equation when
pH-7. However, the controller cannot know either a, fi, l or AG
(measures of the wastewater composition) and cannot exactly know T
(a measured variable) and therefore cannot use Equation (3.4.7) for
control. Rhinehart and Choi (1988), however found that, for con
trol purposes, the process can be represented by the single weak
acid and base reaction system illustrated in Figure 3.2. Equation
(3.4.11) will, therefore, be used as the controller model equation,
and as stated, a dual base injection scheme will be used in the
control strategy.
5.1 Model Parameter Identification
Equation (3.4.11) has two unknowns (model parameters): Af,
the concentration of the single fictitious weak acid and AGf, the
Gibbs free energy of dissociation of the fictitious weak acid. The
measurable information from the dual base injection scheme has
three distinct sets of data: (1) pH, wastewater flow rate, and
temperature at a point before the first base injection point, (2)
pH and base flow rate at a point after the first.base injection
51
52
point, and (3) pH, and base flow rate at a point after the second
base injection point. From simple energy and mass balances, as
developed in Section 4.3 for use in the process simulator, one can
obtain three T/pH/base concentration data sets.
At this point, however, the possibility of process to model
mismatch must be acknowledged, for the actual volumes of the mixing
vessels and the exact concentration of the strong base (titrant)
may be different from those used in the controller model. The
effects of these process to model mismatches must therefore be one
of the areas investigated in this work. Another potential problem
could exist if the noise on the wastewater flow rate and pH values
caused unnecessary and unwanted fluctuations in the base flow rate
setpoint. Therefore these values are filtered to give a more
stable base flow rate setpoint response. We used a first order
filter with a two second time constant (see Appendix E for filter
equations). Another potential problem that must be acknowledged at
this point is the possibility of pH probes or flow rate meter
calibration error.
However, there is, with respect to the above limitations,
enough information to obtain the two parameters, Af, AGf, through
a least squares minimization of the filtered pH values and those
calculated using Equation (3.4.11).
The next question to be answered is when to calculate the
model paramp-t'=»rs. There are many different schemes to determine
53
when is the appropriate time for model parameterization. One
scheme is to parameterize the model when the effluent pH deviates
more than one pH unit from the 7.0 setpoint. Another is to para
meterize the model when a steady state condition is acknowledged,
and still another is to parameterize the model only when a steady
state condition has been lost and then a "new" steady-state condi
tion is reached.
Model parameterization in this work will be performed each
time that the controller acknowledges that the process is at steady
state. The controller identifies a steady state condition when the
filtered standard deviation of the output pH is below a threshold
value of 1.5 times the true steady state value (0.18 pH units in
this case). The filtered standard deviation is the square root of
the filtered variance which is calculated from the filtered efflu
ent pH at each sampling interval. We used a first order filter
with a one second time constant (refer to Appendix H for the equa
tions used to calculate the filtered standard deviation).
5.2 Control Strategy
The GMC (Lee and Sullivan, 1988) control law based on a steady
state model is used in this study. Applied to the pH controller,
this law first calculates a temporary steady state pH target for
the next control interval:
54
pH - pH ^ •»- Kl * e + K2 * r e dt (5.2.1) S3 * out ''
where pHgg is the temporary steady state target, pHout ^^ ^ ® P^ °^
the effluent from the neutralization process, e is the error term
(7.0 - PHQ^C)» Kl is the tuning constant that relates to the rate
of return from pHout ^° pH-7, K2 is the tuning constant that
weights the process/model mismatch correction between parameteriza-
tions, and J e dt is the integral since the last parameteriza
tion. This pHgs value is then substituted into Equation (3.4.11)
as the target pH value along with the current values of the model
parameters and filtered flow rates. Upon rearrangement, the ratio
of the base flow rate set point to the acid flow rate can be deter
mined. This ratio is then used to calculate the base flow rate
setpoint values until the next time the ratio is changed by the
controller (controller period is 1 second). This ratio action
allows the controller to respond quickly (with a filtered lag and
at most a 1 second control period delay) to acid wastewater flow
rate changes.
A difficulty to overcome at this point is the sensitivity of
the base flow rate setpoint to small changes to pHgg when pHgg
target is less than 4 or greater than 11 (the extremes of the
titration curve). Such a value of pHgg can be calculated after a
severe upset where the effluent pH becomes either relatively low or
high. We chose to keep controller responsiveness high by keeping
55
Kl and K2 near the controller stability limits. Then we used very
mild "gain scheduling" to offset this sensitivity. This is accom
plished in the following manner:
Kl - 1.25 - (0.02 * I e I) (5.2.2)
K2 - 0 014 - (0.002 * I e I) (5.2.3)
where lei is the absolute value of the error term, 1.25 is the
value of Kl when pHout"^» 0.014 is the value of K2 when pHout"^»
and 0.02 and 0.002 are the slopes of the linear decrease in Kl and
K2, respectively, as the e term increases.
The controller will continue calculating ratios and setpoints
using old parameter values and Equations (3.4.11), (5.2.1), and
(5.2.3) until a steady state condition is determined. When this
condition is determined, the integral term in Equation (5.2.1) is
reset to zero, and using the current pH, flow rate, and temperature
data, new values for the model parameters are determined by the
least squares minimization procedure mentioned above (refer to
Appendix F for the above least squares minimization procedure).
Figure 5.1 illustrates the process and nonlinear PMBC control
ler. At the bottom of the figure, the wastewater flows from left
to right, is monitored for pH, temperature, and flow rate, enters a
small mixer where a fraction of the desired base is injected (see
56
£
>%
c o
en
CO
u 3 V
z
c
I c
c CQ
u o
E CO u 00 CO
CO c o
u c 3
u 3 QO
57
Appendix G for the equations used in determining the fraction of
base to be injected), exits, is monitored for pH, enters another
small mixer where the remaining fraction of the base is injected,
exits, is monitored for pH and temperature, and then is discharged.
From the reservoir at the top of the figure, the concentrated base
flows through a flow monitor, a flow valve, a flow splitter, and
into the mixers. The mixer residence times are approximately 1
second.
The supervisory nonlinear PMBC controller and the primary base
flow controller are each grouped within dashed lines within the
digital controller of Figure 5.1. The primary base flow controller
is conventional "velocity mode" digital SISO PI controller, tuned
for an over-damped, closed-loop response of about 3 seconds and
operating 5 times per second.
5.3 Options and Variations
There are advantages and disadvantages to the options and
variations presented in the preceding sections. For instance., the
choice of parameterization "trigger" (when to reparameterize the
model parameters) can have a strong influence on controller per
formance. If the controller parameterizes the model when the
effluent pH deviates more than one pH unit from the 7.0 setpoint,
there is a possibility of invalid parameter identification upon a
58
severe step upset due to the time lag on measured variables
(because of mixing effects and instrumentation response time lag).
Since the instruments do not all have the same response time lag
and because of transport delays, the measured variables of pH and
flow rate could be out of "sync" and therefore the parameterization
would be based on inappropriate information. Other parameteriza
tion trigger scheme advantages and disadvantages will be discussed
in Chapter 6.
The form of the objective function used in the multivariable
Newton's search for parameter identification is also a very impor
tant aspect of this investigation. Many different forms of the
objective function can be obtained by simple algebraic manipula
tion, such as multiplication (or division) by a variable (or group
of variables) from the original objective function (Equation
(3.4.11)) and by simply inverting the entire objective function.
The form of the function used in this work is unique and stable,
characteristics that many other forms of the function do not pos
sess. Another advantage can be gained by assuming a constant
temperature through the neutralization process. This assumption
does not significantly affect the model's process characteristics
and will simply be absorbed into the model as another process-to-
model mismatch. This assumption does, however, greatly affect the
59
ease with which this form of the objective function can be imple
mented by allowing the simplification of solving for one of the
model parameters, AGf, in terms of the other model parameter, Af.
This reduces the model parameter search from a two equation/two
unknown system to a one equation/one unknown system, thereby great
ly reducing the computational effort required to parameterize the
model.
The choice of the fraction (portion of the base to be injected
into the first mixing vessel divided by the total amount of base to
be injected for neutralization) also has some importance. This
fraction must be large enough to allow for valve rangeability
(especially in the second fraction). It must be large enough so
that the pH value of the waste stream after the first base injec
tion point needs to be near the neutral portion of the titration
curve. Yet, this pH value must also be far enough away to be able
to obtain some indication of the location of the titration neutral
ization region in the event that too much base is added.
Another possible variation would be to add weighting factors
to the least squares minimization procedure for parameter identifi
cation. This variation could lead to greater accuracy in the
effluent pH value, due to the possibility of better modeling of the
titration curve in the setpoint region (pH-7.0 for neutralization,
or pH of less than or greater than 7.0 for other control applica
tions) .
CHAPTER 6
RESULTS AND DISCUSSION
This chapter will discuss the simulated responses of the
acidic wastewater neutralization process (1) in regulatory mode (no
process upsets other than normal nonstationary wastewater distur
bances) , (2) for a ramp upset in wastewater composition, and (3)
for a step upset in wastewater composition. Additionally, (4) the
effects of adding a large blending tank at the effluent of the
neutralization process will also be examined. Other aspects stud
ied in this controller investigation are the effects of: (5)
process to model mismatch and calibration errors; and in less
detail (6) varying the fraction of the base to be injected at the
first mixing vessel, (7) incorporating weighting factors into the
least squares minimization procedure for model parameter identifi
cation, and (8) effluent pH setpoints other than 7.
6.1 Regulatory Control
Figure 6.1 illustrates the simulated controlled system re
sponse in regulatory mode. In this case, the controller must
respond to normal noise, lags, and auto-regressive drifts that are
inherent in the process. The initial wastewater composition is
60
61
o o ID ^"
o o "^ ' ^
o o cvi ' "
o o o ^-
o o 00
o o to
o o -^
y * ^ .
(0
•o c o o CO
(U
E •r.1
H
E V
CO
CO
CO
u o
Vi-I
X
4-1
c 3
^ Vl-I
^ o k l 4.J
c 0
u Ui
o VM
(0 4-t
^* 3 (0
u 0 4-1 (0
3
b cn
u o > Cfl
X 0)
(0
0) o o u
ou
> U (0 c 0
4-)
<n I-)
(/) c o z (fl E o z ,r . k j
•:;
o o 3 00
c -rA
E X >-i — 0 . 0 * 0
62
detailed in Table 6.1, and the process and model titration curves
are illustrated in Figure 6.2. The nonstationary nature of the
process compositions are illustrated in Figures 6.3, 6.4, 6.5, and
6.6. The controller, as would be expected of any effective con
troller in regulatory mode, shows adequate control response over
the simulated 1800 seconds.
The controller (and its tuning parameters and parameterization
trigger strategy) used in the case will hereafter be called the
base case controller. The gain factors, Kl and K2 of Equation
(5.2.1), will be the same as shown in Equations (5.2.2) and
(5.2.3). The amount of the base to be injected into the first
mixing vessel will be a set value of 60% of the total amount of
base required for neutralization. The parameterization trigger
strategy (scheme for determination of the appropriate time to
reparameterize the model) will be, as discussed in section 5.1, to
parameterize the model each time a steady state condition is iden
tified and to zero the integral term of the control law at that
time. The threshold value of the filtered standard deviation of
the outlet pH required for identification of this steady state will
be 0.18, as stated in section 5.1. Also, the pH points will be
equally weighted for the least squares minimization procedure used
in obtaining the model parameters.
63
Table 6.1: Initial Wastewater Composition for Figure 6.1
Weak Acid Concentration 0.5 gmoles/liter
Strong Acid Concentration 0.0055 gmoles/liter
Salt Concentration 0.005 gmoles/liter
Weak Acid G of Dissociation 5000 cal/gmole
^
64
o "^
c r
O CN
o
o o o •K x ^ ^
u 0)
-»* V M
• ^ U) V
mM
o £ 0 0
"^ c 0
4,d
CO
u ^ J
c V CJ
c o
o 3; CA CO
OQ
oce
ss
ver
sus
u a. V
• ^
«
•^ V M
Jl
o; > U 3
U •^ c •
O vO
^ OJ CO •-U 3 ^ Z£t
'^* •— f - liu
>te ' -
0 o > ^ d
c o —
— - 3 •- 0 fl s c 5 aj o —
gu
re
6.2
: C
t
fO CN
X o.
65
o o lO *"
o o '^
o o (N *"
o o o —
o o 00
o o ID
O o
o o (N
^s.
en •o c o U 0)
>«•
(U
S . , - t H
6.1
3
rFig
c VUl
C O • ^ 4 ^
CO u 4-t C 0
o c o
(J
< W
eak
re
6.3
:
3 00
.1-1
bu
l O ' ^ f O C N ^ l O O > C O N C O l O ' ^ K > C N ^ O > 0 > C O N C i : > l O o o o o o o > o > o > o > o > o > o > o > o > i H i c o i x > a ) D o a )
00T»(-i33TT/sa-[oui8) uox^Bjquaouoo
^ ^ ^ ^
^ \
66
o o (O ' "
o o ' ^
o o C>J ^"
o o o —
o o DO
o o CO
o o ^
o o (N
^—\ Vi •o c o CJ 0)
v ^
0) E
..-1 H
•
u 3 30
U.
O
-O
CO u 4_)
C (U u c o u T3 • . u
<
00
SL
ro
i
• • ^
ure
6.
00
tu
r-o
OOT»(J33TI/S31oii)3) aofieiiasoaoo
k\
67
en T3 C o CJ
en
(U E
0) u 3 00
O
c o
fl
c 1 ) o c o
fl c/:
c o
o CJ
i n
3 00
0000I*(^®^Tl /ss iora9) uoi^BJiauaouoo
\
6d
o o to «—
o o '^
o o CN ^
o o o r-
o o 00
O o (D
O O "^
o o cs
tn •o c o o « 01
>>^ 9
e ft
H
1-4 •
NO
Wi
Flg
u
u o
<M
ion
a) -rA o o 0) 0)
•H
a (M
o o < •0
u <
4)
• • vO
NO
Igu
re
h«
000T/(aToai8/xeo) UOTIBTOOSSTQ JO XSaaug sqq-tQ
^
69
6.2 Step Upset
Figure 6.7 illxistrates the controller response to step changes
in composition as well as normal noise, lags, and auto-regressive
drifts. At time equals 400 seconds the weak acid, strong acid, and
common ion salt, and the Gibbs energy of dissociation of the weak
acid make an instantaneous change (see Table 6.2). This change
results in the process changing from a system consisting of mainly
a highly buffered weak acid to one consisting of a weak acid, a
strong acid and very little buffering. Initially the pH rises and,
in response, the -controller drops the base flow rate, but the model
parameters are not valid and the pH begins to level at 12.3 pH
units with a steady state offset of 5.3 pH units. At that time
steady state is recognized. After three parameterizations the
model is corrected and control is regained. Events at time equals
1200 seconds are similar; however, this change results in the
system changing from one consisting of a weak acid, a strong acid,
and very little buffering to one consisting of mainly a buffered
weak acid (refer to Table 6.2). Initially the pH drops and, in
response, the controller raises the base flow rate, but the model
parameters are not valid and again the pH begins to level at 4.5 pH
units with a steady state offset of 2.5 pH units. At that time
70
O o CO
O O
o o CN
0) 4) 00
c 4
X CJ
a (U
en o
<0 en c o a o
o ^ O en
C o o <u
2 ^ o oo «
.^ £-
o o CO
o o T
O O CN
Res
>
U • * 4) 3 i-w
(44
u •3 <a
f^
0 ui
u c 0
CJ
r VO
4) U 3 00
v4 Cb
o o> 00 N CO ir>
33B)J AO"[j : io ^d
. \
71
Table 6.2: Wastewater Compositions for Figure 6.7
Simulated Wastewater Upset Changes at 400 and 1200 Seconds
Component or Characteristic 400 1200
Weak Acid Concentration 0.050 03 0.06 gmoles/liter
Strong Acid Concentration 0.05 0.03 0.004 gmoles/licar
Salt Concentration 0.005 0.00005 0.002 gmoles/liter
Weak Acid G Dissociation 5000 7000 6000 cal/gmole
72
steady state is recognized. After four parameterizations the model
is corrected and control is regained.
It should be noted that the controller seems to respond slower
to the second upset. This is caused by the lack of information
available to the controller regarding the neutrality region of the
titration curve immediately after the upset, when all three pH
points (influent, midpoint, and effluent) lie on the lower region
of the titration curve. This causes slightly invalid model para
meter identification. The process then moves to a new steady state
of 4.9 pH units, where the model parameters again are parameterized
on somewhat limited information. This is repeated again at the
steady state condition identified at 5.7 pH units, yet now the
controller has better information (closer to the neutrality region)
and can yield a better estimate for model parameters.
This parameterization sequence should be compared to that of
the first upset in which the effluent pH immediately after the
upset lies on the upper region of the titration curve and the
midpoint pH lies near the neutral region, thereby yielding excel
lent information to the controller for model parameter identifica
tion. The parameters are therefore very close to those actually
required for control. The resulting base flow rate setpoint calcu
lated by the controller is also very close to that required for
control, and the response therefore is very rapid.
Note that before, between, and after the step changes the
controller must continuously work to account for drifts. Although
pH is held at 7 during the 600 to 1200 second interval, the base
flow rate had to increase due to composition changes.
Titration curves of both the simulated process and the
controller's fictitious acid at times of 600 to 1400 seconds are
shown on Figure 6.7. Figxires 6.8 and 6.9 show the titration curves
of both the simulated process and the controller's fictitioxis acid
at times corresponding to 100 and 600 seconds, respectively . The
fictitious titration curves at 100 and 1400 seconds, Figures 6.8
and 6.9, show a close approximation to the actual titration curve
of the system over the entire concentration range^ especially the
desired neutrality region aroxind pH equal to 7 pH units. This is
to be expected because the simulator is essentially a weak acid
system and can be closely approximated by the single acid model of
the controller. The fictitious titration curve at time equals 600
seconds shows a close approximation of the process titration curve
in the desired neutrality region yet shows considerable mismatch in
the lower pH regions. This, too, is to be expected because the
single acid model of the controller is trying to mimic a system
that has both strong and weak acid characteristics. This model
mismatch, however, does not effect the base setpoint calculations
of the controller because of the close fit of the model titration
curve to the actual one in the desired neutrality region.
74
(0 " c 0 u V in o n 4J Q
« > U 3
CJ
e o
•-4 4J
o u u v4 H
-^ u
- 3 o
en •o c o (J 4)
CO
o <n U <0
«) > u 3
CJ
c o
t i 4 4J CQ u u •H H
91 (fl 4) U o u cu
o
o
O «
•D C O u a e.1
<3 o 4
i i i
<3
a > u 3
O
c 0
•.14 4J (3 U i J v4 H
CO en V <j O u c
« rs c o u « en
o o vO
u 9
V > u 3
CJ
c o •rA 4J
ea u 4 i
• ^
H ^ 4 4) •« O s
o o o
u
U1
o S 0(
c o
fl u 1.J
c u c o o 4) -Jl fl
ca
4)
en 3 en Wi 4) >
en en 4) u o u a* 4)
o
en 4)
£ 3
CJ
c o
ft 4J «] S-i u
4)
3 00
c o en
C o CJ 4)
C/2
o o
c ca
o en %A o
H en 4)
<« E O •^
H C O S-I en o
•^ u-i >-i <8 i -t O. 4) E -O O O
O S
00
vO
4} V4 3 00
rO CN (^ 00 N CO in rO CN
75
O
o o o
Jl o u > ^
3 •J-. 00 •Jt - *
O cs
_ o
o "" •tc
4)
"" '
J l
O • ~ * O
UJ
CO " " • ^
c o *««
taj
fl u - J
c
u c o
CJ 3J •Jl fl
oa
o u
C
1;
^ u 0
n ^1
> 3
O
^ o taj
•T
;^ •
W -
« ^
ris
e
fl 3 . = O
o
, o o ^ M M
3 00
-c J l
- 3
O
o 1)
CO
O u->
<-< M ^
T3
.T
o o vO
Vk4
c J l
*;
u O
. - 4
ii - 3 O
2:
rO c ^ C7> DO N CO 10 rO CN
76
While not shown, conventional and advanced PID controllers are
completely ineffective. While these PID controllers can be tuned
for one particular system of compositions and acid strengths, when
these factors change, even slightly (which is a common occurrence
for an actual wastewater system), the PID controllers typically
oscillate about the pH setpoint or have a steady state offset.
These conditions result because the changing conditions of the
wastewater system cause the tuning parameters of the PID control
lers to become invalid.
6.3 Ramp Upset
Ramp disturbances are as likely as step changes, and Figure
6.10 illustrates such an event superimposed on the auto-regressive
drifts. From time 30 to 1500 seconds the weak acid concentration
decreases 22.5%, the strong acid concentration increases 82X, the
common ion salt decreases 96.5%, and the Gibbs energy of dissocia
tion of the weak acid increases 40% (see Table 6.3). All these
changes occur gradually over a 25 minute period, and are intention
ally independent. During the upset the simulated influent pH
decreases by approximately 0.5 pH units. While the wastewater flow
and temperature remain essentially constant. One might expect that
this requires more base; however, the controller must reduce the
base flow rate 17% to hold the effluent pH within the control
77
o o CO ^"
o o T
"
o o CN *""
o o o ^
o o 00
o o CO
o o T
o o (N
•Ji
"3
0 u 4) Ul
^^ 4) s
«.i4
H
4J
^
C
: i .
=
fl
•* » *
«
>l II
"~ •» — ..# ^
— • • •
:; —
; j
•
4;
3 :u}
X
k\
78
Table 6.3: Wastewater Compositions for Figure 6.10
Simulated Wastewater Upset Change Period
30 to 1500 Seconds
Component or Characteristic 300 1500
Weak Acid Concentration 0.053 0.01 gmoles/liter
Strong Acid Concentration 0.005 0.01 gmoles/liter
Salt Concentration 0.0075 0.0005 gmoles/liter
Weak Acid G Dissociation 5000 7000 cal/gmole
79
specifications. This counter intuitive feedforward nature is the
result of the process shift from a weak acid to a strong acid which
the controller parameterization fully adequately characterized.
Figure 6.10 shows the titration curves of both the simulated
process and the controller's fictitious acid at times corresponding
to 30 and 1500 seconds on Figure 6.11. And again, similar conclu
sions to those for the step upset in section 6.2 can be made about
the approximations of the fictitious titration curve to the actual
process.
6.4 Large Finishing Blender
A CSTR blender added to the end of the effluent line of the
base case controller system will act as a first order lag on compo
sition changes, consequently damping out temporal changes and
reducing both the rate and amplitude of upsets. The effects of
adding a large blender at the end of the pH neutralization effluent
line can be seen in Figure 6.12. The finishing blender used in
this investigation has a residence time of approximately 100 sec
onds. The wastewater compositions and upsets used in this compari
son were the same as those used for the step upset controller
response examined in section 6.2. Figure 6.12 shows a damping of
the pH deviations from the 7.0 pH setpoint; especially for the
80
1
•> CN r
' " *• ' =>s \
_ ^\N
\ \ \ \
\ \ \ \
A\
a
\
1
cond
nd
s C
30 S
a 30
Suc
o
9
9 9 > U 9 3 >
U U 3
e o o •*4 S w O 9 f* U 4* W 9 •*4 U
0)
Pco
ce
Mod
el
1 1 1 1 1 1 - O CD DO N ^ u
• ^ e • o ^ u e o o M u
9 O CO o — o
(3 44
o a > U 9 3 > ( J w
3
\ O
\ \ " o \ \ 9 •—
\ \ ** 9 \ -^ ^ \ \ • " -
\ \ U 9 . 1 o -o \ I ^ X
t 1 / /
i \ y
\^ M \ \ \
V M H M \ \ \ \ ' I
\ ^
\ v\ . \ \ \ \ w
\ ^ ^ 1 i 1
0 ^ ^ ^
^ 2
1 m
j j
" ^ ^ • M
« • l «
• w
x ^ 2
s
«
W
••
l »
i »
»
i *
^
^ ^ * •
« ^ ^
*
^
OO
!2§ K> o • • •
* u 4)
^ ZL <A
CN i B 00
e o
9
20
on
cen
ti
o 4) Ul (a oa
r-^^
O
4) U= •u CQ O 3 ^ CO U VO 4) > 4)
I . M
M l . 4 CO 3 (Q bO 4) - < U b« O U c
Ou 0
4) ca
r th
co
nd
0 4) w cn 0) O 4) O
£2 3 o -o
c c « o
i ^ o
<u O 1
of
Ti
Tim
es
0 1-1 on 0
•^ (4^
« f-4 O. 4) e T3 0 0
• • »—1 ^ VO
4) kl
3 • P 4
Cbi
81
K ) C>J Cl> DO CO i n to cs
82
crucial regions after the process upsets, where control specifica
tions have been violated. It can, therefore, be noted that the
effluent blending tank reduced both the total amount of time that
the effluent pH was out of specification and the magnitude of the
excursion.
A similar type response would be expected for all upset types,
since the CSTR acts only as a mechanism for blending a large amount
of "in-spec" effluent with a small amount of "out-of-spec" efflu
ent. It should be noted that a blender with a smaller residence
time would dampen the upset less, while one with a larger residence
time would dampen the upset more. Therefore, this one case is
enough to demonstrate the effect of a finishing blender.
6.5 Model Mismatch and Calibration Errors
The control model contains the significant simplification of
considering the wastewater as containing a single weak acid when it
is actually a multicomponent acid system. In this section, the
base case controller used in the previous sections will have the
added responsibility of correcting for additional intentional
modeling and calibration errors. The errors to be added in this
section are those which are the maximum expected in a normal model
ing effort because no process measurement can be exactly known.
83
The additional modeling errors were the values of the mixer
volumes and the concentration of the reagent base used as the
neutralizing agent. The controller model uses a mixer volume of
0.02 liters, while for this case the actxial mixer volume was set at
0.0221 liters: a 10.5Z error. The controller model also uses a
reagent base concentration of 0.1 Molar, while for this case the
actual concentration was set at 0.1093 Molar. And again, this 9.3X
deviation is a typically expected maximum variation.
The controller, in this case, also had to account for calibra
tion errors in effluent pH and influent wastewater flow rate. The
effluent pH value read by the controller had a continuous bias of
0.67 pH units added (or subtracted, depending on the direction of
the intended bias) to the measurable value. The wastewater flow
rate also had a continuous bias of 0.095 liters/minute added (or
subtracted) to the measurable value. These calibration errors are
relatively slightly higher than those expected, yet are used to
illustrate the controller efficacy in handling such errors.
For the base case controller acting on the dual step change
the average lAE (Integral of the Absolute Error, a controller
performance criteria) was 586.1 pH*seconds (for the time interval
of 0 through 1700 seconds) for the controller response with no
calibration error and no modeling errors in mixer vol\ime or reagent
84
base concentration. The average lAE (for the base case controller
acting over the same time interval) was 609.6 pH*seconds for the
controller response with the above mentioned modeling mismatches
and calibration errors (acting in both the positive and negative
direction). Table 6.4 illustrates the actual lAE's obtained-for
progressively adding the modeling mismatches and calibration er
rors . This yields only a 4Z decrease in controller performance
(increase in overall average lAE), and there are no visual differ
ences between the controller effluent pH responses with or without
the errors, therefore curves will not be shown.
It should also be noted that the errors are sometimes slightly
beneficial to control and then sometimes detrimental; yet overall,
reasonable calibration and modeling errors are inconsequential.
6.6 Varied Set Ratios for Base Split
Another effect that had to be examined before further investi
gation, was what effect the different ratio settings (percent of
total base required to be injected in the first mixer divided by
the percent of total base required to be injected into the second
mixer) would have on controller performance. The desired ratio had
to be small enough to yield a midpoint pH far enough away from the
pH neutrality region to yield some information concerning the
location of the middle section of the titration curve, yet also has
85
Table 6.4: IA£ Results for Modeling Errors Introduced Into the Step Change Conditions of Section 6.2
Base Casa * "+•• Calibration "-" Calibration With Errors Errors
No Additional x x errors 666.3,625.3,563.2 587.8.594.8,479.4
Base Concentration Mismatch
Mixer Volume Mismatch
655.1,620.9,572.9
675.1,634.6,573.3
597.7,590.4,475.7
606.2,587.3,480.3
Calibration Error in pH of the Ef f Ixient 6 3 1 . 0 , 577 . 9 , 50^ . 1 721. 9 , 660 . 5 , 589 . 2
Calibration Error in Base Flow meter 585.3,570.7,520.1 708.5,669.1,603.8
*Each error is progressively included into the simulation.
xSimulation runs made with 3 different random number seeds
86
to be large enough to allow for valve rangeability (especially in
the second injection).
Many trials (refer to Table 6.5) for the base case controller
acting on the ramp upset presented in section 6.3 were made at
varied values of base flow ratio and the operating region for this
ratio was set between 60/40 and 80/20. This region was obtained by
a subjective balance of lowest response lAE's under control condi
tions where the nonstationary process compositions varied strongly
(Seed 137) and where they varied weakly (Seeds 747, 274, & 3117).
Another factor considered when bounding this region at 60/40
and 80/20 was consideration of actual plant implementation. The
valve required for the secondary base injection should be smaller
than the first for more precision in the flow, yet must also be
large enough to accommodate higher possible flow rates required for
some wastewater systems.
6.7 Variable Base Split Ratio
In the base case controller, the base flow rate was split into
two streams and sequentially injected into the pH neutralization
line. The ratio used in the base case was 60/40, or in other words
60% of the desired base flow rate was injected into the first mixer
and the remaining 402 was injected into the second mixer. This
ratio was chosen in order to try and obtain some meaningful measure
87
Table 6.5: IA£ Results for Various Base Split Ratios
Random Ntomber Seed
137
747
274
3117
60/40
827.9
556.7
578.2
560.2
Base 70/30
822.0
565.9
591.8
564.8
Split Ratio 75/25 80/20
728.6
563.2
598.4
573.5
762.6
584.8
617.8
587.4
85/15
758.0
604.8
637.9
620.0
88
of where the middle section (between influent pH and effluent pH)
of the titration ctirve was located over a wide range of effluent
pH's.
For this case, however, the controller will be allowed to
calculate the base flow ratio to be used for control of the ramp
upset process of section 6.3. This will be accomplished (refer to
Appendix G) by having the controller calculate the amount of base
required to bring the intermediate pH of the fictitious acid system
to a target pH of 5.0. This calculated base requirement is then
divided by the base requirement calculated for pH neutralization to
yield the desired base flow ratio.
However, because of instrumentation noise and other factors,
this calculated base flow ratio will fluctuate rapidly around the
desired ratio. This calculated ratio will therefore, be filtered
using a first order filter in order to make the transition from one
ratio setting to another. The factor or the first order filter
used in this case was 0.99.
Therefore, based on the results of section 6.6, the ratio
calculated by the controller was bounded between 60/40 and 80/20.
Figure 6.13 illustrates the ratio calculated by the controller for
the same compositions and upset used in the ramp upset case of
section 6.3. It should be noted, however, that the effluent pH
89
CS 00
o
00
o
o o 00 r"
o o CO ^~
o o T
o o CN
o o o —
o o 00
o o CO
o o
o o CN
•
^^ en
•3 C O u 4j Ul
4} s
.«* ^
4) £
H •A
Ul
4) > U 4)
0 u « j
o o
.A
"3 4i
fl
3 U
V
iQ o o Ml 3 a& M l
• ^
a. en
3 0
'Oa
••r.
fl oa
• •
• vO
1
OO r o
1
CO
r o
1
r o
1
cs »
o
T
» o
3T
—V" 00 CO
» o
1
CO CO
o
1
CO
o
i
CN CO
ft
o
CO ft
o
I
00 •
o
4)
3 30
l^
90
responses, for the controller acting under a set ratio of 60/40 and
for the controller calculating the ratio to be used, had no visual
differences (and only slight variations in LAW; 594.8 for the base
case controller versus 612.3 for this variable ratio controller)
and will therefore not be shown. It should also be noted than even
though this effect was not studied extensively, based on the incon
sequential effect foiind in this one investigation and from the
results of section 6.6, it would be recommended to use a set ratio
of 75/25. This would reduce the number of computations and com
plexity of the controller as well as be simpler to implement in a
real system.
6.8 Weighting Factors in the Least Sqxiares Minimization
Another possible method to reduce lAE might be obtained by
varying the weight put on each pH point for obtaining the titration
curve (see Appendix F for minimization procedure). This may seem
to be only slightly beneficial for the cases where the pH setpoint
is 7, because only slight variations in the base flow rate setpoint
cause large variations in the effluent pH; therefore naturally
weighting the effluent pH point significantly more than the first
two pH points. Manual weighting may prove to be entirely necessary
for pH setpoints less than 7, however, because the effluent pH
point is no longer located on the neutrality region (near vertical
91
portion) of the titration curve and therefore has lost the natural
weighting found for pH setpoints of 7.
In the previous sections, the three pH points had equal
weighting in the least squares minimization procedure. Now varied
weighting factors will be used and the resulting effluent pH re
sponses examined.
For this case, the wastewater compositions and upsets from
section 6.2 (the dxial step upset) will be used. Figure 6.14 illus
trates two controlled effluent pH responses. The top curve is for
a case with a weighting of 0.1, 0.4, and 0.5 (for pH points 1, 2,
and 3, respectively), and the bottom curve is for a case with a
weighting of 0.25, 0.25, and 0.5. The controller response for the
weighting of 0.1, 0.4, and 0.5 shows adequate control over the
entire time region. The major difference in the two controller
strategies presented in the investigation is in decreasing the
weight on the influent pH point and increasing the weight of the
midpoint pH for the second control strategy. The results in less
ening the effect of the deviation of the influent pH of the process
from the influent pH of the model. This may be necessary for there
is the possibility of large deviation at the influent even for
adequate parameters. The controlled response for the weighting of
0.25, 0.25, and 0.5 shows adeqxiate control only over the time
92
O O
O O in
o o
o o
o o 0>
o o 1^
o o in
o o
o o
30
c
00 •«« 4) 3
C V u 41
O 3 H u O
irt
(A •3 C 0 u 4) Ul
4} s
.^ H
^ c u 3
" • V^rt
« M
o c o •Ji
•Jl
4> cn
fl o a. — S y o fl
4) u 3 30
(O CN ^ O 0> 00 CO in rO CN
93
region of 100 to 1200 seconds. At 1200 seconds an extreme step
upset upward in acid composition occurs that causes the pH measured
values at the influent, the midpoint, and the effluent to all drop
dramatically. When this occurs, the controller has information
concerning the lower portion of the titration curve but no informa
tion concerning the neutrality region or above. This causes the
controller model to parameterize the model coefficients on insuffi
cient data and thereby resulting, in this case, in an invalid
parameter identification. It can also be seen by the 2.5 pH unit
offset that this identification resulted in an almost unrecoverable
condition (it can be seen in the 1500 to 1800 second region that
the controller is slowly recovering and bring the effluent pH back
toward the setpoint of pH-7. It should also be noted that the
choice of "tioning parameters" (Kl, K2, weighting factors, standard
deviation value used to identify steady state, "trigger" that
initiates the model parameterization procedure, etc.) all have an
effect on the controller's performance in this type situation. The
lAE's presented in Table 6.6 illustrate the effect of varying the
K2 value and the parameterization trigger mechanism on the above
controller performance.
94
Table 6.6: lAE Results for Various Tuning Parameters for tha Step Change Conditions Presented in Saction 6.2
Effluent pH Set Point
7.0
7.0
7.0
7.0
5.0
5.0
5.0
5.0
5.0
Midpoint pH Target
5.0
4.0
5.0
5.0
3.5
3.5
3.5
3.5
3.5
K2
0.014
0.014
0.04
0.07
0.014
0.014
0.014
0.04
0.07
Para. * Trigger
1
1
2
2
1
1
2
2
2
Weighting 1st,2nd,3rd
.33,.33,.33
.25,.25,.5
.1, .4, .5
.1, .4, .5
.33,.33,.33
.1, .4, .5
.1, .4, .5
.1, .4, .5
.1, .4, .5
lAE
603.1
1744.1
830.1
846.9
439.5
1688.2
671.4
342.3
267.9
•Parameterization Trigger
1--Parameterize model each time steady state is identified.
2--Parameterize the model only once per steady state identification and identify the loss of steady state as reaching a threshold value of the effluent pH standard deviation of 0.22.
95
6.9 pH Setpoints Other than Seven
Another potential controller application investigated was the
use of setpoints other than 7, such as in chemical reactors, cool
ing tower water treatment, waste digestion, etc., where special pH
conditions need to be maintained.
For the system composition and upset of section 6.3, the ramp
upset, a pH setpoint of 9.0 was implemented. The controller re
sponses showed adequate control with practically no deviation in
the lAE's (882.6 for weighting factors of 0.25, 0.25, 0.5 versus
889.3 for equal weighting factors of 0.33). This is to be expected
since this type situation lends itself to this controller strategy
because of the inherent positions of the pH points. These posi
tions yield information about all the regions of the titration
curve: (1) pH at the influent--information about the location of
the lower titration curve region, (2) pH after the first base
injection-information about the location of the neutrality region
of the titration curve, and (3) pH at the effluent--information
about the upper titration curve region.
The runs made at a pH setpoint of 5 (refer to Table 6.6),
however, did not show such favorable results. This too is to be
expected though because of the inherent lack of needed information
concerning the titration curve. This lack of information results
from all three pH points being in the lower titration curve region
96
and therefore there is no indication of the location of the neu
trality region of tha curve much less the upper region. It can be
noted however, for the case with a pH setpoint of 5 that different
(Para. Trigger 2 of Table 6.6) parameterization "trigger" mech
anisms (indication of when to parameterize the model) and different
values of K2 (increasing the K2 value from the 0.014 used in the
base case controller) made significant improvements in the control
ler performance.
CHAPTER 7
CONCLUSIONS AND RECOMMENDATIONS
7.1 Conclusions
A new strategy for the control of wastewater pH neutralization
has been simulated under many varying control conditions and in the
presence of noise and nonstationary process behavior. In both ramp
and step upsets, its performance suggests rapid and effective
control. The process model based controller only requires adapta
tion of two model parameters, is rapidly parameterized, remains a
true process simulator during rapid process changes, does not
require process upsets for parameterization, and controls stably
for a wide variety of upsets.
Control is not degraded with maximum expected model and cali
bration errors.
The effect of the finishing blender was, as expected, to damp
out the temporal composition changes and to reduce both the rate
and the amplitude of the pH upsets.
The least squares minimization procedure for calculation of
the model parameters has shown improved robustness to noise over
the parameterization procedure used in the Rhinehart and Choi work
(1988). The investigation of variable base flow split ratio, on
the other hand, seems to add little to control performance.
97
98
The study of the effects of weighting the pH points in the
least squares minimization for parameter identification, and the
effect of pH setpoints other than 7 illustrates the potential
ability of the controller to more effectively handle the extreme
step upsets in the neutralization process and to also adequately
control the process for pH setpoints less than 7.
7.2 Recommendations
Even though the method applied in the control strategy works,
there are several factors that need to be investigated for their
possible improvement to the control performance.
The most important factor for future study would be the choice
of the parameterization trigger strategy. This factor is important
becatose the controller's response to extreme step upsets is highly
dependent on the trigger strategy.
The trigger strategy expected to yield the best results would
be to parameterize the model only once per steady state and identi
fy the loss of steady state by reaching a pH of greater or less
than 0.5 pH units from the pH steady state value. Another possi
bility would be to again parameterize the model only once per
steady state, yet identify the loss of steady state by exceeding a
threshold value for the filtered standard deviation of the effluent
pH. This threshold value would be expected to be about 0.22. And
still another possibility would be to parameterize the model when
9v
the effluent pH violates plus or minus 1 pH unit from the pH set
point.
The next area for future study would be the effect of the
weighting factors of the least squares minimization procedure on
model parameterization. These factors have been shown, in Chapter
VI, to play a major role in the controller's response to extreme
step upsets and also in the controller's response for pH setpoints
of less than 7.
It is expected that the weighting factor for the influent pH
point should be reduced, to around 0.1 or 0.05. And the weighting
factors for the midpoint and effluent pH points should be in
creased, to around 0.4 and 0.5 or 0.45 and 0.5, respectively.
These weighting factors should result in improved control,
especially for cases with pH setpoints of less than 7.
Another possibility for improvement would be to study the
effect of the intercept value for the K2 value of the control law.
An increase in K2 would be expected to increase the integral recov
ery of offset due to model mismatch. This offset can be somewhat
devastating as seen in Figure 6.14.
And still another possibility worth further study would be to
not zero the integral term of the control law at parameterization
as was done in this work. This would be expected to help the
controller recovery from extreme step upsets as in Figure 6.14, yet
this could also be detrimental to control in regulatory mode if the
100
integral term is high enough (large enough K2) to cause small
oscillations about the pH setpoint.
Additionally, a constant base flow split ratio of 75/25 would
be recommended.
And finally, the controller should be experimentally vali
dated.
LIST OF REFERENCES
Albert, W. and H. Kurz: "Adaptive Control of a Wastewater Neutralization Process-Control Concepts, Implementation and Practical Experiences," IFAC Adaptive Control Chemical Processes, Frankfurt am Main, FRG, 1985.
Balhoff, R. A. and A. B. Corripio: "An Adaptive Feedforward Control Algorithm for Computer Control of Wastewater Neutralization," IFAC Real Time Digital Control Applications, Guadalajara, Mexico, 1983.
Gardner, D. V.: "Model Inferential Optimizing Computer Control of Three Series Reactors," ISA/84 Conference Proceedings. ISA/84 paper C.I.84-4722, Houston, TX, October, 1984.
Cott, B. J., P. M. Reilly and G. R. Sullivan: "Selection Techniques for Process Model-Based Controllers," AIChE Annual Meeting, Miami Beach, FL, November, 1986.
CRC Handbook of Chemistry and Physics. 62nd Edition, Robert C. Weast and Melvin J. Astle, editors, 1983.
Cutler, C. R. and B. L. Ramaker: "Dynamic-Matrix Control--A Computer Control Algorithm," 1980 Am. Control Conference Proceedings. San Francisco, CA, 1980.
Economou, C. and C. Morari: "Internal Model Control. 5. Extension to Nonlinear Systems," Ind. Eng. Chem. Proc. Des. Dev.. Vol. 25, 1986.
Garcia, C. E. and M. Morari: "Internal Model Control. l.A Unifying Review and Some New Results," Ind. Eng. Chem. Proc. Des. Dev.. Vol. 21, 1981.
Gray, D. M.: "New Solution to pH Control Problems," Pollution Enp;ineering. April, 1984.
Gustafsson, T. K. and K. V. Waller: "Dynamic Modeling and Reaction Invariant Control of pH," Chemical Engineering Science. Vol. 38, No. 3, 1983.
Gustafsson, T. K. and K. V. Waller: "Myths About pH and pH Control," AIChE J.. Vol. 32, No. 2, February, 1986.
101
102
Jeffreson, C. P.: "Computer Control of Simple Variable Flow Processes," IFAC Real Time Digital Control Applications, Guadalajara, Mexico, 1983.
Joseph, B. and C. B. Brosilow: "Inferential Control of Processes," AIChE J.. Vol. 24, No. 3, March 1978.
Juba, M. R. and W. Hamer: "Progress and Challenges in Batch Process Control," Chemical Process Control - CPCII, Morari and McAvoy editors, CACHE-Elsevier, Proceedings of 3rd Intl. Conf. on Chem. Process Control. Asilomar, CA, June, 1986.
Klumper, I.V. and D. Z. Tobias: "Simulation and Control of Inaccessible Complex Non-Steady State Processes," AIChE Summer National Meeting, Boston, MA, August, 1986.
Lee, P. L.: "Real Time Multivariable Control," IFAC Conference, 1987.
Lee, P. L. and G. R. Sullivan: "Generic Model Control - GMC," Computers and Chemical Engineering. Vol. 12, No. 6, p. 573, 1988.
Leeds and Northrup Instruments: 7084 Microprocessor pH Analyzer/Controller, Product Bulletin C2.1212-DS, North Wales, PA, 1984.
LFE Instruments: Model-3031 pH Controller, Product Bulletin 2409-SBl, Clinton, MA, 1987.
Lu, Y. Z.: "Application of Control Strategies to Thermal Processes in the Metal Industry," 1986 Am. Control Conference Proceedings. ACC Meeting, Minneapolis, MN, June, 1987.
McAvoy, T. J., H. Hsu and S. Lowenthal: "Dynamics of pH in Controlled Stirred Tank Reactor," Ind. Eng. Chem. Proc. Des. Dev. . Vol. 11, No. 1, 1972.
McDonald, K. : "Performance Comparison of Methods for On-Line Updating of Process Models for High Purity Distillation Control," AIChE Spring Meeting, Houston, TX, Session 59, March, 1987.
McMillan, J. M.: "Multivariable Adaptive Predictive Control of a Binary Distillation Column," Automatica. 20, no. 5, 1984.
Moore, R. L. : "Neutralization of Waste Water by pH Control," ISA. Monograph Series 1. 1978.
OMEGA Engineering, Inc.: New Horizons in Process Measurenienu and Control, Model PHCN-2031, Vol. V, Stamford, CT, 1987.
103
Parrish, J. and C. Brosilow: "Nonlinear Inferential Control of Reactor Effluent Concentration from Temperature and Flow Measurements," 1986 Am. Control Conference Proceedings. Seattle, WA, June, 1986.
Patterson, M. J.: "A Survey of Model Reference Adaptive Techniques--Theory and Applications," Automatica, 10, 1975.
Piovoso, G. and A. W. Williams: "Modeling a Low Pressure Steam-Oxygen Fluidized Bed Coal Gasifying Reactor," Chem. Eng. Sci.. 36, 1985.
Proudfoot, R. D., and C. McGreavy: "Computational Techniques in Optimal State Estimation," J. Dynamic Systems. Measurement & Control, 1983.
Rhinehart, R. R.: Dynamic Modeling and Control of a Pressurized Fluidized Bed Coal Gasification Reactor. PhD Dissertation, NC State Univ., Raleigh, NC, 1985.
Rhinehart, R. R. and J. Y. Choi: "Process Model-Based Control of Wastewater pH Neutralization," Advances in Instrumentation. Vol. 43, pp. 351-358, 1988.
Rhinehart, R. R., R. M. Felder and J. K. Ferrell: "Internal Adaptive-Model Control of a Coal Gasification Reactor," AIChE National Meeting, Boston, MA, paper 273, August, 1986.
Richalet, J. A. and I. H. Congalidis: "New Challenges for Process Control," AIChE Annual Meeting, Washington, DC, November, 1983.
Richalet, J., A. Rault, J. L. Testud and J. Papon: "Model Predictive Heuristic Control: Application to Industrial Processes," 4th IFAC Symposium in Identification and System Parameter Estimation, 1976; also Automatica, Vol. 14, September, 1978.
Riggs, J. B. and R. R. Rhinehart: "Comparison Between Process Model-Based Controllers," Proceedings of the 1988 Am. Control Conference. Atlanta, GA, 1988.
Seaborg, D. A.: "Stability and Response of the Analytical Reactor," Tnd. Eng. Chem. Proc. Des.. Dev.. Vol. 22, 1983.
Seaborg, D. A., R. Kelly and R. W. Ferrell: "Internal Adaptive Model Control," Proc. of Amer. Control Conf.. Minneapolis, June 10-12, 1982.
Shinskey, G.: pH and oION Control in Process and Waste Streams. Wiley, 1983.
APPENDIX A
IONIZATION CONSTANT OF WATER (CRC, 1983)
Table A.l shows the variation of water ionization constant (K)
for temperatures ranging from 273 K to 333 K.
The functional form of K (T) is obtained by fitting data to a
second degree polynomial:
K - 10**(-C1-C2*T-C3*T**2) (i)
where CI is equal to 38.42828, C2 is equal to -0.1305219, and C3 is
equal to 1.628-4.
Equation (i) is used to calculate K values at given tempera
tures. At a temperature of 297 K (24 C), the K value calculated
from Equation (i) deviates only 0.2% from tabulated data.
104
105
Table A.l: Water Ionization Constant
-Log (K) Temperature
14.9435
14.7338
14.5346
14.3463
14.1669
14.0000
13.9965
273
278
283
288
293
297
298
-Log (K)
13.8330
13.6081
13.5348
13.3960
13.2617
13.1369
13.0171
Temperature
303
308
313
318
323
328
333
APPENDIX B
MULTI-VARIABLE NEWTON'S METHOD
Newton's Method is used to evaluate the two unknowns of Equa
tions 4.2.1 and 4.2.2. Newton's Method is applied by setting
the solution vector V - and then applying the following
iterative steps:
Step 1:
Step 2:
Calculate f(V)
J(V) * AV - - f(V)
where J - Zf.,/Zx
Zf^/Zx
Zf^/Zd
Zf2/Zd
Solving this linear system, yields
AX - (f2*dfi/88 - fi*af2/a5)/DET,
A8 - (fi*af2/ax - f2*afi/3x)/DET
where DET - 8fi8-x*df2/<p8 - d^i/d8*dd2/dx
Step 3: Check the stopping criteria
Step 4: Repeat the loop until the criteria is satisfied.
106
107
*Stopping criteria is: ABS (Ax/x) > 1 * 10"5
and
ABS (AJ > 1 X 10-5
Execution will be repeated until AV satisfies the stopping cri
teria.
i
APPENDIX C
RANDOM NOISE
A Gaussian Distribution Random Number is generated by use of the
following equation developed by Dr. R. R. Rhinehart of Texas Tech
University.
X - RND
Noise - SD * 1.9607 * (x-.5)/((x + .002432) * (1.002432-x))•203
where x - A uniform distributed random number generated by the Computer
Internally.
SD - the standard deviation of the Gaussian distributed numbers
to be generated.
Noise - A Gaussian distributed random nximber with a mean of zero
and a standard deviation of SD.
The random noise on the process instruments is simulated by simply
adding the noise variable from above to the instrument's simulated
reading value calculated by the computer program.
108
APPENDIX D
AUTOREGRESSIVE DRIFT
The non-stationary process characteristics are simulated by
adding a disturbance to the value calculated by the program. This
disturbance is simply a second order autoregressive sequence gener
ated in the following manner.
Step 1: Time - 0 PV - PV o
Step 2: drt - b3*drt + (l-b3)(.5-RND)
dist - dist + b2*drt
where: b2 and b3 are constants
dist - the disturbance to be added to PV
Step 3: Time - t^ PV^ - PVQ + dist^
Step 4: Repeat Steps 2 and 3.
109
APPENDIX E
FILTERING PROCESS VARIABLES AND SIMULATING
INSTRUMENTATION TIME LAG
To reduce the effect of the random noise associated with the
process variable we will simply apply a first order filter in the
following form:
PVp - aPVc + (1-a) PVp
where: PV^ is the current process variable reading
PVp is the filtered process variable
a is the filtering constant associated with each
process variable.
This filtering will dampen the noise effects, yet will also cause a
time lag in recognition of an actual change in the process vari
able. Therefore, the value chosen for a must be small enough to
dampen out the noise, yet be large enough to allow for recognition
of an actual change within a reasonable amount of time. This first
order filter equation will also be used to simulate the time lag
associated with the process instrumentation readings. In this
case, the a value will be determined as follows:
a - At/r
no
HI
where At is the sampling time interval
r is the process time constant
^
APPENDIX F
LEAST SQUARES MINIMIZATION
The original function developed in Equation (3.4.11) is as
follows:
-pH f(AfAGf) - Exp(-AGf/RTi) " dO ) (Ci +ei)/(A - C - e .)-0
1
where: Af - fictitious weak acid concentration
AGf - fictitious DG of the fictitious weak acid
R = gas constant
T - temperature
pH - pH
€ — base concentration
i - denote t he point in the system
1 = inlet
2 = point after 1st base injection
3 - effluent and
C - 10-pH - Kv,*10P i .
The term (A^ - C. - c.) was seen to be zero at certain f. 1 1
1
conditions and, therefore, for control ler robustness the function
wi l l be inverted, yielding:
112
113
f(A^G^) Exp(AG^/RT^) - ^^-jj-
(A^^ - C^ - e.) I.
(10 '•)(C + e^) - 0
The least squares minimization function will therefore be: 2
3 (Af. • i • ^i) S - S Exp(AG^/RT^)
i-1 - - -P«i (10 '•)(C + 6 ) (i)
Expanding Equation (i) yields:
^ 2 Exi^^f^/^^i^^^i ' ^ ' '^^ S - S Exp(2\5\g /RT ) - ^""^ l^
i-1 "P^i (10 "•) (C. + € )
2 (A. - C. - €.)"•
f L 1 1
+ -pH (10 '•)^(C^ + €^)^
Taking the derivatives with respect to Af and AGf and setting
them equal to zero gives:
3 2(A^^ - C. - . . )
ff- - R u 0 (ii) 3Af i _ i -pH.
^ "• "• ( 1 0 ^ ) ( C ^ + e^)
3 Exp(AG /RT )(A - C - e )
I f^ - 2 i T Exp(2AG /RT.) - ^ ' ' , ^ — ' f i - 1 i i -pH.
(10 "• ) (C^ + c^) ( i i i )
114
Now assume T. ? constant - T.
Divide Equation (ii) by 2.
Divide Equation (iii) by 2/RT.
Equation (ii) yields 3 (A - C - 6 ) 2 i ^ ^ i-1
-PH.)2 (10 "- (C. + e.r
Exp(AG^/RT) - - ^ ^
i-1 ,, P»i (10 ^)(C^ + e^) . (iv)
Equation (iii) yields
3 Exp(AG^/RT)(A^ - C^ - €/)
^ - f k - .2 Exp(2AG^/RT) - — ^ - 0
(10 '•)(C^ + e/)
From Equation (iv), AGf is expressed in terms of Af, therefore,
leaving us with one independent equation with one unknown (Equation
(v) and unknown Af. Af can therefore be determined by simply
applying Newton's Method to Equation (v) . Then AGf can be
determined by (inserting into Equation (iv)) the Af value
determined by Newton's Method. (Note: The Newton's Method search
uses the analytical derivative of Equation (v) yielding
115
3 -Exp(AG-/RT) N - 2 ^
i - 1 -P» i (10 ^ ) ( C . + € )
APPENDIX G
SPLIT CALCULATOR
To determine the split (base injected into first port/total
base injected) required at each control action, the following steps
are applied:
Step 1: Call subprogram SSINV to determine the total base
required for the pH steady state target (phss).
Step 2: Call subprogram SSINV to determine the base required
for some desired intermediate pH (say pH-5.0).
Step 3: Divide the amount of base calculated in Step 2 by
that calculated in Step 1. (Note: Since this is a
highly nonlinear process, this split can vary some
what severely from control action to control action.
Therefore, apply Step 4.
Step 4: Apply a first order filter to the calculated split
(from Step 3), with a recommended a of 0.6.
116
APPENDIX H
FILTERED STANDARD DEVIATION
To determine the filtered standard deviation used to identify
steady state the following equations are applied.
xf - a * pHout + (l-a)xf (1)
vf - a * (xf - pHout)^ + (l-a)vf (2)
sv - (vf)0.5 (3)
where xf is the filtered effluent pH
a is 0.3
vf is the filtered variance in the effluent pH
sv is the filtered standard deviation in the effluent pH
A threshold value of 0.175 for sv was used in this work for identi
fication of steady state.
117
APPENDIX I
COMPUTER CODE
•PMBC.BAS •July 25, 1989 'Gaylon L. Williams
'THE SIMULATION OF A LABORATORY-SCALE WASTEWATER 'NEUTRALIZATION PROCESS
'The QuickBasic program PMBC.BAS consist of two parts, 'process simulator (simulation of the acidic wastewater 'stream) and controller part (PMBC). The process 'simulator generates simulated data of the wastewater, 'temperature, flowrate, and pH for the influent, the 'midpoint, and effluent. The process simulator also 'simulates the instrumentation noise present on the pH 'probes and the flow meters; and also the measurement 'lag present with these instruments. The controller •model is periodically adapted to match the real process ' in the controller part so that the controller 'calculates the proper base flow rate set point. This 'simulation program does not consider any transport 'delay between the mixing vessels. All used variables 'are commented in each subroutine.
'The code for PMBC.BAS follows:
118
119
•k-k-k-k-k MAIN PROGRAM *****
The main program supervises the entire simulation program and this part provides the required constants and initial values needed in the other sections. The process simulator subprograms are:
DFT - this subprogram generates the numbers used in simulating the nonstationary nature of the component compositions
DataGen - this sxibprogram generates the pH values of the 3 different positions (influent, midpoint, and effluent)
Noise - this subprogram generates the noise which is added to the pH and flow rate measurements
PrcsLag - this subprogram simulates the time lag present in the measurement devices.
Pictl - this subprogram simulates the dynamics of the PI control valve on the base (titrant)
The controller part subprograms are: CalBase - this subprogram calculates the base
concentration of the influent, midpoint, and effluent based upon the simulated measured data.
Suprvsr - this subprogram calculates control actions and decides when to reparameterize the model
AdaptPar - this subprogram parameterizes the model when called upon by Suprvsr subprogram
DEFDBL a-h,k-z DEFINT i,j
COMMON SHARED time, dt, r, cl, c2, c3, vol, be, tb
RANDOMIZE (747)
OPEN "C:\lotus\PMBCl.PRN" FOR OUTPUT AS #1 OPEN "C:\lotus\PMBC2.PRN" FOR OUTPUT AS #2 OPEN "C:\lotus\PMBC3.PRN" FOR OUTPUT AS #3 OPEN "C:\lotus\SPLIT.PRN" FOR OUTPUT AS #4
DIM E(3),C(3),PH(3),AFICT(3),N(3),D(3),A(3)
120
************ Set up All Constants And Initial Values Cl= 38.42818D0 C2=-0.1305219D0 C3= 0.00016287D0 r=1.987D0 bc=0.IDG tinc=298D0 t2c=298D0 toutc=298D0 Vol=0.02D0 dt=0.2D0 bfsp=l.llD0 bfc-bfsp afc=2.0D0 ratio=bfsp/afc i=l ebasel-O.ODO ebase2=0.02498124531132783D0 ebase3=0.03569131832797428D0 wa2=0.03750937734433608D0 sa2=0.004126031507876969D0 salt2=0.0005626406601650413D0 base2=0.02498124531132783D0 wa3=0.03215434083601286D0 sa3=0.003536977491961415D0 salt3=0.0004823151125401929D0 base3=0.03569131832797428D0 tb=298D0 Xl=.lD-4 dell=0D0 x2=.lD-4 del2=0D0 x3=.lD-4 del3=0D0 time=0.ODO distwa=0.ODO distsa=0.ODO distsal=O.ODO distg=O.ODO disttl=O.ODO distaf=O.ODO ctltime=O.ODO sd=0.12D0 proIAE=0.0D0 ebfsp=l.llD0 ebfcf=l.llD0 eafcf=2.0D0 ephoutcf=7.ODO eph2cf=3.5D0 ephincf=2.ODO
121
irp=0 afic=5.55D-2 gfic=4.75D3 Xf=7.0D0 vf=0.15D0 af1=2.ODO bfl=:l.llDO phinl=2.ODO ph21=3.5D0 phoutl=7.ODO icount=6 split=0.75D0
' Split the base flow into two parts
100 bfcl=bfc*split bfc2=bfc*(1.ODO-split)
' Calculate the amount of drift to be added to each ' process variable
CALL DFT (dftwa,.997D0,.00004D0,distwa) CALL DFT (dftsa,.997D0,.000009D0,distsa) CALL DFT (dftsal,.997D0,.00002D0,distsal) CALL DFT (dftg,.997D0,10.0D0,distg) CALL DFT (dftaf,.997D0,.00025D0,distaf) CALL DFT (dfttl,.997D0,0.5D0,disttl)
' Add the drifts to each process variable ' and make step or ramp changes
IF (time < 400) THEN af c=2. ODO-i-distaf wal=0.05D0-»-distwa sal=0.0055D0-i-distsa saltl=0.005D0-Hdistsal g=5.0D3-Hdistg tinc=298D0-i-disttl
ELSEIF (time < 1200) THEN af c=2. ODO-i-distaf wal=0.03D0-i-distwa sal=0. OlDO-Hdistsa saltl=0.00005D0-t-distsal g=7.0D3+distg tinc=298D0-hdisttl
122
ELSE af c = 2 . ODO-J-distaf wal=0 .06D0+dis twa sa l=0 .004D0-t -d is t sa s a l t l = 0 . 0 0 2 D 0 - i - d i s t s a l g = 6 . 0D3-f-distg t inc=298D0- t -d i s t t l
END IF
• Concentrations cannot drift below zero
IF (wal < O.ODO) THEN wal=O.ODO
END IF
IF (sal < O.ODO) THEN sal=O.ODO
END IF
IF (saltl < O.ODO) THEN saltl=O.ODO
END IF
CALL DataGen (i,l,bfcl,tine,afc,phinc,basel,wal,sal, saltl,xl,dell,tine,t2c,toutc,bfc2,wa2, sa2,salt2,base2,g)
CALL DataGen (i,2,bfcl,t2c,afc,ph2c,base2,wa2,sa2, salt2,x2,del2,tine,t2e,toutc,bfc2,wa2, sa2,salt2,base2,g)
CALL DataGen (i,3,bfcl,toute,afe,phoutc,base3,wa3,sa3, salt3,x3,del3,tine,t2c,toutc,bfc2,wa2, sa2,salt2,base2,g)
CALL PrcsLag (afc,bfc,phine,ph2e,phoutc,afl,bfl,phinl, ph21,phoutl)
CALL Noise (tine,t2c,toutc,bfl,afl,phoutl,ph21,phinl, etinc,et2e,etoutc,ebfc,eafc,ephoutc,eph2c, ephine,sd)
• Filter the process variable readings
ebfcf=.6D0*ebfc-i-.4D0*ebfef eaf cf =. 6D0*eaf c-f-. 4D0*eaf cf ephoutcf =. 6D0*ephoute-i-. 4D0*£phoutcf eph2cf =. 6D0*eph2c-i-. 4D0*eph2ef ephinef=.6D0*ephine+.4D0*ephincf
123
CALL CalBase (ebasel,ebase2,ebase3,ebfef,eafcf, split)
CALL Sprvsr (ebasel,ebase2,ebase3,ratio,ephoutc, ephoutcf,eph2ef,ephincf,etinc,et2e,etoutc, eafcf,ebfef,proIAE,ctltime,afie,gfic, ebfsp,eint,xf,vf,sv,irp,split)
bfsp=ebfsp
CALL pictl (bfsp,bfc)
'prepare numeric format for lotus
pafic=afic*100D0 peint=eint*100D0 psv=sv*1000D0 pwal=wal*100D0 psal=sal*1000D0 psaltl=saltl*10000D0 pg=g/1000D0
'print every fifth time to lotus
IF (icount>4) THEN
PRINT #1,time,ephinc,ephoutc,bfsp PRINT #2,pwal,psal,pafic,gfic ieount=0
PRINT "pH in = ";ephinc;" @ time = ";time
PRINT "pH 2nd = ";eph2c;" pH out = "; ephoutc
END IF
icount=icount+l
time=i*dt i=i-Hl
IF (i < 9000) THEN GO TO 100
END IF
CLOSE #1 CLOSE #2 CLOSE #3 CLOSE #4
150 END
124
Subprogram DataGen
This Subprogram simulates the actual acid wastewater stream characteristics. It is used to simulate all three points in the stream, influent - midpoint -effluent, and is therefore called three times at each process time step, which is 0.2 seconds.
Variables
unless otherwise noted flow rate are in liters/minute, concentrations are in gmoles/liter and temperatures are in degrees K
ithpoint = the stream point 1 is the influent 2 is the midpoint 3 is the effluent
bfel = the base flow amount injected in the first mixing vessel
bfc2 = the amount injected in the second mixing vessel t = the temperature at each respective ithpoint af = the acid wastewater flow rate ph = the pH at each respective ithpoint basek = the base concentration at each respective ithpoint wa = the weak acid concentration at each respective
ithpoint sa = the strong acid concentration at each respective
ithpoint salt = the salt concentration at each respective ithpoint X = amount of weak acid dissociated del = the amount of water that has dissociated tine = current influent temperature t2c = current midpoint temperature toutc = current effluent temperature g = the Gibbs free energy of the wastewater ka = The equilibrium constant of weak acid dissociation kw = the water ionization constant
125
SUB DataGen (i,ithpoint,bfcl,t,af,ph,basek,wa,sa,salt,x, del,tine,t2c,toutc,bfc2,wa2,sa2,salt2,base2, g) STATIC
IF (ithpoint = 1) THEN
basek=0.ODO wal=wa sal'ssa saltl=salt t=tinc
ELSEIF (ithpoint = 2) THEN
itn=0 tau=60.0D0*vol/(af+bfcl) base2=basek-i- (bc*bf el/ (af-Kbf cl) -basek) *dt/tau basek==base2 wa2=wa-i- (af *wal/ (af+bfel) -wa) *dt/tau wa=wa2 sa2=sa-t- (af *sal/ (af+bfel) -sa) *dt/tau sa=sa2 salt2=salt-»- (af *saltl/ (af-i-bfel) -salt) *dt/tau salt=salt2 t2c=t+((bfcl*tb+af*tine)/(af+bfel)-t)*dt/tau t=t2c
ELSE wf2=af+bfel itn=0 tau=60.0D0*vol/(wf2+bfe2) wa3=wa+(wf2*wa2/(wf2+bfc2)-wa)*dt/tau wa=wa3 sa3=sa+(wf2*sa2/(wf2+bfe2)-sa)*dt/tau sa=sa3 salt3=salt+(wf2*salt2/(wf2+bfe2)-salt)*dt/tau salt=salt3 base3=basek+((be*bfe2+base2 *wf2)/(wf2+bfc2)-basek)*dt/tau basek=base3 toutc=t+((wf2*t2e+bfe2*tb)/(wf2+bfe2)-t)*dt/tau t=toutc
END IF
itn=0
Ka=exp(-g/(r*t))
kw=(10.0D0)^(-el-c2*t-c3*t^2)
126
200 fl=ka*(wa-x)-(sa+x+del)*(x+salt) f2=kw-(sa+x+del)*(del+basek) dfldx=-ka-2.0D0*x-sa-del-salt dflddel=-x-salt df2dx=-del-basek df2ddel=-sa-x-2.0D0*del-basek det=dfldx*df2ddel-dflddel*df2dx
IF (det = O.ODO) THEN x=x*0.03D0 del=del*0.03D0 GO TO 200
ELSE
dx=(f2*dflddel-fl*df2ddel)/det ddel=(fl*df2dx-f2*dfIdx)/det x=x+dx del=del+ddel h=sa+x+del
END IF
IF (h < 0) THEN x=x*1.5D0 del=del*0.03D0 GO TO 200
ELSE
itn=itn+l
END IF
IF (ABS(dx) > lD-14) AND (ABS(ddel) > lD-14) THEN
GO TO 200
ELSE
z=log(10.0D0) ph= -l*LOG(h)/z
END IF
END SUB
127
Subprogram Noise
This subprogram adds noise to the process variable from the DataGen subprogram in order to simulate the noise present on actual process instrumentation.
Variables
An e added to the front of a process variable signifies that the variable has noise added
An 1 added to the rear of a process variable signifies that the variable is a lag variable which simulates the time lag associated with process instrumentation
sd = the standard deviation of the Gaussian random number added to the process variable
SUB Noise (tine,t2c,toutc,bfl,afl,phoutl,ph21,phinl,etinc, et2c,etoutc,ebfc,eafc,ephoutc,eph2e,ephinc, sd) STATIC
etinc=tine et2e=t2c etoutc=toutc
CALL GAUSS (noise,0.00025D0) ebfc=bfl+noise
CALL GAUSS (noise,0.0005D0) eafc=afl+noise
CALL GAUSS (noise,sd) ephoute=phoutl+noise
CALL GAUSS (noise,sd) eph2c=ph21+noise
CALL GAUSS (noise,sd) ephinc=phinl+noise
END SUB
128
Subprogram CalBase
Since the controller cannot actually know the base concentrations at each point, this subprogram calculates these concentrations from noisy process data which it can know.
Variables
ebase = the base concentration calculated for each respective point in the stream
ebfcf = the filtered base flow rate measurement eafcf = the filtered acid flow rate measurement split = the base injected in the first mixing vessel
devided by the total base injected
SUB CalBase (ebasel,ebase2,ebase3,ebfcf,eafcf,split) STATIC
ebfcl=ebfcf*split ebfc2«ebfcf*(1.ODO-split)
ebasel^^O.ODO ebase2=ebase2+(bc*ebfcl-ebase2*(eafef+ebfcl)) *dt
/(60.0D0*vol)
ewf2=eafef+ebfel
ebase3=ebase3+((bc*ebfe2+ebase2*ewf2)-ebase3*(ewf2+ebfc2)) *dt/(60.0D0*vol)
END SUB
Subprogram Suprvsr 129
This supervisory controller looks at the process every 1.0 seconds and makes a control action based on the current conditions of the filtered lagging noisy process data measurements. If a steady state condition is recognized then the supervisory controller also calls the AdaptPara S\ibprogram and adapts the model parameters to fit the corrent conditions.
Varaibles
ebase = the base concentration calculated by the controller for each point in the wastewater stream
ratio = the base flow rate setpoint devided by the acid rate measurement (This allows for response to temporal acid flow rate changes between control actions)
ephoutc = the current effluent pH measurement ephoutcf = the filtered effluent pH measurement proIAE = the control proformanee measurement of lAE
(Integral of the Absolute Error) ctltime = variable used to determine when the controller
should take another action e = the error in effluent pH from the pH setpoint eint = the integral of the error xf = the filtered effluent pH used to determine steady state vf = the variance in the effluent pH used to determine
steady state sv = the standard deviation in the effluent pH used to
determine steady state irp = a varaible used when it is desired to determine if a
new pH steady state has been reached a2 = the alpha constant in the filter equations phss = the pH steady state target
SUB Sprvsr (ebasel, ebase2, ebase3 , ratio, ephoutc, ephoutcf, eph2cf,ephincf,etinc,et2c,etoutc,eafcf,ebfcf, proIAE,ctltime,afic,gfic,ebfsp,eint,xf,vf,sv, irp,split) STATIC
IF (time > ctltime) THEN
ctldt=1.0D0 ctltime=ctltime+l.ODO a2=0.3D0 e=7.ODO-ephoute
130
eint=eint + e*ctldt kl=l.250D0-0.02D0*ABS(e) k2-0.014D0-0.002D0*ABS(e)
• SS identification
xf=0.3D0*ephoute + 0.7D0*xf vf=a2*((xf-ephoute)^2.0D0) + (l-a2)*vf sv=vf^0.5D0
PRINT "sv =: ";sv
phss=ephoutc + kl*e + k2*eint
IF (phss > 14.ODO) THEN phss=14.0D0
ELSEIF (phss < O.ODO) THEN phss^O.ODO
END IF
PRINT "phss = ";phss
CALL SSINV (phss,afic,gfic,eafcf,ebfsp,etoutc,delbfsp)
IF (ebfsp < O.ODO) THEN ebfsp=0.ODO
ELSEIF (ebfsp > 1.5D0) THEN ebfsp=1.5D0
END IF
ratio=ebfsp/eafef
IF (sv < 0.175) AND (delbfsp < 0.01) THEN
CALL AdaptPar (ebase2,ebase3,afie,gfic,ephoutcf,eph2cf, ephincf,etinc,et2c,etoutc,ebfcf,eafcf, split)
irp=0 eint=0.ODO
END IF
CALL SSINV ( 5 . O D O , a f i c g f i e , e a f c f , e b f p h 5 , e t o u t c , d e l b f p h 5 )
I F (ebfsp=O.ODO) THEN s p l i t n = 1 . 0 D 0 131
ELSE splitn=ebfph5/ebfsp
END IF
IF (splitn<0.6D0) THEN splitn=0.6D0
ELSEIF (splitn>0.8D0) THEN splitn=0.8D0
END IF
split=split*0.6D0+splitn*0.4D0
PRINT "split = ";split
IF (time>200) THEN
proIAE=proIAE+ABS(e)
END IF
ebfsp=ratio*eafef
PRINT "lAE = ";proIAE;"bfsp = ";ebfsp PRINT "afic = ";afic;"gfic = ";gfic PRINT #3,proIAE,phss PRINT #4,time,split END IF
END SUB
Subprogram AdaptPar 132
A two parameter phenomenological model is used for the model. This subprogram parameterizes the controller model so that the model matches the real process data. This allows the model "inverse" to be used to calculate the desired base flow rate setpoint.
Variables
wf = weighting factor exgrt = the variable used to convert the two equation
two unknown system to a single equation with one unknown
T = the average of the influent and effluent temperatures
SUB AdaptPar (ebase2,ebase3,afic,gfic,ephoutcf,eph2cf, ephincf,etinc,et2c,etoutc,ebfcf,eafcf, split) STATIC
wf(1)=0.333333D0 wf(2)=0.333333D0 wf(3)=0.333333D0
T = (etinc+etoute)/2.0D0 E(l) = O.ODO E(2) = ebase2 E(3) = ebase3 PH(1) = ephincf PH(2) = eph2cf PH(3) = ephoutcf
FOR i = 1 TO 75 STEP 1
kw = (10.0D0^(°-el-c2*T-c3*T^2.0D0) )
FOR j = 1 TO 3 STEP 1
C(j) = (10.0D0^(-PH(j)))-kw*(10.0D0^PH(j))
NEXT j
AFICT(l) AFICT(2) AFICT(3)
afic (afic*eafcf)/(eafef+split*ebfef) (afic*eafef)/(eafcf+ebfcf)
133
FOR j =1 TO 3 STEP 1
N(j) = ((AFICT(j)-C(j)-E(j))/((((10.0D0-(-PH(j)))-2.0D0) *((C(j)+E(j))-2.0D0))))
D(j) - (l/((10.0D0-(-PH(j)))*(C(j)+E(j))))
NEXT j
N = 0.0 D = 0.0
FOR j =1 TO 3 STEP 1
N = N+N(j) D = D+D(j)
NEXT j
exgrt = n/d
FOR j = 1 TO 3 STEP 1
A(j) = (AFICT(j)-C(j)-E(j))
NEXT j
F = 0.0 DF = 0.0
FOR j = 1 TO 3 STEP 1
F = (exgrt^2.0D0)*wf(j)-exgrt*A(j)*D(j)*wf(j) + F DF = DF - exgrt*D(j)*wf(j)
NEXT j
dafic = F/DF
afic = afic+dafie
134
IF (ABS(dafic) < lD-12) THEN
GO TO 2000
END IF
NEXT i
2000 IF (exgrt < 1 ) THEN exgrt=1.0
END IF
gfic = r*T*LOG(exgrt)
END SUB
135
Subprogram SSINV
This subprogram is the model inverse and is used to calcualte the base flow rate setpoints.
SUB SSINV (phss,afic,gfic,eafcf,ebfsp,etoutc,delbfsp) STATIC
obfsp=ebfsp
kw3=10.0D0^(-el-c2*etoutc-c3*etoute^2) ka=EXP(-gfic/(r*etoute)) ebfsp=(ka*(10.ODO^phss)*afic*eafcf/(ka*(10.ODO^phss)+
1.0D0)+kw3*(10.0D0^phss)*eafcf-(10.ODO^-phss)* eafcf)/(-kw*(10.ODO^phss)+(10.ODO^-phss)+bc)
delbfsp=ABS(ebfsp-obfsp)
END SUB
'Subprogram PICTL t
'This subprogram simualtes the lag associated with the 'SISO PI valve
SUB pictl (bfsp,bfc) STATIC
dt=0.2D0 taui=.4D0 kc=2O.ODO cv=.7D0
bfc=bfc+dt*kc*cv/(taui*(12.ODO+kc*cv))*(bfsp-bfe)
END SUB
136
Subprogram DFT
This subprogram cauculates the drifting disturbances to be added to each process variable.
SUB DFT (drift,b3,b2,dist) STATIC
drift=b3 *drift+(l-b3)*(.5D0-RND) dist=dist+b2 *drift
END SUB
'Subprogram GAUSS
'This subprogram genertate the Gaussian random numbers 'to be added to each process variable to simulate the 'process noise. f
SUB GAUSS (noise,sd) STATIC
n=RND noise=sd*1.9607D0*(n-.5D0)/((n+.002432D0)*(1.002432-n)
)^.203D6
END SUB
137
Subprogram PrcsLag
This subprogram simualtes the lag associated with process instrumentation by simply applying a first order filter to the variable.
SUB PrcsLag (afe,bfe,phine,ph2e,phoute,afl,bfl,phinl,
ph21,phoutl) STATIC
alpha = 0.08D0
beta = 0.0285D0
afl = afc*beta + afl*(1.ODO-beta)
bfl = bfc*beta + bfl*(1.ODO-beta)
phinl = phinc*alpha + phinl*(l.ODO-alpha)
ph21 = ph2e*alpha + ph21*(l.ODO-alpha)
phoutl = phoute*alpha + phoutl*(l.ODO-alpha)
END SUB
PERMISSION TO COPY
In presenting this thesis in partial fulfillment of the
requirements for a master's degree at Texas Tech University, I agree
that the Library and my major department shall make it freely avail
able for research purposes. Permission to copy this thesis for
scholarly purposes may be granted by the Director of the Library or
my major professor. It is understood that any copying or publication
of this thesis for financial gain shall not be allowed without my
further written permission and that any user may be liable for copy
right Infringement.
Disagree (Permission not granted) Agree (Permission granted)
Student's signature
Date Date 7-3-1- f f