LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Elapsed Time Express VI

Solved!
Go to solution

When use Elapsed Time EXpress VI to get the elapsed time, if the elapsed time is 60 seconds, the display of this time is from 00:00:59 to 00:00:60 then change to 00:01:00. 

 

But for the Windows OS time, there is no step for changing to 00:00:60, it may be changed to from 00:00:50 to 00:01:00 directly.

 

It will take some time to change to 00:00:60, which may result in the inaccurency of time.

0 Kudos
Message 1 of 6
(1,773 Views)

Hi Sandra,

 


@Sandra421 wrote:

When use Elapsed Time EXpress VI to get the elapsed time, if the elapsed time is 60 seconds, the display of this time is from 00:00:59 to 00:00:60 then change to 00:01:00. 

 

But for the Windows OS time, there is no step for changing to 00:00:60, it may be changed to from 00:00:50 to 00:01:00 directly.

 

It will take some time to change to 00:00:60, which may result in the inaccurency of time.


Only in the very last 5ms of each minute - and only when you use the ElapsedTime string output:

This is the subVI within that ExpressVI responsible for formatting that string: it will round the seconds part to an integer…

 

Simple solution: use the ElapsedTime numeric output instead!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(1,751 Views)

@GerdW

 

Hi GerdW,

 

For this question, I use this VI to dipslay the elapsed time as a number( Elapsed Time (s) ) and string(Elapsed Time Text) in a whole loop to confirm the diference between this two format.

 

The block diagram is as following:

Sandra421_0-1694050088185.png

The dipslay includes elapsed time with this two different format, and for the number type, use <Seconds to Date/Time Function> to format the number as hours, minute and second which can help directly compared with the string type. 

 

1.When the time from 0s to 1s, the Elapsed Time(s) is a number < 1, and the number(second) of this format is 0, at the same time, the Elapsed Time Text is 0 too.

Sandra421_1-1694050638784.png

 

 

2.When the time from 1s to 2s,  the Elapsed Time(s) is a number < 2, and the number(second) of this format is 1, at the same time, the Elapsed Time Text updates to 2s faster than the Elapsed Time(s).

Sandra421_2-1694051090980.png

 

According to your reply "only in the very last 5ms of each minute", I created this VI to monitor the difference between this two format, but I fonud that the Elapsed Time Text updated faster than Elapsed Time(s), so which one type is the accurate time? And what caused this result?

 

Sincerely hope for your reply. Thanks

0 Kudos
Message 3 of 6
(1,711 Views)
Solution
Accepted by topic author Sandra421

@Sandra421 wrote:

@GerdW

 

Hi GerdW,

 

For this question, I use this VI to dipslay the elapsed time as a number( Elapsed Time (s) ) and string(Elapsed Time Text) in a whole loop to confirm the diference between this two format.

 

The block diagram is as following:

Sandra421_0-1694050088185.png

The dipslay includes elapsed time with this two different format, and for the number type, use <Seconds to Date/Time Function> to format the number as hours, minute and second which can help directly compared with the string type. 

 

1.When the time from 0s to 1s, the Elapsed Time(s) is a number < 1, and the number(second) of this format is 0, at the same time, the Elapsed Time Text is 0 too.

Sandra421_1-1694050638784.png

 

 

2.When the time from 1s to 2s,  the Elapsed Time(s) is a number < 2, and the number(second) of this format is 1, at the same time, the Elapsed Time Text updates to 2s faster than the Elapsed Time(s).

Sandra421_2-1694051090980.png

 

According to your reply "only in the very last 5ms of each minute", I created this VI to monitor the difference between this two format, but I fonud that the Elapsed Time Text updated faster than Elapsed Time(s), so which one type is the accurate time? And what caused this result?

 

Sincerely hope for your reply. Thanks


Gerd did misspeak slightly. 

 

If you look at the vi shown and the format string you see that Elapsed time as DBL, in seconds, is passed through Quotient and Remainder mod 60 to find real seconds within a minute as the remainder. Again as a  double precision floating point number.  The format string is %02d meaning interpret the  dbl as a decimal whole number, INT with two or more digits Zero padded on the left i.e. 00, 01, 02 ...10, 11, 12...100, 101, 102...etc...

 

To get a decimal whole number from a floating point number LabVIEW applies the correct IEEE 754 standard rounding known as Banker's Rounding.  n.000001 to n.49999 is rounded down, n.5000001to n.9999999 is rounded up and n.5 exactly is rounded to the closest even whole number.  The rounding is what causes you to see days HH:MM:60 in the string indicator for the last 500mSec of each minute.  Both displays are completely correct per IEEE 754.  You would also see minutes = 60 for the last half minute of each hour and hours = 24 for the last half hour of each day.  You could change the behavior by inserting round down primitives (floor) just before the format into string inputs.


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 6
(1,695 Views)
Solution
Accepted by topic author Sandra421

Hi Sandra,

 


@Sandra421 wrote:

The block diagram is as following:

Sandra421_0-1694050088185.png


You can simplify your VI like this:

No need for a string indicator, no need to convert a DBL value into a cluster just to show 3 numeric indicators…

All you need is to change the display format of a numeric indicator!

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 6
(1,685 Views)

Thanks!!   

 

Accepted this reply as solution.

 

Thanks again.😺😺

0 Kudos
Message 6 of 6
(1,670 Views)