LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

output changes when input is constant

Solved!
Go to solution

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)

0 Kudos
Message 1 of 4
(2,898 Views)

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.

 

Example.png

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.

Tim
GHSP
0 Kudos
Message 2 of 4
(2,887 Views)
Solution
Accepted by topic author ianhaigh

I figured out what the real problem was: You need to re initialize the integral when the values goes back to zero. See below:

 

Example.png

Tim
GHSP
Message 3 of 4
(2,876 Views)

Nice one - thanks for your help.

 

I knew it'd be something simple, but couldn't see it myself

 

Ian

0 Kudos
Message 4 of 4
(2,860 Views)