LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sample Rate - Strain Continuous Input

Solved!
Go to solution

Indeed, now it is as expected! And I can monitor it by looking at the dt display. Just wondering how I can see that the decimating works as intended? With the factor set to 10, I should have a sample frequency of 200Hz, correct? 

 

Is there a way to monitor this as well? 

 

Best,

S

 

0 Kudos
Message 11 of 18
(433 Views)

Hi sbrink,

 


@sbrink8 wrote:

Just wondering how I can see that the decimating works as intended? With the factor set to 10, I should have a sample frequency of 200Hz, correct? 


With a decimation rate of 10 you should see just 100 samples in the graph when you read 1000 samples from DAQmx…

 

(The sample frequency of your DAQmx task will still be 2000Hz.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 12 of 18
(432 Views)

Yes! I think, I am having a hard time making the visual comparison between the two graphs and wondered what the best way is to compare them. So I can basically see the new dt to check my decimated sampling frequency. 

0 Kudos
Message 13 of 18
(430 Views)

Hi sbrink,

 


@sbrink8 wrote:

So I can basically see the new dt to check my decimated sampling frequency. 


There is no "new dt" after decimation as you only decimate the Y array!

 

You can calculate a new dt with "dt * decimation factor" and create a new waveform:

 


@sbrink8 wrote:

I am having a hard time making the visual comparison between the two graphs and wondered what the best way is to compare them.


You can simply compare the array sizes before and after decimation…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 14 of 18
(428 Views)

I adapted the code so I can safe both data sets at once! And it works like a charm. Thank you so much for your help and patience. It also makes so much more sense now!

 

Best,
S

0 Kudos
Message 15 of 18
(386 Views)

Good afternoon, 

 

not sure if you receive a notification when you get a reply on an older channel, but here we go. 

 

I have been playing around with different methods to sample 2 strain gauges with the NI 9237, sampling at the same rate (i.e. reduced to 2 Hz from 2000 Hz) and saving the data. At the moment I can choose the sampling rate for each individually which is also nice. 

 

However, while the script I came up with works, it is very convoluted (plus I am saving the down sampled signal into 2 separate files). Could you take a look at the .vi and provide some insights into how it could be improved? 

 

I played around with different ideas I found in various forums: 

Solved: Order of channels in Analog 2D DBL NChan NSamp VI - NI Community

--> Here, I was not able to add the Channels_to_read as suggested by the post

--> Plus, for the initial solution I was not able to recreate the 'data' option. 

 

I also came across the WDI Index Channel option which albeit crude, seemed to allow me to do the job. 

 

I've attached the vi and hopefully in your preferred (2019) format. 

 

Best,

S

0 Kudos
Message 16 of 18
(285 Views)

Itwo                                                 ul

                                       db                                                                                                          erea

 

 

 

                                                                                                                  l

                                     l                                                                                                      yh

 

 

 

 

el                                                                                                                                                                          pfu

 

 

 

 

 

 

 

                                                             lify

ouw                                                                                                                    ou

 

 

                              l                                                                                       d

 

 

 

 

 

neaten up the code inside your main loop! (see the analogy to my text above?)  The code prior to the loop is a much better pattern to follow, much like when I write this paragraph this way.

 

I'd also very highly recommend that you learn enough about TDMS file functions to use the lower-level file functions to write your decimated waveforms directly into a TDMS file.  TDMS supports the ability to have different sample rates for different data channels within the same file.  You could then choose to include the original raw data as well as the decimated data.

 

When decimating, it can often be a good idea to turn on the averaging option.

 

I'll note that you handled the basic mechanics of waveform decimation properly.  You built a new decimated waveform from the original (which carries some attributes like channel name that will show up in your TDMS file), while replacing only the Y and dt which are necessarily changed by the decimation.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 17 of 18
(277 Views)

@Kevin_Price wrote:

 

When decimating, it can often be a good idea to turn on the averaging option.

 

-Kevin P


+1 for averaging. Averaging will act like a low pass filter and help avoid possible aliasing effects. Typically before decimating, you low-pass filter the data then decimate. When you select averaging, the average of many points will act similar to a low pass filter.

0 Kudos
Message 18 of 18
(268 Views)