Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi speed fan #115

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion copper/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ def __init__(self, path=chiller_lib, rating_std="", export=False):
and not "degradation_coefficient" in p
and not "indoor_fan_speeds_mapping" in p
and not "indoor_fan_speeds" in p
and not "infdoor_fan_curve_coef" in p
wanhanlong1130 marked this conversation as resolved.
Show resolved Hide resolved
and not "indoor_fan_curve" in p
):
obj_args[p] = vals[p]
elif (
Expand Down Expand Up @@ -117,6 +119,8 @@ def load_obj(self, data):
and not "degradation_coefficient" in p
and not "indoor_fan_speeds_mapping" in p
and not "indoor_fan_speeds" in p
and not "infdoor_fan_curve_coef" in p
and not "indoor_fan_curve" in p
):
obj_args[p] = data[p]

Expand Down Expand Up @@ -191,6 +195,7 @@ def find_set_of_curves_from_lib(self, filters=[], part_eff_flag=False):
"part_eff_ref_std",
"indoor_fan_speeds_mapping",
"indoor_fan_speeds",
"infdoor_fan_curve_coef",
]

# Set the equipment properties
Expand All @@ -204,7 +209,11 @@ def find_set_of_curves_from_lib(self, filters=[], part_eff_flag=False):
elif p in prop_to_default:
obj_args[p] = sign_eqp_class.parameters[p].default
elif (
"part_eff" in p or "alt" in p or "degradation_coefficient" in p
"part_eff" in p
or "alt" in p
or "degradation_coefficient" in p
or "infdoor_fan_curve_coef" in p
or "indoor_fan_curve" in p
):
pass
else:
Expand Down
84 changes: 58 additions & 26 deletions copper/unitarydirectexpansion.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,15 @@ def __init__(
"capacity_fraction": 1.0,
},
},
infdoor_fan_curve_coef={
"type": "cubic",
"1": 0.63 * 0.0408,
"2": 0.63 * 0.088,
"3": -0.63 * 0.0729,
"4": 0.63 * 0.9437,
},
indoor_fan_speeds=1,
indoor_fan_curve=0,
fan_power_unit="kW",
):
global log_fan
Expand Down Expand Up @@ -153,8 +161,9 @@ def __init__(
self.indoor_fan_speeds_mapping = indoor_fan_speeds_mapping
self.indoor_fan_speeds = indoor_fan_speeds
self.indoor_fan_power = indoor_fan_power
self.infdoor_fan_curve_coef = infdoor_fan_curve_coef
self.fan_power_unit = fan_power_unit

self.indoor_fan_curve = indoor_fan_curve
# Define rated temperatures
# air entering drybulb, air entering wetbulb, entering condenser temperature, leaving condenser temperature
aed, self.aew, ect, lct = self.get_rated_temperatures()
Expand Down Expand Up @@ -202,36 +211,59 @@ def __init__(
plf_f_plr.out_max = 1
self.set_of_curves.append(plf_f_plr)

# default fan curve
self.default_fan_curve = Curve(
eqp=self, c_type=self.infdoor_fan_curve_coef["type"]
)
self.default_fan_curve.coeff1 = self.infdoor_fan_curve_coef["1"]
self.default_fan_curve.coeff2 = self.infdoor_fan_curve_coef["2"]
self.default_fan_curve.coeff3 = self.infdoor_fan_curve_coef["3"]
self.default_fan_curve.coeff4 = self.infdoor_fan_curve_coef["4"]

def calc_fan_power(self, capacity_ratio):
# Full flow/power
ratio = capacity_ratio
wanhanlong1130 marked this conversation as resolved.
Show resolved Hide resolved
if capacity_ratio == 1 or self.indoor_fan_speeds == 1:
return self.indoor_fan_power
else:
capacity_ratios = []
fan_power_fractions = []
for speed_info in self.indoor_fan_speeds_mapping.values():
capacity_ratios.append(speed_info["capacity_fraction"])
fan_power_fractions.append(speed_info["fan_power_fraction"])
# Minimum flow/power
if capacity_ratio <= capacity_ratios[0]:
return self.indoor_fan_power * fan_power_fractions[0]
elif capacity_ratio in capacity_ratios:
return (
self.indoor_fan_power
* fan_power_fractions[capacity_ratios.index(capacity_ratio)]
)
else:
# In between-speeds: determine power by linear interpolation
for i, ratio in enumerate(capacity_ratios):
if (
ratio < capacity_ratio
and capacity_ratios[i + 1] > capacity_ratio
):
a = (fan_power_fractions[i + 1] - fan_power_fractions[i]) / (
capacity_ratios[i + 1] - capacity_ratios[i]
)
b = fan_power_fractions[i] - a * capacity_ratios[i]
return self.indoor_fan_power * (a * capacity_ratio + b)
if self.indoor_fan_curve == 0:
wanhanlong1130 marked this conversation as resolved.
Show resolved Hide resolved
capacity_ratios = []
fan_power_fractions = []
for speed_info in self.indoor_fan_speeds_mapping.values():
capacity_ratios.append(speed_info["capacity_fraction"])
fan_power_fractions.append(speed_info["fan_power_fraction"])
# Minimum flow/power
if capacity_ratio <= capacity_ratios[0]:
return self.indoor_fan_power * fan_power_fractions[0]
elif capacity_ratio in capacity_ratios:
return (
self.indoor_fan_power
* fan_power_fractions[capacity_ratios.index(capacity_ratio)]
)
else:
# In between-speeds: determine power by linear interpolation
for i, ratio in enumerate(capacity_ratios):
if (
ratio < capacity_ratio
and capacity_ratios[i + 1] > capacity_ratio
):
a = (
fan_power_fractions[i + 1] - fan_power_fractions[i]
) / (capacity_ratios[i + 1] - capacity_ratios[i])
b = fan_power_fractions[i] - a * capacity_ratios[i]
return self.indoor_fan_power * (a * capacity_ratio + b)
else: # using curve
defualt_coef = 1 # can update this coef later
wanhanlong1130 marked this conversation as resolved.
Show resolved Hide resolved
default_min_fan_power = (
self.indoor_fan_power * 0.25
) # default min fan power
power_factor = self.default_fan_curve.evaluate(
x=defualt_coef * ratio, y=0
wanhanlong1130 marked this conversation as resolved.
Show resolved Hide resolved
) # x:ff factor
if self.indoor_fan_power * power_factor > default_min_fan_power:
return self.indoor_fan_power * power_factor
else:
return default_min_fan_power

def calc_rated_eff(
self, eff_type="part", unit="cop", output_report=False, alt=False
Expand Down
7 changes: 7 additions & 0 deletions tests/test_unitarydirectexpansion.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,3 +258,10 @@ def test_get_ranges(self):
ranges = self.dx_unit_dft.get_ranges()
assert isinstance(ranges, dict)
assert len(ranges) == 5


# Run the tests
import unittest

if __name__ == "__main__":
unittest.main()
wanhanlong1130 marked this conversation as resolved.
Show resolved Hide resolved
Loading