News:

  • October 16, 2026, 05:09:47 PM

Login with username, password and session length

Author Topic: Forward/Reverse Combination PID  (Read 28424 times)

RBPLC

  • Hero Member
  • *****
  • Posts: 586
Forward/Reverse Combination PID
« on: August 18, 2021, 11:49:00 AM »
Would you guys consider making a combined forward/reverse combination PID? I realize this can be done with two loops (obviously) but the setup isn't that straightforward (IMO). The issue is in how to deal with the changeover from heating to cooling (and vice versa). What I envision is something that is similar to a typical single loop process controller. Typically, a process controller of this style will smoothly transition throttle output from heating, through zero to cooling without having a sudden step response in throttle output. This would be a nice feature to have for those of us who would like to replace single loop controllers with the much more capable BRX but could be setup as easily as most of these dedicated devices. The complexity is compounded if you want to implement cascade control as this then becomes four loops instead of two. 

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3628
  • Darth Ladder
Re: Forward/Reverse Combination PID
« Reply #1 on: August 19, 2021, 01:50:35 AM »
Couldn't the CV 0-100% be split between heading and cooling?  So 0% output is full cooling, 50% is neutral, and 100% is full heating effort?  You'd do the scaling from the loop output to the two devices external to the loop.  Neutral wouldn't even necessarily need to be 50%.
« Last Edit: August 19, 2021, 06:19:54 PM by Controls Guy »
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

RBPLC

  • Hero Member
  • *****
  • Posts: 586
Re: Forward/Reverse Combination PID
« Reply #2 on: August 28, 2021, 09:58:19 PM »
I'm trying to think through this. How would the forward/reverse setting affect setting up the PID like this?

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3628
  • Darth Ladder
Re: Forward/Reverse Combination PID
« Reply #3 on: August 28, 2021, 10:41:21 PM »
Well, like any PID.  If you set it up the way I suggested, where increased CV tends to increase PV, then it's normal/direct.   If you had 0% be full heating and 100% full cooling, then you'd set it up as reverse.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3628
  • Darth Ladder
Re: Forward/Reverse Combination PID
« Reply #4 on: August 28, 2021, 10:50:22 PM »
I think how I'd select the neutral/crossover point would be so that equal deltas of CV% represent equal BTU effect.  For example, if full heating is 100k BTU and full cooling is 50k, then make the neutral point 33%. 

I think I might also put in a little deadband, so for CV between +/-1% or so of the neutral point, you don't do any output at all.
« Last Edit: August 28, 2021, 10:53:53 PM by Controls Guy »
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

RBPLC

  • Hero Member
  • *****
  • Posts: 586
Re: Forward/Reverse Combination PID
« Reply #5 on: August 28, 2021, 11:16:42 PM »
I guess what I'm struggling with is that (for example with forward acting) if your PV is any value less than your SP, Output goes to zero (because it's forward acting). This is not the intent. I must be missing something obvious.

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3628
  • Darth Ladder
Re: Forward/Reverse Combination PID
« Reply #6 on: August 28, 2021, 11:51:10 PM »
We actually had this conversation once before  ;D:

https://forum.hosteng.com/index.php?topic=2793.0

What you have to remember is that "direct acting" for Host, and this is the norm for me as well, is that increasing CV will tend to increase PV (so heating).  And the loop doesn't automatically go to 0 output (unless its P-only), it moves in the direction it needs to (possibly towards 0) and stabilizes at the point that zeros the error, until the load changes.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

RBPLC

  • Hero Member
  • *****
  • Posts: 586
Re: Forward/Reverse Combination PID
« Reply #7 on: August 29, 2021, 12:37:58 PM »
I'm not confused by forward/reverse acting as implemented in DmD. I just don't understand how you can split the range when you've specified the PID to be forward acting (for example). For simplicity sake assume that you have only a P loop (no I, no D). With a Gain of 1, if PV=55 and SP = 50, Output is 0. In this case, the desired output would be Output = 5 if this was a cooling (reverse) loop. For this scenario, I want this to be 5% cooling throttle. How would this be set up?   

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3628
  • Darth Ladder
Re: Forward/Reverse Combination PID
« Reply #8 on: August 29, 2021, 01:42:39 PM »
Whichever portion of the CV range is mapped to cooling you have to scale outside the loop. For example, if cooling is 0-32%, then if CV < 32%, cooling output = 100% - 3.125*CV.  The inversion is external.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

RBPLC

  • Hero Member
  • *****
  • Posts: 586
Re: Forward/Reverse Combination PID
« Reply #9 on: August 29, 2021, 02:05:36 PM »
Quote
For example, if cooling is 0-32%, then if CV < 32%, cooling output = 100% - 3.125*CV.  The inversion is external.

This makes sense. This however doesn't work the way that I currently have it set up. The way I currently have it set up, the PID output goes to zero when PV>SP . See attached for reference. As shown, when PV is above SP, Output = 0. The desire here is not to have 100% cooling but 5% cooling.

   

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3628
  • Darth Ladder
Re: Forward/Reverse Combination PID
« Reply #10 on: August 29, 2021, 03:22:30 PM »
Yeah, but you're in P-only.  Reduce Kp, put in some Ki, and preload some bias before you enable the loop.  Then let the loop start seeking.

Even if you just go as is, yes it will start cooling at 100% but pretty soon, even the P term will figure out that's too much and ease off.  Even better if you use some integral.  Loops always start with the wrong CV, that's why they constantly adjust till they find the right one.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

RBPLC

  • Hero Member
  • *****
  • Posts: 586
Re: Forward/Reverse Combination PID
« Reply #11 on: August 30, 2021, 03:55:57 AM »
Thank you for your help. The key thing that was missing was proper initialization of the loop (see attached). Initialization could be done many ways but initializing the loop to Output=50 (when the desire is 0-50 cooling and 50-100 heating) produces the response that I would expect. 

Quote
Even if you just go as is, yes it will start cooling at 100% but pretty soon, even the P term will figure out that's too much and ease off.

It was only starting at 100% cooling due to the fact that I initially had it initialized at Output=0. You're right in that if hooked to an actual system it would eventually correct itself, but immediately jumping to 100% cooling when the loop starts running is not a desirable thing for my use case.

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3628
  • Darth Ladder
Re: Forward/Reverse Combination PID
« Reply #12 on: August 30, 2021, 10:14:18 AM »
Awesome, glad you got it going!  8)

Are max cooling & max heating about the same capacity, BTU-wise?   If not, and if you have trouble getting gains that work well in both heating and cooling, you might move the neutral point, so that it's roughly equal BTU per CV%.
« Last Edit: August 30, 2021, 10:20:30 AM by Controls Guy »
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3628
  • Darth Ladder
Re: Forward/Reverse Combination PID
« Reply #13 on: August 30, 2021, 10:19:52 AM »
The key thing that was missing was proper initialization of the loop (see attached). Initialization could be done many ways but initializing the loop to Output=50 (when the desire is 0-50 cooling and 50-100 heating) produces the response that I would expect.

You can do that??  It'd have assumed that bias was the integral accumulator, and that output was recalculated from scratch each cycle as P + Bias + cycle integral contribution + D.  But, if that were the case, it would immediately wipe out your initialization.

Host guys? Does .Output have some retention cycle to cycle? Where does the integral sum get saved?
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: 6177
  • Yes Pinky, Do-more will control the world!
Re: Forward/Reverse Combination PID
« Reply #14 on: August 30, 2021, 10:33:42 AM »
Host guys? Does .Output have some retention cycle to cycle? Where does the integral sum get saved?

No. Output gets assigned at the top of the calcs to the pTerm + Bias and then offset by other terms as appropriate.

Integral term gets applied to the Output (as a delta, this scan) and integrated into Bias for future scans.
"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