LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Basic tank fill, heat, then drain problem

I am requesting some assistance on a problem.  I am a student taking an into to LabView class and I am stuck on a homework question that I would like some assistance on as I am stuck.

The problem is you have two tanks that need to be filled.  When tank 1 is full tank 2 fills. when both tanks are full the heaters are turned on.  Three heaters are on when the temperature is below 50, 2 heaters or on when the temp is between 50 and 60, 1 heater is on when the tanks are between 60 and 70, and all heaters are off when the tank is 70 and above.  An alarm will turn on if the tank temp is 80 or above.

I have this all figured out but the code is probably more elaborate than it needs to be but it works.

The issue I am having is that once the tanks are full and at temp a drain valve is to open and stay open until both tanks are empty.  The heaters, the fill valve, and the fill pump should not turn on until both tanks are empty.

I cant get the fill valve and fill pump to turn off when the drain valve opens.

any help will be appreciated.  I am willing to rewrite the code if I need to but I need direction on how to do it.  I don;t really understand how to get a event structure or a timed structure to work.  If you could give me a good example on how to do it if that is the best way to do this.

Thanks for any help that can be given.  I just want help and direction not the problem answered for me.

0 Kudos
Message 1 of 5
(2,164 Views)

Hello RQuarles,

 

Thank you for posting on the forums. No one here will simply do your homework for you, but we might be able to give a bit of advice. Are you trying to have the program automatically fill and heat the tanks, or simply change the indicators depending on what the user inputs?

 

My thought would be to implement a State Machine design pattern if you are trying to automate the process. You can read about state machines at the following link:

Tutorial: State Machines
http://www.ni.com/tutorial/7595/en/

 

I also wanted to point you towards the basic debugging tools in LabVIEW, in case you are unfamiliar.

Debugging Tools in LabVIEW
http://www.ni.com/getting-started/labview-basics/debug

 

Thanks,

Message 2 of 5
(2,123 Views)

This is pretty complex for a beginner student.  Complex enough that checking out the CLD examples could actually be of use to you.  They should give you some ideas on how to attack this project.

 

Keep trying and keep asking questions!  🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 3 of 5
(2,106 Views)

2 quick tips, in many Cases you perform X AND True, which is the same as X, you can simply connect the wire.

There's only a wait in case of overheating, you probably don't need to check the temperature millions of times/sec. Add a Wait(100) in the main loop.

As stated, a simple State machine would clean up the code some, but isn't really necessary in this case. If seems you have 3 sections of code as well as thought in the program. Each of those can be a State, making the program loop through Tank1, Tank2 and Fill states.

Also, in the overheating loop you wire backwards, from Indicator to control, swap places of the locals.

/Y

G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 5
(2,080 Views)

Regarding your temperature levels, it's better to use InRange with an array, as follows:

InRangeArray.png

/Y

G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 5
(2,075 Views)