LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Aquarium Automatic Water LEvel Control

Hi all,

 

I am pretty new to Labview, and am currently attempting to make a VI that controls automatically the water level in an aquarium.

 

What I am trying to do is have the water level in the tank decrease slowly over time simulating evaporation. At a preset level (70-80% full), a pump comes on to fill the tank back up to 100%.

 

I have tried a few different methods, all of which have had less than the desired outcome. The current attempt uses a case structure, and I have successfully written two small block diagrams within the case structure for "evaporate" (drain) and "fill".

 

They work, but I am only controling it with a simple boolean on/off control.

 

It needs to:

 

1.) Be able to discriminate when the tank has evaporated to approximately 80% full and kick in the fill routine until 100% full.

 

2.) The tank level indicator only updates when the routine has finished running. I'm sure this is because it is sitting outside the structure, but every attempt I make to move it inside the structure doesnt work. I would like it to display real time fill / evaporate.

 

3.) When the cycle of evaporation / fill completes, it needs to start the cycle all over again with evaporation.

 

I have searched the examples and forum posts here, played with quite a few of the posted VI's and tried to modify them, but still can't get this thing to work properly.

 

I have attached my latest attempt to this post. Any advice or suggestions are greatly appreciated.

 

Thanks in advance !

 

Chris

 

 

0 Kudos
Message 1 of 16
(7,291 Views)

Sounds like homework so I'm going to be a bit vauge.

 

evaporation should ocurr at all times so a case structure makes no sense (a decent first try though).  If you want it to physically represent evaporation (and not a drain) then it should occur during every iteration of a loop.  This can get MORE complicated by evaporation rate as a function of ambient temperature and relative humidity, but start simple for now, a flat rate is sufficient.

 

As far as the pump goes, I recommend you need comparisons and boolean logic.    A physical system wouldn't really try to fill to 100% because then you get water spilling over it causes not only a mess but potential damage to nearby equipment.  (If your assignment requires it to stop at 100%, then go ahead and do so).

Message 2 of 16
(7,279 Views)

This is for a controls simulation project I am working on, yes.

 

I have multiple aquariums at home that I never seem to get the proper time to maintain, and when choosing my project I thought it would be great to design  a level control in Labview and perhaps someday even expand on the basic platform to other functions.

 

I am of course accelerating the evaporation function greatly in Labview. For the purposes of this project, I am working under the assumption that the evaporation has gone on long enough to reduce the overall volume of water to about 80%, then the tank will top itself up to 100% ( 100% defined as just slightly below the top of the tank).

0 Kudos
Message 3 of 16
(7,266 Views)

Tell me if this is helpfull to you.

 

PD: you could add a Tank level indicator that updates only when Filling tank goes from TRUE to FALSE (comparing the last value with the new value).

Message 4 of 16
(7,193 Views)

I suggest that you create one loop that does the following (in order):

 

  1. Simulate measurement of the water level by reading the tank level (local variable)
  2. Check the status of the pump. If the pump is on, add the “level change provided by
    the pump during the previous loop iteration time period” to the tank level.
    Note: In the real world this will not be a nice round number.
  3. Optionally introduce evaporation (case statement).
    (To automate this, use a Boolean shift register that goes true when you get to 100%.
    Keep it true until you get to 80%.)
  4. Based on steps 1-3, update the level of the tank (write to tank terminal)
  5. Check tank level to see if pump should be turned on or off
    (Hint: compare against 100 or 80 based on pump status)
  6. Update pump status (and indicator) for next iteration (shift register)
  7. Continue or quit based on a Stop button

 

I hope this helps (and that Step 2 makes sense). Let us know how it goes.

steve

--------------------------------------------------------------------------------------------------------------------------
Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
question. Give "Kudos" to replies that help.
--------------------------------------------------------------------------------------------------------------------------
Message 5 of 16
(7,181 Views)

Greetings, from the look of it, you can reduce it (in the real world of course) to a matter of 3 booleans

 

-Boolean 1, input, detects whether or not the level has reached a preset low (70-80%)

-Boolean 2, output, activates water pump when boolean 1 is true

-Boolean 3, input, detects when tank has reached 100% preset and shuts down the pump

 

If you are not too familiar with LabView then yes, a case structure would probably be best, since it's simple to understand and will do the function; best would be event structure since you only want your code ro react and not poll, but they're somewhat tricky to learn. Basically you want the inputs to control the state of the output, so if the tank goes at or below the minimum, it will trigger the pump, then when it reaches maximum it will shut it down.

Message 6 of 16
(7,159 Views)

Thanks so much to everyone who replied for all the insightful suggestions. I was finally successful last night in getting something put together that works, although it is not nearly as elegant as some of the solutions here it does incorporate some of the concepts.

 

It does everything I want it to do, except I still cant seem to get the tank display to update in real time as it is filling. It only goes to 100% full after the VI has stopped running. On the evaporate cycle it works just fine. I stuck the needle indicator in there just to have some kind of visual that there is some filling action going on there.

 

Is this because the level indicator is located outside the case structure ? If I move it inside the case structure, then I need two indicators (one for each case, no bueno) and it doesnt update in real time on the evaporate cycle.

 

It's 95% there, just stuck on this little detail.

0 Kudos
Message 7 of 16
(7,143 Views)

The simplist way to fix the tank issue, assuming you are happy with the rest of the vi, would be to add a local variable inside the while loop of the true case.

Message 8 of 16
(7,135 Views)

That did the trick Smiley LOL

 

Thanks very much !

0 Kudos
Message 9 of 16
(7,129 Views)

Good job getting your vi to work!

 

This task could be done in one loop:

 

Aquarium Water Level Control mod_BD.png

This is a snippet - drag onto a block diagram to create the code (LabVIEW 2015) .

 

steve

--------------------------------------------------------------------------------------------------------------------------
Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
question. Give "Kudos" to replies that help.
--------------------------------------------------------------------------------------------------------------------------
Message 10 of 16
(7,095 Views)