IfTime Statements- Interval Start Time?_Campbellsci论坛问答

When using an IfTime statement does the interval start when you upload the program to the logger, the nearest hour, or something else? I currently have it running every 5 hours for 15 minutes (see below). I am just unsure when the 5 hour interval starts (ie 5 hours after the program is uploaded to the logger, 5 hours after the nearest hour after the program is uploaded to the logger, or something entirely different).

Sub PUMP
'run the pump for 15min every 5h
If (IfTime (5,300,Min)) Then
PortSet (2,1)
EndIf
If (IfTime (20,300,Min)) Then
PortSet (2,0)
EndIf

IfTime Statements- Interval Start Time?_Campbellsci论坛问答

EndSub

Any information would be greatly appreciated. Thank you.

新对话如下:

I believe it's based on the system clock. Your pump would turn on at 05:00, 10:00, 15:00 and 20:00.

IslandMan

新对话如下:

IfTime is based on the system clock, but calculated since January 1, 1990. From the IFTime help page:

"Time is kept internally by the datalogger as the elapsed
time since January 1, 1990, at 00:00:00 hours. When the Interval divides evenly into this elapsed time, the TimeIntoInterval is set True."

The problem with a 5 hour interval is that it does not divide evenly into a 24 hour period; thus, the interval will not be true at the same time every day. For instance, I set a test program last night (to confirm my assumptions :) When the IfTime interval occurs, I am writing the timestamp to a data table. The program started running at 18:32. So far I have had output at 21:00, 2:00, and 7:00. I am expecting I will see output at 12:00, 17:00, 22:00, 3:00, 8:00, 13:00... I didn't calculate it, but the first time stamp of 21:00 should be based on a start of 1/1/90.

If you need an interval that is not evenly divisible into a 24 hour period, you'll need to look at some other method. Off the top of my head, perhaps a case statement would work.

Hope this helps,

Dana W.

分享到:

原文链接:,转发请注明来源!
海洋仪器网 仪器使用 IfTime Statements- Interval Start Time?_Campbellsci论坛问答
「IfTime Statements- Interval Start Time?_Campbellsci论坛问答」评论列表

发表评论