10-19-2016 03:14 PM
Hello everyone.
Iam working on a Labview temperature control program which makes use of a PDI controller, a heater and a thermocouple reading the temperature.
Iam able to read the sensor and I think I have managed to implement the PID as well.
What I need to do now is to convert the output of the PID into an appropriate Duty Cycle in % to energize/de-energize a Solid State Relay for the heater supply voltage.
To generate a square wave I thought using the Square Waveform.VI. (see image below)
The output for the PID is in the range of 0...5V so I guess I have to scale this output in some way?
Thanks in advance for any help,
best regards,
Michael
Solved! Go to Solution.
10-19-2016 03:31 PM
I haven't seen that Simple PID VI in a while, and if you have access to the PID toolkit (now included with non-Base versions of LabVIEW) you should use that one instead. In either case, though, the output limits are set by the inputs to the VI - in your case, the "lower limit" and "upper limit" controls. Change those so they're 0 and 100 and then use the output as the duty cycle.
10-19-2016 03:34 PM
Is it a linear relation between 0-5V and 0-100% duty cycle? If so, it should be pretty simple to do a linear conversion.
For example, if you get 3.7V from the PID, solve the equation:
3.7V / X % = 5V / 100%
X = 74% Duty cycle
If you have the PID toolkit from NI, I think this functionality is built-in to the PID.vi. You simply specify the output range and the VI will handle the rest.
10-19-2016 04:02 PM
Oh man....
Sure it is linear. It's too late at my place.
Thank you!
Regards,
Michael
10-19-2016 04:07 PM
Thanks for your reply. I actually have access to the toolkit.
I think I found the old PID VI in some exemple code.
I didnt know it was that easy to scale (If this is the right word here) the output of the PID that easy.
regards,
Michael
10-19-2016 04:07 PM
Thanks for your reply. I actually have access to the toolkit.
I think I found the old PID VI in some exemple code.
I didnt know it was that easy to scale (If this is the right word here) the output of the PID that easy.
regards,
Michael
10-19-2016 04:32 PM
@´MikeSv wrote:I didnt know it was that easy to scale (If this is the right word here) the output of the PID that easy.
You're not scaling anything here, it's just a limit on the output. The proportional gain scales the output to the input. So, you could use the 0-5 output and scale it to 0-100 as aputnam suggested, or you could take the direct route of changing the output limits, in which case you would need a proportional gain (Kp) 20x larger (to turn 5 into 100) for the same results. Mathematically these are identical.
10-19-2016 04:36 PM
Hi again.
Thanks for the explaination!
Regards,
Michael