Showing results for 
Search instead for 
Did you mean: 

Tank Process Simulation

Hi NIquist,


Thank you very much. I will check this out very quickly.

0 Kudos
Message 11 of 17

Hello All,


I want to say a big thanks to everyone one whot have shared their ideas on how I can go about solving my tank simulation problem. I have been able to implement my tank process on a state machine and also have dealt with the problem of having to use a single stop botton to stop the problem. Thanks to NIquist for his invaluable assistance. I have also been able to run my program with real-time data and have generated output signals to control air blowers using USB-6008.


one more thing I need a clue on how to go about doing is to plot a graph of logged data (historical data of the process) at the click of a button by an operator on the front panel.


I am looking forward to seeing your quick responses.


Thank you all.




0 Kudos
Message 12 of 17

Congratulations!  It sounds like you're doing great with LabVIEW.


To plot out your data you need to read the data file you created and graph it.  How you do it depends on your needs.  I usually plot my data on-the-fly by writing it to a chart AND saving it to file every time I collect it.  That way I can see at a glance what's happening in real-time and I can write a little data reader program to read the file and plot the data for viewing and analysis in the future.


Why not post the code you have and explain how you want to be able to view and store your data.  






LabVIEW 8.5.1 - 2019 Pro Dev
0 Kudos
Message 13 of 17

Here is the code that I have developed. I the acquired data is used to update the oxygen level indicator by means of a local variable. I am using a USB-6008 to generate two output that is coupled to two small d.c motors through a d.c amplifier.


What I want to do now is to have a record of the acquired signals as well as the generated outputs. I also want to be able to generate a pop-up graph of theses recorded data at the click of a button on the front panel.


I have tried using read to measurement file VI and Read from measurement file VI in a simple program to see how It will work, I didn't get any good result


My main codes and the simple program have been attached for you to see.



0 Kudos
Message 14 of 17

Hmmmm. Smiley Indifferent  Well, I have to say "A" for effort and if the code works that's always a bonus.   BUT, your use of local variables and all those extraneous loops are a bit troubling.  You DO have a state engine in there but it really shouldn't require all that support to run.  This should be done in a single loop with all your controls, process variables and data passing from one iteration to the next by way of shift registers (you can cluster similar items to reduce the number of shift registers).  That way you don't risk race conditions and don't have to deal with all that convoluted logic.  


I don't have time to refactor your code but you're already running into one of the problems that's inevitable when code gets convoluted like this.  You want to add a data didplay pop-up but you don't have a good way to do that with so many loops.  If you had everything in a single loop you could just add a state called "Display".  In that state you could easily pop up a graph since the collected data would be available in a shift register that passes through it.  


I'll try to find (or write) some appropriate examples to illustrate...

LabVIEW 8.5.1 - 2019 Pro Dev
0 Kudos
Message 15 of 17

Hi NIquist, Thanks so far. Have you had the time to find out examples for me to illustrate your method? I haven't been able to figure out what to do so far and I have till 28th of this month to round up my work. Waiting eagerly to get some ideas on what to do as soon as possible.


Please anyone else who could suggest how I can generate graphs from logged data and make them pop-up on the screen and disappear from the screen at the click of a button?



0 Kudos
Message 16 of 17

Probably should have mentioned this before but there are really good templates built-in to LabVIEW that would show you all you need.  Unfortunately they are kind of advanced.  Check out the state machine and continuous logging templated and see if you can follow them.  


As far as the pop-up display goes, I would just put a graph on a different tab and then let the user look at it whenever they want.  Just keep a copy of your data in an array or use the chart with a long history (right-click... Chart History length).  If you're talking about a display that reads and graphs the stored data for manipulation and analysis that could be a much bigger project than your data logger program so try to keep it simple.

LabVIEW 8.5.1 - 2019 Pro Dev
0 Kudos
Message 17 of 17