pH loop tuning at pharma company


A biopharmaceutical company located in Poland asked DotX to provide:
  1. On-site Training in PID Tuning using the DotX PID Tuner software
  2. On-site assistance in applying the PID Tuner to tune 3 control loops (pH, Temperature and Dissolved Oxygen)

In this post, we focuss on tuning of the pH loop because this case was rather typical for what process technologists experience in practice, and where the PID Tuner is used in off-line mode.


The PID parameter interface

The PH loop runs on a bioreactor produced by Sartorius Stedim; this equipment also runs on Sartorius Stedim control software, with a user interface that looks like Figure 1. From the manual we understood that (ignoring the D-action in the PID for now): \( MV = \frac{C}{XP}\left( e+ \frac{1}{TI} \int e \right) \)
with e = Setpoint - pH, MV = PID output, C =100, XP = proportional band

Figure 1: User interface for tuning the pH loop (PID parameters)


Tuning in practice

We then performed a closed-loop experiment, where the PID controller was active, and the setpoint was changed suddenly. At this stage, we are not tuning the loop yet, we are just gathering data. The data was not logged by the PID Tuner in on-line mode, but by a logger provided by the manufacturer of the Sartorius equipment. We set the logging sample period sufficiently small (here at 1 second) to capture the dynamics. We only log the pH value, its setpoint and the output of the PID controller (which we refer to as MV).
Figure 2 shows the result of the step change experiment.


Figure 2: Closed loop response to setpoint change, with original PID settings (XP = 25%, TI = 30 s).


Verification of the PID formula

The closed-loop step experiment provides us with data to verify the PID formula, and check the value of the constant C. In practice, scaling is often applied somehwere in the controller code, or in the interface. To verify the PID formula, we simulate the PID controller when fed with setpoint data and pH data as shown in Figure 2.

Figure 3 shows the simulated MV (=PID output) when C = 100, the simulated MV controller after rescaling and the measured MV. The PID Tuner calculates a scaling parameter for the proportional gain, called Kp Scaling.

Since Kp Scaling = 10 we apparently need to use C = 100*(Kp Scaling) = 1000 instead of C = 100.


Figure 3: Simulated and measured MV (= PID output). Kp Scaling is computed by the PID Tuner so that it fits the measured MV best (which turned out to be Kp Scaling = 10)


Model identification

The same data of the closed-loop experiment, as shown in Figure 2, can (often) be used to perform model identification. Figure 4 shows a part of the data, and the First Order Time Delay (FOTD) model fit from the PID Tuner.


Figure 4: Measured PV (=pH value) and simulated PV.


Verification of the closed-loop response

Now that we know how the PID formula is defined, and how the pH responds to the MV (according to the identifed FOTD model), we can simulate the response of the closed-loop to the measured setpoint change, to verify whether we 'understand' the complete closed-loop.

Figure 5 shows the simulated pH value and the measured value.

Clearly, the response is better damped when the setpoint step change is downwards. This indicates that the pH process behaves in a non-linear way.


Figure 5: Measured closed loop response and simulated closed response. Here, we simulate both the PID and the pH model, using the setpoint as the only model input. Hence, the model also simulated the MV response


Retuning of the PID and verifying the closed-loop response

Since the closed-loop model seems to be sufficiently accurate, we can now move on to the next step: retune the PID controller. In the PID Tuner, we can simply push the button 'Autotune', resulting in XP = 2.5, TI = 240 s. We entered these settings, and performed again a closed-loop setpoint step change experiment. Figure 6 shows the result.

Clearly, the loop is now well damped and the pH value reaches setpoint 10 times faster than with the original PID settings. The simulated response predicts a somewhat faster loop than measured which is due to the nonlinearity, but this is not a big issue.

The PID Tuner predicts that there is room for more improvement, for instance by gain scheduling, and by introducing D-action. However, Polpharma's first concern was to obtain well damped PI control, and this goal has been achieved.


Figure 6: Measured closed loop response and simulated closed response after retuning of the PID with XP = 2.5, TI = 240s (as obtained from the PID Tuner).