ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Graph for parallel loops

Hi, I have a problem!

 

Actually i have two sequential while loops and i see the plot at the end of the second loop.

If i put the graph inside the loop i need two different xy graphs, so is it possibile to have only a unique real time graph?

 

Regards,

Enrico.

0 Kudos
Message 1 of 12
(4,168 Views)

Hi Enrico, what is a sequential while loop? If you are gathering data in 2 separate loops and you want to graph the data, you can create a 3rd loop to send the data to and graph it.

0 Kudos
Message 2 of 12
(4,161 Views)

I have two different loop. Until now i can see at the end of the script my graph, instead i would like to see run time my graph. A solution could be to put 2 different graphs inside the two different loops but i prefer only one graph. Is it possibile?

 

PS: Sequential means that i run first a loop and than the other one, they are not in parallel.

0 Kudos
Message 3 of 12
(4,154 Views)

Show us some code.

0 Kudos
Message 4 of 12
(4,149 Views)

As Gregory suggested you could use a 3rd loop (parallel to the other two loops) and send the data to it for graphing. I believe that you could also use a state machine architecture to do what you want. For better answers you need to attach your code.

0 Kudos
Message 5 of 12
(4,128 Views)

Currently i can't post vi because i'm not at home for two days.

I will try to explain better my problem: the goal of my vi is to make a polarization curve (back and forth). At the moment i have two different graphs because the two loops are not running at the same time. The point is that i would like to plot in real time the first curve and then the other one on the same graph. How can i solve my problem? Making a third loop of course i lose the concept of real time.

 

0 Kudos
Message 6 of 12
(4,075 Views)

A pair of producers and a single consumer (Producer/Consumer) with the graph in the consumer will do what you want:

Example_VI.png

 

This is a fairly basic example, but you could also for example pass a plot index, and use an array of plots to have multiple plots on your graph (for different colours, etc).


GCentral
0 Kudos
Message 7 of 12
(4,060 Views)

All you need is exactly one while loop and a state machine architecture. Build up the graphs in a suitable data structure in a shift register and display with each iteration. Update the relevant data depending on the state.

0 Kudos
Message 8 of 12
(4,049 Views)

This is What i need. Can you send me this vi? Thanks

0 Kudos
Message 9 of 12
(4,027 Views)

@Enrico93 wrote:

This is What i need. Can you send me this vi? Thanks


You didn't say who (or even use kudos to make a suggestion), but I'm guessing you meant my image.

Unfortunately I didn't save it, and it wasn't a snippet (darn! 😞 ) so I had to recreate it from scratch.

As a result, I decided to add the multiple indices. You can add or remove as desired.

DoubleProducer_ConsumerGraphing.png

Since this one is a snippet, it should be draggable onto a block diagram.

A 2015 copy is attached just in case.


GCentral
0 Kudos
Message 10 of 12
(4,006 Views)