取消
顯示結果 
搜尋替代 
您的意思是: 

Controlling Filling of Tank with Ring Constant

已解決!
前往解決方案

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

0 積分
1 條訊息(共 5 條)
2,047 檢視

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 積分
2 條訊息(共 5 條)
1,991 檢視

Here are the files in version 18

0 積分
3 條訊息(共 5 條)
1,977 檢視
解決方案
由主題作者所接受 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 積分
4 條訊息(共 5 條)
1,952 檢視

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

PS: Blue is better on the eye 🙂

Thank you

0 積分
5 條訊息(共 5 條)
1,891 檢視