From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

The error in the function of Periodically writing the Data

I am using tensile machine doing the fatigue test and each test could cost 10 hours, for saving the disk room in computer, the loop has to be developed to periodically collect the real-time data then write out, for example collecting 1000 data at first second in each 10 seconds,rest 9 seconds will be empty, then start to write 11th seconds so on. I was using  both DAQ Max and DAQ assistant with time loop, as show below in picture 1 and picture 2. 

 

After 40 seconds ruining the program, the picture 3 and 4 are result for each DAQ Max and DAQ assistant, the result in picture 4 are right, but result in picture 3 have wrong time history which is 20 seconds with continuous data recording. Could anyone help me to locate the problems?   

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

Yes, the location of the problem is in the VI(s) and not the pictures.  Please upload the actual VI(s) so we can inspect them.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 8
(2,300 Views)

Sorry, I attached my block diagram below.

Download All
0 Kudos
Message 3 of 8
(2,284 Views)

How do you stop your VI?  You don't have any stop condition on the Timed While Loop (if you are running on Windows OS, there is not much benefit to timed while loops), so the  only way to stop it is to hit the Abort button.  Don't do that!

 

You have a fundamental difference between your 2 VI's (looking at underlying code and ignoring the use of express VI's.).  The one with the DAQ assistant is set for N samples which means when it runs, it waits until N samples are collected, stops and returns them.  When run again, it runs, waits for another N samples, stops and returns them.  Nothing is captured in the buffer between the two loop iterations.

 

Your DAQmx one you set for Continuous Samples. It runs, collects N samples, returns them, but the acquisition doesn't stop, it keeps going loading samples in the buffer.  Next iteration it collects the next N samples which are in the buffer, and will be "continuous" to the ones you already captured.  Eventually, if you don't read the samples fast enough, the buffer will fill up, overflow, and throw an error.

 

 Don't use the timed while loop.  You'd be better off collecting all data continuously, and only writing out the first second of every 10 to the file and throwing away the rest of the data.

0 Kudos
Message 4 of 8
(2,265 Views)

Ok, I am thinking to use case structure with Write to measurement inside connect with DAQ Assistant so that I can make the case structure be true to write out data at the first second, and turn it to false to stop the data recording at next 9 seconds, and do it time by time, but I could not  imagine which block in Labview can control the case structure in this periodic recording way? the counter? or other function?

0 Kudos
Message 5 of 8
(2,258 Views)

Hi John,

 

so that I can make the case structure be true to write out data at the first second, and turn it to false to stop the data recording at next 9 seconds, and do it time by time

Use ElapsedTime ExpressVI and configure it to 10s with automatic reset.

Now compare the elapsed time with 1 to get your boolean signal:

IF elapsed time <= 1 THEN
  save data
ENDIF
Best regards,
GerdW


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

@GerdW wrote:

Hi John,

 

so that I can make the case structure be true to write out data at the first second, and turn it to false to stop the data recording at next 9 seconds, and do it time by time

Use ElapsedTime ExpressVI and configure it to 10s with automatic reset.

Now compare the elapsed time with 1 to get your boolean signal:

IF elapsed time <= 1 THEN
  save data
ENDIF

I'm guessing you meant to compare Time has Elapsed instead of Elapsed Time?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 8
(2,243 Views)

Hi Bill,

 

no, I want to compare with "Elapsed Time (s)".

The user wants to repeat each 10s, but only save data in the first second of each interval…

Best regards,
GerdW


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