Nonlinear Adaptive Control of a Biological Reactor | |
Beyond PID(View more Control information or download the preliminary implementation.) When you have a system for which simple control strategies are not quite good enough, how can you implement something better? Data Acquisition Processor boards provide one possibility, and they can do much more than just the real-time control of the process. Biological processes sound very easy, but as it turns out, these present just about every kind of control system nightmare other than discontinuity. The process discussed in this note is a "fed batch reactor," a process in which microorganisms are cultivated in a tank [1]. Lacking anything original, let's hypothesize that the organisms are genetically modified bacteria for manufacturing a kind of agricultural growth hormone. Liquid nutrients are added to feed the bacteria growth. The hormone is secreted into the tank as a biological waste product. To recover the product, a stream of liquid is drawn off for processing, replaced with sterile liquid. Supplemental systems regulate temperature, liquid levels, and stirring rates for the tank contents. Figure 1: Fed batch bio-reactor processThe population can sustain production when nutrients support enough new growth to balance the portion of the population drawn off with processed liquid. The most important measured variable is the population density. The primary control on the population is the substrate feed rate. This system seems like a good candidate for PID control, and in fact, PID controls have been used for such processes — but they don't work very well. The population tends to grow exponentially if fed too much, or to collapse exponentially if not fed enough. PID control is faced with three challenges:
Measurable State Variables It is presumed that there are three measurable state variables
governing the dynamics: the population density
Controlling With PID Suppose that there is no model to describe internal processes
of the real system. We can still apply a heuristic control such
as PID, because we can measure the current population density
We cannot use PID alone to reach setpoint effectively because the gains must be kept low for stability. To establish the necessary feed levels, first apply a nutrient density and feed level that (it is believed) will support a growing population. Then allow conditions to stabilize. Let's try this first without PID control. Figure 2: Constant input feedforward controlThe fixed inflow strategy overfeeds the small initial population. The nutrients build up until they reach a level where they are detrimental to organism growth. Eventually, equilibrium is reached. It can be hard to guess the right feed level to get the population density desired, and it can take a very long time to settle to the right level. Otherwise, this works. It would be much better for automatic controls to find the desired setpoint quickly and then regulate that level. We can use a PI control strategy, being careful to use very small gains. First we try adding proportional feedback gain. This is the result with gain 0.35 . Figure 3: Feedforward control plus proportional feedbackThe final convergence speed is better, but this matters little, because the initial overfeeding transient is much worse. Integral control does not fare any better. It tends to sustain the population better, but it has the same kind of initial overfeeding problem and its settling time is degraded. Nonlinear Bio-Reactor ControllerA better control strategy will incorporate knowledge about the system. The internal details of this design are beyond the scope of what we can describe here, but we can quickly survey some of the main features:
Running the nonlinear controller under the same conditions as the PID controller, here is the response. Figure 4: Nonlinear controlNow suppose the estimated growth factor is off by about 20% at the start. We activate the adaption gain. Figure 5: Nonlinear control with growth rate adaptionNotice that the blue trace here is the estimate of the growth rate parameter, and the mortality state is not shown. During the gross transient, the adaption law dragged the rate estimate down too low. But as the system began to stabilize, the value of the growth rate parameter stabilized too. Instead of settling in 9 hours, it took 12 hours, but the system remained in control, and also "learned" the correct growth rate factor. After settling, the adaption gain can be set to zero, and response to subsequent disturbances will be more like Figure 4. A Mathematical Reference ModelHow is it possible for the nonlinear controller to outperform the PID controller, even under imperfect information about the most critical parameter? Basically, the improved performance results from incorporating more knowledge about the internal workings of the process. In this case, the process is described by a small differential equation system. The nonlinearities and gains of the model are taken into account, "built into" the controller design. This implies a controller that is better suited to one kind of application, but limited to that one kind of application. The population density tends to grow at a rate proportional
to the current density, and also to die off at a rate proportional
to the current density. The population is not viable unless the
growth rate exceeds the basic mortality rate. The two rates are
combined into one net growth rate, As individuals in the population die off, this results in an accumulation of detritus in the liquid, and that in turn inhibits population growth. Combining the effects of growth and inhibition yields the population density dynamic equation. x' = G(s) x - Kx m Nutrient density s' = - Ks G(s) x + u Detritus from dead organisms interferes with the healthy metabolism of the live ones, and if the accumulation is too much it can force a shutdown of the batch process. The mortality dynamic equation represents the accumulation of detritus in proportion to population density. m' = Km x So far, the equations describe the population dynamics in a tank with fixed content. However, some fraction of the material is drawn out in each unit of time for harvesting the hormone product. Due to the stirring of the tank contents, the drawn mixture contains parts of population, nutrient, and detritus in proportion to their densities. We include this extra draw-down rate into each of the dynamic equations to complete the population model. x' = -D x + G(s) x - Kx m s' = -D s - Ks G(s) x + u m' = -D m + Km x This looks easy, but that Model Parameters - The Growth Rate Growth has a nonlinear dependence on the nutrient density
Despite various multiple-parameter models described in papers
or textbooks, there is often not enough time or information in
practice to isolate the relative influences of multiple
parameters. For our purposes here, we use a model of the
following form, with one adjustable scaling parameter
Figure 6: Growth curveG(s) = Kg s e1-(s/smax) The nutrient density for maximum growth is determined by
parameter It is presumed that the liquid draw rate A Quick Note About the DesignWhile it is what the controller does that really matters, some readers might be interested where this particular controller design came from. The controller was derived using a backstepping method[2,3,4] with matched direct parameter adaption. The design method constructs a sequence of control terms for the differential equation model and evaluates their effect, using candidate Lyapunov functions until one is found that simultaneously assures convergence of all adaption, settling, and tracking errors to zero. Lots of coffee helps. Even though the design of the controller can be tedious, the implementation is rather easy. The section of code that does the real work of the control computation spans about 45 lines. A dense and cryptic coding style without source documentation could squeeze this to under 30 lines. DownloadsUnfortunately, we do not have any real bio-reactors that you can borrow. (We have automatic bread makers, but those don't count.) The best we can do is run the controller against a simulation. With a little caution, perhaps you can do more than that. Be careful, this is not field proven software and there are no assurances that it will work for you. Some configuration files are provided in the download
package. One set is in the
To run these, you must install the Just to make things a little interesting, the scenarios illustrated in this note are not fully optimized. You can tune each one for better performance. After identifying "optimized" gains, check the robustness of the control strategy by adjusting control gains and model parameters. Are Data Acquisition Processors The Right Solution?We have just seen an example where PID control doesn't work very well, but where a specialized controller does. If you have a system that isn't working very well, what are the alternatives? You can continue to cope with old problems, and suffer the operational costs. You can implement a DAP-based controller. Or you can build a custom controller from low-level components -- at a cost in time and effort that really makes the cost of a DAP system seem like pocket change! For a bio-reactor system, updates are on a scale of minutes, with sampling on the order of seconds. You don't need the full computational capacity of a DAP at these speeds. But you will need:
Footnotes and References:
Return to the Control page. Or download the preliminary implementation. |