11-28-2012 03:08 AM
hi all ,
i have implemented a PI controller for my air heater controller using labview PID.
The PID blocks input range is as follows
min - 48300
max - 65000
With the Kc = 10 , Ki=8000 , the output is perfect . But now my question is how to implement the same using a c code.
Can some one suggest me whether the below program is right or not ?
loop {
error = sp_temp - actual_temp;
integral = integral + error*dt;
output = Kp*error + Ki*integral (where Kc = kp =10 , Ki = Kp/Ti = 10/8000 = 1.25e-3)
}
how can i implement the min and max values in c implementation .
11-29-2012 12:08 PM
It might be a bit long winded, but if you double click on the PID.vi and check out it's block diagram you'll see precisely how LabVIEW goes about performing PID Control.
From what I can see, the VI just uses an In Range and Coerce block to force values to a set window. I guess the equivalent in C would be an If Statement controlled by the maximum and minimum input parameters, and the current value to output.
12-06-2012 09:00 AM
Hi john,
unfortunately there is no PID toolkit for LabWindows/CVI. You can either try to to search for a mathematic code,which representates your pid behaviour in c code or create a dll in LabVIEW. You told me that you have a working VI with LabVIEW PID, so if you have the application builder you can build a .dll out of your labview code and include this .dll in labwindows/CVI.
Regards,
Joaquin