LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Fill 2 tanks in parallel and one more Question

Solved!
Go to solution

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!

 

0 Kudos
Message 1 of 6
(2,981 Views)
Solution
Accepted by topic author Liran66

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

Message 2 of 6
(2,954 Views)

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 stupid very 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.

 

labelling.png

 

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.

Spoiler
Ok. Maybe there's one case you might hide it, but that's just for the "This VI" reference, and it's not important if you leave it visible, so it's safe to always leave them visible and forget this potentially viable single case in which you might hide it.

 


GCentral
Message 3 of 6
(2,905 Views)
  • All you need is one single loop containing shift registers for all tank values, running at a reasonable common loop time.
  • All your values should be orange (DBL). Liquids cannot be approximated as integers. Once you do that, enver use equal comparisons
  • You can use arrays to carry most data.
  • Properly done, you code could be smaller than a postcard. Simple tasks don't need complicated code!

 

 

 

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.

0 Kudos
Message 4 of 6
(2,890 Views)
Solution
Accepted by topic author Liran66

@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.) 

 

altenbach_0-1585504801296.png

 

Message 5 of 6
(2,884 Views)

thanks eveybody!

 

🙂

0 Kudos
Message 6 of 6
(2,849 Views)