DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

DIAdem DAQ Store and display value between measurements.

Solved!
Go to solution

Hello,

 

I have created DAQ program where the user inputs a number of cycles to test a hydraulic and electronic system. It runs through 5 test steps per cycle and stops when it reaches the user input.

 

Now, I wish to display the total number of cycles performed across measurements. I.e. the program runs through 500 cycles then the measurement is stopped. The user then starts the DAQ program again, whereby I want a numeric display to show 500 cycles. The user then starts another test run where 500 cycles are performed, then the measurement is stopped. Starting the DAQ program once again should then show 1000 cycles performed.

 

My idea is that the number of performed cycles can be saved to a file (e.g. one line with the number of cycles). The program should at measurement start read from that file and output the value to a numeric display. Then, e.g. when the program has completed running through a batch of cycles, it should sum the old value and the new value and write that to the file.

 

Is this something that can be done?

 

I appreciate any help I can get.

0 Kudos
Message 1 of 14
(5,596 Views)

Hi Matthiast,

 

It sound like the simplest approach would be to save your DAQmx results to TDMS file.  You could optionally put the results from each cycle in a separate Group or Channel, and you could save a "CycleCount" property on the File level that tallies the number of cycles saved to this file.  Each time the VI starts, it could read that "CycleCount" property and update the indicator on the front panel, and also save the next data to the correct Group or Channel.

 

Or are you saying you're currently saving the data from each cycle to a separate data file?  What file format are you currently saving the data into?

 

Have you used TDMS files before?

Brad Turpin

Principal Technical Support Engineer

NI

0 Kudos
Message 2 of 14
(5,558 Views)

Hello Brad,

 

Thank you for your response! I have not actually implemented any functionality to do this. And no, I will not need to save each cycle to a file, it is sufficient to just get a final value once the measurement is done (and as I wrote, to also read this value at start of the measurement).

 

I have not worked with TDMS files before. Do you have an example file that could be of help?

 

//Mattias

0 Kudos
Message 3 of 14
(5,551 Views)

Hi Matthias,

 

NI makes it easy to read and write TDMS file from a variety of programming languages and products, but I'm mainly familiar with the LabVIEW TDMS VIs.  By chance is that how you are interfacing with DAQmx?  There are a whole suite of examples you can look through that ship with LabVIEW that show reading and writing TDMS files.

 

The TDMS file format is a binary file format, so sending you a sample file will only help if you already have an NI product installed, such as LabVIEW, CVI, MeasurementStudio, etc., which already can read the binary file format.  Also, any of these products will also install a TDM Excel Add-in with which you can load TDMS files directly to Excel if you like.

 

But, for what it's worth, here's a sample.

 

Brad Turpin

Principal Technical Support Engineer

NI

0 Kudos
Message 4 of 14
(5,541 Views)

I'm working with DIAdem and was hoping there was an easy solution using the standard blocks - but I cannot figure it out. I am not very familiar with VBscript.

0 Kudos
Message 5 of 14
(5,531 Views)

Hi Mattias,

 

Do you mean that you are acquiring the data with DIAdem-DAC?  In that case you can save to a TDM data file and get all the benefits I just ascribed to TDMS.

 

I'm not any good at DIAdem-DAC details, though, so if you have questions around saving and reading TDM file properties with DIAdem-DAC blocks, then I'd have to defer to Walter Rick or some other DIAdem-DAC hotshot.

 

Brad Turpin

Principal Technical Support Engineer

NI

0 Kudos
Message 6 of 14
(5,525 Views)

Hello Brad,

 

Exactly, everything is performed using DIAdem-DAQ.

 

Do you happen to have contact information to Walter Rick?

 

Cheers for your answers!

 

//Mattias

0 Kudos
Message 7 of 14
(5,509 Views)

Hi Mattias,

 

Walter usually answers these forum posts before I do.  I'll send him a nudge to look at this one.

 

Brad Turpin

Principal Technical Support Engineer

NI

Message 8 of 14
(5,497 Views)
Solution
Accepted by Mattiast

Hi Mattias,

 

I have created an example for this request. In the end you need an initialization the counter, a deinitialization, as well as some helper variables (in my case L1, L2, L3)

 

L1 contains the last value of counting of the last measurement, to be used for the new measurement (initialize)

L2 contains the sum of L1 and the current counting (the current overall counts)

L3 contains the last value of the current measurement after this was stopped (deinitialization)

 

If you start the measurement, the fist clock system initializes L1 and starts the second clock system and continuously write L2. To stop the measurement please use the STOP button. With that the third clock system starts to set L3.

 

Greetings

Walter

 

I hope this helps.

Message 9 of 14
(5,488 Views)

Hello Walter Rick,

 

Thanks for the answer. This is of great help! Two questions:

 

First, a newbie question, how do variables (in your example L1, L2, L3) work - do they need to be defined somewhere before saving to them and working with them? I cannot seem to get variables to work in my own DAC plan and I cannot find any got sources for information regarding this subject.

 

Second, is it possible to do exactly what you did in the example file, but to also restart DIAdem and it remembers the cycles value?

 

Best regards,

Mattias

0 Kudos
Message 10 of 14
(5,443 Views)