Jump to content

Waveform chart X scale not matching time correctly


Recommended Posts

Hello,

 

I am experiencing some problems with the time scale of a Waveform chart. I am using LabVIEW 2012 SP1 on a Win7 PC.

The vi here attached updates the waveform every second and shows on the Y scale the seconds passed (modulo 60).

The graph seems to flow more quickly as the X scale. After 4 minutes and 35 seconds the graphs is shown full, but the X scale is 5 minutes.

 

What is going wrong here? Is there a problem with the code?

 

post-1684-0-45927200-1366816980_thumb.pn

 

post-1684-0-53123100-1366817044_thumb.pn

 

An additional question is why the difference of the current time - initial time gives: 1 hour, 4 minutes and 35 seconds while it should be only 4 minutes and 35 seconds?

 

Any hint is welcome.

 

 

waveform_chart_time_problem.vi

Link to comment

Hi ShaunR thanks for your reply.

 

a) Loose fit is disabled (grayed out) in the waveform chart so I do not thing that is the problem. A curious thing is that if you stop the vi after 4min 35 sec, look at the properties of the waveform and click cancel, the graph gets corrected (it gets compressed of 25 seconds to the right)!

 

b) It could be the daylight saving time, but I sitll do not understand why the current time minus the time 5 minutes ago, would give 1hour and 5 minutes of difference. Both times should include the 1 hour of daylight  saving time.

 

I have attached the vi saved in LabVIEW 2009. I do not know if the behaviour is identical with versions previous than 2012.

 

Regards

waveform_chart_time_problem.vi

Edited by patufet_99
Link to comment

The time passed problem is because you're converting a double precision number back to a timestamp. When you do this you're using the double as the seconds elapsed since the epoch and will result in an absolute time. Since it's absolute things like timezone and daylight savings come into play-- you see +1 hr in Switzerland, but on the east coast USA I see +7 hours. What you probably want to do is just keep the difference as a double and configure your indicator to display as relative time rather than a raw numeric.

 

As for the x-axis wonkiness, I don't know. I've had issues with charts which use time as an axis and have never figured them out either.

Link to comment

I think you're making it too hard.

First off your loop is executing every 100 ms. I think you want it to execute every second.

Second, I'm not sure why you're updating t0 every time. Normally you would set t0 once at the start and then just update the y array. If you set your loop time to 1 sec, then also set dt to 1 sec and all will be as it should be.

 

George

Link to comment
The time passed problem is because you're converting a double precision number back to a timestamp. When you do this you're using the double as the seconds elapsed since the epoch and will result in an absolute time. Since it's absolute things like timezone and daylight savings come into play-- you see +1 hr in Switzerland, but on the east coast USA I see +7 hours. What you probably want to do is just keep the difference as a double and configure your indicator to display as relative time rather than a raw numeric.

 

As for the x-axis wonkiness, I don't know. I've had issues with charts which use time as an axis and have never figured them out either.

 

 

I think that more than daylight saving it has to do with the conversion from double to timestamp being dont to UTC rather than to the local time.

 

http://zone.ni.com/reference/en-XX/help/371361J-01/glang/to_timestamp/

 

As the display is shown in local time 4min35sec UTC = 1h4min35sec local (in Switzerland)

 

Your reply was very useful, thank you very much.

 

Patufet

 

 

I think you're making it too hard.

First off your loop is executing every 100 ms. I think you want it to execute every second.

Second, I'm not sure why you're updating t0 every time. Normally you would set t0 once at the start and then just update the y array. If you set your loop time to 1 sec, then also set dt to 1 sec and all will be as it should be.

 

George

 

 

 

I just reduced the code of another more complex vi to try to reproduce the problem so that it is clearly shown. In any case if you set the loop time to 1 sec the problem is exactly the same. In the posted vi the waveform dt=1 sec. and it is updated every second.

Edited by patufet_99
Link to comment
  • 2 weeks later...

Patufet, did NI give you have a CAR number for this bug?

 

I've seen my horizontal scale falling out of sync with the data and grid (as posted here) and think the issue you posted could be related. I'm looking to track this defect in future releases.

Link to comment
Patufet, did NI give you have a CAR number for this bug?

 

I've seen my horizontal scale falling out of sync with the data and grid (as posted here) and think the issue you posted could be related. I'm looking to track this defect in future releases.

 

mje, thanks for your reply.

 

I do not have a CAR number, I will ask for it.

 

The behaviour is the same than in my example, the grid and the graph flows faster than the time scale.

 

In my application to take screenshots of the graph I send the data to a sub-vi through a reference and then the scales, history etc, copying the values with attributes nodes. The graph data of the sub-vi matches then the time scale correctly.

Link to comment
Patufet, did NI give you have a CAR number for this bug?

 

I've seen my horizontal scale falling out of sync with the data and grid (as posted here) and think the issue you posted could be related. I'm looking to track this defect in future releases.

 

CAR Number: 406018
Link to comment
  • 3 months later...

Join the conversation

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

Guest
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.