LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling Filling of Tank with Ring Constant

Solved!
Go to solution

Hey, 

 

I had a problem statement where I had to create a control using ring constant for filling, holding and draining of water tank.

I started with a simple VI (attached) and its works fine without ring constant.

However, in my second attempt, i tried using Ring constant with case structures, but its filling up at an instance, i have used a delay function in for loop.

Kindly if someone can guide me to a better solution to this problem.

I have to assign 3 values to ring constant

1-Fill the tank

0-Hold Tank Level

-1-Drain the tank

 

Thank you

Download All
0 Kudos
Message 1 of 5
(1,026 Views)

Can you "Save for Previous Version" your two VIs?  I (and many other Forum users) are not using LabVIEW 2022 or 2023 (I'm using LabVIEW 2019 and 2021).

 

Bob Schor

 

P.S. -- I've never used a Ring Control.  I had to look it up, and I said (to myself) "It's almost like an Enum" (which I use frequently).

0 Kudos
Message 2 of 5
(970 Views)

Here are the files in version 18

Download All
0 Kudos
Message 3 of 5
(956 Views)
Solution
Accepted by topic author WasiqSaleem1122

Your VI is doing (surprise!) exactly what you are telling it to do.  You've forgotten how Data Flow programming works -- everything "inside" a Structure (like a Case Statement!) needs to finish before any of the outputs of the Case Statement become available.

 

What takes place inside the Case Statement?  You use your Ring structure (please substitute an Enum, call the three values "Fill", "Hold", and "Drain" -- you'll see when you wire the Enum to the Case Selector and tell the Case Statement to create a Case for Every Value you will have three Cases named "Fill", "Hold", and "Drain" -- makes understanding the code so much simpler than remembering that 1 means Drain, 2 means Fill, and 3 means Stop the Program) to choose which action you want to do, then you fill the whole tank (which takes 100 * 100 ms = 10 seconds, then "Presto", the tank is full.

 

Do you see the fix?  (Sometimes the solution to a programming problem is not adding more code ...)

 

Bob Schor

 

P.S. -- for this assignment, I recommend using I32 instead of Dbl quantities -- the dark blue is much more restful on the eyes ...

 

0 Kudos
Message 4 of 5
(931 Views)

Thank you for your reply. this seems to do the trick.

PS: Blue is better on the eye 🙂

Thank you

0 Kudos
Message 5 of 5
(870 Views)