News:

  • July 03, 2026, 09:11:35 PM

Login with username, password and session length

Author Topic: Do-More PID  (Read 13417 times)

HB_GUY

  • Full Member
  • ***
  • Posts: 43
Do-More PID
« on: September 01, 2015, 02:10:24 PM »
Just coding my first PID loop on the DM.
It is always running either in Manual mode or in Auto mode. correct?
I have the PID in our "Dosing" program. I am using C bits to turn from manual to Auto, but when it goes to manual mode, I really want it to be "Off".
Currently, I handle this by writing zeros to the PV, SP, and Output variables when in Manual/Off mode.
Is this the best approach?

Essentially, I only want the PID on when water is flowing in the pipe (I have a flow switch) and the PID controls a chemical injection pump. I just have to make sure that when there is now flow in the mainline that the PID STOPS and stops the pump. I am using and EDRV100 and a GS2 to control the pump.
When flow stops, I write 0's to the RS485 speed ref, PID PV, SP, and Output variables...

Am I approaching this all wrong? Or am I on the right path?
It does make logging the PID a little wonky with me manually writing these values...

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6164
  • Yes Pinky, Do-more will control the world!
Re: Do-More PID
« Reply #1 on: September 01, 2015, 02:47:04 PM »
Put it in a Task or Program which is enabled/run as needed.
"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

HB_GUY

  • Full Member
  • ***
  • Posts: 43
Re: Do-More PID
« Reply #2 on: September 01, 2015, 02:55:00 PM »
yes, it is in a program but when that program is not running, will it stop/reset the output of the PID so that the pump stops?

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3619
  • Darth Ladder
Re: Do-More PID
« Reply #3 on: September 01, 2015, 02:55:58 PM »
If you put it in a task and disable it, will that prevent reset windup?  Or when it's reenabled, will the PID know how long since the last update and add all that integral to the bias?
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: 6164
  • Yes Pinky, Do-more will control the world!
Re: Do-More PID
« Reply #4 on: September 01, 2015, 03:03:09 PM »
If you put it in a task and disable it, will that prevent reset windup?  Or when it's reenabled, will the PID know how long since the last update and add all that integral to the bias?

It accumulates time only when it is being executed, so no.
"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

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3833
    • Host Engineering
Re: Do-More PID
« Reply #5 on: September 01, 2015, 03:04:39 PM »
When in manual mode, just write to the .Output member to set the output to the desired "manual" output value (it's a percentage 0.0 thru 100.0).

If you are scaling the .Output to a WY analog output, that will push that manual setting automagically to the WY output.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6164
  • Yes Pinky, Do-more will control the world!
Re: Do-More PID
« Reply #6 on: September 01, 2015, 03:06:47 PM »
yes, it is in a program but when that program is not running, will it stop/reset the output of the PID so that the pump stops?

The termination code does not change the state of the output, but killing the program definitely disables the loop. I would consider putting the loop control in an isolated program block, with a startup stage to initialize, a run stage containing the actual loop, and a termination stage to clean up on shutdown.
"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

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6164
  • Yes Pinky, Do-more will control the world!
Re: Do-More PID
« Reply #7 on: September 01, 2015, 03:07:08 PM »
When in manual mode, just write to the .Output member to set the output to the desired "manual" output value (it's a percentage 0.0 thru 100.0).

If you are scaling the .Output to a WY analog output, that will push that manual setting automagically to the WY output.

Or what he said...
"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

HB_GUY

  • Full Member
  • ***
  • Posts: 43
Re: Do-More PID
« Reply #8 on: September 01, 2015, 03:46:05 PM »
Ok thanks!
Ill be onsite with the machine today and will move some of the code around.

Thanks!!!

Garyhlucas

  • Hero Member
  • *****
  • Posts: 421
Re: Do-More PID
« Reply #9 on: September 02, 2015, 09:22:59 PM »
I also used a PID loop for the first time today. I have to say it is a very nicely done feature in DM. Forty years ago I was tuning Temperature PID loops with pots and patience! This application is simple pressure control of a centrifugal pump. At first I couldn't get a stable pressure and the pump hunted a lot. Then I realized the pressure transmitter has a fast response and is very close to the pump so it probably sees impeller pulses. So I used the Filter function on the input and ran autotune again. Amazing to watch the pressure home in on the setpoint and sit right there! Way better than my skill at doing the tuning. Two more pumps, one on flow, one on level, and two blowers on pressure. Should be easy after the first one.