-
Notifications
You must be signed in to change notification settings - Fork 2
/
data_storage.py
95 lines (76 loc) · 3.71 KB
/
data_storage.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
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
# /\ \ / /\
# /__\ \ / /__\
# / \ \/ / \
# This is the main file that shall be run. It calls all the rest of the modules
import serial
import csv
import graph
import gui
import formulas
import excel
#Connecting to arduino port and then setting up serial object
arduino_port = input("Enter the name of the arduino port(read it from arduino IDE)")
baud = 9600
ser = serial.Serial(arduino_port, baud)
print("Connected to Arduino port:" + arduino_port)
# Author: Animish Murthy
# Date: 18/05/23
#Reading the raw values from the arduino,
inputted=[]
for i in range(5):
getData = ser.readline()
datastring = getData.decode('utf-8')
datastring=datastring.split(',')
inputted.append(datastring)
#This creates a GUI file and stores its output(a dictionary) in the variable value
value=gui.data_entry()
#It converts to the standard units which may be different from SI units
inputted_si=inputted
for i in inputted:
suction=formulas.bar_to_m_h2o(i[1])
delivery=formulas.bar_to_m_h2o(i[2])
suction=inputted_si[1]
delivery=inputted_si[2]
#Here some of the values are converted with respect to a proportionate value of RPM which is provided by the GUI
rated=[]
single=[]
def total_head(x,y,z):
sum=x+y+z
return sum
for i in inputted_si:
single.append(formulas.ratedq(i[0],int(value['rpm_']),i[3]))
single.append(formulas.ratedh(i[0],int(value['rpm_']),total_head(i[1],i[2],int(value['guageHeight_']))))
single.append(formulas.ratedp(i[0],int(value['rpm_']),(int(value['motorEffi_'])*i[5])))
single.append(formulas.efficiency(single[0],single[1],int(value['Density_']),int(value['motorEffi_']),i[5]))
rated.append(single)
single=[]
print(rated)
# Author: Animish Murthy
# Date: 18/05/23
#This is the final list that has all the elements that we need to enter into the table
final = inputted_si
for k, item in enumerate(final):
final[k].insert(1, inputted[k][1])
final[k].insert(3, inputted[k][2])
final[k].append((int(value['motorEffi_']) * final[k][-2]))
print(type(rated[k]))
final[k].extend(rated[k])
#Creates an excel file of the pump test report and then it plots the graph
excel.excel_file(final)
graph.grapher(rated, value['capacity_'], value['head_'])
# Author: Animish Murthy
# Date: 18/05/23
# _ _
# / \ \"""\ /"""/ / \
# / \ \ \ / / / \
# / \ \ \ / / / \
# / _ \ \ \ / / / _ \
# / / \ \ \ \ / / / / \ \
# / / \ \ \ \ / / / / \ \
# / / \ \ \ \ / / / / \ \
# / """"""" \ \ \ / / / """"""" \
# / \ \ \ / / / \
# / /"""""""""\ \ \ \ / / / /""""""""""\ \
# / / \ \ \ V / / / \ \
# / / \ \ \ / / / \ \
# """"" """"" """"" """"" """"