LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PID Control for a Triangular Wave Setpoint

I am trying to implement a closed loop control system with a trianular wave input setpoint using the NI PID control toolkit. Control theory suggests that in order to get a good tracking accuracy, we need to have two integrators as part of the controlller.  I do not have NI Control and Simulation module.  Can someone suggest how I can implement this alogorithm using the NI PID control toolkit?  I appreciate the answers or suggestions.

Thanks

0 Kudos
Message 1 of 4
(3,157 Views)

 

  I am not sure you need two "integrators", nor do I know how to do that, but you may want to start with the simpler form and see how it works.  If you use the PID block there are a few things to consider.  First, the loop rate at which you run your control will have a large impact on your ability to follow your setpoint in addition to your gain settings.  In theory you want to sample as fast as possible and you real rate will be limited by your DAQ DA and AD ability.  The gains in the labVIEW block are not simply gains though.  The "I" and "D" gains are entered in units of "integral time (Ti)" and "derivative time (Td)" which can be confusing.  This is a common usage in industry referred to as the "standard form".  In terms of the typical gains that you may have learned Ki, Kp, and Kd, you can use the following conversions.  Kp is the same in the PID block it is exactly the proportional gain.  The "Ti" is actually Kp/Ki , and the Td is Kp*Kd.   This should help with the conversion, though they say it is given in "min." so there may be a factor of 60 there too.

 

  I would ignore Kd completely.  I would start with just Kp and then add some "Ti".  Since you are adding "Ti" (not Ki directly), a higher value is less "I" gain, and a lower value is more "I" gain.  I typically find myself using "I" gain values of less than 1 (i.e. Ti < 1) in the end.

 

  Then you should the rest of the block with appropriate setpoints and such and you should be good to go. 

 

  For picking your initial P gain, start off small.  Think of it this way.  If your setpoint were 1 unit away, what output value would you want the PID block to send to your system?  That would be your gain value.  Don't forget to scale the input/output appropriately if you are using an amplifier between your DAQ card and your real system (which is typically done since the DAQ cards only put out -10V to 10V with very low power)

 

  --Alex--

0 Kudos
Message 2 of 4
(3,139 Views)

Alex,

 

Thanks.  I have tried all of this, and have a reasonably good control system.  But the tracking accuracy is not good enough.  Since I am using the triangular wave as the set-point, I would want the output to ramp up, but it does not happen quickly and accurately.  Addding one more integrator may help me improve the performance if the theory is right. I could add PID controllers in series and parallel to achieve this.  Purchasing NI Control & Simulation Module is my last option, but there may be a simpler way using the PID control toolkit. Any suggestion is appreciated.

0 Kudos
Message 3 of 4
(3,134 Views)

 

   What type of system are you controlling specifically?  What external amplifiers etc are you using?

   If it is not happening fast enough, then more P gain is necessary, integral gain will help maintain a setpoint, but not reach it faster.  P gain helps reach it faster, and D gain will slow that down (it kind of acts as a damper) which is why I suggested not using it at all.  If you have already increased P gain and still no improvement, I would suggest this:  start with a low P gain and increase it slowly and find out at what a point increasing your P gain no longer helps.  What voltage are you sending out from the controller at this point?  Are you at 10 volts and have maxed out your DAQ capabilities?  If so, you will need to add an external amplification to increase your power.

 

   For example, if this is a DC motor you are trying to turn, it requires a certain amount of power to move.  Assuming you have some amplifier that is between the DAQ board and the motor, and you send out a voltage signal (from your PID) to the amplifier which gets amplified and sent to the motor.  IF, you are sending 10 volts to the amplifier BUT the amplifier is still not putting out enough power (i.e. enough current to turn the motor, or only turns it slowely) than its not your PID code at fault, but the lack of power from your external amplifier.

 

  --Alex--

0 Kudos
Message 4 of 4
(3,129 Views)