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.
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.
11-08-2019 10:49 AM
Hi,
I am looking for some guidance on a VI that uses a timer which will advance a state machine through set stages when it reaches it target time. I've found this timing engine on the a blog post here and this looks exactly what i need but i cant figure out how to get this timer to restart again within a larger VI when it meets its target. I've tried putting in a case structure with Boolean control but because the while loops stops itself i cant get it to restart.
I would also advice on how the timer elapsed boolean could be used to advance a state machine to the next state? Or if there is a better way to do it?
11-08-2019 12:45 PM - edited 11-08-2019 12:48 PM
Why not just have a "Timer" state in your state machine that handles the timing between states?
11-08-2019 01:01 PM
Well, you didn't show your State Machine, but if it's the usual "Case Statement inside a While Loop", where each Case is a State and you wire the Next State to a Shift Register when the Case exits, if you want State N to last for, say, 100 msec, simply put a 100 msec Wait in the loop. The Principle of Data Flow will guarantee the Case element won't finish until everything in it, including the 100 msec Wait, is done. Of course, if you want an immediate "Next State when Done", don't put in a Wait.
Bob Schor
11-08-2019 03:28 PM
Hi Bob,
I wanted to avoid putting a wait in the stages as what I am aiming for is a experimental timer at the top of my main VI that shows the current stage (state) remaining time along with the full experiment time and the ability to pause the timer which will halt the transition to the next state.
11-08-2019 04:32 PM
@xander054 wrote:
Hi Bob,
I wanted to avoid putting a wait in the stages as what I am aiming for is a experimental timer at the top of my main VI that shows the current stage (state) remaining time along with the full experiment time and the ability to pause the timer which will halt the transition to the next state.
That is going to require the timer to be a part of each state itself.