LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Wrong timestamp on waveform chart

Solved!
Go to solution

Dear Community members, 

I am having a hard time with fixing the timestamp on waveform chart. I am sharing a pseudo code of my problem. I am trying to get multiple plots on the wavechart. I am bundling all the data and passing to waveform chart. I also set the properties as "system time" so that it gets time stamp on X axis. However, for some reason, the time stamp starts from 1903.

 

Jarir_0-1689283573865.pngJarir_1-1689283675358.png

 

So I tried "build waveform", it fixes the issue with date and time. However, I cannot add multiple plots in it. 

Jarir_2-1689283765262.png

Can you suggest a solution for this? Thank you. 

 

 

0 Kudos
Message 1 of 11
(1,578 Views)
Solution
Accepted by topic author Jarir

Just set the offset and multiplier for the x axis accordingly:

 

altenbach_0-1689290848640.png

 

Message 2 of 11
(1,562 Views)

In your Chart, did you specify the X axis as "Absolute time", and did you plot your data as a 1D (or 2D if multiple channels) Array?  Are you in Alaska?

 

The reason your Time axis starts at 4 pm on the day before 1 Jan 1904 is that corresponds to t = 0 in Time Zone UTC-8, which corresponds to midnight on 1 Jan 1904, the "time 0" for LabVIEW's TimeStamp "time" data type.  In the US, Alaska is UTC-8.  If you change the Chart to plot "relative time", the X axis values would start at 0.

 

Bob Schor

0 Kudos
Message 3 of 11
(1,541 Views)

@Jarir wrote:

So I tried "build waveform", it fixes the issue with date and time. However, I cannot add multiple plots in it. 


That chart can accept an array of waveforms, each element being a different plot.  Use a FOR loop or Build Array to create this array.

 

Here is an example from another thread:


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 11
(1,511 Views)

@crossrulz wrote:
That chart can accept an array of waveforms, each element being a different plot.  Use a FOR loop or Build Array to create this array.

 

This will dramatically increase the complexity of the underlying data structures because each point is basically it's own waveform with its own t0 definition! I really don't recommend that for typical use. You might want to do that if the points are not spaced equally in time, but that's obviously not the case here, where dt is a constant 0.5s

 

After defining t0 and dt as I showed earlier, you can easily add as many plots as you want, either as an array or cluster. My picture above already shows a chart with two traces. That's all you ever need! Keep it simple!!!

0 Kudos
Message 5 of 11
(1,503 Views)

I was looking for this to keep the code simple. Thank you!

0 Kudos
Message 6 of 11
(1,479 Views)

I have two questions. Could you please help?

 

a. Why did you connect the error of property node to the while loop?

b. What will happen if I leave the XScale Multiplier blank? or what if it doesn't match the sampling rate of the loop?

 

Thank you.

0 Kudos
Message 7 of 11
(1,358 Views)

The problem I am facing is that for some reason I am having different "wait time" for each loop. Therefore, the XAxis Multiplier does not match with the sampling rate. So, it changes the time stamp. For example, after 8 hours of experiment. It is 10.10AM. But it shows 8.05 AM or something like that. Do you know a way to fix this?

0 Kudos
Message 8 of 11
(1,348 Views)

@Jarir wrote:

I have two questions. Could you please help?

 

a. Why did you connect the error of property node to the while loop?

b. What will happen if I leave the XScale Multiplier blank? or what if it doesn't match the sampling rate of the loop?.


a. Strandard practice for a dataflow language. we want the property node to execute before the while loop. Wihtout the error wire, the while loop and property node run in parallel.

 

b. The multiplier is the time between points in seconds. If you set it to any random value, your time axis will be wrong. It needs to be based on the update rate of the chart, i.e. the loop rate. You cannot leave it blank, but if you eliminate it, it will assume 1. (or whatever the last setting was when the VI was saved).

0 Kudos
Message 9 of 11
(1,340 Views)

Is there any other way to get the timestamp only when the loop runs? I can't set a constant xscale multiplier because the wait time for loop depends on one instrument's response, and it varies every loop. Could you please suggest what to do in this situation?

 

Thanks,

Jarir

0 Kudos
Message 10 of 11
(1,326 Views)