キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

Timed Loop, initial run zero delay?

Hi all,

 

I'm working with (several) timed loops and have pretty complex vi's inside them.

The longest dt = 180000, i.e. run the loop each half an our.  

This works just fine, but i have one problem. I would like the first iteration to start immediately and then repeate the timed loop accordingly to the set dt.

Se the enclosed .vi that start the first iteration after 10 seconds. Is it possible to modify this so the first run starts at once?

 

Many thanks!

 

LW 8.5

Message Edited by Izze2000 on 03-03-2010 01:53 PM
0 件の賞賛
メッセージ1/8
4,423件の閲覧回数

Thusly.png

Thusly


"Should be" isn't "Is" -Jay
メッセージ2/8
4,419件の閲覧回数

Izze,

 

The initial iteration of the timed loop does run with zero delay. (Numeric is immediately set to zero).  It is the next iteration that is delayed by the dt time.

 

Jeff's idea looks right, but there is one problem with the implementation of it.  It actually winds up doing the same thing as yours.  Why?  Writing the new value to the dt in the initial iteration seems to affect the iteration that it is still in.  To truly only affect subsequent iterations, you need to do this.

 

 

Here iteration 0 starts at t=0

Iteration 1 starts at t=0 (more or less)

Iteration 2 starts at t=5 seconds.

Iteration 3 starts at t=10 seconds.

Message Edited by Ravens Fan on 03-03-2010 05:22 PM
メッセージ3/8
4,405件の閲覧回数
thats what I get for not testingスマイリー 悲しい

"Should be" isn't "Is" -Jay
メッセージ4/8
4,402件の閲覧回数

Jeff Bohrer wrote:
thats what I get for not testingスマイリー 悲しい

The way you coded is the way I would have thought to do it.  I originally wanted to post a message to try to clarify what the OP wanted.  They said

 

"This works just fine, but i have one problem. I would like the first iteration to start immediately and then repeat the timed loop accordingly to the set dt.

See the enclosed .vi that start the first iteration after 10 seconds. Is it possible to modify this so the first run starts at once?"

 

I wanted to state that the first iteration of a loop always starts right away.  It may be semantics, because the first iteration of the loop is i=0, the second iteration is i=1, and so on.

 

So I figured that based on what you coded (which sure looked OK to me, but I just wanted to test things before I wrote anything) was that the OP mean that the "first" iteration was the i=1 iteration.  Then when I tested your VI, I found it didn't work like I expected.  And that the dt in the loop must have affected the current iteration of the loop rather than acting like a shift register to only affect later iterations.  I don't know if there is any documentation that clearly states that.  The context help for period for the timed loop really didn't say anything.

メッセージ5/8
4,395件の閲覧回数

Raven, Jeff, thanks!

 

But how very odd, the timed loop actaully works as i want it to do just drawn as my original .vi

The first iteration with zero delay and the rest delayed accordingly to dt.

The strange thing is in my complex timed loop, the first iteration is actually delayed for some strange reason, i can see that there is no activity (not related to counting the loopnumber)?

When i strip it down it starts to work exactly as you described above.

 

Anyway thanks for helping me understand how the timed loop works and now i need to do some debugging!

 

Cheers

0 件の賞賛
メッセージ6/8
4,356件の閲覧回数
There is another input to the timed while loop called t0 or offset/phase if you open the dialog for setting the timed loop properties.  Perhaps you have a value other than 0 set there.
0 件の賞賛
メッセージ7/8
4,354件の閲覧回数

Not really, the only thing i have tied is the dt and the name of the loop.

In the timed loop I also talk via virtual COM port, use mixed graps and some other stuff. Perhaps something strange happends here, but i cannot understand how it would relate to just delay the timed loop excatly the time i haved defined in dt?

 

hum hum... 

Message Edited by Izze2000 on 03-04-2010 02:25 PM
0 件の賞賛
メッセージ8/8
4,352件の閲覧回数