LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Cleaning up Local Variables

I only judge the part of the sandbox that I can actually see. 😉
 
We definitely need to see the entire code for a final assessment.
Message 11 of 25
(1,524 Views)

Christian wrote;


I only judge the part of the sandbox that I can actually see.
 
We definitely need to see the entire code for a final assessment.

 
Oh Yes.
 
Now that I look closer,
 
A) If this is a loop with no wait
 
B) and at least a dozen tranisitions to and from the UI thread,
 
 
I can see how this goobles up CPU.
 
Please post some code so we can stomp around in your sand box. Smiley Wink
 
Ben

Message Edited by Ben on 07-12-2007 05:30 PM

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 12 of 25
(1,512 Views)

And judging by the code and control names, an Action Engine may be of help.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 13 of 25
(1,507 Views)
Attached is a copy of the summary VI, be brutal but polite lol

Thanks for the link to the action engine ben, I'm going to read through it right after getting this code posted (2 birds one stone..once you see it there may even be a better way)

Thanks!

LV7.1, LV8.5, LV2014/15/16
0 Kudos
Message 14 of 25
(1,489 Views)

"Waits" are your friends. Smiley Happy

PaulG.
Retired
0 Kudos
Message 15 of 25
(1,480 Views)
To elaborate on Pauls comments, you should almost never have a loop without at least a small amount of "Wait" in it. Otherwise it tries to run VERY fast and gobbles up resources on the PC. Even a 1 millisecond wait is better than nothing, but i typically put at least 25ms. This would likely be the source of some lag issues.
0 Kudos
Message 16 of 25
(1,474 Views)
To further elaborate on mine and Matt's comments, try the waits first in all your loops, then see what happens to the CPU and performance. That should improve performance dramatically. It may be all you need. No, it's not pretty but it looks functional and straightforward enough.
 
Scratch everything I said about rewriting the entire application. If anything, for your own sanity I would at least try to put some effort into make the code more readable: i.e. consolidating your code so everything fits into one screen without a lot of scrolling. It will also help you understand the code a little better, breaking it down into sub-functions. Sub-vi's are your friends, too. Smiley Happy
PaulG.
Retired
0 Kudos
Message 17 of 25
(1,465 Views)
This is actually the better part of the program, built to work around the piece I took over.

You think this is bad lol.

On the note of the wait - I saw a demonstration in the LV intermediate class I & II (Just took them, so trying to learn to apply the material).  In the demonstration a while loop with nothing but a stop button was used.  It was an empty structure and pulled 100% CPU time.  After we tried again with a 250ms wait....useage dropped to about 3%.

I'd like to try and get it on all one screen, and get rid of all those while's altogether.  We used functional globals in the class, but moving so fast you start to do without thinking.  This is a good chance to figure these out...or generally a better way to do it in case down the road say I have 200 of those loops by keeping the same scheme....eventually the waits aren't going to help too much.
LV7.1, LV8.5, LV2014/15/16
0 Kudos
Message 18 of 25
(1,457 Views)
Update:

I tested out the VI I posted and it gave 100% CPU usage.  Again with 100ms waits in every while loops that was used.  CPU time dropped to 2-3%.

That may make the load easier on the PC thats running the program, but is it helping the effeciency of the program?  It seems like logically if you are placing some 30 waits into 1 VI, those waits are all going to add up causing huge delays in the programs ability to zip through what it needs to do.  Is this really the only change I should make?

I will attempt this AE that was recommended also, but i'm not sure I understand how it will help?  I did try reading through the "Action Engines, What are They?" post and I'm still a bit confused.  What I suppose I'm trying to do is find a good medium between hogging the CPU cycles for the computer, and the responsiveness of the overall test program.  The waits seem to help with the CPU cycles, but I can't see it speeding up how fast the indicators collect their data and update on screen.
LV7.1, LV8.5, LV2014/15/16
0 Kudos
Message 19 of 25
(1,446 Views)

This is just TOO sticky for me to get into this very deep.

RE: waits

Just put one wait in the big loop and leave them out of the the little ones.

 

Re: Action Engine

You will have to go through all of your code and determine what logical operations are taking place i.e. Check for error, Check for ....

Design your AE such that all of the logic signals (current held in FP controls) are in the shift register in the AE.

Create actions for your AE that mathc up with your logical operations 9Check for error,....)

If the AE needs to know about something happening in the outside world, add an action to update those states.

If the GUI needs to know what is happening to the signals inside the AE, add an action the "Gets Status".

I hope this helps,

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 20 of 25
(1,437 Views)