-
Notifications
You must be signed in to change notification settings - Fork 3
/
load_status.py
59 lines (42 loc) · 1.2 KB
/
load_status.py
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
import m4
import abs
import m2
import time
from datetime import datetime as dt
dtime = dt.now()
if dtime.month < 10:
month = '0' + str(dtime.month)
else:
month = str(dtime.month)
if dtime.day < 10:
day = '0' + str(dtime.day)
else:
day = str(dtime.day)
file = str(dtime.year) + month + day + '.txt'
#f = open(file,"a")
m2 = m2.m2_monitor_client('172.20.0.12',9998)
m4 = m4.m4_monitor_client('172.20.0.12',6004)
hot = abs.abs_monitor_client('172.20.0.12',6002)
while(1):
tv = time.time()
mjd = tv/24./3600. + 40587.0 # 40587.0 = MJD0
ntime = dt.now()
secofday = ntime.hour*60*60 + ntime.minute*60 + ntime.second + ntime.microsecond*0.000001
lst_g = 0.67239+1.00273781*(mjd-40000.0)
l_plb = -67.7222222222/360.0
lst_plb = lst_g + l_plb
lst_plb_i = int(lst_plb)
lst_plb -= lst_plb_i
lst_plb = 24.0*lst_plb
lst_hh = int(lst_plb)
lst_plb = 60.0*(lst_plb - lst_hh)
lst_mm = int(lst_plb)
lst_plb = 60.0*(lst_plb -lst_mm)
lst_ss = int(lst_plb)
m4pos = m4.read_pos()
hotpos = hot.read_pos()
m2pos = m2.read_pos()
log = "%5.0f %6.1f %2d:%2d:%2d m4: %s hot: %s m2: %s" %(mjd, secofday, lst_hh, lst_mm, lst_ss, m4pos, hotpos,m2pos)
print log
time.sleep(1)
#f.write(log + "\n")