Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| import math | |
| # Title and description | |
| st.title("Pipe Sizing Helper") | |
| st.write("This application helps you determine the recommended pipe diameter based on flow rate and velocity.") | |
| # Input fields for flow rate and velocity | |
| flow_rate = st.number_input("Enter the flow rate (in m³/s):", min_value=0.0, step=0.01, format="%.2f") | |
| velocity = st.number_input("Enter the permissible velocity (in m/s):", min_value=0.0, step=0.1, format="%.1f") | |
| # Calculate pipe diameter | |
| if st.button("Calculate Pipe Diameter"): | |
| if flow_rate > 0 and velocity > 0: | |
| # Formula: Diameter (D) = sqrt((4 * Q) / (π * V)) | |
| diameter = math.sqrt((4 * flow_rate) / (math.pi * velocity)) | |
| diameter_mm = diameter * 1000 # Convert to millimeters | |
| st.success(f"The recommended pipe diameter is {diameter_mm:.2f} mm.") | |
| else: | |
| st.error("Please enter positive values for both flow rate and velocity.") | |