I´m trying to control the temperature in an oven using the PID.vi, but I noticed some weird things about using this control...
I read the oven temperature at every 1 second and input this data at the PID.vi at every 1 second too. But, I need to make a for loop iterating a bunch of times to really have a good control. If I don´t use this for loop, I can see a really considerable diference comparing to the result of the test I used PID.vi inside the for loop. So, at every 1 second, I read the data, input this data at the for loop, iterate it a bunch of times and I make the average of the results, then I have my PID output.
I want to know how exactly use this control and what can I be doing wrong? Can somebody send me an example using this vi? How do you do PID control, do you always use this vi or you do it in another way? Please, I really need to make it work properly and I need to make it soon =(
I am not sure if I understand how and why you are using for loops. Normal use of the simple pid.vi would be as shown in the attachment, but I assume that is what you actually doing (without the for loops). You just read every second the current value of the temperature and feed this into the PID.vi Since in this vi the shift registers are not initialized it will remember the values of the previous time it was called. No need for extra for loops ... This method works properly (over a limited temperature range) provided that the P, I and D values are set correctly using for example the Ziegler-Nichols method.
Then you can add a little bit more 'intelligence' by adding for example the range in which the integration should start, resetting the integration part at an overshoot, different PID parameters for different temperature ranges, ...
If you are still not happy with it you can also spend some money and buy an external controller or the PID toolkit from NI.
I was wondering what your desired function is, as you say you are not having 'good' control without the for loop? What you are currently telling the PID function, by using the for loop, is "I have actually sampled many times (n size of for loop) in this second, and they were all the same" which is kind of bypassing the PID functionality, and not accurate.
Is your problem that it is not reacting fast enough, or not getting close enough to the target? In that case, what you need to do is tune your PID loop coefficients - details on how to do this are in the PID Control Toolset user Manual, section 2-6. I have always found tuning to be almost an art form, and experience really serves - especially when the control output is an on/off vs. a proportional output. Which is yours?