Shivraj8615 commited on
Commit
560063f
·
verified ·
1 Parent(s): 747c020

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +57 -44
app.py CHANGED
@@ -1,44 +1,57 @@
1
- import streamlit as st
2
- import pandas as pd
3
- import numpy as np
4
- from calculation import SteamPipe
5
-
6
- # Load pre-arranged data
7
- insulation_data = pd.read_csv("insulation_data.csv")
8
- cladding_data = pd.read_csv("cladding_data.csv")
9
-
10
- # Streamlit UI Design
11
- st.set_page_config(page_title="Steam Pipe Calculator", layout="wide")
12
- st.title("🔥 Steam Pipe Heat Loss & Insulation Calculator")
13
-
14
- # Sidebar Inputs
15
- st.sidebar.header("Input Parameters")
16
- steam_flow = st.sidebar.number_input("🚀 Steam Flow (Kg/hr)", min_value=1, value=1000)
17
- inlet_pressure = st.sidebar.number_input("🔥 Inlet Steam Pressure (Kg/cm²g)", min_value=1.0, value=10.0)
18
- superheat = st.sidebar.number_input("🌡️ Degree of Superheat (°C)", min_value=0.0, value=50.0)
19
- steam_temp = st.sidebar.number_input("🌡️ Steam Temperature (°C)", min_value=100.0, value=200.0)
20
- line_size = st.sidebar.selectbox("📏 Line Size (Inch)", ["1", "2", "3", "4", "6", "8", "10"])
21
- ambient_temp = st.sidebar.number_input("🌤️ Ambient Temperature (°C)", min_value=-50.0, value=25.0)
22
- ambient_velocity = st.sidebar.number_input("💨 Ambient Air Velocity (m/s)", min_value=0.0, value=1.0)
23
- insulation_material = st.sidebar.selectbox("🛡️ Insulation Material", insulation_data["Material"].unique())
24
- cladding_material = st.sidebar.selectbox("🔩 Cladding Material", cladding_data["Material"].unique())
25
-
26
- # Perform Calculations
27
- pipe = SteamPipe(steam_flow, inlet_pressure, superheat, steam_temp, line_size, ambient_temp, ambient_velocity, insulation_material, cladding_material)
28
-
29
- outlet_temp, required_thickness, heat_loss = pipe.calculate()
30
-
31
- # Display Results
32
- st.subheader("Results")
33
- st.metric(label="Outlet Steam Temperature (°C)", value=f"{outlet_temp:.2f}")
34
- st.metric(label="Required Insulation Thickness (mm)", value=f"{required_thickness:.2f}")
35
- st.metric(label="Heat Loss per Unit Length (W/m)", value=f"{heat_loss:.2f}")
36
-
37
- # Run Streamlit App
38
- if __name__ == "__main__":
39
- st.write("🔍 Adjust inputs in the sidebar and view results dynamically!")
40
-
41
-
42
-
43
-
44
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import numpy as np
4
+ from calculation import SteamPipe
5
+
6
+ # Load pre-arranged data
7
+ insulation_data = pd.read_csv("insulation_data.csv")
8
+ cladding_data = pd.read_csv("cladding_data.csv")
9
+
10
+ # Streamlit UI Design
11
+ st.set_page_config(page_title="Steam Pipe Calculator", layout="wide")
12
+ st.title("🔥 Steam Pipe Heat Loss & Insulation Calculator")
13
+
14
+ # Sidebar Inputs
15
+ st.sidebar.header("Input Parameters")
16
+ steam_flow = st.sidebar.number_input("🚀 Steam Flow (Kg/hr)", min_value=1, value=1000)
17
+ inlet_pressure = st.sidebar.number_input("🔥 Inlet Steam Pressure (Kg/cm²g)", min_value=1.0, value=10.0)
18
+ superheat = st.sidebar.number_input("🌡️ Degree of Superheat (°C)", min_value=0.0, value=50.0)
19
+ steam_temp = st.sidebar.number_input("🌡️ Steam Temperature (°C)", min_value=100.0, value=200.0)
20
+ line_size = st.sidebar.selectbox("📏 Line Size (Inch)", ["1", "2", "3", "4", "6", "8", "10"])
21
+ ambient_temp = st.sidebar.number_input("🌤️ Ambient Temperature (°C)", min_value=-50.0, value=25.0)
22
+ ambient_velocity = st.sidebar.number_input("💨 Ambient Air Velocity (m/s)", min_value=0.0, value=1.0)
23
+ insulation_material = st.sidebar.selectbox("🛡️ Insulation Material", insulation_data["Material"].unique())
24
+ cladding_material = st.sidebar.selectbox("🔩 Cladding Material", cladding_data["Material"].unique())
25
+ user_insulation_thickness = st.sidebar.number_input("📏 User-defined Insulation Thickness (mm)", min_value=0.0, value=0.0)
26
+
27
+ # Perform Calculations
28
+ pipe = SteamPipe(
29
+ steam_flow,
30
+ inlet_pressure,
31
+ superheat,
32
+ steam_temp,
33
+ line_size,
34
+ ambient_temp,
35
+ ambient_velocity,
36
+ insulation_material,
37
+ cladding_material,
38
+ user_insulation_thickness if user_insulation_thickness > 0 else None
39
+ )
40
+
41
+ outlet_temp, required_thickness, heat_loss = pipe.calculate()
42
+
43
+ # Display Results
44
+ st.subheader("Results")
45
+ st.metric(label="Outlet Steam Temperature (°C)", value=f"{outlet_temp:.2f}")
46
+ st.metric(label="Required Insulation Thickness (m)", value=f"{required_thickness:.4f}")
47
+ st.metric(label="Heat Loss per Unit Length (W/m)", value=f"{heat_loss:.2f}")
48
+
49
+ # Run Streamlit App
50
+ if __name__ == "__main__":
51
+ st.write("🔍 Adjust inputs in the sidebar and view results dynamically!")
52
+
53
+
54
+
55
+
56
+
57
+