LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Tank Filling and Emptying

Solved!
Go to solution

One last piece of advise.  Do you know the difference between Wait Until Next mS Multiple and Wait(ms)?  Look up the help screen on both functions.  Most of us use the Wait(ms) function.  It is more straight forward.

 

You are learning quickly, keep it up.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 11 of 37
(3,586 Views)

tbob wrote:

One last piece of advise.  Do you know the difference between Wait Until Next mS Multiple and Wait(ms)?  Look up the help screen on both functions.  Most of us use the Wait(ms) function.  It is more straight forward.

 

You are learning quickly, keep it up.

 


 

Good work on these posts Tbob. You kept things in perspective and didnt jump straight to DO IT THIS WAY WITH A STATE MACHINE! Obviously, further down the road the OP could make refinements to his VI to make it more easily readable and follow some more "best practices" but at the same time someone could come look at this code and know whats going on. I think sometimes people forget new users are going to learn in steps and often jumping straight into more complex architectures isn't always plausible. So kudos on that.

 

That said...

 

To the OP, if you ever are interested in learning more about LabVIEW, hang around these forums. You seem to pick it up pretty quickly (or quicker than many) and if you are interested in learning better code architectures there are tons of people to help you. Best of luck on this project.

 

 

0 Kudos
Message 12 of 37
(3,573 Views)

for(imstuck) wrote:

 

Good work on these posts Tbob. You kept things in perspective and didnt jump straight to DO IT THIS WAY WITH A STATE MACHINE!


When I saw his flat sequence structure, it reminded me of my first days with Labview programming, except I use a stacked sequence since there were no flat sequences back then.  You are right in that it probably would have been overwhelming to try to push a state machine or other advance architecture down his throat.  Besides, for his purpose, the flat sequence works fine.  Anything larger than one screen would be calling for a state machine. 

 

Also, he did a good job for a beginner, so I didn't want to bust his bubble by telling him that his architecture was not the best.  It doesn't have to be the best when it is simple and it can fit on one screen.  As his projects get more complex, he will learn about advanced architectures.

 

- tbob

Inventor of the WORM Global
Message 13 of 37
(3,557 Views)

Hello again folks,

 

Thanks for all the feedback it has been a real help so far. Im not sure if I should have started a new thread for my next querie so if I should, apologies in advance, Im sure someone will let me know the correct protocol soon enough. I have continued working on my project and created a further two Vi's but have now hit another stumbling block with regards the way I want them to perform in the sequence along with my main Vi. Firstly I created a pressure monitoring Vi that I hope to use to simulate the correct pressure for pumps 1 and 2. Ideally I would hope for this Vi to operate when the main Vi is initially started and to stop when pump 2 is shut off. I have tried to get this sequence to work over the last couple of days but as yet its not happening. I hope to use my second Vi to simulate sampling the fluid in both tanks after every 50 cycles of the graph and show the results in the table beside the graph. Ideally I wish for this to run through the course of operation of the Vi. I have attached the Vi and hopefully someone may be able to give me some advice on what to do . I really hope Im not attempting to run before I can walk in relation to this.

 

Regards,

David.

 

 

 

0 Kudos
Message 14 of 37
(3,529 Views)

OK, its time to step it up a bit.  First, you do not need the flat sequence structure.  You first loop has an output which feeds into the second loop.  But virtue of dataflow, the second loop cannot start until all of its inputs are there, which means the first loop has to finish before the second loop can start.  The flat sequence accomplishes nothing in this case.  Same for the second loop having an output to feed the third loop.  Get rid of the flat sequence.  Leave the wires between the loops.

 

Next, you pump2 pressure loop.  There is nothing feeding this loop, so it has no inputs.  Therefore it will start running as soon as you start the vi.  It won't stop until you press stop3.  BTW, you should not wire right to left.  Move the stop3 to the left of the stop sign to create left to right data flow.  But don't do this because you should not use stop3 at all.  You will have to create another pump2 local variable.  Right click on the local and select Change to Read.  Use this inside the pressure loop instead of stop3.  Change the stop sign in the loop by right clicking on it and selecting Continue if True.  Then wire the pump2 local to the new green icon.  The loop will run until pump2 becomes false.

 

To stop your graph loop, you will need to set some indicator to false when your last loop (frame 3) ends.  Use a local variable of this indicator to stop the graph loop.

 

Don't forget to put the re-init function at the end.  You will need to wire an error wire from the last loop to the re-init function.  This means wiring an error in throughout the loops and to the re-init.  Error wires are often used to cause proper execution flow.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 15 of 37
(3,494 Views)

Hi tbob,

 

your right about stepping it up a bit. I've been working on this for about the last three and a half hours but cant seem to crack it. Sorry to be a pain but is there any advice you could offer me as a way of simplifying the sequence. Basically just a simplified version of what i set out to achieve should suffice. As it stands I think I have a long way to go before im able to write this type of code. Im definately going to stick with it, but I think i'll concentrate on getting the very basics right before trying this sort of thing. At least I can say I learned a lot over the last few days and understand a little better what it takes. Anyway thank you for all your help so far it has been great. Again i will attach where I have left off and maybe you or one of your fellow enthusiasts may be able to offer some advice on what I should do to try wrap this up.

 

Regards,

Dave.

 

  

0 Kudos
Message 16 of 37
(3,477 Views)

Here is the screenshot of my changes.  You were very close.  You will have to pay attention to every detail to make sure you got all the changes.  I put some comments where I mad some changes.  Sorry I only have LV2009 so I can't save it in your version.  BTW, I spent 3 years as a SCADA engineer.  At the time, I used Wonderware's In-Touch for HMI code.  I enjoyed it and would not mind doing it again.

 

ProjectProcessHMI_BD.png

- tbob

Inventor of the WORM Global
0 Kudos
Message 17 of 37
(3,469 Views)

Many thanks for all your help with this tbob, its been a great help and i really have learned alot from it.

 

regards,

Dave.

0 Kudos
Message 18 of 37
(3,432 Views)

hello

 

i am also new in this labview world....i have jst done few codings for blinking leds nd multiple series of leds....now i wnt to simulate a very simple program of filling tanks....say there will be two tanks connected by a pipe and a valve in between them...when the valve is opened, water from one tank flows to another tanks.....but i am not being able to write this program... 😞 .... i am really ashamed to tell you that even, i am not being able to find the blocks for pipe (i.e pipes for connecting the tanks).

moreover i could not see your attachments also as i am using labview version8.0......so do you have any solutionor any hints?

 

regards,

 

rohini...

0 Kudos
Message 19 of 37
(3,235 Views)

Here is the vi in LV 8.0.  I think you have to have a special toolkit to have tanks and valves as front panel objects.  Maybe the Supervisory and Datalogging toolkit.  If someone knows which toolkit, please chime in.  I had it on this vi because I copied another vi posted here.  You could just copy the front panel object from this vi and paste it into yours.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 20 of 37
(3,217 Views)