09-01-2011 05:19 PM
Hi all,
I want to make something like:
Where A and B are both the current time x is a constant, z is a variable and y is change in time. I know the > needs to enter into an "If" loop but I'm not sure how to keep A and B at the same time and how to get the integer y out of the "If" loop. After the program solves for y I need it to continue looping inside the main system indefinitely.
Thank you for your help,
Falcon
09-01-2011 05:25 PM - edited 09-01-2011 05:26 PM
There is no such thing as a "if" loop in LabVIEW. We have FOR and WHILE, and you are probably looking for a while loop.
Take a tick count, feed it in a feedback node, and subtract the previous value from the feedback node output whenever the condition is met. Repeat forever.
(To get access to Y value in a different loop, use a local variable, action engine, or queue, for example.)
09-01-2011 05:50 PM
Is this related to this problem? Please keep it all in one place, then. Thanks!
09-01-2011 09:28 PM
Compare to infinitiy. The positive infinity block is in the numeric section. The greater than comparison is in the comparison section. Compare something to infinity and wire the output to the stop icon in the while loop found in the structures section. Whatever you put in the while loop will loop indefinitely. It's recommended that you put one of the wait blocks found in the timing section, wire zero to the wait vi or a small number that works for you. It wasn't that long ago that I was learning, so I remember where you are coming from.
09-01-2011 11:26 PM
@gchristi1 wrote:
Compare to infinitiy. The positive infinity block is in the numeric section. The greater than comparison is in the comparison section. Compare something to infinity and wire the output to the stop icon in the while loop found in the structures section.
What???? 😮 Are you really serious?
To loop forever, simply wire a FALSE diagram constant to the conditional terminal. No comparison needed. 😉
09-02-2011 04:00 AM
"Loop indefinatly" most often means "Loop until i press stop button" 🙂
Create a boolean control and wire it to the stop of a while loop.
/Y
09-02-2011 11:09 AM
@gchristi1 wrote:
Compare to infinitiy. The positive infinity block is in the numeric section. The greater than comparison is in the comparison section. Compare something to infinity and wire the output to the stop icon in the while loop found in the structures section. Whatever you put in the while loop will loop indefinitely. It's recommended that you put one of the wait blocks found in the timing section, wire zero to the wait vi or a small number that works for you. It wasn't that long ago that I was learning, so I remember where you are coming from.
My computer is SO FAST it'll complete an infinite loop in under twenty seconds. How can I handle that?
09-02-2011 11:40 AM
09-02-2011 04:41 PM
@altenbach wrote:
Have you tried squaring the Inf constant? 😄
Hehe.