Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

IfTime Statements- Interval Start Time?


KBurles Nov 4, 2009 12:12 AM

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

EndSub

Any information would be greatly appreciated. Thank you.


IslandMan Nov 4, 2009 11:44 AM

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


Dana Nov 4, 2009 06:36 PM

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.

Log in or register to post/reply in the forum.