Question about the Wait Function

I wrote a VI to store the time stamps in a text file.
I fond something strange in the text file (see the picture below).
The time stamps weren't writen into the file every 10 ms! How could this happen? And how could I fix it and make the time stamp to be writen every 10ms?
Thanks a lot!

To further what was just said:
The wait function will indeed wait 10ms, or near enough as I will soon explain.
When used in a loop, the wait function will wait for 10ms AFTER the code inside the loop has been executed.
Depending on your Operating System, and the speed of your PC, the code inside the loop could take several hundred milli-seconds to execute.
So the total time for each loop iteration, and thus the time between file writes, will be (Xms + 10ms), where X is the time taken to execute the other code.
Another thing to consider is that unless you are using a Real-Time OS, your Windows or Mac OS will not prioritise LabVIEW! The execution of your code must run alongside your virus scanner, email client, music player etc. etc. etc.
As such, it is often asking too much to try to use labVIEW in accuracies of +/-1ms on the common desktop PC.
As a final note: I cannot give facts on file writing, but just from my experience with LabVIEW a file write every 10ms is impractical as the write-to-file VI usually takes longer than 10ms to execute itself. Why not buffer up 10 writes/pieces of data/whatevers and then write them all to file at once? Whilst we are at it, why not buffer 100 pieces and then write them all at once?
I have had this idea argued before, with people saying that if the system were to crash then the buffered up 100 reads would be lost. Remember guys: that labVIEWs write to file VI passes the data to the windows write buffer, and windows doesn't necessarily put it on disk straight away! That can only be guaranteed by closing the file reference or flushing the queue.
Apologies, I have diverged.
Rhys
Applications Engineer
National Instruments

Similar Messages

  • Some question about the renegotiation function in SRM Contract (GOA)

    Hi All Expert,
    We are on SRM 5/4.6,  there is a question about the renegotiation function in SRM GOA.
    Can we renegotiate the price for some parts in the GOA items with this function ( e.g. Only renegotiate one item in the contract) ?
    Will the item price updated automatically after the renegotiation?
    Many thanks in advance!!!
        Wendrin

    Hi Sanjeev,
    Many thanks for your help.
    One more question, if I add a new item when we renegotiation, will it be transfered to contract and create a new item after that?
    Thanks and best regards
    Wendrin

  • I have a question about the Siri function.

    Here in Belgium, we speak Dutch and also French and English. But I think when you use the Siri function it is always easier to use it with your own language ( Dutch). 28th October, the iphone4S will be launched here in Belgium, but only with a Englisch version of the Siri function. So my question is that you have any idea when te Dutch version will be available in Belgium, or when i buy an iphone 4S with English version that I can update it to a Dutch version when it will be launched..
    Thank you for helping
    Dylan

    Nobody here can tell you anything more about Apple's plans than what they have already publicly stated, which is that more languages were promised for later (including Japanese, Chinese, Korean, Italian, and Spanish in 2012).

  • Question about the alarm function.

    Has anyone used the alarm function on the iPhone?
    This may be a dumb question, but does the phone need to be in sleep mode, not shut off for alarms to work? If that is the case (I expect it is) would it be best to leave on while charging overnight for an early morning alarm to work properly?
    I think I've answered my own question, because I doubt an alarm can go off if the phone is off, but probably would if it was just asleep. Any thoughts on the alarm function in general?
    Thanks,
    CD3

    CD3, I would also assume the same but I do not really
    know the answer. To answer your question, yes. I use
    the Alarm function everyday thought I do not know why
    as I get up before the !@# thing wakes me up.
    Your answer is funny. I only need the alarm to wake me for a flight I'm taking to a show in Denver in Sept. Don't want to miss the flight because the alarm didn't work because the phone was completely off.
    So the non lazy way to answer my question...I'm going to try it myself. If it works one way or the other I'll mark my question answered and get myself a point or 2
    CD3

  • A question about the save function

    How does the save function work in the following flash
    application(in fact,this is a game)??
    Line
    Rider

    Good work
    There is something know as MMSave
    and also look out for file referrence class

  • Question about the Wait Until Next ms Function

    Hello,
    I met a problem when I tried to use wait until next ms function to control the period of the loop.
    I use Labview2009 now. I wrote a VI to sample the current values at 100Hz and then store the samples in a text file. The currents are sampled once in a loop and then wait for next 10ms to begin the next loop. After 360,000 loops (should be an hour), it will creat a new file to store the new samples in the following an hour.
    I left the VI runs on CompactRio for the whole weekend. The result I got is shown in the picture below:
    24 files should be created in one day. While there were only 3 files created in the firest 24 hours ( from Fri 16:00 - Sat 16:00). And after that it worked very well.
    When I checked the first three files (created from Fri 16:00 - Sat 16:00), I found that it didn't sample at 10Hz. It sampled at the frequency of about 20Hz (sometimes 18Hz, sometimes 19Hz).
    I am confused by the problem a lot. What may cause it didn't work in the first 24 hours and worked after 24 hours? And How could I fix this problem?
    Thank you very much!

    You need to show us some code!
    This cannot happen in a single loop, but can easily happen if you have e.g. stacked loops or sequences containing multiple wait statements.
    Also have a look at these old threads:
    Synchronization problems during measurements (using while loop)
    accurate timing between events
    If accurate timing is important, use a timed loop. Your incorrect times are faster, so I don't think there is a problem with the inner code taking too long.
    LabVIEW Champion . Do more with less code and in less time .

  • Question about the GPS function

    I have just got my iPhone 3G, but still need to wait a couple of days to
    get my mobile number transferred.
    My question is: i don't have at the moment any mobile services from my provider.
    (No Service) I do have a WLAN connection. Should my GPS function in Google Maps still work? At the moment the icon is only spinning spinning and spinning....

    Thanks All!
    I turned it off and on again. waited a couple seconds outside (in the rain )
    And it is working great. 100% accurate
    Thanks Again.

  • Question about the 'TEST' function of BAPI

    I have run a BAPI function 'BAPI_GOODSMVT_CREATE' using 'TEST FUNCTION MODULE'.
    The process is successful and I can see the return material doucment number and year.
    However, when I search the table MKPF, no such document exists.....
    It seems that a document no. has been used but no such document is really created...as when I create a material document manually using transaction code MIGO, a doucment with doc. no. = that return by BAPI by using test function module + 1.
    I want to know is there any way to commit the transaction created by test function module? and it is wierd that it makes my document number becomes discontinue....
    thanks!

    Gundam,
    whenever you use TEST facility, the changes are never committed to the database. However, you loose the serial number because of Serial Number Range Object. Once you take a number of the object, that number is lost and that is why you are missing the sequence.
    Regards,
    Ravi
    Note : please reward the posts that help you.

  • Question about the Filter type for the trace provide "Microsoft-Windows-Kernel-File"

    Hello all,
    I have moved this question from the Windows
    Server General Forum accorfing to the suggestion from Mr. Justin Gu 
    I have a question about the Filter function for the trace provider "Microsoft-Windows-Kernel-File".
    I can find the Filter function with the following operation.
    Mr. Justin Gu wrote:
    > You create a Data Collector Set for the trace provider "Microsoft-Windows-Kernel-File" and finish completely, then you > can right click it and select Properties.
    In the Properties dialog box, click Filter and
    then select ‘Edit…’. You will be> able
    to see the Filter type and Filter data in the Filter dialog box.
    What
    Kind of Filter can
    I use in this Filter dialog box?
    And, how can I set to exclude the some kind of datas?
    Could you give me your suggestion?
    Thank you.

    What
    Kind of Filter can
    I use in this Filter dialog box?
    And, how can I set to exclude the some kind of datas?
    Could you give me your suggestion?
    Thank you.
    I'm looking for the same information.

  • Question about the function module (RFC_READ_TABLE)

    Dear everyone
    Could I ask you a question about the function module (RFC_READ_TABLE)?
    I was asked if it's possible to create a report which compares the data between different SAP systems (both production systems).
    Now, the easiest way would be to use the function module (RFC_READ_TABLE) within a SAP infoset query (SQ01 type query).
    But I heard the rumor that using the function module (RFC_READ_TABLE) is not advisable due to the security reason.
    However, I am not exactly sure what sort of security problems this function module can possibly have...
    Would you help me on this?
    I also would like to know if using "remote enabled module" type function module can always overcome this possible security issue.
    Or, are there any points that I need to be careful about even when I use "remote enabled module" function module?
    Thank you very much in advance.
    Takashi

    Dear Fred-san
    Thank you very much for your support on this.
    But, may I double check about what you mentioned above?
    So, what you were mentioning was that if some user executes the query with
    the function module (RFC_READ_TABLE), under the following conditions, he can access to
    the HR data even when he does not have the authorizations for HR transactions?
    <Conditions>
    1. the user has the authorization for HR database tables themselves
    2. RFC_READ_TABLE is called to retrieve the data from HR database
    <example>
    Data: LF_HR_TABLE like  DD02L-TABNAME value 'PA0000'.
    CALL FUNCTION 'RFC_READ_TABLE'
       EXPORTING
        query_table                = LF_HR_TABLE
      TABLES
       OPTIONS                    =
       fields                     =
       data                       =    .
    But then, as long as we call this function module for a non-critical tables such as
    VBAP (sales order) or EKKO (purchase order) within our query, it wouldn't seem to be
    so security risk to use RFC_READ_TABLE...
    Besides, each query (infoset query) has got the concept of user groups, which limits
    the access to the queries within the user group.
    ※If someone does not belong to the user group, he cannot execute the queries within that
       user group, etc
    So, my feeling is that even infoset queries does have authorization concept...
    Would you give me your thought on this?
    I also thank you for your information for SCU0.
    That is an interesting transaction
    Kind regards,
    Takashi

  • A question about the impact of SQL*PLUS SERVEROUTPUT option on v$sql

    Hello everybody,
    SQL> SELECT * FROM v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0  Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SQL>
    OS : Fedora Core 17 (X86_64) Kernel 3.6.6-1.fc17.x86_64I would like to ask a question about the SQL*Plus SET SERVEROUTPUT ON/OFF option and its impact on queries on views such as v$sql and v$session. Here is the problem
    Actually I define three variables in SQL*Plus in order to store sid, serial# and prev_sql_id columns from v$session in order to be able to use them later, several times in different other queries, while I'm still working in the current session.
    So, here is how I proceed
    SET SERVEROUTPUT ON;  -- I often activate this option as the first line of almost all of my SQL-PL/SQL script files
    SET SQLBLANKLINES ON;
    VARIABLE mysid NUMBER
    VARIABLE myserial# NUMBER;
    VARIABLE saved_sql_id VARCHAR2(13);
    -- So first I store sid and serial# for the current session
    BEGIN
        SELECT sid, serial# INTO :mysid, :myserial#
        FROM v$session
        WHERE audsid = SYS_CONTEXT('UserEnv', 'SessionId');
    END;
    PL/SQL procedure successfully completed.
    -- Just check to see the result
    SQL> SELECT :mysid, :myserial# FROM DUAL;
        :MYSID :MYSERIAL#
           129   1067
    SQL> Now, let's say that I want to run the following query as the last SQL statement run within my current session
    SELECT * FROM employees WHERE salary >= 2800 AND ROWNUM <= 10;According to Oracle® Database Reference 11g Release 2 (11.2) description for v$session
    http://docs.oracle.com/cd/E11882_01/server.112/e25513/dynviews_3016.htm#REFRN30223]
    the column prev_sql_id includes the sql_id of the last sql statement executed for the given sid and serial# which in the case of my example, it will be the above mentioned SELECT query on the employees table. As a result, right after the SELECT statement on the employees table I run the following
    BEGIN
        SELECT prev_sql_id INTO :saved_sql_id
        FROM v$session
        WHERE sid = :mysid AND serial# = :myserial#;
    END;
    PL/SQL procedure successfully completed.
    SQL> SELECT :saved_sql_id FROM DUAL;
    :SAVED_SQL_ID
    9babjv8yq8ru3
    SQL> Having the value of sql_id, I'm supposed to find all information about cursor(s) for my SELECT statement and also its sql_text value in v$sql. Yet here is what I get when I query v$sql upon the stored sql_id
    SELECT child_number, sql_id, sql_text
    FROM v$sql
    WHERE sql_id = :saved_sql_id;
    CHILD_NUMBER   SQL_ID          SQL_TEXT
    0              9babjv8yq8ru3    BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES); END;Therefore instead of
    SELECT * FROM employees WHERE salary >= 2800 AND ROWNUM <= 10;for the value of sql_text I get the following value
    BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES);Which is not of course what I was expecting to find in v$sql for the given sql_id.
    After a bit googling I found the following thread on the OTN forum where it had been suggested (well I think maybe not exactly for the same problem) to turn off SERVEROUTPUT.
    Problem with dbms_xplan.display_cursor
    This was precisely what I did
    SET SERVEROUTPUT OFFafter that I repeated the whole procedure and this time everything worked pretty well as expected. I checked SQL*Plus documentation for SERVEROUTPUT
    and also v$session page, yet I didn't find anything indicating that SERVEROUTPUT should be switched off whenever views such as v$sql, v$session
    are queired. I don't really understand the link in terms of impact that one can have on the other or better to say rather, why there is an impact
    Could anyone kindly make some clarification?
    thanks in advance,
    Regards,
    Dariyoosh

    >
    and also v$session page, yet I didn't find anything indicating that SERVEROUTPUT should be switched off whenever views such as v$sql, v$session
    are queired. I don't really understand the link in terms of impact that one can have on the other or better to say rather, why there is an impact
    Hi Dariyoosh,
    SET SERVEROUTPUT ON has the effect of executing dbms_output.get_lines after each and every statement. Not only related to system view.
    Here below what Tom Kyte is explaining in this page:
    Now, sqlplus sees this functionality and says "hey, would not it be nice for me to dump this buffer to screen for the user?". So, they added the SQLPlus command "set serveroutput on" which does two things
    1) it tells SQLPLUS you would like it <b>to execute dbms_output.get_lines after each and every statement</b>. You would like it to do this network rounding after each call. You would like this extra overhead to take place (think of an install script with hundreds/thousands of statements to be executed -- perhaps, just perhaps you don't want this extra call after every call)
    2) SQLPLUS automatically calls the dbms_output API "enable" to turn on the buffering that happens in the package.Regards.
    Al

  • Two questions about the new iWeb

    Hi
    I've got two questions about the new iWeb.
    1. Is it possible to blog online now? Meaning adding a new blog entry without having to be on your own Mac? This is a feature I've been waiting for since iWeb first was released.
    2. Is it possible to choose the format of images? Earlier editions had the option to "optimize" images but that meant it changed it into .png meaning the site got a lot heavier than if .jpg was used. And since I have relatives who still only have an isdn connection I need to be able to have the website as light as possible.
    thanks

    Ah well... thanks for the quick answer
    Message was edited by: Guðlogi

  • Question about the programming of a legend

    Hello everybody,
    I have a question about the programming of a waveform's legend. I
    already asked here in this forum about the legend programming (03)
    months ago.
    I went satisfied but I ve just noticed that this code
    (See Code old_legend_test.llb with main.vi as main function) operates a
    little different from my expectances.
    Therefore I have a new question and I want to know if it
    is possible by labview programming to plot and show, on a waveform
    chart, a signal with activ plot superior to zero (0) without to be
    obliged to plot and show a signal with activ plot equal to zero (0) or
    inferior to the desired activ plot.
    I give you an example
    of what I m meaning. I have by example 4 signals (Signal 0, 1, 2 and 3)
    and each signal corresponds respectively to a channel (Chan1, Chan2,
    Chan3, Chan4). I want to control the legend (activ plot, plot name and
    plot color) programmatically. Is it possible with labview to plot signal
    1 or 2 or 3 or (1, 3) or (2,3) or (1,2,3) or other possible combination
    without to active the signal with the corresponding activ plot zero
    (0)?
    Let see the labview attached data
    (new_legend_test.llb with main.vi as main function). When I try to
    control the input selected values again I get them back but I don't
    understand why they have no effect on the legend of my waveform chart.
    Could somebody explain me what I m doing wrong or show me how to get a
    correct legend with desired plots? Thank by advance for your assistance.
    N.B.
    The
    both attached data are saved with labview 2009.
    Sincerly,PrinceJack
    Attachments:
    old_legend_test.llb ‏65 KB
    new_legend_test.llb ‏65 KB

    Hi
    princejack,
    Thanks for
    posting on National Instruments forum.
    The behavior
    you have is completely normal. You can control the number of row displayed in
    the legend and this rows are linked to the data you send to your graph. Thus,
    if you have 3 arrays of data, let say chan1, chan2 and chan3, you can choose
    which data you want to display in your graph using the property node (Active
    plot and visible). But for the legend as you send 3 plots there is an array of
    the plot name [chan1, chan2, chan3] and you can display 0, 1, 2 or 3 rows of
    this array but you cannot control the order in this array! So, to be able to
    change this array you have to only send data you need to you graph. I'm not
    sure my explanations are clear so I have implemented a simple example doing
    that.
    Benjamin R.
    R&D Software Development Manager
    http://www.fluigent.com/
    Attachments:
    GraphLegend.vi ‏85 KB

  • Using the Wait function in while loops?

    Hi,
    I have a rather complicated top level VI with about 20 subVIs and the main VI has on big while loop around it and another smaller one inside, basically it runs rather slow and I have no idea how to set the wait function. I mean what factors should I consider..what would be the difference between setting it to 10 and 100 (besides the obvious 10ms vs 100ms)? I just want to increase the performance of the executable, so it is not that slow. Can you offer some hints as to what I need to take into consideration when determining my delay? And also, are while loops the only place that I should use the delay or are there other instances too?

    Adding waits is not a fix-all for slow running applications. Its just one thing that can be done to improve things. If you determine that a sub-vi is causing your problems then you need to find out exactly what that vi is doing to slow you down. If its because there is a loop inside it that is running constantly as fast as it can, then a delay in that loop may help. If that is not your problem then you need to look at other ways to boost performance. It sounds like you have alot of locals variables, each instance of a local variable makes a copy of the data that's in the control. If the controls/indicators that you have local variables of contain large amounts of data then you may be filling up memor
    y with copies of it.
    I suggest that you study the "Performance and Memory Management" chapter of the LabVIEW manual. This can found in the printed manual of the older versions, in the online manuals that install with 6i, or on NI's web site here: http://zone.ni.com/devzone/conceptd.nsf/2d17d611efb58b22862567a9006ffe76/732cec772aa4fbe586256a37005541d3?OpenDocument , which is Application Note 168. This should give you some good ideas of what to look for to improve your performance.
    Hope this helps.
    Brian

  • Questions about user-defined functions

    Hello all,
    I've got some questions about user-defined function in a message mapping:
    1) How can I get the current date/time in format yyyy-mm-dd hh:mm:ss ? What is the java code for this?
    2) I want to use the StreamTransformation constant TIME_SENT, only this is not in the right time-zone.
    It is GMT and it should be CET (1 hour difference). How can I convert this in Java?
    Can somebody help me with this?
    Thanks in advance.
    Kind regards,
    Marco van Iersel

    Hi Marco,
    If the date format is fixed as you have mentioned,please use this:
                                    String test = "2009-03-27 23:15:30";
              String test1 = test.substring(11,13);
              if(!test1.equals("23"))
              int a = Integer.parseInt(test1);
              int b = a+1;
              System.out.println("b"+b);
              String c = Integer.toString(b);
                                    test = test.substring(0,10)+" " + c + test.substring(13,19);
                                    return test;
              if(test1.equals("23"))
              test = test.substring(0,10)+ " 00" + test.substring(13,19);
              return test;
                                    else return "";
    Kindly let me know if this works.
    Thanks.
    Regards.
    Shweta

Maybe you are looking for