LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help running my "Master Progam1" VI faster. (under 1 minute)

Hi all,

 

I need to get the run time down to under 1 minute, because i will be running it multiple times to scan an object for my senior project. 

 

My "Master Program1" vi is currintly running at 2.35 minutes. Smiley Sad My "Master Program1" is suppost to move a "Thorlabs t-cube dc servo motor driver (mn TDC001) and stage (mn Z625B) 1 mm.  Then have my

"LC1-USB" CCD line camera take a measurement of the peak location, 23 times. Input the peak locations into an array and input the arrays into the graph.

 

For the sub-vi "modified detect peak positionv1" I just need to detect the max peak location of each measurement.

 

Also,for the sub-vi "ActiveX controller for stage1v2.2" is suppost to move the stage 1 mm.

 

My main vi "Master Program1" and my sub-vis "modified detect peak positionv1" and "ActiveX controller for stage1v2.2" are attached below.

 

I will be very greatful and give kudos to any one who can help.

 

Michelle2607

0 Kudos
Message 1 of 15
(2,922 Views)

Your main program has a 23 iteration for loop.  Your first subVI in that loop has a 1 iteration For Loop (why?), that has a 20 second wait in it.  That means your Main program will run at least 460 seconds, which is over 7 minutes.

0 Kudos
Message 2 of 15
(2,919 Views)

I agree with what Ravens Fan said. Also, you can use: Tools -> Profile -> VI Metrics... to monitor the timing performance of your VIs and find out what VIs are taking the most time to execute. Then, you can make modifications, and see if the performance improved.

0 Kudos
Message 3 of 15
(2,912 Views)

I took out the for loop in the sub-vi "ActiveX controller for stage1v2.2" and it still takes 2.35 minutes to run.  I do not know why you are saying it takes 7 minutes? 

 

Michelle2607

0 Kudos
Message 4 of 15
(2,895 Views)

Maybe I was not clear when I said


 My "Master Program1" is suppose to move a "Thorlabs t-cube dc servo motor driver (mn TDC001) and stage (mn Z625B) 1 mm.  Then have my "LC1-USB" CCD line camera take a measurement of the peak location, 23 times. 


I meant that the For loop moves the stage 1 mm and takes a measurement 23 individual times.

 

Michelle2607

 

0 Kudos
Message 5 of 15
(2,886 Views)

23 iterations of a for loop that has a subVI that takes at least 20 seconds.  Multiply and you get at least 460 seconds.

 

So are you actually saying that a single iteration of your For Loop takes 2.35 minutes?

 

You may also want to put some flat sequences in and Tick count functions in between different steps in your SubVI so that you can see how long each portion of your code is taking to run.  Or you could put a probe on each error wire in your ActiveX section of code.  The probe will give you a timestamp of when that wire executes so that you can see if any portion of your ActiveX methods are taking longer than you think to run.

0 Kudos
Message 6 of 15
(2,880 Views)

@Ravens Fan wrote:

23 iterations of a for loop that has a subVI that takes at least 20 seconds.  Multiply and you get at least 460 seconds.

 

So are you actually saying that a single iteration of your For Loop takes 2.35 minutes?

 


No. I'm saying that to run the "Master Program1" vi through all 23 iterations of the For loop and put the arrays in the graph takes 2.35 minutes.

 

Michelle2607 

 

P. S. I am using LabVIEW 8.6

0 Kudos
Message 7 of 15
(2,873 Views)

That math does not add up.  Unless you are running an ActiveX subVI that has a smaller wait statement in it than the one you posted.

0 Kudos
Message 8 of 15
(2,860 Views)

I'll bet you need to use Automation Open and Close of your activeX object. They should both occur outside the main loop.

The HWSerialNum and Start/stop control should also be outside the main loop (thus not in the sub vi at all) but in the main vi.

 

Try that and tell how it works.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 9 of 15
(2,858 Views)

@Ravens Fan wrote:

That math does not add up.  Unless you are running an ActiveX subVI that has a smaller wait statement in it than the one you posted.


Yes, I gave you the wrong one. sorry.

 

Here is the right one. 

 

Michelle2607

0 Kudos
Message 10 of 15
(2,848 Views)