0

I was able to measure properly the airflow and sound parameters separately using two different LabVIEW VIs. One of the program is responsible for measuring the respiratory airflow through a USB device connected to the computer at sampling rate of 100Hz. The other program is responsible for acquiring lung sounds through audio jack.

However, when I combine both the programs in one while loop, as shown in the attachment, the combined VI. Was not working properly. I tried to acquire both the signals by putting the same number of samples for both airflow and sound parameters. However, the saved data revealed that I’m not getting the same number of samples for both airflow and sound. I’m having difficulty in controlling and standardizing the number of samples for both the parameters.

I added write to measurement function to record and save both the data in one file. I manage to save the data but the saved data was in unarranged manner and saved in multiple sheets.

VI block diagram

nekomatic
  • 5,988
  • 1
  • 20
  • 27
  • I can't tell from this image how the acquisition from the USB device works. What's in the other case of the case structure? If I follow the wire from the *Time interval (sec)* control you've circled, I end up at a Boolean wire connected to a terminal on the right-hand side of the case structure, but is that connected to anything outside the case structure? When you say you *combine both programs in one while loop*, did you start with a working program that acquires data from the USB interface correctly? – nekomatic Oct 07 '19 at 14:03

1 Answers1

0

I can't tell from just the image why you have this problems but I can give a few tips. Don't use local variables, instead use shift registers. Local variables can mess with the order things are executed. You can try to do the data sampling in two parralel loops. That way they won't run sequentally and you might see if one of the input samplings is slower than intended.

I don't think it is smart to write to the file every loop iteration. My guess would be that this is your main culprit! Use a parralell loop for this as well. You can create a queue to seemlessly send data for the data smaple loops to a save to file/create graph loop. When you use parrallel loops is really where Labview shines. From experiance usb can be fickle when it comes to data sampling but in this case I really think the save to file function is messing things up for you.

klirfa
  • 46
  • 5