LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

parallel programming suggestion & help

Hi guys, I need some recommendation of parallel programming.

 

motor program.png

 

First i want to get the motor combination next each combination I will draw the dynamic grey level from 0 to 255 and acquire data = max -min. Each combination will have 51 data and I will use array max and min to get the max and min dataSo my question is how do I integrate this 2 program together. Each program is tested to work individually.

 

The motor program works by the first motor turn until its max degree and the second

I combined the 2 program using flat sequence however I think there may be a timing problem causing my result not to display properly. The subvi draw only draws out image according to the gray level. The array function contains the code for the DAQ and it stores all the acquired data.

 

You see in my result(in yellow the same angle occur twice.) e.g 60 60

Array for first trial.png

 

This is the things I want to do.

1) get motor combination.

2) each combination will draw the gray level and acquire data

3) store all the data in array.

 

Any suggestion how I should combine this 2 program together? Thanks!!!

0 Kudos
Message 1 of 5
(2,149 Views)

First, post your code. The picture is of little use especially at the resolution. It is impossible to see any detail. Also, get rid of the sequence structures. They are a very bad habit. Learn how to use data flow and you will not need sequence structures and you will be able to achieve parallelization of your code. Once you get into a sequence structure you are on a one way trip through it and the code within it (each individual frame that is) cannot run in parallel.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 2 of 5
(2,111 Views)

Hi Mark Yedinak,

Sorry the code contains alot of subvi and driver from manufacturer(I don't have it in this computer).  You can view the image by right click -> view image. Today I had modified the program to become like this:

Thanks for your advice can you elaborate more how to use a data flow.

 

motor integrate.png

0 Kudos
Message 3 of 5
(2,099 Views)

The image is still of no use. Even with view image the detail is not sharp enough.

 

Data flow is the fundamental part of LabVIEW. The most basic definition is that a node (think so item on your block diagram: a subVI, a built-in function, a case structure, etc.) is able to execute once all of it's inputs are available. That means if the output of one node (one) is wired to the input of another node (two) then node two cannot and will not execute until one completes. If however the input to both nodes one and two are a split wire, but they share no other wires (dependencies) then they are both capable of running at the same time. They can run in parallel. By definition, either node can run and therefore can run in parallel. You have no guaranteee of which one will start first. The compiler and scheduler will determine that. A flat sequence structure like you have will force each frame to run in order. Frome 1 must complete before frame two can run. Frame two must complete before frame 3 can run and so on. The problem with frame structures is that you do not allow code to execute in parallel. Also, once you start a sequence frame all frames must run. You cannot easily skip frames and jump out of the frame sequence frame.

 

I suggest you look through the examples that ship with LabVIEW. Look at state machines (a much better way to do things like your frame structure without all the negatives), producer/consumer or queues. The producer/consumer and queue examples will show you examples of parallel execution. The state machine is just a bread and butter architecture to use in your applications.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 5
(2,066 Views)

Hi Mark Yedinak,

 

Is it from your side that the image is not able to view clearly? I can see it clearly when I right click -> view image and zoom by clicking on the picture. Sorry I am not at my workspace so I don't have the code now. 

 

The code in frame 2 does not need any output from frame 1. The frame 1 code is just to program the motor while the frame 2 code is to program my LC. Without the sequence the DAQ start acquiring data before the motor move to the position. Actually, I planned to use state machine before, however I need to integrate it to other code too, so not sure how to do it and there is alot of tunnel which I have nothing to connect to.

 

I am only trying to achieve these things.

1) get motor combination(In frame 1)

2) draw gray level for each combination (In frame 2)

3) Get the data from detector (In frame 2)

4) store all the data & combination in array.

 

Looking at the general structure of my code can you give me more advice? Thanks!!!

0 Kudos
Message 5 of 5
(2,032 Views)