LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stop and Pause Buttons and Estimated Execution Time

I have more or less completed my programme (as attached).

I am just left with two doubts - first: is it possible to let the user know the estimated time to finish executing the entire code/ running the entire experiment on my devices?

I am currently trying to calculate this estimated time by using the arithmetic functions and time stamp. I tried putting on both the left and right sides of my case structure but it never runs - I tired running the code and after all other commands are executed, the estimated time is still not displayed. I suspect that even if the estimated time is displayed, it would only be displayed after all other commands are executed.

I have tried looking up on timed structures but they don't seem to fit the job.

Do you have any advice on this?

Second: While loops could only be stopped (by pressing my 'STOP' button/Boolean that is linked to the loop condition) only after the first execution of the loop. How could I let my user stop the execution of code during the first run of the loop or should I wire my code differently using another structure?


As for the 'Pause' button to pause the VI, I have read about the 'Wait for' function (http://zone.ni.com/reference/en-XX/help/371361H-01/glang/wait_for_front_panel_act/). I am not sure if this is the right function I am looking for and if this function enables the user to 'un-pause'/toggle the switch and enable the execution of the subsequent commands.

This function seems useful but it does not solve the problem of the while loop having to execute at least once before I terminate it and it seems like this function acts like a 'Stop' function that exits the loop, terminating all commands instead of pausing the VI.

What is your advice on this?

 

Thank you so so much!

0 Kudos
Message 1 of 10
(3,523 Views)

Wow, what a mess. Your pogram is basically 80% deeply stacked sequences with no regard to dataflow. None of your inner while loops will ever sense a change of the stop button. Basic dataflow! The little while loop on the right will never be able to stop and use 100% of a CPU core forever.

 

Tear it all down, do some basic LabVIEW tutorials, learn about dataflow, learn about state machine architecture and shift registers and you will be able to rewrite the entire thing in 10% of the time and without the need of local variables, value property nodes and stacked sequencese. Try it!

0 Kudos
Message 2 of 10
(3,480 Views)

I used to do my code in another manner with less stacking as attached. I did go and learn about state machines on my own and I thought it is neater to used stacked structures. Do you mean if I were to remove the stacking, and adjust the loops accordingly, the stop button would be sensed?

 

0 Kudos
Message 3 of 10
(3,467 Views)

@hqwoon wrote:

Do you mean if I were to remove the stacking, and adjust the loops accordingly, the stop button would be sensed?


No. Your new code doesn't even have a stop button.

0 Kudos
Message 4 of 10
(3,461 Views)

No that was not my new code. It was just one of my old codes and I am wondering if this has a better flow and should be the right style I am supposed to write my code.

0 Kudos
Message 5 of 10
(3,456 Views)

Here's my lastest code which I finished. The problems I have asked earlier are solved. The stop button could not be used to stop my loop based on logics. The pause button would not be included because it would be too tedious to do so. Hence, I would just use the LabVIEW interface's 'Pause' and 'Abort' buttons instead.

0 Kudos
Message 6 of 10
(3,393 Views)

@hqwoon wrote:

The pause button would not be included because it would be too tedious to do so. Hence, I would just use the LabVIEW interface's 'Pause' and 'Abort' buttons instead.


You are kidding, right?

0 Kudos
Message 7 of 10
(3,375 Views)

Hi hqwoon,

 

I guess you followed the advice given to you in your older thread on the same topic?

 

Creating double posts on the same topic is considered rude behaviour…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 10
(3,361 Views)
Yes I know about it. I have already alerted the moderator to remove it the moment the post was posted accidentally due to internet problems.
0 Kudos
Message 9 of 10
(3,330 Views)

Yea I just found out that the pause button could be done. I'll continue working on it. Sorry for all the embarrassing questions I have. I am still really new to LabVIEW. 

0 Kudos
Message 10 of 10
(3,328 Views)