-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathlive_demo.py
154 lines (117 loc) · 5.74 KB
/
live_demo.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
import streamlit as st
import time
import numpy as np
import pandas as pd
st.set_page_config(
page_title='Sirkülasyon Testi',
layout="wide",
initial_sidebar_state="collapsed",
)
st.sidebar.markdown('''
### Sirkülasyon Testi
Yapılacak değişiklikler programı resetler.
''')
marka = st.sidebar.text_input("Pompa Markası:","Brand")
model = st.sidebar.text_input("Pompa Modeli:","Model")
mod = st.sidebar.text_input("Çalıştırma Modu:","dP5.0")
zamandamgasi = time.strftime("]_%Y%b%d_%H.%M.%S")
isim = marka+"_"+model+"_["+mod+zamandamgasi
i = 0
t = 0
st.sidebar.write("Otomatik Vana Modunda Deney")
Dint = st.sidebar.number_input("Başlangıç Noktası:",value=15.0)
Dfin = st.sidebar.number_input("Bitiş Noktası:",value=70.0)
ds = st.sidebar.number_input("Adım Aralığı",value=0.25)
dt = st.sidebar.number_input("Adımlar Arası Periyot",value=8)
if st.sidebar.button("Otomatik Modda Kayıt Başlat"):
kaydet = 1
else:
kaydet = 0,
st.sidebar.write("Manuel Vana Ayarı")
D = st.sidebar.number_input("Vana Açıklığı [0:Kapalı -90:Açık]",value=0.0)
if st.sidebar.button("Ayarla"):
yaz(64,[int(D*4)])
sozluk =[
['Date' ,"Tarih" ,"YMD" ,"" ],
['Time' ,"Zaman" ,"HMS" ,"" ],
['Temperature' ,"Sıcaklık" ,"T" ,"°C" ],
['Flow_Rate' ,"Debi" ,"Q" ,"m³/saat" ],
['Valve_Aperture' ,"Vana Açıklığı" ,"D" ,"°" ],
['Static_Pressure' ,"Durağan Basınç" ,"P" ,"Bar" ],
['Suction_Pressure' ,"Emme Basıncı" ,"P1" ,"Bar" ],
['Discharge_Pressure' ,"Basma Basıncı" ,"P2" ,"Bar" ],
['Voltage' ,"Gerilim" ,"V" ,"V" ],
['Current' ,"Akım" ,"I" ,"A" ],
['Measured_Frequency' ,"Ölçülen Frekans" ,"f" ,"Hz" ],
['Active_Power' ,"Aktif Güç" ,"PAP" ,"W" ],
['Reactive_Power' ,"Reaktif Güç" ,"QRP" ,"VAr" ],
['Apperent_Power' ,"Görünür Güç" ,"SAP" ,"VA" ],
['Phase_Voltage_Angle' ,"Faz Gerilim Açısı" ,"PVA" ,"°" ],
['Phase_Current_Angle' ,"Faz Akım Açısı" ,"PCA" ,"°" ],
['Cos_Phi' ,"Cos_Phi" ,"PHI" ,"" ],
['Power_Factor' ,"Güç Faktörü" ,"PF" ,"" ],
['Differential_Pressure' ,"Fark Basıncı" ,"DP" ,"Bar" ],
['Head' ,"Basma Yüksekliği" ,"H" ,"m" ],
['Hydraulic_Power' ,"Hidrolik Güç" ,"PHYD" ,"W" ],
['Efficiency' ,"Verimlilik" ,"ETA" ,"%" ]
]
varis = []
for i in sozluk: varis.append(i[0]) #sozluk ilk sütun (Türkçe için 0 yerine 1. sütun seçilebilir.)
df = pd.DataFrame(columns=varis)
buffy = pd.DataFrame(columns=varis)
col = st.columns(4)
###################################### G R A F İ K L E R #############################################
col[0].subheader("Debi & Basma Yüksekliği [m³/h,m] \n Flow Rate & Head")
QHt = col[0].line_chart()
col[0].subheader("Hidrolik Güç & Verimlilik [W,%] \n Hydraulic Power & eta")
PHYDETAt = col[0].line_chart()
col[1].subheader("Emme & Basma Basınçları [Bar] \n Suction & Discharge Pressure")
P1P2t = col[1].line_chart()
col[1].subheader("Elektrik Güçleri [W, VA, VAr] \n Active, Reactive & Apperent Power" )
PAPQRPSAP = col[1].line_chart()
col[2].subheader("cos(φ) & Güç Faktörü \n cos(φ) & Power Factor")
PHIPFt = col[2].line_chart()
col[2].subheader("Faz Gerilim & Akım Açıları [°] \n Phase Voltage & Current Angles")
PVAPCAt = col[2].line_chart()
###################################### M E T R İ K L E R ##############################################
col[3].write(f"Deney Kimliği: \n {isim}")
YMDt = col[3].empty()
HMSt = col[3].empty()
Tt = col[3].empty()
Dt = col[3].empty()
Pt = col[3].empty()
Vt = col[3].empty()
ft = col[3].empty()
##################################### D E M O ##########################################################
df = pd.read_excel("demo_data.xlsx",index_col=0)
######################################### D Ö N G Ü ####################################################
for i in range(len(df)):
buff=df.iloc[i]
with Tt:
st.metric("Hat Sıcaklığı",f"{buff[2]} °C")
with YMDt:
st.metric("Tarih",buff[0])
with HMSt:
st.metric("Saat",buff[1])
with Dt:
st.metric("Vana Açıklığı",f"{buff[4]} °")
with Pt:
st.metric("Durağan Basınç",f"{buff[5]} Bar")
with Vt:
st.metric("Gerilim",f"{buff[8]} V")
with ft:
st.metric("Ölçülen Frekans",f"{buff[10]} Hz")
QHt.add_rows([[float(buff[3]),float(buff[19])]])
PHYDETAt.add_rows([[float(buff[20]),float(buff[21])]])
P1P2t.add_rows([[float(buff[6]),float(buff[7])]])
PHIPFt.add_rows([[float(buff[16]),float(buff[17])]])
PAPQRPSAP.add_rows([[float(buff[11]),float(buff[12]),float(buff[13])]])
PVAPCAt.add_rows([[float(buff[14]),float(buff[15])]])
time.sleep(0.1)
# if kaydet == 1:
# if t%dt==0 and Dint<Dfin:
# Dint=Dint+ds
# yaz(64,[int(Dint*4)])
# elif Dint>=Dfin:
# df.to_excel(f"{isim}.xlsx")
# kaydet=0