LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

wrong results -- it nees to run twice

Hello I have vi for calculating impulse responses, but at a first run, it gives out a wrong result. And if you run it again it has a right one. It doen't make sense, does it? Could you help me, please?
You can reconstruct the problem by (1) typing in varables, (2) run the program twice in row. (N.B, changing z will make it repeated)
The prog is done in version 5.0.

Many thanks in advance

Ultrason
0 Kudos
Message 1 of 5
(2,778 Views)
The reason is that you use locals without having anything make sure that they have been updated prior to being read. The solution though is very simple; do not use locals - wire the data from the control to all the locations where it is to be used, do not "copy" it to different locations on the diagram by using locals (locals should *only* be used if data flow prevents you from waiting for data from a wire), wire it.

If you really need a local somewhere, make sure that the local is read after the control has been updated...you can control that using the priciples of data flow, that's how execution is controlled in LabVIEW (in some cases you may need to use synchronization functions like occurences, ques etc...but data flow covers 90% of the execution control neede
d).
Message 2 of 5
(2,778 Views)
Many many thanks
0 Kudos
Message 3 of 5
(2,778 Views)
Ultrason

Also remember than any FFT analysis requries a power of 2 data points. It could be that the first run gives you a non-power of two input
Eric P. Nichols
P.O. Box 56235
North Pole, AK 99705
0 Kudos
Message 4 of 5
(2,778 Views)
If he is using the FFT function that comes with LV it will handle non-power of two input as well, it just won't be that fast.
0 Kudos
Message 5 of 5
(2,778 Views)