11-01-2013 03:38 PM
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.
11-01-2013 05:46 PM
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.
11-04-2013 02:41 PM
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.
11-04-2013 05:38 PM
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,
11-05-2013 04:42 PM - edited 11-05-2013 04:42 PM
Thanks a lot 0utlaw for your help.
Now I can try what Chris said.