-
Notifications
You must be signed in to change notification settings - Fork 0
/
maint.CR1
98 lines (74 loc) · 2.54 KB
/
maint.CR1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
'CR1000 Series Datalogger
'Declare Public Variables
PreserveVariables
Public Int_Temp As Float
Public batt_volt As Float
Public PortonFlag As Boolean ' boolean menandakan bisa true atau false
Public Air_Temp
Public Switch_Count
Public switch_24hr
Public maint_mode As Boolean
Public maint_timer
Public maint_limit
'Public Alarm
'Define Constant
Const Alarm = 26
Const Comport = COM1
'Define Data Tables
DataTable (Satu_Min,maint_mode = false,-1)
DataInterval (0,60,Sec,10)
Average (1,Air_Temp,FP2,False)
Maximum (1,Air_Temp,FP2,False,False)
Minimum (1,Air_Temp,FP2,False,False)
Totalize (1,Switch_Count,FP2,False)
EndTable
DataTable (Harian,maint_mode = false,160)
DataInterval (8,24,Hr,10)
Minimum (1,batt_volt,FP2,False,False)
Maximum (1,Int_Temp,FP2,False,False)
Average (1,Air_Temp,FP2,False)
Maximum (1,Air_Temp,FP2,False,False)
Minimum (1,Air_Temp,FP2,False,False)
Totalize (1,Switch_Count,FP2,False)
EndTable
DataTable (Maint,maint_mode = true,20)
DataInterval (0,60,Sec,10)
Totalize (1,Switch_Count,FP2,False)
EndTable
'Main Program
BeginProg
maint_mode = false
' Alarm = 26 ' alarm set point to compare temp
maint_limit = 30 ' maint limit 30 second
Scan (1,Sec,0,0)
maint_timer = Timer (1,Sec,4) 'read value the timer #1
PanelTemp (Int_Temp,_50Hz) 'panel temp measurement
Battery (batt_volt) 'Battery voltage measurement
TCDiff (Air_Temp,1,mV2_5C,5,TypeT,Int_Temp,True,0,_50Hz,1.0,0) 'Type T thermocouple meas on diff
PulseCount (Switch_Count,1,1 ,2,0,0.2,0) ' Switch count on pulse channel
switch_24hr = switch_24hr + Switch_Count
If Air_Temp >= Alarm Then ' if the air temp rises above 26 then
PortSet (8,1 ) ' turn on the LED
Else ' otherwise
PortSet (8,0) ' turn off the LED
EndIf
If Air_Temp >= Alarm
PortonFlag = NOT PortonFlag ' false = true, supaya setelah mencapai alarm, lampu hidup dan mati bergantian
PortSet (8,PortonFlag)
Else
PortSet (8,0)
EndIf
If maint_mode = true Then ' if user has set the maint variable
Timer (1,Sec,0)
EndIf
If maint_timer >= maint_limit Then
Timer (1,sec,3)
maint_mode = false
EndIf
CallTable Satu_Min ' memanggil tabel menitan
CallTable Harian ' memanggil tabel harian
If TimeIntoInterval(7,24,hr) Then ' pada jam 7 pagi setiap hari
switch_24hr = 0 ' akan kembali ke 0
EndIf
NextScan
EndProg