Reference of a loop

Hello

The question is perhaps silly, but I can't make the time to get what I want.

Here it is: "how to measure the time of a Microsoft iteration loop in one?

I can do that with a sequence structure by placing counters of impulses before and after an iteration, but the problem is that this kind of media gives a result in Ms. How if you go faster?

I think that each iteration of my loop to a period of execution of the order of microseconds.

There's a you it a solution pour measure iterate precisely? DOI-I for example measuring my time over 1000 iterations and make a series of promotion beast by division (I can't find this very elegant if it's the only solution :/)

Thanks in advance.

Hello Cyco,

First of all thank you for having posted the Forum of National Instruments.

There is a meter more accurate than the classic counter which is called 'high resolution Relative Seconds.vi'in LabVIEW. It is not present on the basic palette, but is located in the folder C:\Program NIUninstaller Instruments\LabVIEW 2010\vi.lib\Utility\

You will find here a link to a forum full of tips on LabVIEW. The first posts talk about this vi, extracted in support.

Sincerely,

Tags: NI Software

Similar Questions

  • Using 'New data value reference' in a loop

    Hi all

    I just read on the data value references (DVR?) and I'm trying to use them with overall functional (see table).

    I don't think that I'm just doing.  The final goal is a producer/consumer nickname.  My concern is that I don't feel the implementation of the new primitive data value reference and re-stuffing the result in the FGV, should occur in each loop.

    Of course I could "spread" data with a single gueue element (where the queue of new data would take place each loop).  I just thought that I would play with them.

    Beavercreek wrote:

    I think that we defend the same point, but I can't seem to understand why this does not work the way I expected.  I discovered the DVR (and queues) as a pointer, simply a way that the other vi can know where the data is located.  The data that we are after is here.  So, why Ch1 does not work in the data_reader.vi?

    If we can get Ch1 to work data_reader without re-creating and re-writing of the reference in the FGV each pole (what does Ch2), we find no more what is wrong with my vI or I'm going to learn something that is still beyond me.  I hope to hit me in the head this afternoon still

    You are missing a fundamental idea: the function you call creates a reference that points to a specific value. To actually interact with this value (read/write), you need to use the structure of the International preliminary examination. At this time what you are creating a single reference for ch1 (which do you nothing with) and creation of multiple references to ch2 (where at each iteration that you replace the reference in the FGV, so you basically lose the old reference), so instead of having two DVRs, you really N + 1 DVR (where N is the number of iterations of the loop runs).

    For your code works the way you want, you only need to create two digital video recorders (probably before the loop), then bring them inside the loop and use the structure of the International preliminary examination with nodes in R/W DVR to set the value in the DVR.

    For example:

    Other problems with the code, but this deal the DVR issue.

  • Error: Cannot access a property or method of a null object reference. to enemy / loop)

    Hi everyone, I'm learning Flash for a few days. I want to write a simple game... We have a 'gun', and if we click the mouse, the gun to send a ball. Then, if the ball hits the enemy, the enemy and bullet disapear. Unfortunately, I got an error this is my code fragment:

    main (in game.fla):

    var bulletholder:MovieClip = new MovieClip();

    addChild (bulletholder);

    function shoot(e:Event):void

    {

    Player.y = 400;

    var bul:MovieClip = new bullet();

    Bul.x = player.x + 21;

    Bul.y = player.y - 10;

    Bul.Width = 30;

    Bul.Height = 30;

    bulletholder.addChild (bul);

    }

    It's code in enemy.as:

    public enemy class extends MovieClip {}

    Subject: main private var;

    public void enemy() {}

    addEventListener (Event.ENTER_FRAME, loop);

    x = Math.random () * 550;

    y = - 100;

    Base = MovieClip (root);

    }

    private void loop(e:Event) {}

    y += 4;

    var ilosc:int = core.bulletholder.numChildren; Currently, debugging display error!

    for (var i: int = 0; i < 4.Ilosc; i ++)

    {

    var target: MovieClip = core.bulletholder.getChildAt (i);

    If (hitTestObject (target))

    {

    core.bulletholder.getChildAt (i) .remove (); Remove() is my bullet.as function

    core.bulletholder.removeChild (target);

    removeEventListener (Event.ENTER_FRAME, loop);

    core.removeChild (this);

    }

    }

    if(y > 600)

    {

    removeEventListener (Event.ENTER_FRAME, loop);

    core.removeChild (this);

    }

    }

    }

    Please help me, I'm stuck here now for 2 days

    And sorry for the typos, I do not know English very well.

    When you remove a child so that reduce you the number of children and all children above this movement of the index down this gap.  Your loop counter 'number' is based on the number of children before remove you any.  So as soon as you get to an 'i' value when it is no longer a child, you will encounter this error.

    Overcome is to work the loop in the opposite direction, from the child index higher at the lowest, as in...

    for (var i: int = number-1, I > - 1; i--)

  • Using a cursor to reference in a loop for.

    I have a procedure with a few loops for nested that finds consecutive intervals with different ranges of entry into force. It looks something like this.
    declare
    
    cursor c1 (p1 in date, p2 in date, p3 in date) select col1,col2,col3,col4 from a_table where col1 = p1 and p2 between col2 and col3..(more conditions)..;
    cursor c2 (p1 in date, p2 in date, p3 in date) select col1,col2,col3,col4 from a_table where col1 = p1 and p2 between col2 and col3..(more conditions)..;
    cursor c3 (p1 in date, p2 in date, p3 in date) select col1,col2,col3,col4 from a_table where col1 = p1 and p2 between col2 and col3..(more conditions)..;
    
    begin
    
    for x1 in c1(start1, start2, start3)
    loop
      --print stuff from x1.col1 x1.col2 x1.col3 x1.col4
      for x2 in c2(x1.col4, x1.col2, x1.col3)
      loop
        --print stuff from x2.col1 x2.col2 x2.col3 x2.col4
        for x3 in c3(x2.col4, x2.col2, x2.col3)
        loop
          --print stuff from x3.col1 x3.col2 x3.col3 x3.col4
        end loop;
      end loop;
    end loop;
    end;
    /
    .. .cursor for loops are nice and clean, do not have to worry about pick... works perfectly.

    But I don't like that I have 3 sliders with the same exact query. I would rather define it only once if possible. I tried to do it with the ref Cursor, but it looks like I can't use ref Cursor in a for loop in the same way you can with a plain ol' slider.

    Is there a way to get what I'm doing? A single cursor definition reused within nested for loops without worrying about opening/extraction/closing anything?

    DylanB123 wrote:
    For some reason any I Although pl/sql did not support recursion. Maybe it's the ticket.
    >

    For some reason any I Although pl/sql did not support recursion. Maybe it's the ticket. PL/SQL doesn't support recursion, but it is allowed. You can do it, but you're on your own to make it work :)

  • Control reference 1055 error when you use a loop for

    Hello

    I'm having a problem using control references to accomplish the following: I a VI that reads data from a text file, and then uses that automatically update the value of a control on front panel on two live different, then set the default values, and then save them. Comes from the array of control references, I tried looping on text labels until I have find the one corresponding to the order, I want to change and then update its value. The problem I have is that if I use a loop for, then 9times of LabVIEW 10 complains error 1055: "LabVIEW: object reference is not valid. If instead I the wiring to the index table and manually extract the reference, then it works every time and for each index of the reference of the order.

    Can someone take a look at my code and just see if its obvious what the problem is? In this case, I have a simple solution, but I would really like to understand what I did wrong. I have included as a code snippet, but also attached the files if that helps (Its Import_Colormap.vi, which is the problem). Persons with disabilities code fails, the active code works but I can't see what is really the difference between them - I can change the index of array 0,1,2, 3. and no mistake.

    Thank you.

    Your "Colormap.ctl" is a strict type def that contains a ring.  You define the elements programmatically, make the default values, and then save the "Colormap.ctl"?   I was never practicing this but here is a thread that covers this in detail. I do not understand what you expect reach by running.
    The next thing: at the same time (at the same time!), you open the Colormap.vi (this is what we see in yout PNG) that contains an instance of the Colormap.ctl on the front panel. I'm not pretty sure if LabVIEW can handle this correctly. This could be the reason why you sometimes get the error 1105.
    I prefer StringsAndValues and eventually the value of the ring running.  There is no need to do it with a def of strict type.

  • Reference to a while loop

    If you open references to a LabVIEW object, such as an application,
    control or VI, close the references using the LV object close
    Datum feature. Otherwise, the reference remains in memory even
    Although the VI is no longer use it.

    This quote is from the development Guide of NOR. I realized that I used for references without closing them. Even if I never met no problems, I decided to add a close reference to my programs. My question is, should I put the reference and close reference as well live in a while loop and open/close each iteration or should I use reference open before a while loop and close after the while loop, in this way, I'll have to use a shift register to maintain the reference. Or if there are other options. Can someone give some advice?

    Thanks in advance,

    Wang Guangde

    Open and close your references outside the loop (i.e. open the ref before the loop and close it once the finished loop execution).  Repeatedly opening and closing the same reference inside a while loop is unnecessary and takes up an unnecessary overload.

    Also, because the reference does not change with each iteration of the loop (unless you're doing something for her specifically?), you don't actually have a registry change.  You can use one if it makes you happy, however.

    d

  • Closing references ActiveX correctly in the Simple user interface

    Hello

    I am currently editing the user supplied with Teststand 2013 Simple interface in order to access the global variables of the station through LabVIEW.  A simple test, I'm trying to access the value of username.  When I run the VI for the first time after the opening of LabVIEW, I get no error message and the program works as required.  Stop the running VI will return no error, but when I try to run the VI and rerun the Teststand, stalls the execution sequence and I get a wait status.  I then have to close running VI by killing all threads in Teststand, I think that the PropertyObjects do not come out properly and I find the structure of the event quite confusing to deal with.

    My attempt to close the references in the while loop looks like this:

    The rest of the program is exactly as expected with Teststand 2013.

    Any input on how to close properly references ActiveX and extracting station globals in LabVIEW would be much apreciated.

    Thank you for your help,

    Christian

    Christian,

    Doug is correct if you open references in a loop, you should also be closing them in the loop. For example, this code open a reference to the engine and the Globals PropertyObject. Two of these references must be closed each time that the loop is executed with the current code.

    You might be able to improve this code is to put your username querying code elsewhere. This username appears as something that would happen only when a user connects or disconnects, then perhaps that this code could be registered as a reminder of the event UserChangedevent. Follow these steps in the VI of reminders set up event of the user interface.

    If you do not need this code to update constantly, you can put in the structure of the event time-out event in your screenshot and fix a reasonable (maybe 100 to 200 ms).

    Hope this helps and let us know if you have other questions about this!

  • Stop several parallel loops - error &amp; stop button status

    I have several ongoing loops run in parallel and want to arrest all a loop based on the question whether one of the two conditions are met:

    • One of the loops has an error
    • You press a stop button

    Right now I do this using a master loop that checks to see if any of the loops have a mistake or if you press the stop button.

                                                     

    The problem I have is that I do the references between the loops using indicators of State T/F. These lights if it is the judgment of loops. This means that, at the end of a test, all the lights are on, and before the program is run again each light must be unchecked. It is not easy to use and my program grows I don't want to have to uncheck 20 bulbs before each test.

    Is there a way to make the lights reset at the beginning of each test, or is there a better way to refer to the status of each loop?

    An alternative is to use a notification utility.

    Implement a notifier with a Boolean data type.

    The stop of two loops of wire to the output of a waiting for Notification (remember to set a time-out).

    If an error occurs, or you press stop then send a notification.

    By clicking on Stop stop the two loops. Or a mistake in a loop will stop both.

    It's not more complicated I think a FG.

  • Open reference vi to a string in the executable file

    Hi all

    Scenario: A vi of above (main.vi) called two subvis (subvi1.vi and subvi2.vi) separately as they are executed in parallel. subvi1.VI has a façade that appears when it is called, subvi2.vi does not work.

    subvi2.VI uses open vi Reference to get a reference to subvi1.vi. It then uses this reference in a loop and continuously queries the FrontPanel.IsFrontmost property to determine if the Panel before the subvi1.vi is more. When it's over, it performs certain actions. When there is no more - it doesn't.

    This set works very well in the development environment, but as soon as I build this 'scenario' in an application I get following error:

    subvi2.VI generates the reference to subvi1.vi using the string "subvi1.vi" as an input for the path terminal of open vi reference function. Why it causes problems in an executable built?

    PS Clearly this scenario is actually a part of my project much more, so I don't have simple vi to attach


  • AS3/AIR - for the loop is ignored but the rest of the function to run

    This has left me speechless. It is either something really stupid on my part or part of the Flash. Here goes:

    I have a function that accepts all simply a table of movieclip references, executes a loop to add them to a sprite container, then the container gives a background color. It works perfectly the first time. Now, when the program returns to this feature yet it completely ignores the loop but always adds the background color. Here's the function:

    public void prepareContainer (sections): Sprite

    {

    trace ("prepareContainer called.");

    trace ("cuts" + sections);

    containerClips.splice(0,containerClips.length);

    trace ("containerClips.length is" + containerClips.length);

    for (var rs: int = 0; rs < sections.length; rs ++)

    {

    trace ("sections [" + rs + "] is" + [rs] sections);

    }

    var w: Number = 0;

    var l:Number = 0;

    for (var sx:int = 0; sx < sections.length; sx ++)

    {

    trace ("sx is" + sx);

    section of the sections [sx] = var;

    If (SX > 0)

    {

    section.y = sections [sx-1] there + .height sections [sx-1];

    w = section.width;

    l = l + section.height;

    }

    container.addChild (section);

    }

    container.graphics.beginFill (0xfafafa); Just for the background color in the container.

    container.graphics.drawRect (0,0,w,l);

    container.graphics.endFill ();

    containerClips = sections;

    for (var p:int = 0; p < containerClips.length; p ++)

    {

    trace ("containerClips [" + p + "] is" + containerClips [p]);

    }

    return the container;

    }

    You can also see that I have traces in the service to trace the content and the length of the incoming array.

    It's track of the first time through:

    called prepareContainer!

    sections.length is [object ViewPrevTranClosed_AEM], [medicareHead_AEM object], [object NAMEsubscriberSection_AEM], [object SearchInformationSection_AEM]

    containerClips.length is 0

    sections [0] is [object ViewPrevTranClosed_AEM]

    sections [1] is [object medicareHead_AEM]

    sections [2] is [object NAMEsubscriberSection_AEM]

    sections [3] is [object SearchInformationSection_AEM]

    SX is 0

    SX is 1

    SX is 2

    SX is 3

    containerClips [0] is [object ViewPrevTranClosed_AEM]

    containerClips [1] is [object medicareHead_AEM]

    containerClips [2] is [object NAMEsubscriberSection_AEM]

    containerClips [3] is [object SearchInformationSection_AEM]

    ============================================

    As you can see, the traces in the loops went very well and the result is as expected. The container is filled with the movieclips. However, on the next time through the result is that the background color and none of the movieclips are added to the container. The following trace shows also that the loops did not stand even if the table is full and there is no condition that stop the loops. This is the inside track:

    called prepareContainer!

    sections.length is [object ViewPrevTranClosed_AEM], [medicareHead_AEM object], [object NAMEsubscriberSection_AEM], [object SearchInformationSection_AEM]

    containerClips.length is 0

    Any ideas on what is the cause?

    You can have a circular reference. containerClips is the same table that the sections. Try this simple test:

    array1 = [1,2,3,4] var;

    var array2 = array1;

    array1.splice(0,array1.) Length);

    array1 = [];

    trace (array2. Length);

    I'm sure that you expect to see it trace 4, but it trace 0. Now try to use the line commented out instead. Now you get a record of 4.

    If somewhere in your code you establish sections also point to the same table as containerClips, that you really wanted to duplicate a table, you can use the concat:

    Var items = containerClips.concat ();

    It would be either his own picture double and a pointer to the same table.

  • Variable references to objects

    OK, I have a grid of 15 x 3 of the dynamic text fields in an object called 'textbox' I want to reference through a loop for, so I don't have to have 45 lines of code for the allocation of the stuff in these fields.

    I have every dynamic field named by their placement in the grid, so c0a, c0b, c0c, c1a, c1b, c1c, etc..

    I can also name c00, c01, c02, if necessary.

    I tried:

    for (i = 0; i < 15; i ++) {}

    TextBox.c [i] a.Text = 'Cell' + i + 'A ';

    TextBox.c [i] b.Text = 'Cell' + i + 'B ';.

    TextBox.c [i] c.Text = 'Cell' + i + 'C '.

    }

    but it gives me a syntax error.

    I also tried naming c00, c01, c02, c10, c11, c12, etc., so that I could do a double nested loop:

    for (i = 0; i < 15; i ++) {}

    for (n = 0; n < 3; n ++) {}

    TextBox.c [i] [n]. Text = 'Cell' + i + n;

    }

    }

    but it gives me a syntax error too.

    Yes, is there a way to access all of this with a loop for, or I'll have to make a long trip?

    (I use AS2)

    You're close but not quite as far as using the ratings of support with chains of target objects.  You need to build the entire string inside the brackets...

    for (i = 0; i<15; i++)="">

    TextBox ['c' + i + 'a'] .text = 'Cell' + i + 'A ';

    TextBox ['c' + i + 'b'] .text = 'Cell' + i + 'B ';.

    TextBox ['c' + i + 'c'] .text = 'Cell' + i + 'C '.

    }

    And you could use String (i) I in the media to be more correct, but in AS2 it is less picky like that.

  • Problem with asynchronous call and Forget.vi and MessageBoxW (user32.dll)

    I have a problem.  I want to use the same type of structure as in "asynchronous call and Forget.vi.

    There is a picture of my (Message Box.vi) VI.

    The VI expect the 'narrow reference' I select OK or cancel.  This is not the expected behavior.  If I turn off the "narrow" reference I have the expected behavior (by renaming properly the buttons).

    What am I doing wrong with the asynchronous call?

    Looks like close reference wants the loop of the root and your dialogue it blocks until it is finished.   I assumed that Run in the user interface thread is selected in the COLD LAKE to the MessageBoxW function, try changing to run in any thread

  • Update of multiple charts simultaneously

    Hi, I have a VI containing graphs multiple (on a page of a control tab, to be precise) like these:

    Now, I would like when the VI starts to initialize all these graphics the same way:

    Basically, removing all the names of the plot and makes them all is not visible.

    Later, my VI runs, I want to fill every graph with relevant data and to decide on the number of plots in each graph, the names of plots etc. programatially.

    Now, it's OK to do as highest when there are some graphics, but I have some 16 of them and it's a real pain to add wires as in the screenshot above whenever I decide to add a chart in the front panel or if I decide that additional initialization is necessary.

    Is it possible somehow a loop? I have visialize some kind of loop passing through all the graphs belonging to some object of LabView and define somehow all of these properties, while maintaining the ability to reference each individual chart later in the program (by that name).

    Thanks in advance for your help.

    Create a table of references for each of these graphs.  Separate property notes using the graph and feed table of references to the loop.  Now, the loop will be autoindex on the table and setting the properties of each of these graphic references.

  • Using include data for a sequence

    All-

    I do not know my terminology is bad here so let me explain what I want to do. I would like to follow a com port and when the data flow happens things like analyze, draw, send to the indicators and write the data to a file. I built a series of cases to make each of the tasks in sequence. I need neatly nice to start the sequence when the data are finished coming and then wait for the next data transmission. The data are coming about once per minute. Unfortunately, for the moment, data will not come to 1200 bps, so transmission takes about 3 seconds. I think that an event structure would work, but I have no idea how create/use dataflow on the experiences to start the sequence. Thanks in advance for the help.

    [email protected] (Scott)

    ssmith490D wrote:

    I tried to use the time-out on the vi "Set up the Serial Port" but it did not work very well. The example uses a property with playback function node. How this time-out period differs from the Config Ser port. "time-out feature? Thank you.

    Scott

    I don't know what example you speak here or what property with playback function node you are talking about.

    How is it, you have 60 000 cable for the node property for the data bits?  The setting is valid only for who is 5-8.  And the only probable parameters would be 8 or 7.  I think you have that the definition of confused with the timeout.

    I would recommend opening your port configuration settings only once during the initialization of your state machine and series.  Close the port that once in a framework which occurs once only when you stop the program.  In the meantime, you simply wear the VISA reference through the loop through records shift.

    (Actually you should use much more shift registers.  You rely too heavily on local variables to get data from one State to another.  It could possibly cause problems on the road).

    Your architecture is now technically a state machine, but basically just a step above a structure plate sequence.  You can use decisions to determine what code to run then.  See the attached screenshot.

  • How can I create multiple threads parallel programaticaly?

    Hi all!

    I work in RF test lab that I would "stress" equipment using SNMP/Telnet/TFTP and other things, so I have to use parallel model for this.

    But my problem is that the user will select the number of threads in parallel will start, depending on the type of equipment!

    I created a reentrant VI which loops until a global goes wrong.

    An another GUI VI, the user inserts a number random, example 3, and in the GUI VI, I create 3 threads running through the reentrant VI.

    In GUI VI, I used a loop to "Reference Open VI", build an array of references to the first reentrant VI and then I tried to run by using "Call By Reference" in another loop, but only the first VI is running.

    By placing "Call by reference" three times in the GUI VI, all works well because the reentrant VI is cloned three times and parallelism is offered, but I need to establish the number of clones per programming.

    Is there a way to clone screws when running? Or... there at - it a different approach for this task?

    Thank you!

    Tiberiu

    Tiberiu salvation,

    without the while loop is no problem, but you should load the vi dynamically. See the attached picture. You can set all controls with the invoke node.

    Mike

Maybe you are looking for