04-29-2009 03:17 PM
I am using a cDAQ chassis to control a temperature loop, where I read the temperature using a thermocouple and turn the heater on/off using a relay connected to a digital output card (NI 9477, does not support PWM). I am using the PID.vi to create a PID controller. But this vi provides the output as an analog value in the range of 0 to 100 and I need to convert this value to a PWM signal. Is there a sample program available that shows how to convert an analog value to a PWM signal. I did find a sample program on the ni website (pid_control_pwm.lib) but the version is 5.1 and does not work with LabVIEW 8.6.
This PID loop is a part of a large program. Does the PID need to be in an independant timed loop? How should I adjust the loop period such that it does not get affected by other things in the program?
Also can someone explain how the Autotunning vi works. I tried using the VI but it never completed the autotunning. It goes to the last step of the wizard and then never comes out of the loop.
Thanks.
04-30-2009 03:28 AM - edited 04-30-2009 03:32 AM
For your PWM signal: think of an array with 100 Elements. For 100% all are 1, for 50% half of them. How do you distribute these 50 ones? How long should a 1 or 0 be? That is up to you!
Well, some points to consider: AC or DC heater?
Really a mechanical relay?
Power and Power Line Flicker (a fluctuation in the voltage of AC power lines, whose compliance is regulated by IEC61000-3-3, Wikipedia)
However a good approach is to have 10 power steps, create the arrays , feed them into one DO .
If It is a slow process (you mentioned relays) software timing might be fine.
BUT think about software failures and ADD A INDEPENDENT OVERTEMP GUARD
For heater there is a alternative to PID (the I part here is the candidate for overshoots and oscillation) , search for TBH (Take back half) algorithm.
05-04-2009 05:42 PM
Hi Controls_Engineer,
It is doing the Ziegler-Nichols closed loop tuning, edging up Kp, then Ki, then Kd.
Do you have a model for your system? If not, you could attempt to create one using the System Identification tools and start from there.