03-28-2020 10:49 AM
Hello everbody!
I am new in LabView program.
I am a student and we got a project to make.
A part of the requirements i have 2 problems.
1. I have 4 tanks to fill (i add my VI file). i want to able to click on refil water for example and in parallel to fill sugar.
Right now, It's only fill One after another and not able to clic on refil water and in parallel to click refil sugar.
2. I want to know how can i go from one page to another pressing a button like on the web. to switch pages a part of a project while thee project runs.
Thanks!
Solved! Go to Solution.
03-28-2020 12:37 PM
Works (almost) fine once you get rid of all the unnecessary Property Nodes (which don't seem to be connected to anything).
Most of your loops are able to run in parallel. The main problem is that they are contained inside a larger Loop, which enforces LabVIEW's Prime Principle, the Principle of Data Flow. Say you click on of the identically-labeled and unidentified Boolean Controls on the Front Panel (that's really a stupid very silly thing to do -- can't associate the Control with the item it is supposed to "control"). Let's say this starts one of the inner Loops running. You click another Control, and nothing happens. Why not? Because you have already read this control, and need to wait for the outer While Loop to finish (which requires its running inner While loop to finish).
To simplify, lets say you have a While Loop with two Booleans inside it. The first Boolean runs a "Wait one second" loop, the second a "Wait two seconds" loop, otherwise the outer loop runs at some rate, say 100 times a second. If nothing is pushed, the outer While runs at 100 Hz. When it starts, it runs everything inside it in parallel. This means "Read Control 1, Read Control 2, Run Case 1, Run Case 2, Done" (if both Control 1 and Control 2 are false). Now you push Control 1. When the outer loop runs, you'll do "Read Control 1, Read Control 2, Run Case 1, Run Case 2, Do Inner While 1 and wait 1 second, Done". If, during that second, you push Control 2, it has already been read (and seen to be False) on this loop, so the next loop it will (still) be True and you'll run just Loop 2. In order to run the two inner loops in parallel, both must be True when the outer loop starts. If the outer loop runs at 100 Hz, that means you have to really push them almost simultaneously (hard to do with a Mouse).
Please learn to clean up your code.
Bob Schor
03-29-2020 05:15 AM - edited 03-29-2020 05:20 AM
To expand on what I think might have happened here:
@Bob_Schor wrote:
Say you click on of the identically-labeled and unidentified Boolean Controls on the Front Panel (that's really a
stupidvery silly thing to do -- can't associate the Control with the item it is supposed to "control").
Bob is right (unsurprisingly) that you shouldn't have unlabelled controls. I'm guessing that you placed these controls, then set their "boolean text" to "Refil" as you wanted, then they had a bunch of labels above them like "Boolean 1", "Boolean 2" etc, and you didn't want to see this.
Rather than double clicking on the "labels" (these are the names associated with the controls, e.g. "Boolean 1") and then using delete/backspace to remove the name, you can instead right click on the control and go to Visible Items > Label and uncheck the label option.
This will hide the label (producing the desired UI) whilst still allowing you to identify the controls on the block diagram. You can also then rename them to have more useful names, like "Refill Tank 1", "Refill Tank 2", "Exit", "Refill All" (if you had a button to do that) etc.
In principle, you can do the same thing on the block diagram. However, in this case, I would strongly advise against it - you should always leave labels visible on the block diagram.
03-29-2020 12:33 PM
Also (In addition to what has been said already):
Never maximize the front panel and diagram windows to the screen. This will prevent you from efficiently working on both while having the help windows (that you need!) all open at the same time. If you can always only see one thing, it gets much more difficult.
03-29-2020 01:01 PM
@altenbach wrote:
- Properly done, you code could be smaller than a postcard. Simple tasks don't need complicated code!
I wasn't kidding! This is probably not exactly what you need, but here's something to chew on. See if you figure out how it works. 😄
(Now you just need to add code to simulate consumption, for example so all tanks slowly empty themselves. See how far you get.)
03-30-2020 04:09 AM
thanks eveybody!
🙂