-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdados_simulator.py
53 lines (51 loc) · 3.39 KB
/
dados_simulator.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
def create_instance():
import threading
threading.Thread(target=simulator).start()
def simulator():
import time
import datetime
lines ='''P1, 1289Od, 1.23e-2, 2.07e-2, 2.87e-2, 6.35e-2, 0.00e+0, 0.00e+0, 67}, 2019-03-19 11:55:00
P1, 1289Od, 1.42e-2, 2.77e-2, 2.79e-2, 1.00e-13, 0.00e+0, 0.00e+0, 57}, 2019-03-19 11:55:01
P1, 1289Od, 1.41e-2, 1.38e-2, 2.83e-2, 4.23e-2, 0.00e+0, 0.00e+0, 6D}, 2019-03-19 11:55:03
P1, 1289Od, 1.24e-2, 1.00e-13, 2.74e-2, 1.00e-13, 0.00e+0, 0.00e+0, 69}, 2019-03-19 11:55:05
P1, 1289Od, 1.08e-2, 1.00e-13, 2.79e-2, 4.23e-2, 0.00e+0, 0.00e+0, 5E}, 2019-03-19 11:55:07
P1, 1289Od, 1.21e-2, 2.07e-2, 2.83e-2, 4.23e-2, 0.00e+0, 0.00e+0, 64}, 2019-03-19 11:55:09
P1, 1289Od, 8.78e-3, 1.38e-2, 1.99e-2, 1.00e-13, 0.00e+0, 0.00e+0, 53}, 2019-03-19 11:57:36
P1, 1289Od, 7.69e-3, 1.00e-13, 1.87e-2, 1.00e-13, 0.00e+0, 0.00e+0, 68}, 2019-03-19 11:57:37
P1, 1289Od, 2.11e-2, 3.46e-2, 2.07e-2, 8.47e-2, 0.00e+0, 0.00e+0, 62}, 2019-03-19 11:57:39
P1, 1289Od, 1.11e-1, 1.11e-1, 2.08e-2, 2.11e-2, 0.00e+0, 0.00e+0, 67}, 2019-03-19 11:57:41
P1, 1289Od, 6.91e-3, 6.91e-3, 2.01e-2, 1.00e-13, 0.00e+0, 0.00e+0, 5D}, 2019-03-19 11:57:43
P1, 1289Od, 1.00e-13, 1.00e-13, 1.95e-2, 1.00e-13, 0.00e+0, 0.00e+0, 53}, 2019-03-19 11:57:45
P1, 1289Od, 1.00e-13, 1.00e-13, 2.02e-2, 4.23e-2, 0.00e+0, 0.00e+0, 6A}, 2019-03-19 11:57:47
P1, 1289Od, 1.00e-13, 1.00e-13, 1.96e-2, 1.00e-13, 0.00e+0, 0.00e+0, 50}, 2019-03-19 11:57:49
P1, 1289Od, 3.46e-3, 6.91e-3, 2.03e-2, 4.23e-2, 0.00e+0, 0.00e+0, 64}, 2019-03-19 11:57:51
P1, 1289Od, 7.78e-3, 2.07e-2, 1.96e-2, 1.00e-13, 0.00e+0, 0.00e+0, 5C}, 2019-03-19 11:57:53
P1, 1289Od, 5.83e-3, 1.00e-13, 1.90e-2, 1.00e-13, 0.00e+0, 0.00e+0, 68}, 2019-03-19 11:57:55
P1, 1289Od, 4.38e-3, 1.00e-13, 1.84e-2, 1.00e-13, 0.00e+0, 0.00e+0, 6C}, 2019-03-19 11:57:57
P1, 1289Od, 5.01e-3, 6.91e-3, 1.85e-2, 2.11e-2, 0.00e+0, 0.00e+0, 6B}, 2019-03-19 11:57:59
P1, 1289Od, 3.46e-2, 3.46e-2, 1.79e-2, 1.00e-13, 0.00e+0, 0.00e+0, 51}, 2019-03-19 11:58:01
P1, 1289Od, 6.91e-3, 6.91e-3, 1.87e-2, 4.23e-2, 0.00e+0, 0.00e+0, 64}, 2019-03-19 11:58:03
P1, 1289Od, 3.46e-3, 1.00e-13, 1.88e-2, 2.11e-2, 0.00e+0, 0.00e+0, 5D}, 2019-03-19 11:58:05
P1, 1289Od, 1.73e-3, 1.00e-13, 1.95e-2, 4.23e-2, 0.00e+0, 0.00e+0, 52}, 2019-03-19 11:58:07
P1, 1289Od, 1.12e-2, 2.07e-2, 1.96e-2, 2.11e-2, 0.00e+0, 0.00e+0, 64}, 2019-03-19 11:58:09
P1, 1289Od, 1.02e-2, 6.91e-3, 1.96e-2, 2.11e-2, 0.00e+0, 0.00e+0, 6F}, 2019-03-19 11:58:11
P1, 1289Od, 7.62e-3, 1.00e-13, 2.03e-2, 4.23e-2, 0.00e+0, 0.00e+0, 58}, 2019-03-19 11:58:13
P1, 1289Od, 1.09e-2, 2.07e-2, 2.03e-2, 2.11e-2, 0.00e+0, 0.00e+0, 61}, 2019-03-19 11:58:15
P1, 1289Od, 8.17e-3, 1.00e-13, 2.04e-2, 2.11e-2, 0.00e+0, 0.00e+0, 55}, 2019-03-19 11:58:17
P1, 1289Od, 1.13e-2, 2.07e-2, 2.11e-2, 4.23e-2, 0.00e+0, 0.00e+0, 6E}, 2019-03-19 11:58:19
P1, 1289Od, 1.25e-2, 2.07e-2, 2.17e-2, 4.23e-2, 0.00e+0, 0.00e+0, 6D}, 2019-03-19 11:58:21
P1, 1289Od, 1.18e-2, 6.91e-3, 2.17e-2, 2.11e-2, 0.00e+0, 0.00e+0, 6E}, 2019-03-19 11:58:23
P1, 1289Od, 1.12e-2, 6.91e-3, 2.17e-2, 2.11e-2, 0.00e+0, 0.00e+0, 64}, 2019-03-19 11:58:25
'''
for line in lines.split('\n'):
try:
spline=line.split(', ')
ch1=float(spline[2])
ch2=float(spline[4])
except:
continue
timestamp = str(datetime.datetime.now())
print(f'channel#1= {ch1}, channel#2= {ch2}, timestamp={timestamp}')
time.sleep(1)
if __name__=='__main__':
simulator()