Jump to content

Why can't I change the mode of a timed loop?


PeterB

Recommended Posts

Hi there,

while running a timed loop I would like to change its mode by wiring a mode enum control into the RHS data node of the Timed Loop. The Timed Loop does not seem to change its behaviour (let alone report the new mode) when I do this. Any ideas why?

thanks

Peter Badcock

Product Development

ResMed Ltd.

Download File:post-1272-1142390859.vi

Download File:post-1272-1142390871.vi

Link to comment
Hi there,

while running a timed loop I would like to change its mode by wiring a mode enum control into the RHS data node of the Timed Loop. The Timed Loop does not seem to change its behaviour (let alone report the new mode) when I do this. Any ideas why?

thanks

Peter Badcock

Product Development

ResMed Ltd.

I've had no problem running you're example (8.0.1), the only thing you have to remind is that you can't initialize with 'no change' setting this kills you're loop BEFORE the first run. (error -820)

Ton

Link to comment
Peter:

Supply an offset along with the change in mode. See the shipping example.

biren

Hmmm.... well adding the offset in gets me a step closer, but I must say that I could find NO evidence of needing to do this in any example (could you list the specific example Biren?) nor in any of the LV Help literature.

Moving on however, when I did add the mode on the RHS datanode (see attachment Timed Loop Test v0.1.2.vi), and select a new mode, the loop dt goes from 1000ms to 0mS ! i.e. it iterates VERY fast, and because timed loops are high priority, the vi takes a while to recognise any stop buttons on the FP. OK admittedly I have no code in the timed loop to actually consume additional CPU clock cycles, but this behaviour is rather weird. So while adding in the offset did answer my original question, it highlights a new unexplained behaviour.

Moving on to a more real life example, check out the next vi "Timed_Loop_Test_v0.2.1.vi". The delay being called inside this timed loop is programmed to finish late every 4th iteration. Now run it, then simply change the "Subsequent Mode" from 'No Change" to "Process missed periods, maintain original phase" and the Expected Start and End times drop down to 0 and 500ms respectively ! Rather weird.

regards

Peter

Download File:post-1272-1142469841.vi

Download File:post-1272-1142469854.vi

Link to comment
I've had no problem running you're example (8.0.1), the only thing you have to remind is that you can't initialize with 'no change' setting this kills you're loop BEFORE the first run. (error -820)

Ton

I am running 7.1.1, if you have got it working then maybe v 8.0.1 doesn't require the offset to be simultaneously set as Biren suggests. Anyway, I updated the examples and they now run for me under v7.1.1 but with some interesting behaviour as noted in the reply here .

regards

Peter

Link to comment
So while adding in the offset did answer my original question, it highlights a new unexplained behaviour.

Biren has now solved the unexpected behaviour for me by pointing out that ..

"when you change the offset you should be supplying an offset into the future and not 0. If I am changing the offset I usually add the expected start to period to get the new offset"

This now makes sense and works OK Download File:post-1272-1142563359.vi

If only NI had shown me this by way of example it would have clicked much sooner for me. Even though Biren had suggested that examples are available in LV 7.1, none of them contain a timed loop with the mode and /or offset wired up from inside the loop.

There's also no indication of how to properly effect a mode change in the LV user manual - other than to say

"To set the mode, right-click the Mode input terminal of the Right Data Node and select Create

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.