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: 

Unexpected Labview Shutdown

Solved!
Go to solution

Hi Everyone,

 

New Labview user here.  I am using an Agilent multimeter to measure the current of a device over time.  I am communicating with the multimeter through the network.  For the most part, my code runs fine until last night.

 

I set it up so that my program would measure and record the data every 60s with 7200 measurements (120 hours).  When I came to check it this morning, Labview was closed, and I initially thought that maybe I closed Labview by accident.  I checked where my data is saved, and the file was saved in the middle of the night (about 750 points of data or 12.5 hours).  Therefore, I didn't close Labview by accident.  The multimeter was still running but not being controlled by Labview.

 

My code is also set up to stop running if the device breaks.  The device is not broken.  I don't have any code that records error logs, unfortunately.

 

I don't think anyone will be able to give me a definite answer, but are there any ideas?  This is the first time it has happened.  I attached my code.

 

Thank you!

0 Kudos
Message 1 of 4
(3,442 Views)
Solution
Accepted by topic author _natalie_

Here are a few points to consider:

- You have a lot of arrays on shift registers - these are never cleared and so the memory of your application will continue to grow (which can be the cause of LabVIEW crashes)

- You write the entire data set to the file each time the loop runs, why not just append the new data (using the file I/O functions)? This will save/reduce disk writing and reduce the amount of data in memory.

 

Have you tried looking on your windows event logs to see why LabVIEW crashed? If an error occurs, are you sure you want to exit - would you not want to retry? You should definitely think about putting some error logging in there - even if it's just to log the error as you exit.


LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 2 of 4
(3,426 Views)
Solution
Accepted by topic author _natalie_

Expanding on what Sam mentioned, here are some suggestions for not having "ever-growing" arrays ...

  • Write your Spreadsheet "smarter".  Outside the loop, write the Header, with Append to File set False.  Don't bring that wire into the While Loop (in fact, get rid of the Shift Register altogether).  Instead, simply take the current set of data (which you don't need to Add to Arrays), build a 1D array of the current "row" data, and write that to Spreadsheet, but with Append to File now wired True (which appends the current row to the now-growing Spreadsheet file).
  • Eliminate the bottom Shift Register that you are using to accumulate data for an ever-growing Graph.  Instead, use a Chart, which allows you to add "the most recent point", scrolling the plot rightward as new points come in.  Make the Chart "as big as reasonable".
  • I don't know your intended use of the middle Shift Register accumulating TimeStamps in ever-growing arrays.  if you are looking for Elapsed Times, use a one-or-several node Shift Register to remember the last N time samples (in case you need more than simply "time between samples"), and simplify this section, as well.  Why keep all of the Times if you only need one to write to the Spreadsheet (once it has been written, why save it)?

Removing ever-growing arrays from your loop with not only prevent "out of memory" problems, but will also prevent "time leaks" caused by having to stop and allocate more memory for the ever-growing arrays (this might not be a problem here, but why take the chance?).

 

Bob Schor

Message 3 of 4
(3,343 Views)

Thanks Sam and Bob!

 

I tried all of your suggestions.  My code looks a lot simple now.

 

Natalie

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