DASYLab

cancel
Showing results for 
Search instead for 
Did you mean: 

dasylab how to write data to a file every 15 minuts

Solved!
Go to solution

Hi all,

I am using dasylab and datashuttle/3000 to log data. What I want to do is write data to a new file every 15 minutes. I'm using the milti-file, which can write the data to diffenret file, but how can I control the timing, such as log the data every 15 minutes automatically.

 

The other problem is that I use FFT to analysis the frequency spectrum. How can I determine the frequency value where peaks happens.

 

Thanks

0 Kudos
Message 1 of 6
(8,893 Views)
Solution
Accepted by Alan005

To write less data to the file than you have collected requires some data reduction.

There are three techniques to consider. 

 

Averaging or block averaging - both reduce the data by using an averaging function, defined in the module. To accomplish data reduction, choose the block or blockwise mode in the properties dialog, and then enter the number of samples/values of data that you want to average.

 

Average -  when you reduce the data, you should also reblock the data using the Change Block Length at output parameter. For example if you sample at 100 samples/second with a block size of 64, the Average module configured to average over 10 samples will take 10 times as long to fill a block. The initial block represent 0.64 seconds, the output block will represent 6.4 seconds at a sample rate of 10 samples/second. If you change the output block size to one, the program will remain responsive.

 

Block Average - averages the values in a block against each subsequent block, where the average is position based. All first samples are averaged, all second samples are averaged... etc. The output is a block of data, where each position has been averaged over the preceeding blocks. This is how you will average FFT data or Histogram data, for example, because the x-axis has been transformed to Hz or bins.

 

Second technique - Separate module. This allows you to reduce data and the effective sampling rate by skipping blocks or samples. For example, to reduce data from 1000 samples / second to 100 samples/second, you would configure the module to keep one sample, skip 9, keep one, skip 9, etc. If you configure it to skip blocks, you will not reduce the sample rate, but will reduce the overall amount of data, keeping one block in 9, for example. This is appropriate for FFT or Histogram data, for example, to keep the context of the data correct.

 

Finally, you can use a Relay module and a timing module to control it. For example, to reduce data to one sample per 15 seconds, configure a TTL Pulse Generator module to time a 15 second cycle. Connect it to a Combi Trigger module, and configure it to trigger on rising edge and stop triggering directly, with a post-trigger value of 1. The output of the trigger connects to the X control input of the Relay. 

 

In addition to these techniques, you can modify the third technique to allow a variable duration by using a combination of other modules. 

 

Several of these techniques are touched on in the Help-Tutorial-Quickstart, as data reduction is one of the most frequently asked questions. 

 

With regard to the FFT... use the Statistical Values module to obtain the Maximum and the Max Position. The Max Position will be the frequency value associated with the Maximum value. The output of the Statistical Values module is a single sample per block. Look at the various FFT examples installed in the worksheet/examples folder.

 

Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.
0 Kudos
Message 2 of 6
(8,885 Views)

Thank you very much, CJ.

It works perfectly. One more question,  There are several peaks within the FFT frequency spectrum.  I want to determine each peak's frequency value within specific frequency range. I am not sure if DASYlab capable to do it. Again, many thanks.

0 Kudos
Message 3 of 6
(8,881 Views)

Use the Cut Out module (Data Reduction) to zero outside the frequency range. It's done by sample numbers, so you have to look at the block to see what the frequency lines are for each sample in the block. Then, get the maxima from that narrowed range.

 

Also, look at the example ampl_harmonic.dsb for how to use the Select Values module (Statistics) to pick a value from the block by position.

Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.
0 Kudos
Message 4 of 6
(8,875 Views)

I'm trying to solve a very similar problem and have tried both the Seperate and the Signal Generator techniques listed above, but they both give the same error:

"The time information or block length of the input channels do not match. These channels cannot be linked in this module. STOP!" I'm afraid I don't understand what this error is telling me. 

0 Kudos
Message 5 of 6
(6,939 Views)

Hi,

 

sounds like you've been very busy!

 

The time/block length error message occurs when a module requires all of its inputs to be synchronized - timestamp, sample rate, and block size. The usual problem is the Write data module, when you are writing to an ASCII file.

 

You have to review the inputs to the module that is complaining, and determine if the error is accidental (the average module needs each channel to be configured) or deliberate ( analog input and digital inputs are sampled at different rates on most devices).

 

If accidental, it should be pretty easy to fix. If deliberate, you may be forced to write data to two different files.

 

Other common errors - using a switch to control a relay. The Switch has a time base, since it generates data  (in this case, software generation). It defaults to the Driver time base. If you are using MCC or NI hardware, then you need to force the Switch to use the same timing as the data (Switch properties, Options dialog).

 

Otherwise, post or PM your worksheet to me, and let me look it over. 

Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.
0 Kudos
Message 6 of 6
(6,915 Views)