LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

order of execution

Solved!
Go to solution

Hi,

 

Is there anyway that I can set up an order of excution inside a for loop? For example I want to make a LabView program that first take a picture then secondly, upload the picture and after that repeat the first step.

 

Thanks

0 Kudos
Message 1 of 20
(3,617 Views)

Wires,  Flat Sequence Structure (if necessary)

 

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

Message 2 of 20
(3,612 Views)

Dataflow automatically ensures execution order. The upload cannot happen unless the picture has been taken is as available on the wire.

 

(just don't break dataflow by excessive use of local variables, for example).

0 Kudos
Message 3 of 20
(3,596 Views)

Prefer to to use the 'Error In' and 'Error Out' to every subVI you use, I think that is the best practice and also helps to mainitain the dataflow.

-
Amit
CLAD
0 Kudos
Message 4 of 20
(3,576 Views)

@amitwadje wrote:

Prefer to to use the 'Error In' and 'Error Out' to every subVI you use, I think that is the best practice and also helps to mainitain the dataflow.


Not necessarily. Excessive serialization, even if the order does not matter, prevents the compiler from efficiently parallelize the code.

Message 5 of 20
(3,564 Views)

@altenbach wrote:

@amitwadje wrote:

Prefer to to use the 'Error In' and 'Error Out' to every subVI you use, I think that is the best practice and also helps to mainitain the dataflow.


Not necessarily. Excessive serialization, even if the order does not matter, prevents the compiler from efficiently parallelize the code.


While that is true, the question was about serializing a certain flow of operation and then the error wire is always something I connect too, since it is quite useful to know that the previous function had an error and skipping the next function in that case eventhough there is also a wire for the actual data coming from the source that serves as dependency for serialization.

 

If things don't need to happen in sequence then I agree that not connecting the error cluster can be often beneficial, although in many typical situations that is often not the limiting factor. Tight unoptimized loops running for many million iterations are usually a much bigger issue for performance than serializing a few VIs unneccessarily. Or using communication functions with unneccessarily long timeouts. 60 seconds to open a TCP connection might have been useful at times when even businesses were connected to the internet through dialup modems but nowadays if you can't connect within a few seconds, it won't happen within 60 seconds either even if the other system is across the planet.

Rolf Kalbermatter
My Blog
Message 6 of 20
(3,543 Views)

Thank you Altebench and Rolfk for your thought on my view,

 

How about?

 

If there is no necessity of serialization then we can connect the ‘Error Wire’ in parallel and merge the errors after execution, this way we avoid unnecessary serialization and improve the execution speed.

 

Thank you.

-
Amit
CLAD
0 Kudos
Message 7 of 20
(3,530 Views)

@amitwadje wrote:

Thank you Altebench and Rolfk for your thought on my view,

 

How about?

 

If there is no necessity of serialization then we can connect the ‘Error Wire’ in parallel and merge the errors after execution, this way we avoid unnecessary serialization and improve the execution speed.

 

Thank you.


If you are just adding in the error cluster to VIs that cannot generate an error, then you are limiting the compiler.  Let normal data flow do its thing.

 

But two paths that need to run in parallel and both can cause errors, then you will want to use Merge Error when the parallel section is done.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 20
(3,507 Views)

@crossrulz wrote:

@amitwadje wrote:

Thank you Altebench and Rolfk for your thought on my view,

 

How about?

 

If there is no necessity of serialization then we can connect the ‘Error Wire’ in parallel and merge the errors after execution, this way we avoid unnecessary serialization and improve the execution speed.

 

Thank you.


If you are just adding in the error cluster to VIs that cannot generate an error, then you are limiting the compiler.  Let normal data flow do its thing.

 

But two paths that need to run in parallel and both can cause errors, then you will want to use Merge Error when the parallel section is done.


Unless of course, that VI is a wait with an error passthrough to aid in dataflow execution.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 9 of 20
(3,491 Views)

@billko wrote:

@crossrulz wrote:

@amitwadje wrote:

Thank you Altebench and Rolfk for your thought on my view,

 

How about?

 

If there is no necessity of serialization then we can connect the ‘Error Wire’ in parallel and merge the errors after execution, this way we avoid unnecessary serialization and improve the execution speed.

 

Thank you.


If you are just adding in the error cluster to VIs that cannot generate an error, then you are limiting the compiler.  Let normal data flow do its thing.

 

But two paths that need to run in parallel and both can cause errors, then you will want to use Merge Error when the parallel section is done.


Unless of course, that VI is a wait with an error passthrough to aid in dataflow execution.


Which I have found is RARE that you actually need.  I used to put the error terminals on everything and then one day I just realized I was cuasing slow downs in my code for no good reason.  If your code does not do anything with the error, then it does not need to have it.  So it runs in parallel with something else.  That is the point of data flow.

 

The only times I have found an exception to this is when I am using global variables or something else that breaks data flow.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 10 of 20
(3,484 Views)