LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

why my vi repeat its data of previous run and canot refresh itself?

hi,
i have a vi to normalize the raw data to a sine wave, but the vi repeat the previous calculated data, i wonder wether its cause my indicator is not  a locale varient but a global one.....or other cause?
the below is my vi. can you do me a favor to check how can i improve this vi to refresh it self and release the memory after every calculation.
thank you
 
scott cuhk
0 Kudos
Message 1 of 7
(3,191 Views)

Try this:

Right-clik on the leftmost shift register and select "create constant". You have the shift register uninitialized, thus it retains data from previous runs. Now repeat the same with the blue shift registers in the second FOR loop and the last shift register in the last FOR loop.

(Of course a simpler version would be as follows:

You can just built the array at the loop boundary. Other possibilities would be to use autoindexing and a shift register on the input, then subtract the previous from the current value, the use of decimate array, etc.)

Message Edited by altenbach on 10-28-2005 10:13 AM

Message Edited by altenbach on 10-28-2005 10:16 AM

0 Kudos
Message 3 of 7
(3,181 Views)
hi,altenbach, thank you for your help.
i try again and use constant to initial the shift register. the vi work very well.
but when i use this subvi( max and min for normalize sinII) in the vi named "SIN WAVE NORM",
there a very weird, that the one of subvi works very well but the other reapeat the previous data again, though thoes two subvi is the same except i change the name.....i dont know what happen, can help me?
thank u
 
0 Kudos
Message 4 of 7
(3,151 Views)
0 Kudos
Message 5 of 7
(3,152 Views)
There is no reason to create two identical VIs with different names. Why don't you simply use max and min for normalize sinII.vi twice on the diagram??? 😮
 
In any case, you forgot to initialize the shift register in the TRUE case of the big case structure. I guess that this case is sometime true, thus retaining data from earlier runs whe this case was true previously.
 
To me, it seems that this subVI (and the calling VI) is overly complicated, (almost Rube Goldberg'ian). Could you post the formula you use to "normalize a sine"? There has to be a better way. 🙂
0 Kudos
Message 6 of 7
(3,144 Views)

hi,altenbach

it very nice to get your reply.thank you

in fact using the same subvi twice but with a different name is because i thought with different name will have different memory management, so the Data repeat will be avoid. so it's a weird thinkingSmiley Tongue

to the formula of normalize a sine, i emplyed a very simple way, firstly, i get the raw data with noise (hi-frequency) via a A2D card.

then i use a low pass filter to make the raw data smooth, in fact the raw data should be a sine wave though they are always not due to all kinds of extrinsic cause. so we need to normalized the unsine signal for the next step to get the phase information through two different sine wave(we call differential phase) acquiring from two different analog channel of A2D.

to normaliz the sine, i just find the max and min points and divide the original array to several zones according to the position of max and min indexs.

then use the x-min/max-min(x is the value of every point in some zone)to normalize the sine wave to vary between 1 and 0. the lase step  is to make the two sine normalized wave to have the same length.that's all Smiley Happy

if you have a better way, or any unclear . pls tell me...

thank you very much again.

scott

0 Kudos
Message 7 of 7
(3,131 Views)