LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get time stamp for waveform build

Hi! I am trying to build a waveform using which has an inconsistent start time. I tried to index the first value in the time array and convert it to a time stamp,but I am obviously doing something wrong. I have attached a VI of what I am trying to do. Thanks for your help!!
0 Kudos
Message 1 of 10
(4,522 Views)
What is the actual numeric value of that first element in your time array that you are feeding into your "To Time Stamp" block?

Unless its value is somewhere around 3 x 10^9, then it probably doesn't represent the number of seconds elapsed since Jan 1, 1904, and it therefore won't convert to the timestamp you're hoping for in LabVIEW. And that probably means that the time array values in your "US Data" control actually represent elapsed times relative to some other date.

Explain a little more about the "time array" values that you have, and what reference time they might be relative to, and we can get you pointed in the right direction.

--John
Message 2 of 10
(4,505 Views)
Thanks for your help! The time array is made up of single digit decimals, e.g. I was trying to start the x-axis of the graph at 5.6, which is seconds. Is there an easy to convert this into the needed format??
0 Kudos
Message 3 of 10
(4,497 Views)
Graphs have gotten trickier since NI introduced the Waveform data type a few versions back. There are now even more graph configuration gotchas than there used to be, and there used to be plenty!

Right-click on your graph and see if "Ignore Time Stamp" is checked. If so, that's the reason your data is being plotted starting at t=0 (if, indeed, that's the behavior you're seeing).

If instead you're seeing your data being plotted at absolute times on January 1, 1904, then the time stamp isn't being ignored, but it is being treated in an absolute manner (elapsed time since 1/1/1904). This will be apparent if you right-click on the graph, choose X Scale >> Formatting, and see "Absolute time" selected in the listbox. You can override this by choosing "Relative time" instead, or any of the options at the top.

If you don't care so much about absolute time when managing your datasets, then you might want to avoid the Waveform data type altogether. The good old Waveform Graph is also plenty happy to take non-Waveform inputs. Check out the Waveform Graph.vi example that ships with LabVIEW to see what I'm talking about.

Hope that helps,
John
Message 4 of 10
(4,486 Views)
Thanks again, I am actually re-writing an old application and thought I would update it with the new waveform configuration. I do like the additonal VI's avaliable with the waveform bundle, however it does seem a bit tricky to me. Thanks for your input, I will try your suggestions!
0 Kudos
Message 5 of 10
(4,474 Views)
I am indeed seeing the behaviours you mentioned. If I create a timestap of say "10" as my VI jpeg shows I see an x-axis starting with 1:00:10.000 AM - 1/1/1904. That is in absolute time, when I switch to relative time I get zeros all across the axis. There must be a way to convert "10", e.g. 10 seconds, to an appropriate tag. I have come across this several times and always revert back to the old waveform graphs but I would really like solve this one!!
0 Kudos
Message 6 of 10
(4,472 Views)
Select one of the formats besides "XX time" and your problem will be solved. I usually use SI, but that is a personal choice. See the screenshot for an example (LV7.1, other versions should be similar).

On a side note, the timestamp is really a 128 bit fixed point number, with 64 bits of integer and 64 bits of fraction. It is signed, so will handle negative numbers as easily as positive, allowing it to handle about the age of the universe with femtosecond range resolution. An example of this capability used on an NI product is the graph on the NI-SCOPE Soft Front Panel.
Message 7 of 10
(4,464 Views)
That seems to have done the trick!! I used Floating Point because when I used SI Notation, it started at 10 but did not increase in uniform units. For example the x-axis look like: 10 10 11 12 12 12 13 14.
0 Kudos
Message 8 of 10
(4,460 Views)
If you want the x scale to show something like 00:00:05.70, 00:00:05.71, etc., instead of using the build waveform, use the regular bundle with your t0, dt, and y array. Then set the x scale formatting for releative time and 2 digits of precision.
0 Kudos
Message 9 of 10
(4,452 Views)
My apologies. I set up my screenshot in haste. If you set the digits of precision to something other than 0, the repeating number issue will go away with SI units as well.
0 Kudos
Message 10 of 10
(4,431 Views)