AhmadMughal commited on
Commit
c448c2b
·
verified ·
1 Parent(s): 348f09c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -21
app.py CHANGED
@@ -4,21 +4,21 @@ from PIL import Image
4
  # Set Page Config
5
  st.set_page_config(
6
  page_title="HVAC System Calculator",
7
- page_icon="❄️",
8
  layout="wide",
9
  initial_sidebar_state="expanded",
10
  )
11
 
12
  # Title and Description
13
- st.title("❄️ HVAC System Calculator")
14
  st.markdown("""
15
- An interactive tool for HVAC calculations:
16
  - **CFM to Ton Conversion**
17
  - **Heat Load Calculation**
18
  - **System Selection**
19
  - **AC Unit Requirements**
20
 
21
- Use the sidebar to select tasks and input parameters.
22
  """)
23
 
24
  # Sidebar for User Input
@@ -34,8 +34,8 @@ task = st.sidebar.selectbox("Choose a Task", [
34
  def cfm_to_ton(cfm):
35
  return cfm / 400
36
 
37
- def calculate_heat_load(area, occupants, appliances):
38
- return (area * 20) + (occupants * 500) + appliances
39
 
40
  def recommend_system(heat_load):
41
  if heat_load <= 24000:
@@ -58,28 +58,33 @@ if task == "CFM to Ton Conversion":
58
  if cfm:
59
  tons = cfm_to_ton(cfm)
60
  st.success(f"Equivalent Tons: {tons:.2f}")
 
 
61
 
62
  elif task == "Heat Load Calculation":
63
  st.header("Heat Load Calculation")
64
- col1, col2 = st.columns(2)
 
65
  with col1:
66
- area = st.number_input("Enter Area", min_value=0.0, step=1.0)
67
- area_unit = st.selectbox("Area Unit", ["sq ft", "sq m", "sq cm", "sq mm"])
68
  with col2:
 
 
 
 
 
 
69
  occupants = st.number_input("Number of Occupants", min_value=0, step=1)
 
70
  appliances = st.number_input("Appliances Heat Load (in BTU)", min_value=0.0, step=100.0)
71
 
72
  if st.button("Calculate Heat Load"):
73
- # Convert area to square feet if needed
74
- if area_unit == "sq m":
75
- area *= 10.764
76
- elif area_unit == "sq cm":
77
- area /= 929.03
78
- elif area_unit == "sq mm":
79
- area /= 92903.04
80
-
81
- heat_load = calculate_heat_load(area, occupants, appliances)
82
- st.success(f"Heat Load: {heat_load:.2f} BTU")
83
 
84
  elif task == "System Selection":
85
  st.header("System Selection")
@@ -89,6 +94,8 @@ elif task == "System Selection":
89
  system, details = recommend_system(heat_load)
90
  st.success(f"Recommended System: {system}")
91
  st.info(f"Details: {details}")
 
 
92
 
93
  elif task == "AC Unit Requirements":
94
  st.header("AC Unit Requirements")
@@ -102,7 +109,9 @@ elif task == "AC Unit Requirements":
102
  if heat_load and capacity_per_unit:
103
  units_required = calculate_ac_units(heat_load, capacity_per_unit)
104
  st.success(f"Number of AC Units Required: {units_required}")
 
 
105
 
106
- # Add Footer
107
  st.markdown("---")
108
- st.markdown("Built with ❤️ using Streamlit")
 
4
  # Set Page Config
5
  st.set_page_config(
6
  page_title="HVAC System Calculator",
7
+ page_icon="⚙️", # Changed to an engineering-related icon
8
  layout="wide",
9
  initial_sidebar_state="expanded",
10
  )
11
 
12
  # Title and Description
13
+ st.title("⚙️ MEP HVAC System Calculator")
14
  st.markdown("""
15
+ An interactive tool for MEP engineers to perform HVAC calculations:
16
  - **CFM to Ton Conversion**
17
  - **Heat Load Calculation**
18
  - **System Selection**
19
  - **AC Unit Requirements**
20
 
21
+ Use the sidebar to select tasks and input space parameters. Detailed recommendations are provided after the calculations.
22
  """)
23
 
24
  # Sidebar for User Input
 
34
  def cfm_to_ton(cfm):
35
  return cfm / 400
36
 
37
+ def calculate_heat_load(volume, occupants, appliances):
38
+ return (volume * 5) + (occupants * 500) + appliances
39
 
40
  def recommend_system(heat_load):
41
  if heat_load <= 24000:
 
58
  if cfm:
59
  tons = cfm_to_ton(cfm)
60
  st.success(f"Equivalent Tons: {tons:.2f}")
61
+ st.markdown("### Description and Recommendation")
62
+ st.write("CFM (Cubic Feet per Minute) is the volume of air moved per minute. Converting it into tons helps select the appropriate HVAC system.")
63
 
64
  elif task == "Heat Load Calculation":
65
  st.header("Heat Load Calculation")
66
+ st.markdown("Enter the dimensions of the space:")
67
+ col1, col2, col3 = st.columns(3)
68
  with col1:
69
+ length = st.number_input("Length (in feet)", min_value=0.0, step=1.0)
 
70
  with col2:
71
+ width = st.number_input("Width (in feet)", min_value=0.0, step=1.0)
72
+ with col3:
73
+ height = st.number_input("Height (in feet)", min_value=0.0, step=1.0)
74
+
75
+ col4, col5 = st.columns(2)
76
+ with col4:
77
  occupants = st.number_input("Number of Occupants", min_value=0, step=1)
78
+ with col5:
79
  appliances = st.number_input("Appliances Heat Load (in BTU)", min_value=0.0, step=100.0)
80
 
81
  if st.button("Calculate Heat Load"):
82
+ volume = length * width * height
83
+ if volume:
84
+ heat_load = calculate_heat_load(volume, occupants, appliances)
85
+ st.success(f"Heat Load: {heat_load:.2f} BTU")
86
+ st.markdown("### Description and Recommendation")
87
+ st.write("Heat load is essential for determining the cooling requirements. Ensure to account for appliance and occupant heat contributions.")
 
 
 
 
88
 
89
  elif task == "System Selection":
90
  st.header("System Selection")
 
94
  system, details = recommend_system(heat_load)
95
  st.success(f"Recommended System: {system}")
96
  st.info(f"Details: {details}")
97
+ st.markdown("### Description and Recommendation")
98
+ st.write(f"{system} systems are typically used for spaces requiring {details} cooling capacity. Consult with a professional for final selection.")
99
 
100
  elif task == "AC Unit Requirements":
101
  st.header("AC Unit Requirements")
 
109
  if heat_load and capacity_per_unit:
110
  units_required = calculate_ac_units(heat_load, capacity_per_unit)
111
  st.success(f"Number of AC Units Required: {units_required}")
112
+ st.markdown("### Description and Recommendation")
113
+ st.write(f"For a total heat load of {heat_load:.2f} BTU, {units_required} unit(s) with a capacity of {capacity_per_unit:.2f} BTU each are required.")
114
 
115
+ # Footer
116
  st.markdown("---")
117
+ st.markdown("Built with ❤️ using Streamlit for MEP Engineers")