06-21-2012 10:41 AM
Hi
I'm probably being an idiot, but until someone can show me how then I'm a bit confused.
I've got a loop iterating in a VI. The inputs to the loop are front panel controls, but even when the input values don't change, the output does.
It's all fine to start with (output shown on the top X-Y graph stays the same), but after the integration step, the output shown on the bottom X-Y graph keeps increasing indefinitely.
The offset increases each time the While Loop executes (you can increase the sweep time or sampling frequency to see this while it is running).
If someone could point me in the right direction I would be very grateful.
Thanks,
Ian Haigh
(running LV 2010)
Solved! Go to Solution.
06-21-2012 12:30 PM
The most obvious reason to me would be that you conneded it to the iteration control. That will continue to itterate while the code is running.
The way that you have it right now the for loop will exicute 6368.88 times whichm means that the "i" value will change from 0 all the way through 6369 then the for loop will stop.
06-21-2012 01:17 PM
I figured out what the real problem was: You need to re initialize the integral when the values goes back to zero. See below:
06-22-2012 04:40 AM
Nice one - thanks for your help.
I knew it'd be something simple, but couldn't see it myself
Ian