News:

  • October 10, 2026, 05:20:57 PM

Login with username, password and session length

Author Topic: PID for Surge Tank?  (Read 11823 times)

Bolt

  • Hero Member
  • *****
  • Posts: 598
PID for Surge Tank?
« on: June 22, 2020, 04:17:56 PM »
I have a surge tank that receives it's contents from multiple sources. The source pumps run "randomly" (on about 20-30 seconds, off about 30-90 seconds) but go through a single flow meter before the surge tank. As such, I can calculate the incoming flow rate over time, and get an average for a desired time period. I also have a transducer on the surge tank, so I can determine tank volume.

The surge tank has GS3 VFD running a centrifugal pump to discharge the tank.

The process works best when the VFD pumps the surge tank empty as slow as possible. At it's simplest, I currently have a LERP in the BRX PLC that tell the pump to run at 16.5 Hz when tank is (almost) empty, and 60 Hz when tank is (almost) full. However, at time of relatively low incoming surge flow, the tank gets near empty, and as such "wastes" opportunity to have run slower in the past.
The kicker is I do not have an output flow meter to calculate flow on the surge tank, AND the discharge head pressure on the pump changes over time, so there's no direct correlation with Hz:Flow.

Would this process benefit from a PID to control the pump speed? Like I said, I can calculate and smooth the incoming flow rate over time, and calculate the outgoing flow rate (only during periods when source pumps are not contributing to tank level).  I envision using the (averaged and filtered) incoming flow rate to determine SP, and calculate the outgoing PV rate from tank level changes between source pump cycles.  Is this too much of a lag time for the PV calculation, causing instability?

On that note, is there an easy instruction to calculate flow rate?  Kind of like the inverse of the INTEGRATE instruction?
« Last Edit: June 22, 2020, 04:20:33 PM by Bolt »

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6176
  • Yes Pinky, Do-more will control the world!
Re: PID for Surge Tank?
« Reply #1 on: June 22, 2020, 06:32:11 PM »
SLOPE
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Bolt

  • Hero Member
  • *****
  • Posts: 598
Re: PID for Surge Tank?
« Reply #2 on: June 22, 2020, 07:01:17 PM »
SLOPE
I've played with that some, but makes it hard to do a rolling average.  Say you do 10 minute average, you only get one average per 10 minutes.
I have resorted to running a $t1Second Task, copy that to a pointer into a block of 1024 DWords, then calculate rolling average from X minutes back, increment pointer.  Filtering this result creates a nice rolling line I feel confident is representative of my incoming flow.  Now to get my output pump speed to match the input flow line...

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3626
  • Darth Ladder
Re: PID for Surge Tank?
« Reply #3 on: June 22, 2020, 07:45:58 PM »
You need Carnac.  The problem is that while you know the historical average flow, you can only hope that that predicts near future flow, combined with having a surplus of bosses.  As currently constituted, the upstream processes send what fluid they want, while your downstream destination wants the surge tank to stabilize flow.

You might try logging max slug volume.   IOW, what's the total gallons pumped in a burst, historically?   Is there, or can you add an interlock to prevent the upstream pumps from running when the surge tank is near full?   Then have a bias to run slow, and only speed up if there's insufficient space in the surge tank for Slugmax.  Then slow down again.

OR....turn the entire deal on it's head and regulate the upstream pumps discharge rate based on the surge tank level, if there's some flexibility / buffer ability in the upstream processes, or partially.

I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

Bolt

  • Hero Member
  • *****
  • Posts: 598
Re: PID for Surge Tank?
« Reply #4 on: June 22, 2020, 07:59:30 PM »
What is Carnac?

The supply pumps run when they must, not much buffering space there.

Here's a screenshot of what I'm starting to compile.  Green line is the supply's 12 min (the process tends to have some modularity at approx 12 mins) rolling average, orange is that filtered, and purple is my initial attempt at the surge tank pump current flow rate between input flows, need to tweak the calcs a little, I think the spike at rate change is exaggerated.

I think my objective is to get the purple line to "match" the orange line.
« Last Edit: June 22, 2020, 08:01:07 PM by Bolt »

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3626
  • Darth Ladder
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6176
  • Yes Pinky, Do-more will control the world!
Re: PID for Surge Tank?
« Reply #6 on: June 22, 2020, 08:23:42 PM »
I've played with that some, but makes it hard to do a rolling average.  Say you do 10 minute average, you only get one average per 10 minutes.
I have resorted to running a $t1Second Task, copy that to a pointer into a block of 1024 DWords, then calculate rolling average from X minutes back, increment pointer.  Filtering this result creates a nice rolling line I feel confident is representative of my incoming flow.  Now to get my output pump speed to match the input flow line...

I would set the SLOPE sample rate to 1 second and FILTER the result with a 10 minute time constant. I would think the result would be pretty close.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3626
  • Darth Ladder
Re: PID for Surge Tank?
« Reply #7 on: June 22, 2020, 08:24:04 PM »
The process is actually not too spastic.   What's the surge tank volume?
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

Bolt

  • Hero Member
  • *****
  • Posts: 598
Re: PID for Surge Tank?
« Reply #8 on: June 22, 2020, 08:26:42 PM »
So you're saying my deal's going to involve magic?

Tank is 1720 (lbs, all rates in lbs/min in trend view)

I figure if I know the past's input flow rate, and tweak the current output flow rate to match, the surge tank should be big enough to catch the next big surge in flow, which will influence the future's output flow rate?  As long as the available tank space is greater than the surges, it might work?

I guess I know what I want to do, just trying to wrap my head around how to control it, and the lag in calculating the output flow rate.  There's also times I can't calculate this, when the supply pumps are running.  Luckily they only run in short bursts.

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3626
  • Darth Ladder
Re: PID for Surge Tank?
« Reply #9 on: June 22, 2020, 08:46:23 PM »
Sounds like you and I are on the same page.    You can actually calculate your outflow rate if your tank is some kind of reasonable shape.   If you can figure tank net in/outflow from level change, then add/subtract the inflow, the rest is outflow.   So that automagically compensates for varying discharge head, etc., because it's derived from an actual volume measurement.

So I'd set your outflow setpoint to the average of the last 12 minutes, which is going to give a fairly stable mean level over time, but with some oscillations.    That means you also get to pick the level, so maybe set it at 860 lb.    You have plenty of buffering space so you shouldn't overflow, and you have some reserve fluid so you shouldn't run too low.   I suspect the receiver actually wants stable flow as much as it wants low flow, especially given that if you let the flow get too low too long you end up having to pay for it with a high flow interval.   So shoot for steady and you'll automatically get as low as the process will allow over a period of time.

« Last Edit: June 22, 2020, 08:47:59 PM by Controls Guy »
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.