LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Long run front panel bugs

I use an executable built from LV2011 VI to carry out some experiments. It runs on pretty slow AMD PC.

Usually I need to execute it non-stop for a few days and it can gather array of 3000-10 000 experimental points for me into file and XY Graph.

In long run strange bug occured twice. First time after 2-3 days of execution some labels on front panel became plain from bold. Then, after 2-3 days more, front panel resized and some elements went missing.

Second time after one day of usage the same thing happened both with labels and entire front panel.

However, it seems not affecting code execution, so it didn't  ruin my experiment.

0 Kudos
Message 1 of 14
(4,693 Views)

Sorry, have messed with accounts. That's my message above ^

0 Kudos
Message 2 of 14
(4,689 Views)

If you look in task manager, how does the memory use behave as a function of time?

 

Is there an update for the graphics driver available, if so, try to upgrade. What else is running on that computer?

 

Do you have the original LabVIEW code?

0 Kudos
Message 3 of 14
(4,661 Views)

I checked memory usage before exiting bugged VI. It was about 30%. I can't be sure about the memory usage in the exact moment of bug occurrence, apparently.

I'll try to update driver, it's built-in AMD graphics, surely can be glitchy. I will test program behaviour on Intel platform.

Nothing particular  is running the same time with VI. Maybe, Excel, Total Commander, Google Drive.

I have the code. It's WIP, gets messed up after every new feature.

0 Kudos
Message 4 of 14
(4,647 Views)

Ouch. I think I need a bigger monitor! 😄

 

(No way to look at that code on my laptop... :()

 

I was more interested about memory use over time, not the final value. Does memory start low but is creeping up over time at a constant rate?

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

A real horror after opening the block diagram 🙂 Actually It made me open a beer. Has ever the programmer took a look at some LabVIEW tutorials, and I specially think about subVI usage, State Machines, and design patterns?

I have no idea why the GUI bug happens which you experience, but the code itself cries to be refactored, or I think even better to be totally re-written based on some proven LabVIEW pattern...

0 Kudos
Message 6 of 14
(4,633 Views)

I've tested VI for memory leaks at some point. It seemed to work just fine. Task Manager isn't good tool to perform prolonged tests. I'll find alternative and perform memory monitoring. But I doubt memory leak is the case.

0 Kudos
Message 7 of 14
(4,602 Views)

Who wrote this?

 

From a quick glance, it is just peppered with illogical code and race conditions. For example the big outer loop can only go to the next iteration after all the inner loops have finished, but at that time the stop button has already been read, causing an additional interation once all inner loops that read the same stop button via locals have finished. If the operator would change the button back to FALSE quicky, the program would be in an unknown state, with some loops running and some not. Looking at the upper left loop inside the big loop, your shift registers never contain more than one element, so why use arrays at all? (You start with an empty array from the uninitialized shift register and append a scalar, creating an array with one element. Then, using an inplace structure for no good reason at all you reverse that array with one element and try to take a much bigger subset (depending on the value of the local), but since the array only contains one element, that's all you get out. Then you reverse the array again.

 

What's up with all the local variables of hidden controls and all the value property nodes?

 

At this point I gave up. This is not salvageable or debuggable in its current form. Sorry. 😞

0 Kudos
Message 8 of 14
(4,580 Views)

I've wrote this. I started from scratch and a few tutorials, so it's history of my learning and mistakes. It was constant prototyping. But now apparatus, running this VI, works and experiments can be performed (and a user cannot see, how obviously bad the code is). So I have time to refactor the code and apply what i have learned. I will try to remove all "duct tape" solutions, like mentioned big outer loop, that makes additional run.

Hidden controls are used to pass data. I'm going to replace them with Glob.Vars or SubVIs.

Value Nodes used to either allow VI to control itself according experimental data, or to allow user to schedule changes in controls.

Race conditions, due to some specific of experiments, allow to get more statistically reliable data. Smiley Frustrated I'm still thinking, should I replace this with synchronized algorithm.

Concerning left up loop. It accumulates data from queue to shift registers. Then the inplace structure looks after array to not exceed certain max size (local variable).

 

Thanks for your participating! I'l try to accummulate more data about the graphic bug.

0 Kudos
Message 9 of 14
(4,556 Views)

Hidden controls are used to pass data. I'm going to replace them with Glob.Vars or SubVIs.

Whenever it is possible use wires to pass data. In other cases use Functional Global Variables (FGV) (not Global Variable, it is useable, but not the good choice usually), Queues, Notifiers, and User Events (Event Structures).

 

Value Nodes used to either allow VI to control itself according experimental data, or to allow user to schedule changes in controls.

Overusing Value property nodes can really impact performance. Use Shift Registers, FGVs, and State Machines to stores data and states. To see some general rules which are adviced to follow for indicators and controls, I would refer to the CLD exam prep guide (section 4.a):

http://download.ni.com/evaluation/certification/cld/cld_exam_prep_guide_english.pdf

 

Race conditions, due to some specific of experiments, allow to get more statistically reliable data.

I think you do not clearly understand what race condition means, and there is no such thing which would justify it to be created on purpose. Non deterministic programming is not programming, you cannot predict the outcomes...

 

So I have time to refactor the code and apply what i have learned. I will try to remove all "duct tape" solutions, like mentioned big outer loop, that makes additional run.

I would really really just rewrite the whole application. First create a written documentation which lists the required functionality, contains a flow chart, etc...Try to decide which proven design pattern would be the most appropriate as solution (for sure it would contain some sort of State Machine(s), probably Event structure, etc...)...

 

Do you have acces to the online Core1-2-3 teaching material? I would go through these...Also some more reading which related to some problems:

http://www.ni.com/newsletter/51735/en/ 

 

You will see after some more learning how easier it will become to build an application which is modular, rescalable, debuggable, etc... And of course the MAIN VI would fit into one single screen 🙂

 

 

0 Kudos
Message 10 of 14
(4,514 Views)