Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import numpy as np
|
| 3 |
+
|
| 4 |
+
st.set_page_config(page_title="Cooling Tower Operation", layout="centered")
|
| 5 |
+
|
| 6 |
+
st.title("Cooling Tower Operation Simulator")
|
| 7 |
+
|
| 8 |
+
# User Inputs
|
| 9 |
+
Ti = st.number_input("Hot Water Temperature (°C)", min_value=30.0, max_value=90.0, value=45.0)
|
| 10 |
+
To = st.number_input("Cold Water Temperature (°C)", min_value=10.0, max_value=Ti, value=35.0)
|
| 11 |
+
Twb = st.number_input("Wet Bulb Temperature (°C)", min_value=5.0, max_value=To, value=28.0)
|
| 12 |
+
m_water = st.number_input("Water Flow Rate (kg/s)", min_value=0.1, value=10.0)
|
| 13 |
+
|
| 14 |
+
# Constants
|
| 15 |
+
cp = 4.18 # Specific heat of water in kJ/kg°C
|
| 16 |
+
|
| 17 |
+
# Calculations
|
| 18 |
+
Q = m_water * cp * (Ti - To)
|
| 19 |
+
range_temp = Ti - To
|
| 20 |
+
approach = To - Twb
|
| 21 |
+
effectiveness = range_temp / (Ti - Twb)
|
| 22 |
+
|
| 23 |
+
# Results
|
| 24 |
+
st.subheader("Operational Results")
|
| 25 |
+
st.write(f"**Cooling Range:** {range_temp:.2f} °C")
|
| 26 |
+
st.write(f"**Approach:** {approach:.2f} °C")
|
| 27 |
+
st.write(f"**Effectiveness:** {effectiveness:.2%}")
|
| 28 |
+
st.write(f"**Heat Rejected:** {Q:.2f} kW")
|
| 29 |
+
|
| 30 |
+
# Optional Plot
|
| 31 |
+
time = np.linspace(0, 10, 100)
|
| 32 |
+
heat_loss = Q * np.exp(-0.3 * time)
|
| 33 |
+
st.line_chart({"Heat Rejected Over Time (kW)": heat_loss})
|