patufet_99 Posted April 24, 2013 Report Share Posted April 24, 2013 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? 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 Quote Link to comment
ShaunR Posted April 24, 2013 Report Share Posted April 24, 2013 a) Graph set to "Loose Fit" in the properties? b) Daylight savings time? Quote Link to comment
patufet_99 Posted April 24, 2013 Author Report Share Posted April 24, 2013 (edited) 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 April 24, 2013 by patufet_99 Quote Link to comment
mje Posted April 24, 2013 Report Share Posted April 24, 2013 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. Quote Link to comment
george seifert Posted April 24, 2013 Report Share Posted April 24, 2013 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 Quote Link to comment
patufet_99 Posted April 24, 2013 Author Report Share Posted April 24, 2013 (edited) 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 April 24, 2013 by patufet_99 Quote Link to comment
patufet_99 Posted May 3, 2013 Author Report Share Posted May 3, 2013 NI confirmed me that this is a bug. Regards. Quote Link to comment
patufet_99 Posted May 7, 2013 Author Report Share Posted May 7, 2013 NI confirmed me that this is a bug. Regards. This bug seems to be specific to LabVIEW 2012. LabVIEW 2011 and previous versions work as expected. Quote Link to comment
mje Posted May 7, 2013 Report Share Posted May 7, 2013 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. Quote Link to comment
patufet_99 Posted May 8, 2013 Author Report Share Posted May 8, 2013 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. Quote Link to comment
patufet_99 Posted May 13, 2013 Author Report Share Posted May 13, 2013 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 Quote Link to comment
patufet_99 Posted August 16, 2013 Author Report Share Posted August 16, 2013 Thank you! This issue seems to have been solved with LabVIEW 2013. Quote Link to comment
shoneill Posted August 19, 2013 Report Share Posted August 19, 2013 This bug needs to be squashed in LV 2012 also, it's mucking up UIs for existing applications..... Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.