LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Coherence averaging without while loop

Hi LindsW,

 

I am not an expert in JAVA also. But...anyway...I tried to solve the problem in another way and it worked. I used for loop with number of iterations equals the number of averages that I want, and I wrote the ouput coherence vector in a text file. In JAVA, I can read this text file while it is updating. Thus, I am getting the averaged data in JAVA without waiting the for loop to finish iteraions. I put a resonable delay in the for loop to guarantee that a new data won't overwrite an old data that was not read by JAVA.

 

Thanks for your help.

0 Kudos
Message 11 of 15
(533 Views)

If I understand your problem correctly, the While loop shift register is being re-initialized each time the VI is called by the dll. One solution might be to replace the shift register with a named lossy queue to hold a finite set of older values.You can access the queue by name when writing a new value, and because it is lossy, the oldest element gets dropped out when a new value is written. Read the queue elements without de-queueing to calculate the average.

 

You may also want to make the VI into a state machine with Initialize, Write New Value, Read Average Value, and Terminate cases.

0 Kudos
Message 12 of 15
(521 Views)

Thanks Chris and sorry for the delay in my reply.

 

If you mean the main while loop that I use in my code, I didn't use shift registers. But if you mean the while loop of the FRF VI, I cannot make any changes to the block diagram of this VI. Changes are disabled. Do you think that I should implement it again to replace the shift register with lossy queue.

Alsoifyoucanpresentasimpleexample, itwouldbegreat.

 

Thanks again.

0 Kudos
Message 13 of 15
(503 Views)

Hi Cowboy12,

 

Ctrl+M or the options at File>>VI Properties>>Protection can be used to unlock the block diagram- this is usually done to prevent accidental changes.  Be sure to work with a copy of the SVFA VI rather than the one in vi.lib

 

More fun/useful keyboard shortcuts can be found here, and the "big list" is available in the LabVIEW Help.

 

Regards,

Tom L.
0 Kudos
Message 14 of 15
(496 Views)

Thanks a lot 0utlaw for your help.

 

Now I can try what Chris said.

 

 

0 Kudos
Message 15 of 15
(484 Views)