-
Notifications
You must be signed in to change notification settings - Fork 0
/
calculator.py
27 lines (22 loc) · 1.21 KB
/
calculator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
def calculate_cooling_load(area, num_occupants, building_type, outdoor_temp, indoor_temp):
if building_type.lower() == "residential":
cooling_load = 100 * num_occupants
elif building_type.lower() == "commercial":
cooling_load = 150 * num_occupants
else:
raise ValueError("Invalid building type. Supported types: residential, commercial")
u_coefficient = 30
q_conduction = u_coefficient * area * (outdoor_temp - indoor_temp)
sensible_cooling_load = q_conduction + cooling_load
return sensible_cooling_load
try:
print("21BCE2931 CHIRANJEEVI KARANKI")
area = float(input("Enter the area of the building (in square meters): "))
num_occupants = int(input("Enter the number of occupants in the building: "))
building_type = input("Enter the type of building (residential/commercial): ")
outdoor_temp = float(input("Enter the outdoor temperature (in Celsius): "))
indoor_temp = float(input("Enter the indoor desired temperature (in Celsius): "))
cooling_load = calculate_cooling_load(area, num_occupants, building_type, outdoor_temp, indoor_temp)
print(f"The sensible cooling load is: {cooling_load} W")
except ValueError as e:
print(f"Error: {e}")