Skipped seconds in time stamp loop

Hi all,
I have a two 6024E cards which I am synchronizing via a RTSI cable. I
have an 860mHz Dell dimension with 512 MB of RAM. I am simply logging
analog signals from the cards to a text file on a 1s timebases. The
problem is that the output data file shows a time stamp is missed every
once and a while. I have tried adjusting the rate of sampling and
number of samples, but there always appears to be a hiccup in the
timestamping. I even tried hardware timing with a timed loop and one of
the on-board counters. The hiccups were even more frequent then. Maybe
the code needs to be more efficient, but I am stumped. I attached the
data logger vi. I appreciate any input.
Thanks,
dewey
Attachments:
acquire_ver5a.zip ‏1433 KB

Hello Dewey,
A couple recommendations for your program:
You are manually generating a timestamp for your signals using an
elaborate algorithm that I haven't really taken the time to
understand.  I might be easier, more efficient, and more accurate
to just acquire your data as a Waveform data type from the DAQmx Read
Analog VI instead of acquiring data as an array of doubles.  The
Waveform data type includes a built in timestamp that you could parse
out and log to file instead of calculating your own timestamp using the
Tick Count (ms) VI.  Take a look at the LabVIEW Help and there is
a section under File I/O about Writing Waveform Data to a File Using
Storage VIs.
I would also highly recommend you remove any Wait or Wait for Next ms
Mutlitple VIs from your program.  You are already configuring the
sampling rate of your continuous acquisition earlier in your program
using the DAQmx Timing (Sample Clock) VI.  This is configuring the
DAQ tasks to use the hardware clock to use the onboard sample clock of
Dev1 for your acquisition.  With the sample clock timing
configured, the NI-DAQmx driver will automatically take care of the
speed of execution of your while loop based on the rate you specify in
the DAQmx Timing VI.  By manually including waits in your while
loop, you are conflicting with the timing parameters you set up in your
DAQ task.  This could lead to buffer overflows, missed samples,
and otherwise non-deterministic sample timing.  I would suggest
taking a look at the LabVIEW DAQmx shipping example Multi-Device
Synch-Analog Input-Continuous Acquisition.VI which can be found in the
NI Example Finder (Help >> Find Examples) in the following
category: Hardware Input and Output >> DAQmx >>
Synchronization >> Multi-Device.
I hope these suggestions help!
Regards,
Travis G.
Applications Engineering
National Instruments
www.ni.com/support

Similar Messages

  • Error when add seconds to Time Stamp format

    Hi,
    I've created a subVI that transform an string data/time to Time stamp format.
    The subVI seems that it works fine, but when I use the data 26/10/2014 and I add 1 day, it crashes! The result is 26/10/2014 23:00:00 instead of 27/10/2014 00:00:00.
    Cordially
    Vicen
    Solved!
    Go to Solution.
    Attachments:
    Convert Date-Time strings to Seconds.PNG ‏405 KB
    Sha Convert Date-Time strings to Seconds v2.vi ‏24 KB

    Thank you both!
    I think I've solved the problem.
    Vicen
    LV 2010/2011 on WinXP/Win7
    Attachments:
    Sha Convert Date-Time strings to Seconds v2b.vi ‏26 KB

  • Get Time Stamp will milli seconds from string time stamp format

    Hi Guys,
    I am trying to get the time stamp with milli seconds value from string format time data,
    Attached the snippet (Get milli seconds to Time stamp)I  tried.
    Attached Sub VI Convert string to time stamp
    When run,I am not getting the time string indicator with milli seconds value even though the format have <%2u> .
    please guide me on this.
     ..AND Finally i will be converting the date and time string output to time stamp data type
    Attachments:
    Convert_String_to_TimeStamp.vi ‏13 KB
    Get Milli seconds to Time stamp.png ‏25 KB

    You do realize you could have just used a single Scan From String to get the timestamp, right?
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    Get Timestamp.png ‏43 KB

  • Integration Process - Time-Dependent Loop

    Hello All
    I made solution like :
    [Time-Dependent Loop|http://help.sap.com/saphelp_nw04/helpdata/en/c5/582541019fa52fe10000000a155106/frameset.htm]
    with second case "Time-Dependent Loop".
    But my exception is never raise and i don't know why. is there any special setting in PI where i have to configurate it ??
    Regards
    Maciej

    Hi
    What i have done is:
    define block with local correlation "Correlation" and exceptions "TimeOut"
    inside this block i create infinite loop with inside receive step tha use correlation and container operation.
    to block i added deadline block with following properties: creating the step 3 minutes and inside it control step with throw exception
    to block also added exception branch with exception handler
    after block i have some mapping and send step
    BR
    Maciej

  • How to include seconds and millisecon​d in the CSV file time stamp generated by the SpreadShee​t Object?

    I'm Using Lookout 6.02, in a XP Pro Windows Machine, Service Pack 3.
    I have an application that collects data at the rate of 20 samples per second. It works just fine, the CSV File contains all the samples without missing a single one.
    The problem is that the time stamp in the data file only shows hours and minutes. With 20 sample per second, there are 1200 samples per minute. It is hard to figure out in which second or sample number, occurred some events collected. These files are open with Excel and analyzed with Excel. There is no easy way to implement a search or a guidance for knowing the sample number or the exact time in Excel.  My problem is to add the seconds and if possible the milliseconds to the time stamp done by the spreadsheet object.
    Any suggestion?
    Other ways to do the same that includes the time stamp all the way down to milliseconds?

    Create another column with the Now() function, then set the calumn format to hh:mm:ss.s
    expression would be now(trigger) for the date and time or now(trigger)-today(trigger) for just time
    The trigger will cause the expression to stay updated, perhaps using the same trigger for logging the spreadsheet.
    Good luck
    Mike
    Message Edited by Mike@DTSI on 01-16-2009 04:12 PM
    Mike Crabtree - Lead Developer
    Destek of Nevada, Inc. / Digital Telemetry Systems, Inc.
    (866) 964-6948 / (760) 247-9512

  • Converting time stamp in waveform to seconds

    Hello,
    I would like to convert the time stamp in a waveform (coming from 'AI Sample Channel') into seconds.  Currently when I read the waveform into a file I get a format that looks like
    18:00:47.453000
    Any help you can offer would be greatly appreciated, it seems like this should be easy to do?
    Thanks,
    Cullen

    In the attached example, I compare converting the datestamp to seconds by converting to double, to extended precision and doing a delta directly on the timestamp iteself (then converting). 
    Running the VI showed the same results (using Win-XP) for all three cases.  Unless you have a better OS, then the top example would probably do.
    At least the example will show you how to convert to seconds (in 50ms steps for the example), and how to do it using the array directly (polymorphic functions).
    Hope it helps,
    RayR
    Attachments:
    DeltaTime.vi ‏13 KB

  • Time stamp dropping seconds

    I figure someone has had this problem before but didn't see it in the forum anywhere.  I'm adding a time stamp to a file so I've used the "Get Time/Date in Seconds" and wired that to a "Convert to DBL".  This then wires both into an indicator on the Front Panel and into the "Write to Measurement File" Express VI.
    The indicator displays the time stamp just fine but in the file it puts it into scientific notation and cuts off the last 4 digits as well as any fractional seconds.  The time stamp writes to the file every 5 seconds so it is important to have the rest of the time stamp included.  I've tried using probes on the wires to see where things go weird but I get the same truncated value in the wire before and after the indicator.  I thought it had something to do with the Express VI first since the indicator is fine but with it truncated in the wire it seems that the Express VI is indeed saving exactly what is handed to it...but then again the indicator...you can see I've been running in circles over this!  Does anybody know the reason it is doing this and a possible solution?
    Thanks a lot!
    Solved!
    Go to Solution.

    I can't post the exact code because it is being developed for use outside our lab but I've recreated the basics of the problem.  The array would be the collected data and except some filename details and things like that everything relevant to the time and saving is included.  Also settings in the express VI are the same.  Not sure if it will help out.
    Attachments:
    example.vi ‏56 KB

  • Time Stamp a Voice Memo to the Second

    I need to make a voice memo that's date and time-stamped to the second. It looks like Voice Memo doesn't do this (but if there's a way to, please advise!). Does anyone know an app that would do this? The greatest thing would be to be able to make the file name related to the date/time again to the second.
    Thanks for any advice. This is to replace a system on an old Palm Pilot using Audacity Audio with the date/time stamp option for naming capable to the second as well....

    I have the same problem.  I noticed it for the first time after the recent IOS 7 update.  The audio file I recorded using "Voice Memos" was trimmed down to 2 seconds, but iTunes reads it at full length (1:13) so I can't add it as an alert to my phone.  Oddly enough, the playback only lasts 2 seconds in iTunes, so it seems like there is an issue with how iTunes is calculating the time for trimmed Voice Memo files.

  • Time stamp or get info including seconds

    Hi there,
    I'm trying to get more specific information about a selection of files - in particular, the seconds (and even milliseconds if possible) relating to the time-stamp for each. I've tried changing the international system prefs to full format but this seems not to have had any impact on finder or get info.
    Thanks,
    Sarah.

    saraheaston wrote:
    I'm trying to get more specific information about a selection of files - in particular, the seconds (and even milliseconds if possible) relating to the time-stamp for each. I've tried changing the international system prefs to full format but this seems not to have had any impact on finder or get info.
    You can see seconds in the Terminal utility by using the "-T" switch:
    ls -l -T
    (Those are lower-case letter "L".)
    I'm not sure of the best way to show anything of finer resolution.

  • Time stamp and skip test report

    Hello, all
    I am new to teststand and just beginning to do some work with teststand.
    My interest is to report every step with data begin with a time stamp.
    I create  subtest in the Numeric type property to report timestamp in the form of YYYY-MM-DD-HH-mm-ss
    These substep are pre-step and post-step and in pre-step I get timestamp at the beginning and
    post step I get a timestamp at the ens of the step.
    Thing workout pretty well until I report a skip test.
    A skip step does not run so a pre-step and post-step report a time stamp as 00000000000000.
    how can I over come this problem since i want the skip test report as exact the same with "Normal Step"
    is there any way to have a f(x) at the beginning and the end of the step type, and theses f(x) of course
    should be execute even that step is skipped
    Thanks
    TP
    Solved!
    Go to Solution.

     Hello
    For me that is important and for many thing I do the step carried out take a longtime than normal, especial if you test with around 20 socket and more.
    I am surprised that a step type does not have some thing reserved for Pre-execution.  This can help condition further a costumed step.
    The only way I can poke in there may be using "precondition" to put my time stamp.  But that mean my costumed model leaves a bunch of f(x) in there and look ugly

  • Time stamps in Seconds from Epocho

    Hi,
    I have a requirement, where I need to calculate the Time stamp for sy-datum.
    That is. I have to calculate the number of seconds from 01/01/1970.
    www.unixtimestamp.com
    gives more infor. But how do I do this in my report?

    Hi Jurgeon,
    The function module I used is 'L_MC_TIME_DIFFERENCE'. This gives time difference between two dates and time in minutes. I later converted this to seconds by multiplying by 60.
    Thanks for your suggestion.
    Thanks,
    Chaith.

  • Need to add date/time stamp to file name without time change creating new files

    We have setup our application to save data once a trigger event occurs. We also need the date/time stamp as part of the file name. We used Format Date/Time String and concatenated it into the file name. It all works good, but as the time changes (seconds, minutes, etc.) it causes the Write to File to create a new file with the new filename. Is there a way to create the file and save/latch/buffer the time in the file name so that it doesn't create a new file for every second?
    I've attached a shot of the relevant part of our VI. It's all in a big while loop. The data save is in a case/switch so that when it is triggered it starts saving. (The for loop is to split the data up
    into 4 different files). Like I said, it all works except new files are created every second as the time changes instead of just putting it all in one file with the initial time in the file name.
    Attachments:
    TimeInFileNameQuestion.jpg ‏46 KB

    I need a loop in order to use a shift register. I cannot stop the outer while loop (because it would stop the hardware from collecting data), and I cannot add loops inside which bogs down the processor to where the app stops. I've attached a simpler version of my VI which illustrates the problem. While the button is pressed (the trigger) it should save the data (in this case just cycle numbers) into one file with the initial date/time. But, you can see that it creates 1 file/second. I tried using shift registers, but without adding extra loops I can't see how to do it. Thanks
    Attachments:
    FileNameTest.vi ‏29 KB

  • Time Stamps in Producer/Consumer Setup

    I am trying to acquire signal from a Gas Analyzer, Flow Meter, and 3 RTDs.  My hardware is a NI 9215 and NI 9217.  I need to write the data to a file with a time stamp at which the sample was read.  The program is written in a producer/consumer setup in which the data is being acquired in the prodcuer loop and sent to the consumer loop to be written.  I can get the samples written to the file okay. However, I have not figured out how to put the time stamp in the data file correctly. I thought the time stamp was created with the corressponding measurement at the Data Acquisition VI. However, whenever I open the data file, there are only 0s in the time column.  So, I've tried to use Format/Date String to add the time stamp. I can get it to work if I place it in the consumer loop. However, the time stamp is not accurate.  It puts the same time stamp up to six digits of precision for two consecutive samples. I've tried to figure out how to add it to the producer  loop, but I don't know how to add it and the measurements to the queue at the same time. Please tell me the best way to acquire signals with the exact time stamp and write them to a file using a producer/consumer design.
     Example:
    Date             Time               RTD1     RTD2      RTD3     CO2      Flow
    5/26/07      5:20:01.25       57         56         56.5      100       0.5
    5/26/07      5:20:01.30       57         56         56.5      100       0.5
    5/26/07      5:20:01.35       57         56         56.5      100       0.5
    Attachments:
    Producer-Consumer From Scratch2.vi ‏75 KB

    Okay, I've put it in a For Loop and it will connect now. However, whenever it runs the time stamp increments for a couple seconds and then it just repeats. How do I correct this?
    Attachments:
    Producer-Consumer From Scratch2.vi ‏88 KB
    pleasework.txt ‏20 KB

  • How do you make a time stamp update?

    Hi, thanks in advance...
    I am programming an interface to a scale... it retrieves a weight, time stamps it, enters a comment, then sends this string to a spreadsheet.
    My problem: the time stamp never updates unless I right click it > select "data operations" > select "set time to now". Then it's stuck there and never updates while the program is running. It just keeps on stamping 8:15 (or whatever time it is updated to) all day long.
    Am I using the wrong VI here or is there something else I have to select to get it to work?
    Thanks a million...
    Adam Stagnaro
    Abaxis Inc

    Try using the 'Get Date/Time String' or 'Get Date/Time Seconds' vi to obtain your timestamp. Which one you use depends on how you wish to format your timestamp. Im not sure which vi you are currently using, but it looks to me like you are either using a timestamp constant (which wont update in your loop) or control (which you need to manually update from the front panel).
    Hope this helps.

  • Can I create a time stamp of 2ms or 1ms resolution in a text file

    I have trouble creating time stamps in text files that have 2ms resolution. Although my timed loop in LV 7.1 is running the code at 500 Hz without any late iterations, and I record all the data points in the data file, the time stamps are the same in ms range for 5 consecutive points, i.e 10ms resolution. I would like the time stamps to have a 2ms resolution, where each data points every 2ms should show a different milisecond time stamp.
    I am trying to do this to be able to show exact 2ms-time stamps for each data sample from 1 digital input line sampled at 500 Hz using NI-DAQmx 7.2. So far I have been using "Get/Date Time in Seconds" and "Format Date/Time String" to display the time stamp in the milis
    econd range.

    Use the Tick Count (ms) function. Call Get Date/Time in Seconds when you start to get time of day. Also call the Tick Count (ms). After acquiring each point call Tick Count (ms) again and subtract from the starting tick count. Then add this to the starting Time in Seconds value (with appropriate scaling). The result is your timestamp.
    Another approach: If you are using hardware timing for the 500 Hz acquisition, each sample is automatically 2 ms after the previous one. Record the start time and add 2 ms for each sample.
    Lynn

Maybe you are looking for