LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timestamp for Datalogging in Real-Time

Hello,
I am quite new to LABVIEW.
My problem:
I want to do data logging of two analog sources (running on PXI-232 as real-time engine) on a host computer with 20kHz, at the same time, I would like to save the timestamps of certain events (now there are only two events: on, and off. My idea was, so buffer 2048 and send it by a shared variable to the host PC. (You can see the idea attached. The two sources are saved, but the time stamping is not working. Shall I do the communication via TCP/IP or do you think the the problem is solvable with shared variables?
 
The Labview Version is 8.2. We are using PXI-232 as real-time engine.
As an attachment; I send the vi of the host and the vi of the real-time-engine.
I would be really grateful to receive an answer.
Best wishes!
Rainer
 
0 Kudos
Message 1 of 4
(4,785 Views)

Hey Rainer,

The almost easiest way would be to use the shared variables and their provided timestamp. By right-clicking on the variable within the host VI you should be able to choose "show timestamp" from the shortcut menu. Shared variables store the timestamp of each piece of data they receive, so you can read the the data in the host VI and add the correct timestamp of the actual data beeing written.

Hope this helps!

Message 2 of 4
(4,756 Views)

Hey Christian,

thank you for your advice. I didn't know the option "show timestamp" of the shared variable before. But still the timelogging is not working. You wrote: "...so you can read the the data in the host VI and add the correct timestamp of the actual data beeing written."

What do you mean by "correct timestamp of the actual data"? Do you mean the timestamp of the host or another timestamp of the rt engine? And how can I add timestamps? Do I have to transform the format or is there another possibility to add timestamps? Do I have to do the logging of the timestamps in a seperat timed loop?

I implemented your advice, but the time of the timestamp ist still not right. As I am not able to read the first timestamp channel, I transformed the second into an string, so I can write it with "Write to Text File". But how can I log the timestampt of each piece of data?

I would be really grateful, to get another hint.

Sorry for my simple questions, I am quite new to Labview..

I attached the new vi of the host and the old rt-engine vi.

Best wishes!

Rainer

 

0 Kudos
Message 3 of 4
(4,731 Views)

Hey Rainer,

The timestamp the variable provides of the actual element you read out in the host VI, is the timestamp of this element as it has been writtn to the variable in the target VI! So when you write date into the variable it automatically stors the timestamp of this date beeing written. Then you can read this timestamp within the host VI.

Like in your case, if your are using shared variables configured as RT FIFOs automatically generate an invisible communication loop on the target VI. So a variable configured in this manner transfers data from the time critical loop to the communication loop using an RT FIFO and then transfers the data from the communication loop to the host  using the PSP (publisher subscriber protocol). This means you don't need an additional loop for the variables.

If you want to store the timestamp of each sample you acquire, you will have to use the waveform datatyp (WDT) instead of DBL. The WDT stores the first timestamp and then the dt between the samples. You can write this directly into the variable (must be configured as WDT) and separates the values of the WDT in the host VI to do the logging!

After looking over your programming, I would recommend you visit the realtime course which discuss building realtime applications from the scratch on!

Regards, Christian

Message 4 of 4
(4,681 Views)