01-22-2024 05:14 AM
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
Solved! Go to Solution.
01-22-2024 03:48 PM
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).
01-22-2024 11:17 PM
Here are the files in version 18
01-23-2024 10:19 PM
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 ...
01-30-2024 10:07 PM
Thank you for your reply. this seems to do the trick.
PS: Blue is better on the eye 🙂
Thank you