LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Start/Stop large data processing at will?

Could you also tell me more on how to know the processing is finished after splitting into small tasks and co-ordinate them?  how to better control the start of the processing and check the stop signal? And if you have a lot of  processing, you need lots of parallel processing?

Thank you very much!

 

@altenbach wrote:

All you need to do is do the processing in a parallel loop from the UI code and have it check for start or stop signals occasionally during processing (e.g. 1-10x per second). How you do that really depends on the problem. Some processes cannot be unterrupted, for example if you do a huge 2D FFT, it needs to complete before it can check the notifications. Of course you could split it up by doing 1D FFTs in a stack of loops and check at each iteration but this will slow the code down somewhat, so you need to find the right balance.

 

Again, what kind of processing are you doing. Is it memory intensive or CPU intensive? Maybe you are doing it wrong and it could complete in seconds using a better algorithm. See also the videos in my signature.

 

And yes there are plenty of mechanisms for communcating between loops. (queue, notifier, local variable, channel wires (LabVIEW 2016+ only),  etc.)

 

For example, nonlinear fitting can be slow so I typically read an action engine inside the model subVI that creates an error 43 (operation canceled by user), which will communicate to the fitting code that it is time to stop.


 

0 Kudos
Message 11 of 22
(857 Views)

Hi, thank you! Could you show me how "quite easy" after splitter into sub-steps? And is it possible to check at every loop index?

 

GerdW wrote:

Hi binpersonl,

 

I am doing the design and plan and do not have code yet.

Generic answer on your rather vague question:

Once you split your "large and long" processing into smaller sub-steps it becomes quite easy to pause/stop the task in between. A state machine approach will also help…




0 Kudos
Message 12 of 22
(856 Views)

Hi binpersonl,

 

Could you show me how "quite easy" after splitter into sub-steps?

After defining sub-steps you need to process them in order, usually in a loop or  even better state machine. You can check for "pause" signal after each sub-step…

 

And is it possible to check at every loop index?

Yes, sure. Do the check in the loop…

 

Your questions are rather vague. Please start coding with drawing a scheme of your algorithm using well-known standards. Using such a flow chart you can design your program and implement any features BEFORE actually coding them in LabVIEW (or any other programming language you like)!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 13 of 22
(843 Views)

if you can check at every loop index, why you still need to split? You can just wire to the stop button?

 


GerdW wrote:

 

And is it possible to check at every loop index?

Yes, sure. Do the check in the loop…


 

0 Kudos
Message 14 of 22
(839 Views)

Hi binpersonl,

 

if you can check at every loop index, why you still need to split? You can just wire to the stop button?

Surely that's the easiest option.

 

But all you wrote before was:

What is the best way to do start/stop large data processing at will?

And I answered:

how can I say which way to split your processing when you don't tell anything about it?

Now you tell us you're using a loop for your processing!

 

To reiterate:

When you want detailed answers you need to provide detailed information on your problem - right from the beginning!

Telling us in the 14th message of your thread your processing is done in a loop isn't what I understand of "detailed information"…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 15 of 22
(835 Views)

Hi, thank you! I am designing and don't have the actual codes yet. Say, if two arrays  a & b from user interface, the processing is (a+b)+(a-b)+(a*b)+(a/b), and it can divide into four sub steps (a+b), (a-b), (a*b), (a/b),  each sub step need several seconds to finish. The user can start processing and cancel processing at each sub step. Could you demonstrate how to co-ordinate sub steps and know the processing is finished, how to notify the processing loop to start, how to check 'cancel'  from GUI when each sub step finish? diagram will be highly appreciated. 

 

Thank you very much!

 

@GerdW wrote:

Hi binpersonl,

 

if you can check at every loop index, why you still need to split? You can just wire to the stop button?

Surely that's the easiest option.

 

But all you wrote before was:

What is the best way to do start/stop large data processing at will?

And I answered:

how can I say which way to split your processing when you don't tell anything about it?

Now you tell us you're using a loop for your processing!

 

To reiterate:

When you want detailed answers you need to provide detailed information on your problem - right from the beginning!

Telling us in the 14th message of your thread your processing is done in a loop isn't what I understand of "detailed information"…


 

0 Kudos
Message 16 of 22
(824 Views)

@binpersonl wrote:

Hi, thank you! I am designing and don't have the actual codes yet. Say, if two arrays  a & b from user interface, the processing is (a+b)+(a-b)+(a*b)+(a/b), and it can divide into four sub steps (a+b), (a-b), (a*b), (a/b),  each sub step need several seconds to finish. The user can start processing and cancel processing at each sub step. Could you demonstrate how to co-ordinate sub steps and know the processing is finished, how to notify the processing loop to start, how to check 'cancel'  from GUI when each sub step finish? diagram will be highly appreciated.


Look into the State Machine.  It is sounding ideal for your situation.  Basically you use a While loop with a shift register to keep track of what state you should be in.  Use other shift registers to keep whatever data you need.  Then a Case Structure is used to execute a state.  So at the end of each state running, you can check for your cancel condition.


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 17 of 22
(811 Views)

Thanks, what if the total numbers of state I don't know or variable (decided programmatically), or there are hundreds or thousands of sub-steps, how do I automatically generate the next state to go into ?  also do you also mean there are flat sequence to do checking inside the case structure ?


 

@crossrulz wrote:



Look into the State Machine.  It is sounding ideal for your situation.  Basically you use a While loop with a shift register to keep track of what state you should be in.  Use other shift registers to keep whatever data you need.  Then a Case Structure is used to execute a state.  So at the end of each state running, you can check for your cancel condition.


 

0 Kudos
Message 18 of 22
(806 Views)

@binpersonl wrote:

Thanks, what if the total numbers of state I don't know or variable (decided programmatically), or there are hundreds or thousands of sub-steps, how do I automatically generate the next state to go into ?  also do you also mean there are flat sequence to do checking inside the case structure ?


Each state can decide what state needs to be executed next.  That is why the state is stored in a shift register.

 

And the checking of the stop condition should be outside of the case structure.  You probably should put the reading of the terminal inside of a flat sequence structure with some other output from the case structure to make sure it is read after the state has been ran.


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 19 of 22
(798 Views)

If you interrupt processing, do you want to hold onto the intermmediary result and continue processing later or do you want to thrash all analysis already done and start over from scratch the next time?

0 Kudos
Message 20 of 22
(791 Views)