LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reset t0 in an exported file

Hi everyone,

 

So I have this VI (attached), which does some temperature data acquisition and save it in a file every ## seconds. I wired a constant "true" to "append to file", so the program writes the new data without replacing the old one. Each time the file is modified, the graphs are reset to zero and the acquisition continue.

The problem is : when the graphs are reset, the acquisition restarts at t0 (start time, when i click on the start button), whereas I want it to continue.

 

I tried to fix this with a local variable and a conditional structure (center of the second while loop). Now the time is correct when the grahps restart, but in the exported file it still restarts at t0...

Do you know how to correct this ? I don't know if it is very clear.

 

Thank you for your help

Sorry for bad English

0 Kudos
Message 1 of 3
(2,935 Views)

There are many complexities in your code that can be greatly simplified by learning some basic Lab principles.

  • Data Flow means you almost never need to use Frames (Sequences).  For example, the first Frame can be removed by putting the Temps réel Property Node on the Error Line going into the While Loop.  You also might not need the third Frame, and the middle Frame is also unnecessary (there, I got rid of the entire Sequence).
  • You can avoid using the Stop local variable by making the Stop control use the conventional "Stop" Mechanical Action of Latch When Released.
  • Most of your Local Variables can be eliminated by holding (and modifying) the data using Shift Registers.
  • The top While Loop is much better realized by an Event Loop, which provides immediate response to selected Front Panel actions without taking any CPU time when nothing is happening on the Front Panel.  This would be instantly recognized as "Handle Front Panel Controls" by (almost) all Certified LabVIEW Developers at any level (even CLADs).
  • Your method of acquiring samples is very poorly "timed".  I'm not sure what DAQ device you are using for acquisition, but I believe all DAQ devices, particularly those that take analog samples, have hardware clocks in them that are much more precise and accurate than Windows' clock (which is what is timing your acquisition loop).  Learn how DAQ devices work (there are some excellent Tutorials on DAQmx that you can find on the Web, or on links to the Forum's first page, upper right).
  • Free labels (explanatory text in boxes saying what you are doing), sub-VIs with descriptive Icons, other "make the code obvious" techniques would help not only us figure out what you are trying to do (I'm trying to understand the "x > y ?" test).

Sorry I didn't address your original question directly.  I'm having difficulty understanding what you want to do because, in part, you are using methods that most LabVIEW programmers avoid (Frames, Local Variables, huge Block Diagrams, etc.).

 

Bob Schor

Message 2 of 3
(2,909 Views)

Thanks a lot for this developed answer. I'm trying to correct these points, I will maybe post the modified VI later.

 

For the "x > y ?" test, I want to save the data acquired until now and reset the graphs if the array is bigger than a user-specified number (= number of measurements/second). I also re-define a t0, or else the graphs will restart at the first t0.

I don't understand what you mean by "poorly timed". Do you mean the "wait" function ?

 

Thanks again, this is really helping me.

0 Kudos
Message 3 of 3
(2,896 Views)