Host Engineering Forum
General Category => Do-more CPUs and Do-more Designer Software => Topic started by: HB_GUY 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...
-
Put it in a Task or Program which is enabled/run as needed.
-
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?
-
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?
-
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.
-
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.
-
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.
-
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...
-
Ok thanks!
Ill be onsite with the machine today and will move some of the code around.
Thanks!!!
-
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.