-
Notifications
You must be signed in to change notification settings - Fork 0
/
system_Data_Processor.py
52 lines (37 loc) · 1.24 KB
/
system_Data_Processor.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
from System_Data_02 import SystemData
# tester
import numpy as np
def main():
# make fake data to test
print("sterting feed..")
############ variables
nData = 100000
header = "entry_number,gps_time,rpm,water_temp,oil_pressure,pyrometer_1,pyrometer_2,gps_longitude,system_status"
fn = "C:\\Users\\ejmon\\sysData.csv"
Buffer = header #currently using this string to write header. Investigate.
####Experement
entry_number = 1
buffer_Number = 0
header = "entry_number,gps_time,rpm,water_temp,oil_pressure,pyrometer_1,pyrometer_2,gps_longitude,system_status"
fn = "C:\\Users\\ejmon\\sysData.csv"
fo = open(fn, "w+")
fo.write(header)
tmp_SysData = SystemData(entry_number) ## add line to buffer
Buffer += f"{tmp_SysData}\n"
if buffer_Number == 20:
fo.write(Buffer)
entry_number += 1
buffer_Number = 0
Buffer = ""
####
for i in range(nData): #############Run each time new data collected
tmp_SysData = SystemData(i)
Buffer += f"{tmp_SysData}\n"
if i % 1000 == 0:
print(" running ...")
print("writing..")
fo = open(fn, "w+") #########
fo.write(Buffer)
fo.close()
print("done ...")
main()