05-03-2016 03:40 PM
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
05-03-2016 03:57 PM - edited 05-03-2016 03:58 PM
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).
05-03-2016 04:42 PM - edited 05-03-2016 04:43 PM
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).
05-04-2016 04:14 AM - edited 05-04-2016 04:18 AM
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).
05-04-2016 05:13 AM
I suggest that you create one loop that does the following (in order):
I hope this helps (and that Step 2 makes sense). Let us know how it goes.
steve
05-04-2016 09:00 AM
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.
05-04-2016 11:12 AM
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.
05-04-2016 11:31 AM
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.
05-04-2016 12:01 PM
That did the trick
Thanks very much !
05-05-2016 03:58 AM
Good job getting your vi to work!
This task could be done in one loop:
This is a snippet - drag onto a block diagram to create the code (LabVIEW 2015) .
steve