From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Align and Resample has a maximum dt?

Hi all

 

I'm relatively new to Labview, and am having trouble with a DAQ program. I have a multichannel analogue input, continuously sampling at 100Hz, but over night the operator wants to reduce the sample rate to 1 sample every 10 minutes. I know the sample rate cant be adjusted while the task is running so I though a resampling would be the easier way to do this: 

Resampling.png

However the maximum I can set dt to appears to be 208 seconds, any more than that and it stops recording data. Is there any way to increase this?

 

I have attached the VI below. Please be gentle...

0 Kudos
Message 1 of 4
(3,619 Views)

Hi stez,

 


@stez18 wrote:

I have a multichannel analogue input, continuously sampling at 100Hz, but over night the operator wants to reduce the sample rate to 1 sample every 10 minutes. I know the sample rate cant be adjusted while the task is running so I though a resampling would be the easier way to do this: 


So you want to downsample from 100 Hz to 1/600 Hz? Do some averaging!

You might collect 100*60*10=60000 samples (per channel) and average them, this will take some amount of memory for storage.

You might also average each 100 samples (once a second) to one value and collect just 600 of those "1 second averages" to average them as well. And you can use the PtByPtMean to create a running average, if needed…

 


@stez18 wrote:

I have attached the VI below. Please be gentle...


On your VI:

Replace those local variables by wires! All of them…

There are (potential) race conditions due to using all those locals!

You should NOT set the buffer size at DAQmxTiming, read the full help!

You should NOT read just one sample at DAQmxRead: read 100 samples, worth a second of data…

You should NOT hide the labels of controls/indicators in the block diagram!

You should NOT convert "nice" plain datatypes (like your array of waveforms) into DDT wires (related to ExpressVIs): they just hide the underlying data and will make your life job harder than it has to be…

By using autoindexing loops on your array of waveforms the scaling will be much simpler!

Using arrays and autoindexing loops will also make the configuration part ("channel selection") much easier:

check.png

There is no error handling at the file writing part! Oh, there is no error handling at all…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(3,607 Views)

Hi Gerd

 

Thanks for taking the time to take a look at my code. I cant thank you enough for your advice, I will begin implementing it now. I knew there must be a better way to do the channel selection but couldn't figure it out. Thanks for that!

 

Could you explain a bit further what you mean by autoindexing the array of waveforms for the scaling? Do you mean where the offset (zero from initial) and cal factor 'm' are applied?

0 Kudos
Message 3 of 4
(3,543 Views)

Hi stez,

 

yes, I'm talking about applying offset and gain: in the snippet in my last message you see how to apply an autoindexing loop on an array...

Best regards,
GerdW


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