LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

something not updating and/or reading local variable fast enough

This is driving me crazy. Basically I am building a liquid level control using a scale and a device that puts a liquid on the scale. I have a subVI that is reading the mass value from a scale and when it drops below a value (mass to boil down to) I want it to add liquid and when it goes above a value (fill level) I want it to stop adding liquid until the mass drops below value (mass to boil down to) again. I am using a while loop to check for both the fill level and the boil down to level, and in each while loop there is a comparison with a local variable. For some reason it is does not recognize when the mass is above the fill level, unless I hit the highlight execution button. I do not know if it has to do with the way my while loops are set up or with the local variable or sampling rate, i am at a loss. Thanks

0 Kudos
Message 1 of 4
(2,467 Views)

You really should put some kind of wait in your polling loops.  They are basically using up all of the CPU and not letting other things run.  You could just be swamping out your update loop.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 4
(2,466 Views)

@lvuser333 wrote:

This is driving me crazy. Basically I am building a liquid level control using a scale and a device that puts a liquid on the scale. I have a subVI that is reading the mass value from a scale and when it drops below a value (mass to boil down to) I want it to add liquid and when it goes above a value (fill level) I want it to stop adding liquid until the mass drops below value (mass to boil down to) again. I am using a while loop to check for both the fill level and the boil down to level, and in each while loop there is a comparison with a local variable. For some reason it is does not recognize when the mass is above the fill level, unless I hit the highlight execution button. I do not know if it has to do with the way my while loops are set up or with the local variable or sampling rate, i am at a loss. Thanks


If it works in lightbulb mode, then it's a pretty good guess that you have some sort of race condition, since it forces things to execute squentially.  From what I can see, that could definitely be the case.  I'd probably rewrite this code with data flow in mind (plus some subVis to get the BD down to a reasonable size).  Just doing that could solve your issue.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 3 of 4
(2,441 Views)

I would also trdesign your code to use a state machine. It will be easier to maintain in the long run. I agree that you should learn more about how data flow works. I am sure you could eliminate the sequence frames (the one that is fully visible is not needed at all, at least not as a two frame structure). You also seem to rely quite a bit on local variables. As mentioned this can easily lead to race conditions.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 4
(2,424 Views)