10-14-2010 12:30 PM
Hi guys,
I am Agus Herryanto, a Final Year Nanyang Technological University Singapore student.
Currently, I am encountering a problem in doing my final year project.
Basically, I have to perform continuous check on samples of EMG signal which coming in batches of 1000.
The detail of the problem is as follow:
1. EMG Signal comes into the loop by batch of 1000 samples.
2. I have to treat them as if it comes one by one (not in the batch manner), so if first batch is sample number 1-1000, second batch will be sample number 1001-2000, and so on.
3. I have to perform a checking for each sample whether it exceeds certain predetermined threshold and if yes, I have to blank 20 samples starting from current sample.
4. I have done blanking logic for one batch of sample.
5. The problem is that if let say the sample exceeding the threshold happens to be one of the last 20 samples of current batch, I can only blank less that 20 samples for the current batch and therefore, I have to blank some first samples of the next batch.
Example: now I am at first batch. Sample number 998 of this batch exceeds the threshold and therefore I have to blank sample number 998, 999, and 1000 of first batch as well as sample number 1-17 of the second batch.
Currently, I cannot solve this problem.
I have attached the VI I created for blanking only one batch (confirmed correct) and the VI I created to blank continuous samples (wrong result).
I have also attached the testing program.
As the deadline of my project is nearing, I really appreciate if anyone can help me.
Thank you in advance.
Best regards,
Agus Herryanto
School of Mechanical and Aerospace Engineering
Nanyang Technological University
10-14-2010 03:17 PM
It sounds like you need to create a "flag" (local boolean variable) that you can set when you hit the threshold. Then your blanking logic needs to reset this flag after 20 samples have been "blanked". If the flag is still set when the next batch of 1000 samples is processed, the blanking logic knows to continue blanking until the 20 count has been reached and then reset the flag.
10-14-2010 08:35 PM
Dear Johnson,
Thank you for your suggestion.
However, I am still unsure how I can pass the flag value from one batch to another batch.
I am still quite new in Lab View.
What I do now is I do 1000 iterations for each batch and after this 1000 iterations, I do not know how I can pass the flag value into the beginning of next batch.
I really hope that you could advise me regarding this problem.
Thanks a lot.
Regards,
Agus
10-15-2010 10:34 AM
You can put a indicator on the front panel of your VI (any kind of Boolean indicator) and call it "Blanking Flag" or something like that. On your diagram, select the Local Variable item from the Programming - Structures palette. "Create - Local Variable". Click on the local variable terminal and select the name of the flag item that you created. You can right click on this Local Variable item and make it either a "Write" or a "Read" local variable. Now you have a way to set the flag (write to the local variable) and to test the flag (read from another copy of the local variable) from different places in your diagram.
Do a search on local variables in the LV help for more info - hope this helps!