Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Pump Power Calculator (Streamlit)
|
| 3 |
+
Suitable for quick hydraulic/shaft/motor power estimates for pumps.
|
| 4 |
+
- Deploy: push these files to a GitHub repo and create a Streamlit app on Hugging Face Spaces / Streamlit Community Cloud.
|
| 5 |
+
- Run locally: `pip install -r requirements.txt` then `streamlit run app.py`
|
| 6 |
+
|
| 7 |
+
Author: Generated by ChatGPT
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
import streamlit as st
|
| 11 |
+
import math
|
| 12 |
+
import io
|
| 13 |
+
import csv
|
| 14 |
+
|
| 15 |
+
st.set_page_config(page_title="Pump Power Calculator", layout="centered")
|
| 16 |
+
|
| 17 |
+
st.title("Pump Power Calculator")
|
| 18 |
+
st.markdown(
|
| 19 |
+
"Calculate hydraulic power, shaft power (accounting for pump efficiency), and a recommended motor power "
|
| 20 |
+
"including a service factor. Units supported for flow: m³/s, L/s, m³/h. Head in m or ft."
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
+
# -------------------------
|
| 24 |
+
# Inputs
|
| 25 |
+
# -------------------------
|
| 26 |
+
st.header("Input parameters")
|
| 27 |
+
|
| 28 |
+
col1, col2 = st.columns(2)
|
| 29 |
+
|
| 30 |
+
with col1:
|
| 31 |
+
flow_value = st.number_input("Flow rate (value)", min_value=0.0, value=5.0, step=0.1, format="%.6f")
|
| 32 |
+
flow_unit = st.selectbox("Flow unit", ["L/s", "m³/s", "m³/h"], index=0)
|
| 33 |
+
density = st.number_input("Fluid density (kg/m³)", min_value=0.0, value=1000.0, step=1.0)
|
| 34 |
+
|
| 35 |
+
with col2:
|
| 36 |
+
head_value = st.number_input("Head (value)", min_value=0.0, value=20.0, step=0.1, format="%.6f")
|
| 37 |
+
head_unit = st.selectbox("Head unit", ["m"]()_
|