From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Seeking suggestion to count time inside the loop

Hello everyone, 

 

I am trying to measure/count the time inside the while loop, I tried a couple of methods but the problem is while loop execution. 

 

If I will add time count in the start and at the end using flat sequences in this case I need to terminate while however, I can not terminate while loop. Let's say each iteration or "list of conditions when completed" the time will count automatically. 

 

Here is my current VI. 

 

test.png

In short, I am trying to measure the time that how long the "WAIT" is appearing on the button. 

 

If something is not clear then please let me know. 

 

 

0 Kudos
Message 1 of 3
(775 Views)

@sam67 wrote:

If something is not clear then please let me know. 


Nothing is clear, really 🙄.

 

If you  want to measure time between the start and an event, why wouldn't you put the first time measurement at the start?

wiebeCARYA_0-1646241197695.png

 

 

Also, an XOR to invert a Boolean, while the stop condition and be inverted is weird.

A wait for multiple is weird in general.

A wait for multiple in an event structure is most probably simply wrong.  

0 Kudos
Message 2 of 3
(717 Views)

Sorry, I don't have 2021, so I cannot run your snippet. Still, sometimes it is possible to diagnose basic things from a picture (example). 😄

 

  • Why is "Boolean" a control if you use it as indicator? (... and why doesn't it have a better name!)
  • your millisecond times are always integers, so why is it orange?
  • While loops inside inside while loops hints at huge room for architectural improvements. Think state machine instead!
  • A constant wired to a two input boolean function is never needed (except during debugging possibly).
  • Your feedback should be initialized with the tick, not with zero, else the first value is random.
  • What is the "Numeric" local variable for? (... and why doesn't it have a better name?)
  • Color constant should be hex formatted or replaced by a colorbox constant.
  • A 3000ms wait inside an event case is plain madness. (note that "wait next ms multiple" can give you any random shorter wait. Not sure if you want that. Do you know the difference between "wait" and "wait next ms multiple"?
  • With proper dataflow, the sequence structure is not needed.
  • What's in the other events? Other cases?
  • You "ticker" measures the time between calls to exactly that visible event case, (i.e. the time between user changes of the list) nothing else. In the first call to the feedback node, your time will be garbage. Do you know why?
  • etc.etc

Feel free to "save for previous" and attach your VI so we can give more detailed advice.

 

I would recommend to take a step back and describe what the program is supposed to do and how the user interacts with it. Most likely there is much smaller and cleaner code that does it all correctly.

0 Kudos
Message 3 of 3
(698 Views)