Campbell Scientific CR1000 Measurement and Control System User Manual
Page 216

Section 7. Installation
216
'One Minute Data Table
DataTable
(OneMinTable,true,-1)
OpenInterval
'sets interval same as found in CR510
DataInterval
(0,1,Min,10)
Totalize
(1, KWHH,FP2,0)
Sample
(1, KWHHold,FP2)
Totalize
(1, KvarH,FP2,0)
Sample
(1, KVarHold,FP2)
Sample
(1, StationID,FP2)
EndTable
'Clock Set Record Data Table
DataTable
(ClockSetRecord,True,-1)
Sample
(7,ClkSet(),FP2)
EndTable
'Subroutine to convert date formats (day-of-year to month and date)
Sub
DOY2MODAY
'Store Year, DOY, Hour, Minute and Second to Input Locations.
Year = InStringSplit(1)
DOY = InStringSplit(2)
Hour = InStringSplit(3)
Minute = InStringSplit(4)
Second = InStringSplit(5)
uSecond = 0
'Check if it is a leap year:
'If Year Mod 4 = 0 and Year Mod 100 <> 0, then it is a leap year OR
'If Year Mod 4 = 0, Year Mod 100 = 0, and Year Mod 400 = 0, then it
'is a leap year
LeapYear = 0
'Reset leap year status location
LeapMOD4 = Year MOD 4
LeapMOD100 = Year MOD 100
LeapMOD400 = Year MOD 400
If
LeapMOD4 = 0
Then
Leap4 = True
Else
Leap4 = False
If
LeapMOD100 = 0
Then
Leap100 = True
Else
Leap100 = False
If
LeapMOD400 = 0
Then
Leap400 = True
Else
Leap400 = False
If
Leap4 = True
Then
LeapYear = True
If
Leap100 = True
Then
If
Leap400 = True
Then
LeapYear = True
Else
LeapYear = False
EndIf
EndIf
Else
LeapYear = False
EndIf