LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Arrêter une boucle alors qu'une autre s’exécute en parallèle

Bonjour/Bonsoir, voici mon problème :

 

J'éxecute deux boucles en parralèles, cadencées a la même vitesse mais d'on les durées d'éxecution sont différentes. Le problème est que l'orsque la première boucle à fini de s'éxecuter, elle doit attendre la fin de la deuxieme boucle avant de pouvoir s'éxecuter à nouveau.

 

Je souhaiterais donc que les deux boucle s'arretent et repartent indépendament l'un de l'autre.

 

Quelle solution me conseillez vous pour réalisé se fonctionnement ?

 

Je join un VI d'exemple présentant ce problème au cas où l'explication ne soit pas suffisante.

 

Je vous remercie par avance pour vos réponse.

0 Kudos
Message 1 of 2
(2,657 Views)

Translated:

Good afternoon/evening, here's my problem:

 

I am executing two loops in parallel, running at the same speed but with different lengths of execution.  The problem is that when the first loop finishes, it must wait for the second loop to end before starting again.

 

I would therefore like the two loops to stop and restart independent of each other.

 

What approach do you recommend to achieve this?

 

I'm attaching an example VI in case the explanation is not sufficient.

 

Thanks in advance for your response.


In the simple case of your example, I recommend that you remove the for loops entirely and count iterations of the while loop.  Put two shift registers on the while loop.  One shift register counts to 1000, the other to 2000.  This also has the advantage that when you click the stop button, you do not need to wait for the for loops to terminate.  It would look like this:

count in parallel.png

 

If you cannot change the logic of your program like this, you can make two separate while loops so that they run in parallel, independently.  You will need some mechanism to stop both loops when you click the stop button in one.  A notifier is commonly used for this purpose.  One way to do this is shown below:

parallel loops with notifier.png 

 

(Bien que pas mal des utilisateurs de ce forum comprendent le francais, ce forum est anglophone; il existe aussi une communaute francophone sur ce site).

0 Kudos
Message 2 of 2
(2,635 Views)