LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI Slows down after time, difficult to terminate

Hi

I have a problem with my VI, the VI runs fine when you first start it off but after a while the PC hard disk light starts to flash.

After  about 4 or 5 hours it starts to get very slugish.

Also if I then try to stop the VI running it takes for ages to stop, in fact quite often you need to terminate labview from the task manager.

I have tried various things, originally I had some sub VI's for the thermistors, Pressure transducers and status, but with that configuration it would still get slow after about 12 hours but at least I would be able to terminate it ok.

 

The PC has relativly low memory, 256mb so that may have something to do with it, but maybe the way I have written the program is not the best way are there too many while loops in parallel or something.

 

It uses Fieldpoint modules on a RS485 link, I don't get the problem if I run it without being connected to the fieldpoint modules.

 

I have attached the VI which is in Labview 6.1.

 

Any ideas what it could be

 

 

Thanks

 

Allan

 

P.s I wont be able to answer any questions from 4th Feb to 23rd Feb as I will be on holiday.

0 Kudos
Message 1 of 7
(3,053 Views)

Allan,

 

first of all, your VI is way too big. Furthermore, it contains quite many parts of code which are Goldberg-Code. See attached screenshots.

 

Your description regarding the performance clearly indicates a memory leak or growing datastructures. The increased flashing of the harddrive led shows a growing swapfile leading to a reduced lifetime of the HD.

You have to debug the application in regard to growing datastructures.


Pazzer1 wrote:
[...]Also if I then try to stop the VI running it takes for ages to stop, in fact quite often you need to terminate labview from the task manager.[...]

Since your loops are not connected to any stop button, you have no possibility top stop the VI properly. Using the "Abort" button is a no-go and must not be used (it's only available due to "Run Continuously", a button i wish would have never been implemented)!

 

Some suggestions to improve performance:

- Get rid of variables

- Get rid of sequence structures

- Reduce file size

- Preallocate and reuse dataspaces. You use files instead which is slow and not good.

- Improve overall algorithms. You have many repetitions and iterative processes which are "special cases" handled in special structures.

- Reduce amount of type casts.

- Remove unneccasary logic (e.g. the outmost while loop)

 

hope this helps,

Norbert 

 

  vs.

Message Edited by Norbert B on 02-02-2009 06:34 AM
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Download All
Message 2 of 7
(3,037 Views)
vs.
Message Edited by Norbert B on 02-02-2009 06:38 AM
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Download All
0 Kudos
Message 3 of 7
(3,031 Views)

Few points:

Your VI is enormous 4 MB is quite some code.

Most likely you have a memory lake.

Looking at your code, I see tha tyou oriniginate from a textual programming style.

Some style issues, no right to left wiring.

If you can do an operation on an array, do it on an array.

I'm not sure but I can think that the performance of the formula box in LabVIEW 6.1 isn't that optimal. There is no need for it in your code for  instance in the lower left while loop where you index every element of an array and to the same calculation on the element. Perform this calculation on the full array with Lab VIEW primitives.

Another primiteve you need to know is the 'Boolean Array to Number' to convert a list of boolean to a binary number (you do this several times in a convoluted form.

Also you can stretch the 'Index Array' function to get several array elements in a row instead of using the function over and over with different (continious) indices.

 

My advice is to build the code for this VI from scratch using sub-vis and some design pattern.

 

Sorry I can't be more helpfull.

 

Ton

 

 

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 4 of 7
(3,024 Views)

One addition to one of my alternative screenshot:

 

 

Please note that the part in the blue circle is no good idea. Comparing floating point numbers with "equal" is never a good idea. Technically, a comparison to "greater or equal" would be better.....

Message Edited by Norbert B on 02-02-2009 06:53 AM
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 5 of 7
(3,019 Views)

Hi Pazzer1,

you should open your fieldpoint only ones and use the reference in all your loops. I can't find the close function.

 

Mike

0 Kudos
Message 6 of 7
(3,017 Views)
I just can't get over how big this thing is! holy sh1tttt. Sorry, I am of no help 😞
0 Kudos
Message 7 of 7
(2,980 Views)