Jump to content

How to get time stamp during a running program

Recommended Posts

Hi All,

As I am new to Labview, I am asking another (possibly!) simple/naive question!

I know how to get latest y-value while running a VI. However, I do not know how to get the associated time stamp (x-value) with the y-value.

I need both the x & y values during the execution of my program to do some other things.

Please see attached code.

I used the Index Array Function. But it only gave me y-value. No time stamp!




Link to comment

1) Double-click the Convert from Dynamic Data node.

2) In the configuration dialog, select Single waveform from the data type listbox.

3) Wire a Get Waveform Components to the output of the Convert node.

You now have access to the Y array, as you did before, but now you can also retrieve the t0 and dt. These can be used to calculate the timestamp of any arbitrary index of the dataset.

Link to comment

Hi Asbo,

Thanks so much for your response!

I tried to do what you suggested (attached). Now I have (at least) two problems:

1. My y-value is no more a scalar? Can I use it as is or I need to convert it into scalar. When I connect an indicator to it, I get i, j, k, etc. If i keep this to zero, I should be OK?

2. The 't0' is just PC time. How do I use this to get t = 0, 1, 2, 3 sec etc.?

Any help would be much appreciated.

Thanks a lot!



Link to comment

The Y is an array because it's all of the Y points in a waveform. Use the Index Array node like you did before to get a specific element.

You asked for a timestamp, not an index. If you're looking to get the maximum index, get the size of the Y array and then subtract one (based indices are zero-based). In the last VI, you weren't getting the latest Y value, you were getting the first Y value in the latest block of data.


Link to comment

Hi All,

I will try to explain my problem a bit more...

When I run my VI, my pressure pump starts running, and pressure in the system starts to increase.

I want to calculate pressure (P) over time (t) ratio (P/t) at the instant the rising pressure crosses 80mmHg.

The attached VI does something close. Only thing is that I want the FIRST P/t value when this condition is met and want to use it further. So, I want that first P/t to be stored somewhere temporarily while the program is still running.

Based on the first instant of P/t when the pressure crosses 80mmHg, I want to run a motorized leakage valve for a time period proportional to P/t.

So, I have 2 problems:

(1) How to hold/latch the P/t value associated with the instant when rising pressure crosses 80mmHg.

(2) How to send voltage signal to motorized valve only for a fixed duration (range ~ 1-2 seconds), based on the detected P/t ratio.


VI Attached.


Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.