LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parallel loops

🙂 thanks! Yup, it wouldn't be a one way street for sure. Now, regarding synchronization. The commands will not be sent until Producer 1 (Consumer 2)  or Parallel process 1 receives its ACK. Will there be some sort of delay or race condition? Intertwining two queues such that the correct ACK is sent for the correct command...hmmmm... now I got to think about that for a moment.

 

Touche' tbob!

 

V

I may not be perfect, but I'm all I got!
0 Kudos
Message 11 of 50
(1,411 Views)

Give me some time, I will try to come up with a scenario today.  Right now its lunch time.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 12 of 50
(1,395 Views)

As an example of two way queue, is the vi I have attached right? For now, I haven't included the serial communication. Assumed that the numeric is the command it receives and gets the ACK from the status Q.

 

V

I may not be perfect, but I'm all I got!
0 Kudos
Message 13 of 50
(1,380 Views)

modified it a little bit with notifier for stopping the loops. I notice that if the loops are in sync, output from PPL2 is read into PPL1 and displayed. Reinitializing the whole program and starting the program again doesnot give the output B0.

 

V

I may not be perfect, but I'm all I got!
0 Kudos
Message 14 of 50
(1,376 Views)

I changed the mechanical action of the stop button to latched when released.  I also added shift registers for the queue ref and queue error wires in the top loop for the second queue.  This seems to be necessary or the loop hangs.  In the bottom loop, I added an enqueue in the Default case just to see if the queue was working properly.  Now everything seems to be working.  See attached vi.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 15 of 50
(1,364 Views)

OK I get it now. But, this is just one command and one ACK. If there are more c ommands and corresponding ACK's, I would have to create a shift register for PPL 2 de-queue too? I will be opening a serial port and PPL1 will READ and enqueue and PPL2 will dequeue and enqueue the ACK and PPL1 qill again write it back to the port. Right? Cool, I think I got this concept down under my armor. Although, why did you have to add a shift register?

 

I have to incorporate a State Machine which will take care of different states my test will be at. This will get really exciting now.

 

V

Message Edited by VeeJay on 05-19-2010 03:11 PM
I may not be perfect, but I'm all I got!
0 Kudos
Message 16 of 50
(1,357 Views)

VeeJay wrote:

... why did you have to add a shift register?

 


 

The shift register passes the error condition and the queue reference between each loop iteration.  What if there was an error somewhere?  The error in to the queue comes from the loop left hand side.  Without a shift register, this will always be a no-error condition, and you will miss any errors that occur.  If the queue reference becomes invalid, without a shift register it will be a valid queue ref and will cause an error, which will not get propgated any further.  With the shift registers, the state of the queue ref and error wires will be propogated for each loop iteration.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 17 of 50
(1,349 Views)

Awesome! thank you. Right now I am becoming AMBITIOUS and have added a little more to the equation. Refer vi and tbob, your comments are most certainly required and welcome.The vi is not complete, but just proof of concept. I will have to perform tasks based on commands which wil be my next addition to the process.

 

VeeJay -> Learnt a lot in  LabVIEW today 🙂

 

 

 

Message Edited by VeeJay on 05-19-2010 03:50 PM
I may not be perfect, but I'm all I got!
0 Kudos
Message 18 of 50
(1,339 Views)

I think you've got the idea.  Good job.  Now, before it gets out of hand, clean up your wiring.  Try not to make any unecessary bends, and don't hide wires.  Straighten out wires that go through tunnels in case structures and loops.  Make the effort now because after you get it working, you won't want to mess with it anymore.  If you leave a mess of wires, you will regret it when you come back a few months from now to modify it and see a big mess of wires.

 

You did a good job of learning and made a sincere effort to do some coding on your own.  It is a pleasure to help someone who wants to work this hard.

 

 

- tbob

Inventor of the WORM Global
Message 19 of 50
(1,323 Views)
If you want to see an example of why shift registers are important with queue references, see the attached code. It is an example of a queued state machine, and sometimes you may have an event where you want nothing queued up so you wire an empty array (or in the examples case, use default if unwired, which is an empty array) to your auto-indexing for loop. To see what happens if you don't use shift registers in your for loop, press button 1 while highlight execution is on. Then press button 2. Then press button 1 again. The reference is lost and you will see an error (1) because the for loop didnt execute and the reference was not passed through.  uh oh! And your queue no longer works, and the stop button will no longer stop your program!  Now, change the queue reference tunnels in the for loop to a shift register and again press button 1, button 2 then button 1 and voila, it works. You can properly stop now also.
Message Edited by for(imstuck) on 05-19-2010 09:42 PM
0 Kudos
Message 20 of 50
(1,304 Views)