LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How from clock time make time period of 15 minutes?

Hi.

I need read time from some device HHmmss (hour minutes sec). I read time periodical example every 5 sec. From this time  I need make periods of 15 minutes. 00:00.00, 00:15:00, 00:30:00 00:45:00, 01:00:00,

 

Input in labview code is device time (HHmmss) output is minutes of period 0,1,2,3,4...15min, 0,1,2,3,4....15min 0,1,2,3,4........15min;  Every 15 min .... 00:00.00, 00:15:00, 00:30:00 00:45:00, 01:00:00 period is reset and start from 0 minutes to 15 minutes.

 

Please , can you help me?

 

 

0 Kudos
Message 1 of 9
(3,932 Views)

Hi Qooler,

 

that sounds like you need to perform the MODULO math operation on your time data…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(3,907 Views)

Do you have some idea about my problem?

 

(143516) is my time format for 14h 35 min 16s, how from this make output 5

 

or expample

 

(175414) output result is number 14    (54 min - 45min= 14)

(204153) output is number 11   (41 min - 30min=11)

 

0 Kudos
Message 3 of 9
(3,874 Views)

@Qooler wrote:

Do you have some idea about my problem?



Do you?

 

You are throwing numbers around withpout explaining where on earth they are coming from.

 

You know the format of your time, but where are the reference numbers coming from? The 45 minutes and 30 minutes you are subtracting, where do they come from?

0 Kudos
Message 4 of 9
(3,868 Views)

Hi Qooler,

 

 

(175414) output result is number 14    (54 min - 45min= 14)

54 MOD 15 is 9, your result of 14 is plain wrong…

 

As I wrote before: you need to use some MODULO math:

check.png

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 9
(3,856 Views)

There are several functions in LabVIEW that give you time.Time Representations.png

As you can see, they each report time in a different fashion -- an integer number of milliseconds (from a free-running clock), a pair of strings holding the Date and Time, and a TimeStamp, an internal LabVIEW method of presenting Time as seconds since 1 Jan 1904.  You'd think that the easiest to use for purposes of elapsed time would be the "human-readable" String values, but since you are dealing with elapsed time, or time differences, the other two formats are actually simpler.

 

You can use either the Millisecond Timer or the Current Time function to measure elapsed time.  Subtract the Ending from the Starting Time value (which you get by taking a Time measurement "at the appropriate time") and subtract them.  If you are using the Millisecond Timer, your answer will be in milliseconds, which you will need to convert to minutes (I presume you can do that yourself), and if you are using Current Time, the difference, a Dbl, will be in seconds.

 

Suppose you want to run this "forward" -- you want to know "What time will it be in 15 minutes?".  Take the value of either the Millisecond Timer or Current Time and add 15 minutes in the appropriate units (milliseconds or seconds) and you should get the Final Time value that you can use, for example, in a Comparison (to see "Are We There Yet?").

 

If this didn't answer your question, please ask it again, providing further details.

 

Bob Schor

0 Kudos
Message 6 of 9
(3,844 Views)

You need to do a bit better explaining what you need, so, if this isn't it, it's your fault! 😄  I was sloppy with the number formats, but you were sloppy with the math so we're even.

 

Example_VI.png

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 7 of 9
(3,831 Views)

I'm an idiot for not grokking GerdW's solution.  Please ignore mine and, please, don't send me to the RG thread...

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 8 of 9
(3,819 Views)

Hi Jim,

 

please, don't send me to the RG thread...

Well, you had ~1 hour to think about my solution, but you insisted on using Interpolate1DArray! 😄

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 9
(3,815 Views)