Author Topic: setPWM, computePID, PIDDEF  (Read 5994 times)

plc_user

  • Guest
setPWM, computePID, PIDDEF
« on: September 20, 2005, 03:56:35 AM »
Just to get a quick understanding of how to implement the Piddef, computePID and setPWM functions in a closed loop motion control system, does these following assumptions apply?

I have a 24VDC proportional valve that will regulate flow of hydraulic fluid.  Full flow occurs at 1.5 amps, zero flow at ~0 amps.

I am using a imcremental encoder to monitor position and based on that feed back use the PID functions to control the valve.

My question's is:  
When I setup the PIDDEF function what would be the limit variable?  I think it might be the max value the DUTY CYCE will be for the setPWM function.  100 percent duty cyce would be the max limit coming out of the computePID function, I hope.

I believe, I grasp the usage of the above functions but I am just hoping that the limit variable of the PIDDEF statement will correspond to amount of duty cycle in the setPWM statement. That is Max Limit equals 100 percent duty cycle which is provided by the computePID function.

Any info would be appreciated.  

Thanks in advance.
 

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3171
    • View Profile
    • Internet Programmable PLCs
Re:setPWM, computePID, PIDDEF
« Reply #1 on: September 20, 2005, 09:30:44 AM »
Usually when you perform PID computation you base your computation on the unit that you want to control. So the limit is the maximum value that correspond to the full scale output of the PWM or DAC.

E.g. if you are computing the force required in N, and  the PWM output produces 2400N at 100% duty cycle, then the limit of your PIDDEF should be 2400. The PID function will not integrate beyond +/- 2400. This is assuming that you are not controlling bipolar output.

If you need bipolar output then in the case of PWM you will set the neutral position somewhere in the middle of the PWM output (around 50% duty cycle), so positive output is > 50% and negative output is < 50%.  The PIDDEF limit should be set such that the +limit correspond to 100% duty cycle and -limit correspond to 0% duty cycle.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

plc_user

  • Guest
Re:setPWM, computePID, PIDDEF
« Reply #2 on: September 21, 2005, 03:11:22 PM »
Thanks for the reply,

You stated that we base our computation unit on what we are controlling.  Well I am wanting to control position with a PID close loop system.  My position is monitored in "inches."  I will convert encoder pulses to fraction's of an inch for the feedback.

Knowing that Error = Setpoint-Feedback
The error should be in inches also.


Now for the control of the proportional valve.  I need to be able to control the flow of hydraulic fluid based on the PID computations.  The flow through the valve need to be determined by the PID computations.  That flow determines the speed of the rotor actuator that it connected to.  If the error of the system is very great there will be a great amount of flow to compensate for the error, right?  

Using the PWM outputs to control the voltage of the solenoid the duty cycle controls how much the valve is open.  100 percent duty cycle will give full flow.  0 percent will give zero flow.

So what should be coming out of the PIDcompute function should be percentage of duty cycle, right?  We might have said that but you also said that the computations would be the same units as the control variable.  Am I missing something?

Anymore advice would be appreciated.
   

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3171
    • View Profile
    • Internet Programmable PLCs
Re:setPWM, computePID, PIDDEF
« Reply #3 on: September 21, 2005, 05:07:59 PM »
If the controlled variable is the flow rate, then the limit should be set to the maximum flow rate that correspond to 100% PWM.

The limit used by PIDCompute is to prevent the integrator from integrating error when the controlled variable has already reach the maximum possible output. Further accumulation of the error will not do any good as it results in the future correction producing a very large swing due to the unwinding of the "wound up" integrator. Setting the proper limit will prevent such an outcome. But if your application would never face a situation then it is less of a concern.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS