<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Timed loop iterations end early in LabVIEW</title>
    <link>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2974223#M855110</link>
    <description>&lt;P&gt;The difference between start times is the same as what I am doing, as there is no delay between any of the iterations. I have attached an image of the first few data points from a test run so that you can see for yourself.&lt;/P&gt;
&lt;P&gt;Also attached is my VI, but it's quite messy and complex because I'm still in the process of developing the system.&lt;/P&gt;
&lt;P&gt;It's for my final year undergraduate thesis project in engineering.&lt;/P&gt;</description>
    <pubDate>Sun, 31 Aug 2014 01:48:37 GMT</pubDate>
    <dc:creator>iskrazaf</dc:creator>
    <dc:date>2014-08-31T01:48:37Z</dc:date>
    <item>
      <title>Timed loop iterations end early</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2974211#M855104</link>
      <description>&lt;P&gt;I have a timed loop set for a period of 12ms (using the 1kHz system clock).&lt;/P&gt;
&lt;P&gt;Looking at the actual start and ends of each iteration, it seems that the loop moves to the next iteration after around 4ms, rather than 12ms.&lt;/P&gt;
&lt;P&gt;How can I force the loop iteration to idle until the full period has elapsed?&lt;/P&gt;</description>
      <pubDate>Sun, 31 Aug 2014 00:37:02 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2974211#M855104</guid>
      <dc:creator>iskrazaf</dc:creator>
      <dc:date>2014-08-31T00:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: Timed loop iterations end early</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2974213#M855105</link>
      <description>&lt;P&gt;Can you show us some simplified code? How do you measure the timing?&lt;/P&gt;</description>
      <pubDate>Sun, 31 Aug 2014 00:47:09 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2974213#M855105</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2014-08-31T00:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: Timed loop iterations end early</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2974217#M855107</link>
      <description>&lt;P&gt;Thanks for your quick response, it's very much appreciated.&lt;/P&gt;
&lt;P&gt;Attached is an image of my simplified VI with one of my timed loops. I am coordinating two timed loops hence the synchronised start.&lt;/P&gt;
&lt;P&gt;I am using a quad core processor and forcing the other loops and structures onto seperate cores so these shouldn't be an issue.&lt;/P&gt;</description>
      <pubDate>Sun, 31 Aug 2014 01:07:41 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2974217#M855107</guid>
      <dc:creator>iskrazaf</dc:creator>
      <dc:date>2014-08-31T01:07:41Z</dc:date>
    </item>
    <item>
      <title>Re: Timed loop iterations end early</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2974219#M855108</link>
      <description>&lt;P&gt;In terms of measuring the timing, I take the difference between the actual start and end times, obviously ignoring the first actual end time (and writing this all to a spreadsheet file).&lt;/P&gt;</description>
      <pubDate>Sun, 31 Aug 2014 01:17:54 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2974219#M855108</guid>
      <dc:creator>iskrazaf</dc:creator>
      <dc:date>2014-08-31T01:17:54Z</dc:date>
    </item>
    <item>
      <title>Re: Timed loop iterations end early</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2974221#M855109</link>
      <description>&lt;P&gt;can you attach the actrual VI instead?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://ni.lithium.com/t5/user/viewprofilepage/user-id/309741"&gt;@iskrazaf&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I take the difference between the actual start and end times&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Shouldn't you take the difference between successive start times?&lt;/P&gt;</description>
      <pubDate>Sun, 31 Aug 2014 01:36:13 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2974221#M855109</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2014-08-31T01:36:13Z</dc:date>
    </item>
    <item>
      <title>Re: Timed loop iterations end early</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2974223#M855110</link>
      <description>&lt;P&gt;The difference between start times is the same as what I am doing, as there is no delay between any of the iterations. I have attached an image of the first few data points from a test run so that you can see for yourself.&lt;/P&gt;
&lt;P&gt;Also attached is my VI, but it's quite messy and complex because I'm still in the process of developing the system.&lt;/P&gt;
&lt;P&gt;It's for my final year undergraduate thesis project in engineering.&lt;/P&gt;</description>
      <pubDate>Sun, 31 Aug 2014 01:48:37 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2974223#M855110</guid>
      <dc:creator>iskrazaf</dc:creator>
      <dc:date>2014-08-31T01:48:37Z</dc:date>
    </item>
    <item>
      <title>Re: Timed loop iterations end early</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2974267#M855119</link>
      <description>&lt;P&gt;You are looking at the difference between when the previous iteration ended and when the current iteration began.&amp;nbsp; You are actually measuring the wait that the Timed Loop put in in order to maintain the loop rate.&amp;nbsp; If you want to get an actual loop rate, you should look at the Start Times.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your code, I'm seeing a dt of 1.&amp;nbsp; Why didn't you set that to your 12ms?&lt;/P&gt;</description>
      <pubDate>Sun, 31 Aug 2014 13:03:55 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2974267#M855119</guid>
      <dc:creator>crossrulz</dc:creator>
      <dc:date>2014-08-31T13:03:55Z</dc:date>
    </item>
    <item>
      <title>Re: Timed loop iterations end early</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2974269#M855120</link>
      <description>&lt;P&gt;One other thing, why are you setting the dt and mode in every iteration of the while loop, even that it can not change?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have also &lt;STRONG&gt;a lot&lt;/STRONG&gt; of sequence structures that are not needed, as the data flow force the correct execution.&lt;/P&gt;</description>
      <pubDate>Sun, 31 Aug 2014 13:37:10 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2974269#M855120</guid>
      <dc:creator>dkfire</dc:creator>
      <dc:date>2014-08-31T13:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: Timed loop iterations end early</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2974281#M855124</link>
      <description>&lt;P&gt;Thanks for your responses guys, really appreciate the help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;crossrulz: if you look at my timing data you can see that even if I take the&amp;nbsp;difference in the start times, the loop is still ending early. The column on the left is an array of all the start times for every iteration. This is confirmed by the physical response of the system (a camera and LED setup).&amp;nbsp;Also,&amp;nbsp;the dt in my code is set to a control so that I can&amp;nbsp;play with it when I am testing the system (see LineCapture_v6). I made a very quick simplified VI of my code for altenbach and attached it as a jpeg, so I must've accidentally put a 1 in the dt for that one. But I have definitely had dt set to 12 for my timing data collection.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;dkfire: I was setting the dt and mode in every iteration as a frustrated attempt to fix it, it was a bit of a last ditch effort that I knew was probably unnecessary. To be honest I'm tearing my hair out here over this, I just can't see why it's not timing properly. The sequence structures are there so that I can force execution onto different CPU cores, I got a new computer so I just was playing around to test the performance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Again I am still very much in the development stage, I haven't cleaned up my code, it's messy, I'm very sorry about that. I swear I'm usually a lot neater &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 31 Aug 2014 14:56:06 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2974281#M855124</guid>
      <dc:creator>iskrazaf</dc:creator>
      <dc:date>2014-08-31T14:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: Timed loop iterations end early</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2974287#M855126</link>
      <description>&lt;P&gt;Sorry, I cannt really investigate your code, because my laptop screen is not big enough. It actually &lt;A href="https://ni.lithium.com/t5/BreakPoint/Monthly-Bugs-August-2014/m-p/2974295#M25798" target="_blank"&gt;crashes my labVIEW 2014 reproducibly&lt;/A&gt;&amp;nbsp;when I press "cleanup diagram". &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In general, you should take all these timed loops and sequences out of the event structure. What kind of hardware is this running on?&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;crossrulz wrote:
&lt;P&gt;In your code, I'm seeing a dt of 1.&amp;nbsp; Why didn't you set that to your 12ms?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You need to look into the other event cases. There are dozens of timed loops and some have a dt determined from a control that is set to 12ms.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Sep 2014 16:21:18 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2974287#M855126</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2014-09-01T16:21:18Z</dc:date>
    </item>
    <item>
      <title>Re: Timed loop iterations end early</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2974291#M855127</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://ni.lithium.com/t5/user/viewprofilepage/user-id/309741"&gt;@iskrazaf&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Thanks for your responses guys, really appreciate the help.&lt;/P&gt;
..... &lt;BR /&gt;
&lt;P&gt;dkfire: I was setting the dt and mode in every iteration as a frustrated attempt to fix it, it was a bit of a last ditch effort that I knew was probably unnecessary. To be honest I'm tearing my hair out here over this, I just can't see why it's not timing properly. &lt;STRONG&gt;&lt;SPAN style="text-decoration: underline;"&gt;The sequence structures are there so that I can force execution onto different CPU cores&lt;/SPAN&gt;&lt;/STRONG&gt;, I got a new computer so I just was playing around to test the performance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Again I am still very much in the development stage, I haven't cleaned up my code, it's messy, I'm very sorry about that. I swear I'm usually a lot neater &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That is not the case for the sequence structures. They only "helps" you inforce the execution order of the program.&lt;/P&gt;
&lt;P&gt;A while loop or/and a dynamic launched vi can run on different CPU cores or threads, but that dependt on how you have programmed the code.&lt;/P&gt;
&lt;P&gt;Take a look at the Producer/consumer pattern.&lt;/P&gt;</description>
      <pubDate>Sun, 31 Aug 2014 15:32:58 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2974291#M855127</guid>
      <dc:creator>dkfire</dc:creator>
      <dc:date>2014-08-31T15:32:58Z</dc:date>
    </item>
    <item>
      <title>Re: Timed loop iterations end early</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2974657#M855172</link>
      <description>&lt;P&gt;All in all, i have to agree with altenbach: Your block diagram is way too big.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One question:&lt;/P&gt;
&lt;P&gt;This VI has to run on Windows, does it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regardless, your absolute overuse of timed structures and your arbitrary core assignment of those show that you have no understanding of resource management in computer systems.&lt;/P&gt;
&lt;P&gt;My experience is that in most cases, when developers start to meddle with timed structures, they &lt;STRONG&gt;make performance worse&lt;/STRONG&gt; compared to "letting the system optimize itself".&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;The most terrible mistake you do is:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;You use core assignment but fail to provide a proper concept for priorities, which could enable your system to maintain timings for the most important parts.&lt;/P&gt;
&lt;P&gt;Additionally, running the code on Windows can starve complete parts of your application as Windows might assign the core to other applications for an extended time, so your application will NOT load balance in order to account for "the missing core", but it will simply wait for the core to become available.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;just my 5 cents,&lt;/P&gt;
&lt;P&gt;Norbert&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Sep 2014 08:28:28 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2974657#M855172</guid>
      <dc:creator>Norbert_B</dc:creator>
      <dc:date>2014-09-01T08:28:28Z</dc:date>
    </item>
    <item>
      <title>Re: Timed loop iterations end early</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2974721#M855187</link>
      <description>&lt;P&gt;Someone mentioned that you set dt every loop. It could be that setting a new dt performs a 'reset' and treats the subsequent loop as the 'first' loop and just executes it immediately. That's what it looks like. Generally it's considered bad practice to continually set values that never change in a loop.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Sep 2014 10:42:34 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2974721#M855187</guid>
      <dc:creator>ToeCutter</dc:creator>
      <dc:date>2014-09-01T10:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: Timed loop iterations end early</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2975189#M855277</link>
      <description>&lt;P&gt;I am sorry for my last post as i seem to rant a lot without giving any constructive feedback. This is not very nice, hence my apology.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Therefore, i simply recommend you:&lt;/P&gt;
&lt;P&gt;Remove ALL timed structures. Period.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To replace timed loops, use standard while loops and insert a Wait Until Next ms Multiple functions with proper timings.&lt;/P&gt;
&lt;P&gt;Timed sequences can be removed quite safely without any replacement in most places. Remember to use the error cluster wire to define dataflow execution order. If necessary, you can add Wait functions to delay execution on specific locations by inserting wait in a single sequence frame (use error cluster feedthrough to determine WHEN wait should execute) or the Time Delay expressVI.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;hope this helps,&lt;/P&gt;
&lt;P&gt;Norbert&lt;/P&gt;</description>
      <pubDate>Tue, 02 Sep 2014 07:45:17 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2975189#M855277</guid>
      <dc:creator>Norbert_B</dc:creator>
      <dc:date>2014-09-02T07:45:17Z</dc:date>
    </item>
    <item>
      <title>Re: Timed loop iterations end early</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2982175#M856326</link>
      <description>&lt;P&gt;OK everybody thank you for all of your feedback. Apologies for my late response but I have been out of town in the last week.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will take these new approaches on board and clean up my diagram. It definitely seems that my timed loop structures are causing the issues.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One more question: if I use while loops with a wait function, how can I be assured of the iteration times? Is there a similar measure like in the timed loops? Timing is very key to my project.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Sep 2014 00:42:39 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2982175#M856326</guid>
      <dc:creator>iskrazaf</dc:creator>
      <dc:date>2014-09-08T00:42:39Z</dc:date>
    </item>
    <item>
      <title>Re: Timed loop iterations end early</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2982871#M856349</link>
      <description>&lt;P&gt;If you require determinism, you must not use Windows.&lt;/P&gt;
&lt;P&gt;End of story.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That being said, you can use Windows for "semi-determinism" if you configure it the right way (e.g. disable screensaver, virusscan and harddrive indexing). Still, that "semi-determinism" is way less than 1ms (i would say a couple of 10th of ms) and nobody grants you any garantee on that. If that is sufficient for you, you can use normal while loops including "Wait until next ms multiple" as this will result in a behavior similar to a timed loop.&lt;/P&gt;
&lt;P&gt;You will not get any direct information about late iterations, but if necessary, you can include code to detect and react on that (therefore, Wait and Wait until have an output "timer tick").&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Norbert&lt;/P&gt;</description>
      <pubDate>Mon, 08 Sep 2014 07:06:35 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Timed-loop-iterations-end-early/m-p/2982871#M856349</guid>
      <dc:creator>Norbert_B</dc:creator>
      <dc:date>2014-09-08T07:06:35Z</dc:date>
    </item>
  </channel>
</rss>

