LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Resampling aligning and storing data of waveforms with different sample rates.

Hello everyone,


I'm currently developing a program which is in charge of acquiring data from two types of sensors with very different maximum sample rates.
One of them is limited to just 70 S/s, while the other can go up to 10k S/s.
For the purpose of the system requirements, sampling at 1k S/s is ok, so that's what i am aiming for.

For this I have set the DAQmx read function to acquire 7 samples in one case, and 100 in the other, and the while loop repeats every 100ms.

 

I want to be able to display and store said data at 1k S/s, my plan is to do a resampling of the waveform with the lowest sample rate with coercive interpolation. After that, i should align both waveforms so they are synchronized and append one to the other on an array of waveforms.

 

  • The first problem I'm having is that after resampling the waveform, when i try to align it, i get a waveform with 0's on all values.
  • Secondly, if I choose the global setting for the aligning I get a warning with code -20334. That states: Waveforms are not overlapping.
  • Finally when i check on the data recorded It's no surprise the first column is all 0's. But the weird thing is that the t0 of every data set tends to repeat itself a variable number of times, so I'm getting lots of measurements with the same timestamps.

I leave attached screenshots of the setup i have for acquiring data, as well as the last data log i obtained with this.

 

Any comment, or suggestion is more than welcome.

 

Thanks in advance!

Download All
0 Kudos
Message 1 of 8
(1,379 Views)

Hi Hansen,

 

in general we don't like images of code as they are impossible to debug/edit/run in LabVIEW…

 

Why don't you attach an example VI with some example data embedded in controls? (Set their default value before saving the VI…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(1,357 Views)

Ok, sorry for that.

This is an example of the Real Time target's part of the code. (With changes made to exclude the shared variables)


Best regards.

0 Kudos
Message 3 of 8
(1,344 Views)

Hi Hansen,

 

in general not all of us already upgraded to the latest version of LabVIEW (like your LV2021 VI).

You would get a much broader audience when providing a downconverted version of your VI, like LV2019. (Edit->Save for previous…)

 

I cannot open your VI due to its LabVIEW version…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 8
(1,338 Views)

Hi GerdW,

 

Here's the program for LV2019.

 

Thanks for the quick reply.

Cheers!

0 Kudos
Message 5 of 8
(1,311 Views)

Hello everyone,

 

I am posting this problem again but now with an example version of the program for LV2019 as suggested by another user.


I'm currently developing a program which is in charge of acquiring data from two types of sensors with very different maximum sample rates.
One of them is limited to just 70 S/s, while the other can go up to 10k S/s.
For the purpose of the system requirements, sampling at 1k S/s is ok, so that's what i am aiming for.

For this I have set the DAQmx read function to acquire 7 samples in one case, and 100 in the other, and the while loop repeats every 100ms.

 

The program consists on two main Vi's, one which runs on a cRIO-9057 and is charge of acquiring the data. The other Vi, running on host, is in charge of displaying and storing said data.

 

With the Vi running on the cRIO, my plan is to do a resampling of the waveform with the lowest sample rate with coercive interpolation. After that, i should align both waveforms so they are synchronized and insert one to the other on an array of waveforms.

 

  • The first problem I'm having is that after resampling the waveform, when i try to align it, i get a waveform with 0's on all Y values.
  • Secondly, if I choose the global setting for the aligning I get a warning with code -20334. That states: Waveforms are not overlapping.
  • Finally when i check on the data recorded It's no surprise the first column is all 0's. But the weird thing is that the t0 of every data set tends to repeat itself a variable number of times, so I'm getting lots of measurements with the same timestamps.

 

I leave attached a screenshot of the setup i have for acquiring data and one of the indicators. Also the data log i obtained with this as well as an example version of the real-time part of the program. 

 

Any comment, or suggestion is more than welcome.

 

Thanks again!

0 Kudos
Message 6 of 8
(1,249 Views)

Hi Hansen,

 

no need to start a new thread for the very same problem!

 

You forgot to set some default data in your waveform array indicators. That would help greatly to bugfix your VI…

 

On your VI:

Why do you convert the DAQmx task references to strings?

Why don't you use a shift register to hold the DAQmx references?

Why do you use "value" propertynodes in your statemachine?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 8
(1,234 Views)

By default data do you mean two made up array of waveforms as to simulate the ones acquired by DAQmxRead?

 

  1. You are right, no need to convert to strings now. On a previous version of the program, the Tasks were created on host and sent as string through a shared variable, but now as they are created on target, there's no need to do so.
  2. I am using a variable now, but i could do that.
  3. They are just for the example, the real version has shared variables which receive status changes from the program run on host, which has a UI.

More than for debugging i made the example program thinking to show the setup and how I was using ResampleWaveforms.Vi and AlignWaveforms.vi. For example, i am using the (single-shot) version of those as the continuous version seemed to throw errors. But i couldn't find anywhere why (if I) should I do so.

Again, thanks for the fast replies!

0 Kudos
Message 8 of 8
(1,228 Views)