LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How would I be able to run two constantly updating graphs independently, while still having access to other controls in my VI?

I want to be able to start the VI, then be able to start and stop each "video" graph independently, after the VI is initialized. Right now, I just have two while loops run when I start the VI and a seperate event structure nested in another while loop, which gives me access to the other buttons. However, this setup does not allow me to start and stop the "video" graphs whenever or play one, but not the other. Could someone help me?

 

Any help would be appreciated!

 

 

0 Kudos
Message 1 of 10
(2,777 Views)

I think I would need to see some code to be sure, but is sounds like you are doing too much in your event loop.  How are you sending information to your graph loops?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 10
(2,773 Views)

At the most basic level, I have three while loops: the first runs one of the graphs, the second runs the other graph, and the third contains the event structure. The event cases allow me to save both of the arrays in the video as text files, to access in Python if we need to analyze something further. The third event case performs a numerical calculation. 

 

To send information to my graphs, I pull an intensity array from each of the cameras, then send that information to the graph. Since that is in a while loop, it just runs until I stop the program. 

0 Kudos
Message 3 of 10
(2,762 Views)

You did not tell anything new in your Message 3 compared to the original Message 1. 

 

As far as I can imaging your three loop and your wish to execute the cameras separately, this calls for case structures in your camera-WHILE-loops. You place the "pull an intensity array" within the CASE structures (case1). Case2 can be outputting and empty array, without stopping the camera. I would avoid stopping the camera(s) (if stopping them happens repeatedly during the program run) -- just to save overhead of starting the camera(s) again.

 

Any touchable example, please?

0 Kudos
Message 4 of 10
(2,706 Views)

 

 

Do you have any waits on those three loops? are you sharing information between loops?

 

 

 

I suggest that you take a look to this . since what you might need is to run 3 vis in parallels or something like that exchanging information from the controls in a main front panel. you could find this information under Queued message handler state machine

 

 

CLAD, CTD
0 Kudos
Message 5 of 10
(2,696 Views)

@sagittariusA wrote:

At the most basic level, I have three while loops: the first runs one of the graphs, the second runs the other graph, and the third contains the event structure. The event cases allow me to save both of the arrays in the video as text files, to access in Python if we need to analyze something further. The third event case performs a numerical calculation. 

 

To send information to my graphs, I pull an intensity array from each of the cameras, then send that information to the graph. Since that is in a while loop, it just runs until I stop the program. 


Here's how I read this:

I do everything except the graphs in the Event Structure loop.  That is your problem.  You can only be running one event case at a time.  So when you go to poll one camera, you can't do anything else until that task is complete.

 

What you need to do is make additional loops for your camera reads, does some calculations, access Python.  You will want a different loop for each interface you have.  Your Event Structure then just sends the commands to these loops to do what they need to do.  In this way, the Event Structure can just send a command and then send the next command on the next iteration.  This should happen fast enough that it will look simultaneous to you.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 10
(2,671 Views)

Okay, so here is my code. At start up, I want nothing to happen. Then, when one of the start buttons is pressed, the corresponding graph will run until the stop button is pressed. I want to be able to turn them both on and be able to turn each one of them on and off at my leisure. In addition, I would like the save button for each to work while the graphs are running, which is how it is functioning now. The Python commands don't take any time at all. I had just planned on adding them to the event structure. 

0 Kudos
Message 7 of 10
(2,654 Views)

Learn queues.  You will want to use queues to send commands to your loops.  So have the first loop wait for a command with the Dequeue Element.  If you get the "start" command, have it start running.  You should also use a shift register so that you can set the wait for the Dequeue Element to 0.  This way it can just keep executing the start command.  When you get the "stop" command, you perform your stop task and set your timeout to -1 (wait forever).  You should also have an "exit" command that will tell that loop to stop.  No need to have a separate stop button for each of your loops when you can send commands to make them stop.

 

You should have a good look at the Producer/Consumer.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 10
(2,651 Views)

Could this also be accomplished by state machines? I am relatively new to LabVIEW, with my previous experience being simple datasaving procedures. I have never see producer/consumer before and just the basics of state machines, so I have no idea where to start.

 

Thanks!

0 Kudos
Message 9 of 10
(2,641 Views)

You can make each of the separate loops state machines.  But you need to be able to look for commands coming from other locations.  Learn the Producer/Consumer.  That will teach you how to use queues to send commands.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 10 of 10
(2,632 Views)