News:

  • August 23, 2026, 08:19:22 AM

Login with username, password and session length

Author Topic: PID Forward/Reverse acting bit  (Read 16297 times)

davidbgtx

  • Hero Member
  • *****
  • Posts: 215
  • Host be the Most
PID Forward/Reverse acting bit
« on: June 12, 2018, 03:30:59 PM »
Is there some bit to change the PID from forward to reverse acting, like PID.act or something?
« Last Edit: June 12, 2018, 03:47:46 PM by davidbgtx »

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3843
    • Host Engineering
Re: PID Forward/Reverse acting bit
« Reply #1 on: June 12, 2018, 03:56:29 PM »
It's part of the PID instruction itself.

davidbgtx

  • Hero Member
  • *****
  • Posts: 215
  • Host be the Most
Re: PID Forward/Reverse acting bit
« Reply #2 on: June 12, 2018, 04:13:33 PM »
Yes I see it in the PID instruction. I have a need to change the PID instruction from forward to reverse acting depending upon whether which direction the machine is running. I was hoping to just move a 1 or 0 to some address like you do with Gain for instance, since all the other parameters remain the same when I reverse direction. I guess I'll need 2 PID instructions then?

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3843
    • Host Engineering
Re: PID Forward/Reverse acting bit
« Reply #3 on: June 12, 2018, 04:17:02 PM »
If you are needing to do it while in AUTO mode, could you just negate the .Gain?

If you can do it in manual mode, probably best to have 2 PID instructions with 2 different PID structures, but then have the specific PID structure's .Output drive the real world output based on which loop needs to "actively" control the process.

davidbgtx

  • Hero Member
  • *****
  • Posts: 215
  • Host be the Most
Re: PID Forward/Reverse acting bit
« Reply #4 on: June 12, 2018, 04:19:18 PM »
Never thought about negating Gain. I can do 2 PID's , I'm just lazy. Thanks for your help

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3626
  • Darth Ladder
Re: PID Forward/Reverse acting bit
« Reply #5 on: June 12, 2018, 04:24:27 PM »
Still be nice to be able to write directly to anything in the structure, though.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

davidbgtx

  • Hero Member
  • *****
  • Posts: 215
  • Host be the Most
Re: PID Forward/Reverse acting bit
« Reply #6 on: June 12, 2018, 04:28:33 PM »
The wish list never ends, and I'm glad!

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3843
    • Host Engineering
Re: PID Forward/Reverse acting bit
« Reply #7 on: June 12, 2018, 04:43:21 PM »
Still be nice to be able to write directly to anything in the structure, though.

Like this?

MATH MyLoop.Gain "-MyLoop.Gain"

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3626
  • Darth Ladder
Re: PID Forward/Reverse acting bit
« Reply #8 on: June 12, 2018, 05:04:14 PM »
Can you write to MyLoop.Direction or .ReverseActing or whatever the member is called?  I interpreted the other posts to indicate that you could not.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3843
    • Host Engineering
Re: PID Forward/Reverse acting bit
« Reply #9 on: June 12, 2018, 05:21:29 PM »
Can you write to MyLoop.Direction or .ReverseActing or whatever the member is called?  I interpreted the other posts to indicate that you could not.
There is no such structure member.  That flag is a parameter in the instruction, not in the structure.

Similar with the Algorithm (Position vs. Velocity) Initialization Mode, Error Squared, etc.  Those are flag parameters in the instruction - they are not flags in the structure.

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3626
  • Darth Ladder
Re: PID Forward/Reverse acting bit
« Reply #10 on: June 12, 2018, 05:54:50 PM »
Can you write to MyLoop.Direction or .ReverseActing or whatever the member is called?  I interpreted the other posts to indicate that you could not.
There is no such structure member.  That flag is a parameter in the instruction, not in the structure.

Similar with the Algorithm (Position vs. Velocity) Initialization Mode, Error Squared, etc.  Those are flag parameters in the instruction - they are not flags in the structure.

Hmmmm.  Not liking that very much at all.

Update:  OK, looking at the instruction, the stuff that's set there is well chosen, i.e. it's stuff that in 99.99% of all PID applications will never change at runtime.  Still, why not make EVERYTHING a struct member and just use the PID instruction as a faceplate to those members?  Then if you want to write to them you can.

In DL-Classic and AB, all loop config settings are stored in known, documented locations and changeable at runtime (and I do).
« Last Edit: June 12, 2018, 07:33: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.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6172
  • Yes Pinky, Do-more will control the world!
Re: PID Forward/Reverse acting bit
« Reply #11 on: June 12, 2018, 08:08:01 PM »
Update:  OK, looking at the instruction, the stuff that's set there is well chosen, i.e. it's stuff that in 99.99% of all PID applications will never change at runtime.  Still, why not make EVERYTHING a struct member and just use the PID instruction as a faceplate to those members?  Then if you want to write to them you can.

In DL-Classic and AB, all loop config settings are stored in known, documented locations and changeable at runtime (and I do).

At this point it's academic. We're not going to make changes that affect existing apps.

It's the same argument for SysConfig vs Instruction as Instruction vs Image Register. Stuff set in the SysConfig has a very well-defined lifespan, as does stuff hardcoded in the Instruction. When you make things fully data driven (Image Register), the lifespan is just the current scan, which means you have to deal with every possible change to the data. That greatly increases potential for fail, particularly in code that has persistent state over multiple scans. The stuff we put into the instruction was stuff that we viewed more like I/O config...not dynamically changing and tied to physical characteristics of the system.
"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

Garyhlucas

  • Hero Member
  • *****
  • Posts: 421
Re: PID Forward/Reverse acting bit
« Reply #12 on: June 12, 2018, 09:44:56 PM »
You guys made PID so easy to tune I no longer think twice about using them!  We have multiple blowers on VFDs to a common header it was way easier to add a second PID loop for when two are running than to try and get one loop to control well

davidbgtx

  • Hero Member
  • *****
  • Posts: 215
  • Host be the Most
Re: PID Forward/Reverse acting bit
« Reply #13 on: June 13, 2018, 07:08:06 AM »
If you are needing to do it while in AUTO mode, could you just negate the .Gain?

If you can do it in manual mode, probably best to have 2 PID instructions with 2 different PID structures, but then have the specific PID structure's .Output drive the real world output based on which loop needs to "actively" control the process.

Since my PID output range is from 6000 to -6000 (60hz), I just multiply the PID output by -1 when I change directions. Too simple, guess that's why I didn't think of it at first. Thanks