LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stop and Quit LabVIEW Vi

Solved!
Go to solution

@blessedk wrote:
1. First part of my question was confirming if there should be a Boolean control inside the event structure that Altenbach provided.

Yes, the panel close? event should have a TRUE wired to the loop termination. That seems obvous. (My picture shows the corner of a different case and just illustrated what comes after. If the loop does not stop, that code would not be reached).


@blessedk wrote:
2. Second question was to find out how to "interrupt" a program ( not stop the loop or exit the program (
And it does not have to be by stopping Subvis). For example let's say I am running a SubVi that takes 20 mins to execute and I just realized that I entered a wrong value for one of the controls to that SubVi.
I wouldn't want to wait for 20mins before entering the right value and execute the same SubVi again. -

What does the subVI do during the 20 minutes? Does the subVI show its front panel? If there is just an unconditional 20 minute wait function nothing will help. You need to design it to poll certain conditions.

 

For example I have an action engine that sets an interrupt flag when the <esc> key is hit. That flag is read e.g. inside the model function of nonlinear fitting, causing the model to thow error "43: interrupted by user", and thus end the fitting operation gracefully.

Message 11 of 33
(2,220 Views)
Crossrulz, thanks for your earlier advice to go for the state machine. It paid off - I did it eventually despite my "gross naivety". Didn't believe I could 🙂
A lot times I keep asking funny questions until I manage to connect all the dots.

So now that you know I have a state machine with subvis how do I truncate execution ( before it finishes) of a running subvi in order to say, make a change to the control input and rerun it.

[BADGE NAME]

0 Kudos
Message 12 of 33
(2,217 Views)
Altenbach,. Thanks for responding. The SubVi is actually running within that 20min period - llots of calculations with large 2D arrays.

[BADGE NAME]

0 Kudos
Message 13 of 33
(2,212 Views)

@blessedk wrote:
Altenbach,. Thanks for responding. The SubVi is actually running within that 20min period - llots of calculations with large 2D arrays.

Your description is insufficient to give advice. Is it one long worm of calculations or a looping calculation. Does it involve subVIs or flat code?

 

Can you show us the subVI code? 

0 Kudos
Message 14 of 33
(2,207 Views)
I believe the execution time is strictly a function of the array size. (300 Colums * 1 million rows. ) plus the amount of mathematical calculations involved and on each element. It is not looping.

[BADGE NAME]

0 Kudos
Message 15 of 33
(2,203 Views)

Are you sure that 20 minutes is reasonable. Could it be that your code is very inefficient?

What does it actually do? Can the problem be parallelized? Can it be split into parts?

0 Kudos
Message 16 of 33
(2,195 Views)
I think the time is reasonable going by other applications that handle similar computations with the same array size. I actually went from not being to run it ( hangs/freezes) to being able to iwirhin comparable duration. I had to use nested loops even when element level computation was not required. Sometimes the computation required just one column at a time, but if I picked up 1 million elements at once it froze the software.

[BADGE NAME]

0 Kudos
Message 17 of 33
(2,185 Views)

@blessedk wrote:
I had to use nested loops even when element level computation was not required.

Use a Notifier in your inner-most loop with a timeout of 0.  Then you can sent the notification telling the loops to abort.


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
Message 18 of 33
(2,156 Views)
Altenbach,
Thanks for pointing me again towards efficiency of the code. One thing ( should have been obvious) that came to my mind is changing my data type from double to a type that gives me only six digits after the decimal. I am thiniking a fixed point but I need a bit of quick help with the output configuration in properties to ensure I am doing the right thing

[BADGE NAME]

0 Kudos
Message 19 of 33
(2,141 Views)
Oh I think I should simply convert to single precision SGlL ( 6-digits) 🙂

[BADGE NAME]

Message 20 of 33
(2,133 Views)