LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Tank Process Simulation

I want to simulate a tank process that involves switching ON an air blower when dissolved oxygen level reaches a set value and putting the air blower OFF after a specified amount of blower run time. Can someone please suggest to me how this can be achieved with LabVIEW?

0 Kudos
Message 1 of 17
(1,966 Views)

This is a pretty easy task but it sounds like a homework assignment so please show us what you've tried and we can help you on anything you're stuck on...

LabVIEW 8.5.1 - 2019 Pro Dev
0 Kudos
Message 2 of 17
(1,961 Views)

Hello NIquist, Thank you very much for your timely response to my question. It is not an assignment but a part of my project work. I have not actually done anything yet. I know exactly what I want to achieve, but do not know what function in LabVIEW can be used to achieve this. I would be glad if you can suggest to me where to start from. Thanks.

0 Kudos
Message 3 of 17
(1,926 Views)

@Versatilesamudia wrote:

 I would be glad if you can suggest to me where to start from. Thanks.


Start from the LabVIEW online tutorials, some of which are listed at the end of this post.

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 4 of 17
(1,917 Views)

Are you planning to turn this into a real hardware project or will it stay in the simulation world?  You can simulate your tank logic with the boolean primitives in LabVIEW (e.g.: Less Than and Greater Than comparisons).  But, if you want a more advanced control system you're better off with PID control.  Look in LabVIEW examples Help > Find Examples... Control and Simulation > Case Studies > Process Control.  You'll find some tank level control simulations in there.  They need the PID toolkit VIs but I think that comes with LabVIEW these days.  Check them out to see some good examples of what you're trying to accomplish.  Many times you can just modify the examples to fit your needs.

LabVIEW 8.5.1 - 2019 Pro Dev
0 Kudos
Message 5 of 17
(1,890 Views)

Thank you so much NIquist. I shall start from there right now and give you updates of my progress later. Thanks for being there.

0 Kudos
Message 6 of 17
(1,875 Views)

Hi Niquist,

I have got pretty far about the simulation program. I have achieved what I wanted with booleans. My challenge now is stopping the program. Each time I try to stop the program the major while loop will not stop untill its next Iteration is completed which could take some undesirable length of time. Do you know of any way I can terminate the program without the while loop first completing its current iteration

0 Kudos
Message 7 of 17
(1,794 Views)

Generally this is done by breaking down the large time "chunks" in a process to smaller "slices" and then allowing the process to pause frequently and check to see if a user stop event has occurred.  A simple state machine is common and is probably what you want to switch your architecture to.  You can open LabVIEW with a State Machine template and check it out  to get your feet wet.  There are also tons of threads on the subject in this forum.

 

Post the code you have and we can show you how to modify it so that user input is handled efficiently.  The general rule for NI certification is that code should take no longer than 100mSec to respond to user events.

LabVIEW 8.5.1 - 2019 Pro Dev
0 Kudos
Message 8 of 17
(1,785 Views)

Hi NIquist. Here is the code I have developed for my tank process simulation. I have been able to figure out that Occurrence VI can be used to bring the program to a complete stop without having to do any extra iteration. It has however affected the desired behaviour of my programme. I have attached two programmes to this post. One has many stop buttons and the other has just one stop button making use of the occurrence VI.

 

The desired operation of the program is this. At start, when oxygen level is above the minimum limit (5) the two air blowers are to be OFF. When the level falls to or below this minimum level, it is desired that the two air blowers come ON and run for a maximum amount of time which I have set at 60mins as default. During this time, if the oxygen level happens to increase and gets to a set maximum (8), one of the air blowers should be put OFF while the second one is meant to continue to work till the 60mins elapses. After which the process is to start again.

 

The whole process is more than this, but this is the bit I want to get done first before trying to expand to accommodate other control demand of the process.

 

Kindly ignore the small indicators on the front panel. I have them there for the purpose of monitoring what is happening in each of the while loops. They will be deleted on completion of the programme.

 

Thank you very much for your interest and assistance so far.

0 Kudos
Message 9 of 17
(1,757 Views)

Good attempt so far but what you really want here is a state machine.  ESPECIALLY if you plan to add more control and monitoring options in the future.  Trying to do a bunch of individual tasks that interact with each other in their own loops passing info through locals is a sure path to buggy code full of race conditions.  Ocurrences are a good start for loop control but you can do it all in one loop (maybe two if you want to add a separate loop for user interactions).

 

A state machine will loop through states in sequence and can follow a state diagram.  You'll need states like:

 

init > idle (decide what needs to be done next based on curent time and controls) > check O2 > control blowers > shutdown

 

Check this out:   http://www.ni.com/white-paper/7595/en/

 

 

LabVIEW 8.5.1 - 2019 Pro Dev
0 Kudos
Message 10 of 17
(1,734 Views)