Logix 5000 PID with slow process response and odd behavior

That normalizes the required loading and ensures the aerators responds immediately to changes in influent flowrate, instead of waiting for the DO to change when the flowrate changes. I.e. the PID CV output will be a measure of the specific* difference in DO between the influent and the DO setpoint.
That is a REALLY interesting idea if it's possible with existing instrumentation.


If the influent flowrate is available to the PLC, then it is definitely possible.

Btw, I got the idea from my brother, who used it to control a process that applied adhesive to an eight-foot wide paper web moving at something like 1500ft/minute. That is conceptually the same as what this process is doing (adding a material to a continuous stream of media).

It's similar in concept to feedforward-feedback control, see this link.
 
Last edited:
Is this really all that bad?** Yes it's 90deg out of phase at the start but eventually it's 180deg of phase and driving the amplitude of the swings down.

I'm not worried about phase but I don't like how much the DO is swinging. It's affecting the process further down the line and was brought to my attention as a mild emergency. When the setpoint is 1.4mg/L and it's swinging as low as 0.65mg/L and up to 2.11mg/L, that's pretty bad.

The red line must be the influent flowrate***: when the flow drops quickly e.g. 1000gal/s to 700gal/s, the DO measurement shoots up, because the aerator is initially supplying enough oxygen to bring 1000gal/s from whatever DO the influent is at up to the setpoint, but that is being added to only 700gal/s, so it is over-oxygenating.

Yep, exactly.

This is why normalizing the required oxygen load* might work.

* difference between SP DO and influent DO, i.e. difference in DO per unit.

** duh on me, that is probably for a steady flowrate; if the flowrate varies it will never get to stable control.

*** or perhaps PID CV output/VFD speed, which is a proxy for the flowrate, assuming constant influent DO load.

Yeah I'm thinking about how to implement some sort of control that would account for varying flow rate. I'm curious to hear what you come up with.
 
drbitboy DMD is doing a pretty good job of extracting information.
I looked at the graphs. It looks like you have two problems. One is deadtime. The other is that the gain will need to change if the inflow changes. It appears you have a way to measure the inflow, which is good. The bad news is that the integrator gain needs to change as the inflow rate changes. You no longer have a JUST a dead time problem. You have a dead flow or volume problem. Does this make sense? I covered how PID needs to be modified to be a function of flow and not just time in a recent thread.
 
A few observations and very broad generalizations

The equivalent integral time, Ti, from the dependent form of the PID (cf. here) is over a quarter hour, so the current update time of 100ms could probably be increased by one or two orders of magnitude, which would require decreasing the Ki parameter by the same amount, and would also allow for some smoothing of the PV. That said, if the controller performance is acceptable now, there may be no incentive to do this.

There are two effects here:

  1. Flowrate - downstream measured DO response to changes in flowrate is a first-order process, and are reasonably-well handled (i.e. the customer is happ) in the PIDE with Kc and Ki alone.
  2. Influent DO load - downstream measured DO response to changes in influent DO load will be a deadtime process, assuming the both linear flowrate is small, and there is minimal diffusion, along the ditch. Controlling for variation in influent DO load would require some non-zero Kd be added to the PIDE (and even then it might not work).
That being the case, the current control system (PIDE), which compensates for changes in both flowrate and influent DO load, is trying to control a FOPDT (First-Order Plus Dead Time) process.

There is currently no allowance (Kd is zero) in the system for the deadtime i.e. influent DO load. However, that does not matter with the current tuning because

  • the flow is so variable it is masking any variation in the influent DO load,
AND/OR
  • the influent DO load is not varying significantly.
If we change the control scheme to scale the PIDE output CV by influent flowrate, then the CV will be following the difference in DO load between the influent and the setpoint, and the PIDE will be trying to control what is essentially entirely a dead time process, and I doubt the PIDE could do the trick.

Those observations/assumptions beg a few more queries

What are typical flowrates, and typical ranges of flowrates?

How long is the aerator (I assume it extends for some distance along the direction of flow in the ditch)?

What is the cross-sectional area of the ditch i.e. the area perpendicular to the direction of flow in the ditch?
 
drbitboy DMD is doing a pretty good job of extracting information.


And, @defcon.klaxon is a better-than-average OP. We actually have data, wheeee!


The bad news is that the integrator gain needs to change as the inflow rate changes.



Not so much if the output is scaled by the flowrate. What will change is the dead time response to variation in influent DO load. Ouch.

I am pretty sure the differential equation that describes this process is more or less analogous to a one-dimensional form of Navier-Stokes from the domain fluid flow (momentum transport). I'll have to get out my Bird, Stewart, and Lightfoot ...
 
Not so much if the output is scaled by the flowrate.
That scales the proportional gain too. You made the same mistake on the other thread.


What will change is the dead time response to variation in influent DO load. Ouch.
Yes, that's what I said.

Think of using a queue like what is used in a Smith Predictor. However, instead of indexing into the delay queue by time, you index by flow.
 
That scales the proportional gain too. You made the same mistake on the other thread.

Yes I did, but this is completely different: scaling the PIDE output by flowrate resets everything and will completely change the tuning, because the PIDE will be controlling a different model of the process.

As it is now, the PIDE is basically finding the aeration rate that scales (tracks) with the inlet flowrate; I doubt influent DO load is even detectable in the PID's behavior.

The tuning in the proposed scheme, where the PIDE output CV is scaled, after the PIDE, by the influent flowrate to set the aeration flowrate* will be completely different: the PIDE output will track, to first order, the difference in DO load between the influent and the setpoint. And dead time will be far larger than the first-order time constant in that DO load control. In fact, the best thing might be to move one of the DO sensors to the upstream end of the aerators, and put those readings into a FIFO, which FIFO's entries shift at a rate proportional to the flow, and convert to a predict-model control, perhaps with trim, to set the specific* aeration rate that should be multiplied by the flow rate to get the total aeration rate.

* Actually to aeration VFD speed reference, which is hopefully close to linear with aeration rate

** Aeration per unit (liter, gallon, kg, pound, whatever) of water.
 
Last edited:
I'm a bit late to this party, and the two resident PID geeks have already chewed the fat on this one, but for future DO control applications I'd personally suggest looking at what is called "floating point control". Tom Jenkins covers it very well in his book on Aeration control system design.

Because of the long process lag time that can be affected by flow rate, temperature, concentrations of different microbes as well as other process activities like sludge wasting, PID can be difficult to implement as your system model can change all the time.

Floating point control is essentially I term only, generally with different increase / decrease steps.

The step time and inc / dec steps can be varied programmatically. I usually run 3 different step sizes depending how far from SP the DO is.

The step time could well be adjusted proportional to flow rate as well, I'd manually adjust VSD output in a step change and measure time until a change in DO is seen. Do this at different flow rates to work out how much of an affect it has on this particular system.

Are the ditches in series or parallel? If in series the first will definitely influence the second. If in parallel no issue.

If there is no additional mechanical mixing then the civil engineer may require a minimum aerator speed to ensure sufficient mixing to prevent dead zones is being provided. This can sometimes cause problems when plants are under loaded. That is rarely an issue here, they're generally overloaded 😊
 
Here is a simple First-Order decay Plus Dead Time (FOPDT) model of influent + aeration + effluent in a ditch, hopefully similar to this thread's process.

As expected, flow and aeration changes result in responses with first-order decay-ish responses and have little or no deadtime; influent DO changes result in responses with significant deadtime. The lack of deadtime in responses to flowrate and aeration suggest the feedforward approach should work, if the model is a reasonable facsimile of the physical process.

TL;DR

Although written for and annotated like and with variable names from the aeration ditch process, the FOPDT32 class could be used for any process with linear flow and a constant generation )or consumption i.e. negative generation) term, where a mass balance using component fraction and flow between adjacent cells is the primary transport method; The time constants are set by the system volume and input flow.

It uses 32-bit floating-point and integer math as my original intent was to develop in Python but eventually code the model in a PLC; the resulting inaccuracies are typically out in the sixth significant figure.

The comments are not done.

The approach uses Implicit Euler Method for solving the mass balance differential equations, so it should be stable even for unrealistic timesteps.

I am debating whether to try to connect the process to a PLC PID to investigate various control schemes and tuning methods.

The model assumptions are too numerous to mention; the main ones are homogeneous intra-cell mixing, no inter-cell diffusion, and a constant per-cell volume aeration rate. That said, for the first two of those assumptions, the cells can likely be made small enough that all inaccuracies will be second-order effects and not change the general character of the results. The third assumption, constant aeration, is probably not to bad if the DO levels stay well below saturation (1.6mg/l is about 20% of saturation at 30°C)
 
Last edited:
I run it but all I get is a bunch of numbers. You should at least use RK4.
scipy actually has a pretty good odeint.


I am debating whether to try to connect the process to a PLC PID to investigate various control schemes and tuning methods
This is why I was asking if anybody had good analog input and output cards for the Raspberry PI. The Raspberry PI could simulate the system. I found a good solution but I think it would cost too much IF one could even get the parts.
 
I've done RK4 in the past, but it is overkill here.

Implicit Euler is good enough for this system, because everything flows from the upstream end, where the initial conditions are known, but I realized today that the implementation I posted earlier has a minor bug.
 
I run it but all I get is a bunch of numbers.

Code:
 python fopdt.py [b]--plot[/b]

Try that; you'll need the Matplotlib module for Python and a gui to go with it. Linux is easiest; can also be done with WSL and on windows, but it's a little complicated; I assume there is some way to do it entirely in windows.
 
In my experience, PID (even implemented as PI) is ill-suited to DO control, whether diffused aeration or mechanical aeration. I use floating control with a dead band instead. I would implement a three to a five-minute time delay between control calculations. The dead band should be ≈ 0.25 mg/l. I would also bias the change in the control variable, with speed decrease increments about 70% of speed increase increments. I would also implement a rate of change calculation, and if the DO was heading in the right direction and at a sufficient rate (say 0.5 mg/l/minute) I would bypass the control calculation for the set time delay.

It is expected that a change in one aerator's speed affects the other one since the mixed liquor continuously circulates around the "racetrack" and each aerator is downstream of the other.

The slow response is not the only problem in this kind of control. The solubility of O2 in mixed liquor is non-linear, and the OTR (Oxygen Transfer Rate) of the aerator vs. speed is non-linear as well.

Getting the control right is important. Aerator energy is 50% to 70% of the total energy in a treatment plant and is the most critical parameter for meeting process requirements and maintaining proper biology.

I hope I'm not being inappropriate by suggesting my text for further reading: https://www.wiley.com/en-us/Aeratio...ergy+and+Process+Optimization-p-9781118389980
 
Last edited:
I use floating control with a dead band instead.

Interesting. So this boils down to a zeroth-order I-control (ΔCV = Ki Δt), where the normal I in PID is first-order in error (ΔCV = Ki Error Δt).

At least it's trivial to implement.

The solubility of O2 in mixed liquor is non-linear,

Non-linear with what? Temperature? Composition?

and the OTR (Oxygen Transfer Rate) of the aerator vs. speed is non-linear as well.

I am not surprised; one more mis-modeled aspect of my code ;).


Not at all; OP should buy the book and read it,
 
Last edited:

Similar Topics

Hello all, I'm having issues with a PID and trying to tune it. I just do not understand why my CV goes to 105 with the settings I have. Config...
Replies
14
Views
1,557
Hi, Long time not in the forum, and not in the programming. I´m getting back. I was issued a conversion from RSLogix 500 to RSLogix 5000 (studio...
Replies
0
Views
1,282
So I have a PID loop on an 1756-L61 running V17 software just for background. Also the PID PV is a pressure transmitter and the CV is speed sent...
Replies
1
Views
888
Hi All, I have a PID control application that I would like to get your opinions on. As I am reality new to PID loops I am struggling somewhat...
Replies
14
Views
4,269
Good morning guys, I have a machine that fills bags of prepared food at a variable speed, and a machine that checks the weight of the bag. What...
Replies
23
Views
6,796
Back
Top Bottom