Shivraj8615 commited on
Commit
925a3c8
·
verified ·
1 Parent(s): 67de9a2

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +65 -0
app.py ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ def find_nearest_pipe_size(flow, pipe_sizes, commercial_pipes):
4
+ for size, max_flow in pipe_sizes.items():
5
+ if flow <= max_flow and size in commercial_pipes:
6
+ return size
7
+ return min(commercial_pipes, key=lambda x: abs(x - max(pipe_sizes.keys())))
8
+
9
+ def main():
10
+ st.set_page_config(page_title="Condensate Pipe Sizing", layout="centered")
11
+ st.title("💧 Condensate Pipe Sizing Tool")
12
+
13
+ pipe_sizes = {
14
+ 15: 160,
15
+ 20: 370,
16
+ 25: 695,
17
+ 32: 1510,
18
+ 40: 2300,
19
+ 50: 4427,
20
+ 65: 8972,
21
+ 80: 13925,
22
+ 100: 28350
23
+ }
24
+
25
+ commercial_pipes = [15, 20, 25, 40, 50, 65, 80, 100, 125, 150]
26
+
27
+ option = st.selectbox("Select Pipe Location:", ["Before Trap", "After Trap", "Header", "After Pump"])
28
+
29
+ num_connections = st.number_input("Enter number of connections:", min_value=1, step=1)
30
+
31
+ total_flow = 0
32
+ results = []
33
+
34
+ for i in range(num_connections):
35
+ flow = st.number_input(f"Enter flow for connection {i+1} (kg/h):", min_value=1.0, step=1.0, format="%.2f")
36
+ total_flow += flow
37
+
38
+ if option == "Before Trap":
39
+ final_flow = flow
40
+ pipe_size = find_nearest_pipe_size(final_flow, pipe_sizes, commercial_pipes)
41
+ results.append((flow, final_flow, pipe_size))
42
+ elif option == "After Trap":
43
+ final_flow = flow * 2
44
+ pipe_size = find_nearest_pipe_size(final_flow, pipe_sizes, commercial_pipes)
45
+ results.append((flow, final_flow, pipe_size))
46
+ elif option == "After Pump":
47
+ final_flow = flow * 3
48
+ pipe_size = find_nearest_pipe_size(final_flow, pipe_sizes, commercial_pipes)
49
+ results.append((flow, final_flow, pipe_size))
50
+
51
+ if option == "Header":
52
+ final_flow = total_flow * 2
53
+ pipe_size = find_nearest_pipe_size(final_flow, pipe_sizes, commercial_pipes)
54
+
55
+ if st.button("Calculate Pipe Sizes"):
56
+ st.write("### Recommended Pipe Sizes")
57
+
58
+ if option == "Header":
59
+ st.success(f"🔹 Header: Total Flow: {total_flow} kg/h, Final Flow: {final_flow} kg/h, Recommended Pipe: {pipe_size} mm")
60
+ else:
61
+ for i, (flow, final_flow, pipe_size) in enumerate(results, start=1):
62
+ st.success(f"🔹 Connection {i}: Input Flow: {flow} kg/h, Final Flow: {final_flow} kg/h, Recommended Pipe: {pipe_size} mm")
63
+
64
+ if __name__ == "__main__":
65
+ main()