defcon.klaxon
Lifetime Supporting Member
Hey guys,
I've recently been asked to review some code at a water treatment plant that isn't working right; seems like sometimes it'll work, but after a good while of the programmer fiddling with things, he just isn't getting it sorted and I've been asked to come in, review the code, and determine if the code is salvageable or if it would be better to start all over.
I've spent some time with the code at this point, and I've noticed something that I wanted to get a sanity check on. The thing I noticed is how the pumps and valves are being controlled.
There don't appear to be any PID loops at all; instead, the code starts pumps/opens valves to a predetermined starting set point, and then from there starts comparing the PV to the SP. If the PV is too low, the code bumps the pump speed/valve position up 1%. Conversely, if the PV is too high, the code bumps the speed/position down 1%. It does this once per scan until the PV is within a deadband of acceptable value. Once it's there, the code compares the PV to the SP with deadband. If the PV strays outside the deadband, the speed/position is increased/reduced 0.5% until the PV is back within the tolerance. Every pump and valve is controlled in this fashion, including pumps at a remote site that vary their speed based on a flow that is at the WTP, and radio-ed down to the remote site.
On paper the concept seems novel, but I'm thinking this could be the root of the plant's woes. First off, there is nothing controlling the scan time, so these iterative steps are likely varying in timing. Second, this concept doesn't take into account deadtime for the process to respond so I could see how that could induce oscillations with constant chasing (especially with the remote pumps running to maintain flow at the WTP flowmeter which is radio-ed down). Third, and this is more general, if this was a reasonable solution then why would people bother with PID loops at all?
Something just doesn't seem right to me here, but I'd like to be able to intelligently say why. Or heck, maybe this is ok and the issue is with something else, I don't know. Basically wanted to run this by you guys who know more than me, and see what you thought. Thanks!
I've recently been asked to review some code at a water treatment plant that isn't working right; seems like sometimes it'll work, but after a good while of the programmer fiddling with things, he just isn't getting it sorted and I've been asked to come in, review the code, and determine if the code is salvageable or if it would be better to start all over.
I've spent some time with the code at this point, and I've noticed something that I wanted to get a sanity check on. The thing I noticed is how the pumps and valves are being controlled.
There don't appear to be any PID loops at all; instead, the code starts pumps/opens valves to a predetermined starting set point, and then from there starts comparing the PV to the SP. If the PV is too low, the code bumps the pump speed/valve position up 1%. Conversely, if the PV is too high, the code bumps the speed/position down 1%. It does this once per scan until the PV is within a deadband of acceptable value. Once it's there, the code compares the PV to the SP with deadband. If the PV strays outside the deadband, the speed/position is increased/reduced 0.5% until the PV is back within the tolerance. Every pump and valve is controlled in this fashion, including pumps at a remote site that vary their speed based on a flow that is at the WTP, and radio-ed down to the remote site.
On paper the concept seems novel, but I'm thinking this could be the root of the plant's woes. First off, there is nothing controlling the scan time, so these iterative steps are likely varying in timing. Second, this concept doesn't take into account deadtime for the process to respond so I could see how that could induce oscillations with constant chasing (especially with the remote pumps running to maintain flow at the WTP flowmeter which is radio-ed down). Third, and this is more general, if this was a reasonable solution then why would people bother with PID loops at all?
Something just doesn't seem right to me here, but I'd like to be able to intelligently say why. Or heck, maybe this is ok and the issue is with something else, I don't know. Basically wanted to run this by you guys who know more than me, and see what you thought. Thanks!
Last edited: