Showing results for 
Search instead for 
Did you mean: 

Tank fill and hold

Go to solution



I am very new to labVIEW. I have an assignment to simulate a pump and a tank. I have to fill the tank at the rate the pump operates at. The pump ranges between 40 and 180 gpm. So if the pump is operating at 120 gpm i want the tank to fill at a rate of 2 gallons per second ant the tank to hold it.. im struggling to get my head around the holding whats in the tank



0 Kudos
Message 1 of 7
Accepted by topic author garco



How would you do it if you were tracking the data with pencil and paper? You would write down the amount of water in the tank at the end of each second and add to it the amount pumped in during each second.


To do this in LabVIEW you need a loop to repeat the process. You need a time delay to represent each second.  You can use 1 second delays or a shorter delay to make it run faster than the actual time. You need a shift register to hold the accumulated amount of water. An ADD function. A control to represent the pump rate. An indicator to show how much water is in the tank.  LabVIEW has a nice tank indicator.


Try it. If you do not understand something, post waht you have tried along with an explanation about what is not working as you expect.



0 Kudos
Message 2 of 7

Thanks for your reply


Im confused where to add the time delay. I have the numeric control(my pump) connected to an add function and the shift register, from the shift register element to the other input on the add function and then from the add to the tank. I have a constant to drive the loop



0 Kudos
Message 3 of 7

just changed it so the add is connected to the shift register and my tank is filling perfectly.. just still abit puzzled about the time delay

0 Kudos
Message 4 of 7

Please post the VI you have made nd I will take a look at it.



0 Kudos
Message 5 of 7

it appears to be working.. i have tried to set up a reading every minute for 30 days so thats the reason for the two loops..

0 Kudos
Message 6 of 7

Often it is better to use just one loop. If you scale the days and minutes to use the same units, then you can use just one loop.


Initialize the shift register with a zero (outside, on the left). Then every time you start the VI, the tank will start empty.


Do you really want a VI that runs for 30 days without any easy way to stop it?  Using the Abort button is not recommended as it leave the program in an undefined state.  Change to a while loop or a for loop with a conditional terminal.  Add a Stop button to the front panel and wire it to the conditional terminal.


Similarly waiting 10 seconds or 60 seconds for it to respond to the Stop button is not good practice.  It is better to use a shorter time delay and only do something when a threshold has been reached.


I modified your VI to do some of these things.  Note that the tank updates every 10 seconds with the default values but that the loop iterates one time per second.  Also note that the addition of water to the tank occurs before the time delay completes, so it has an "instantaneous" addition at the beginning.



0 Kudos
Message 7 of 7