diff --git a/copper/data/equipment_references.json b/copper/data/equipment_references.json index ef72c15..c3a446f 100644 --- a/copper/data/equipment_references.json +++ b/copper/data/equipment_references.json @@ -63,7 +63,7 @@ "reducedplr": [1.0, 0.75, 0.5, 0.25], "weightingfactor": [0.02, 0.617, 0.238, 0.125] }, - "outdoor_unit_inlet_air_dry_bulb_rated": 35, + "outdoor_unit_inlet_air_dry_bulb_rated": 35.06, "outdoor_unit_inlet_air_dry_bulb_reduced": 18.3, "cooling_coil_inlet_air_wet_bulb_rated": 19.44 }, diff --git a/copper/library.py b/copper/library.py index 83c3ac2..18bea17 100644 --- a/copper/library.py +++ b/copper/library.py @@ -46,6 +46,10 @@ def __init__(self, path=chiller_lib, rating_std="", export=False): and not "indoor_fan_curve_coef" in p and not "indoor_fan_curve" in p and not "indoor_fan_power_unit" in p + and not "compressor_stage" in p + and not "compressor_stage_input" in p + and not "control_power" in p + and not "control_power_unit" in p ): obj_args[p] = vals[p] elif ( @@ -123,6 +127,10 @@ def load_obj(self, data): and not "indoor_fan_curve_coef" in p and not "indoor_fan_curve" in p and not "indoor_fan_power_unit" in p + and not "compressor_stage" in p + and not "compressor_stage_input" in p + and not "control_power" in p + and not "control_power_unit" in p ): obj_args[p] = data[p] @@ -199,6 +207,10 @@ def find_set_of_curves_from_lib(self, filters=[], part_eff_flag=False): "indoor_fan_speeds", "indoor_fan_curve_coef", "indoor_fan_power_unit", + "compressor_stage", + "compressor_stage_input", + "control_power_unit", + "control_power" ] # Set the equipment properties @@ -218,6 +230,8 @@ def find_set_of_curves_from_lib(self, filters=[], part_eff_flag=False): or "indoor_fan_curve_coef" in p or "indoor_fan_curve" in p or "indoor_fan_power_unit" in p + or "control_power" in p + or "control_power_unit" in p ): pass else: diff --git a/copper/unitarydirectexpansion.py b/copper/unitarydirectexpansion.py index 5bf45a5..50d4a07 100644 --- a/copper/unitarydirectexpansion.py +++ b/copper/unitarydirectexpansion.py @@ -33,6 +33,8 @@ def __init__( ref_net_cap=None, part_eff_unit="", set_of_curves=[], + set_of_curves_1=[], + set_of_curves_2=[], part_eff_ref_std="ahri_340/360", part_eff_ref_std_alt=None, model="simplified_bf", @@ -61,6 +63,10 @@ def __init__( indoor_fan_speeds=1, indoor_fan_curve=False, indoor_fan_power_unit="kW", + control_power = 100, + control_power_unit = "kW", + compressor_stage_input=False, + compressor_stages=[0.3, 0.6], ): global log_fan self.type = "UnitaryDirectExpansion" @@ -134,7 +140,7 @@ def __init__( value=Units(value=ref_gross_cap, unit=ref_cap_unit).conversion( new_unit=indoor_fan_power_unit ) - - indoor_fan_power, + - indoor_fan_power[0], unit=indoor_fan_power_unit, ).conversion(ref_cap_unit) self.ref_cap_unit = ref_cap_unit @@ -148,7 +154,14 @@ def __init__( self.ref_net_cap = ref_net_cap self.ref_gross_cap = ref_gross_cap self.ref_cap_unit = ref_cap_unit - + #To do: add indoor fan power/control power unit conversion + if isinstance(indoor_fan_power, list): + if len(indoor_fan_power) > 1: + self.indoor_fan_power = indoor_fan_power + elif len(indoor_fan_power) == 1: + self.indoor_fan_power = indoor_fan_power[0] + #reorder compressor_stages + compressor_stages = sorted(compressor_stages) # Get attributes self.full_eff = full_eff self.full_eff_unit = full_eff_unit @@ -160,6 +173,8 @@ def __init__( self.part_eff_alt_unit = part_eff_unit self.compressor_type = compressor_type self.set_of_curves = set_of_curves + self.set_of_curves_1 = set_of_curves_1 + self.set_of_curves_2 = set_of_curves_2 self.part_eff_ref_std = part_eff_ref_std self.model = model self.sim_engine = sim_engine @@ -168,14 +183,17 @@ def __init__( self.compressor_speed = compressor_speed self.indoor_fan_speeds_mapping = indoor_fan_speeds_mapping self.indoor_fan_speeds = indoor_fan_speeds - self.indoor_fan_power = indoor_fan_power self.indoor_fan_curve_coef = indoor_fan_curve_coef self.indoor_fan_power_unit = indoor_fan_power_unit self.indoor_fan_curve = indoor_fan_curve + self.compressor_stages = compressor_stages + self.compressor_stage_input = compressor_stage_input + self.control_power = control_power + self.control_power_unit = control_power_unit # Define rated temperatures # air entering drybulb, air entering wetbulb, entering condenser temperature, leaving condenser temperature aed, self.aew, ect, lct = self.get_rated_temperatures() - self.ect = ect[0] + self.ect = ect # Defined plotting ranges and (rated) temperature for normalization nb_val = 50 @@ -188,7 +206,7 @@ def __init__( "nbval": nb_val, "x2_min": 15, "x2_max": 40, - "x2_norm": self.ect, + "x2_norm": self.ect[0], }, "cap-f-t": { "x1_min": self.aew, @@ -197,7 +215,7 @@ def __init__( "nbval": 50, "x2_min": 15, "x2_max": 40, - "x2_norm": self.ect, + "x2_norm": self.ect[0], "nbval": nb_val, }, "eir-f-ff": {"x1_min": 0, "x1_max": 2, "x1_norm": 1, "nbval": nb_val}, @@ -207,19 +225,19 @@ def __init__( # Cycling degradation self.degradation_coefficient = degradation_coefficient - self.add_cycling_degradation_curve() + self.add_cycling_degradation_curve(set_of_curves=self.set_of_curves) - def add_cycling_degradation_curve(self, overwrite=False, return_curve=False): + def add_cycling_degradation_curve(self, set_of_curves, overwrite=False, return_curve=False): """Determine and assign a part load fraction as a function of part load ratio curve to a unitary DX equipment. - + :param curves set of curves :param str overwrite: Flag to overwrite the existing degradation curve. Default is False. :param str assign_curve: Add curve to equipment's. Default is True. """ # Remove exisiting curve if it exists if overwrite: - for curve in self.set_of_curves: + for curve in set_of_curves: if curve.out_var == "plf-f-plr": - self.set_of_curves.remove(curve) + set_of_curves.remove(curve) break # Add new curve @@ -236,7 +254,7 @@ def add_cycling_degradation_curve(self, overwrite=False, return_curve=False): if return_curve: return plf_f_plr else: - self.set_of_curves.append(plf_f_plr) + set_of_curves.append(plf_f_plr) # default fan curve self.default_fan_curve = Curve( @@ -247,56 +265,60 @@ def add_cycling_degradation_curve(self, overwrite=False, return_curve=False): self.default_fan_curve.coeff3 = self.indoor_fan_curve_coef["3"] self.default_fan_curve.coeff4 = self.indoor_fan_curve_coef["4"] - def calc_fan_power(self, capacity_fraction): + def calc_fan_power(self, capacity_fraction, ignore): """Calculate unitary DX equipment fan power. :param float capacity_fraction: Ratio of actual capacity to net rated capacity + :param boolean ignore: ignore fan power or not :return: Unitary DX Equipment fan power in Watts :rtype: float """ - # Full flow/power - flow_fraction = capacity_fraction # we assume flow_fraction = 1*capacity_fraction as default - if capacity_fraction == 1 or self.indoor_fan_speeds == 1: - return self.indoor_fan_power + if ignore == True: + return 0 else: - if self.indoor_fan_curve == False: - capacity_fractions = [] - fan_power_fractions = [] - for speed_info in self.indoor_fan_speeds_mapping.values(): - capacity_fractions.append(speed_info["capacity_fraction"]) - fan_power_fractions.append(speed_info["fan_power_fraction"]) - # Minimum flow/power - if capacity_fraction <= capacity_fractions[0]: - return self.indoor_fan_power * fan_power_fractions[0] - elif capacity_fraction in capacity_fractions: - return ( - self.indoor_fan_power - * fan_power_fractions[ - capacity_fractions.index(capacity_fraction) - ] - ) - else: - # In between-speeds: determine power by linear interpolation - for i, ratio in enumerate(capacity_fractions): - if ( - ratio < capacity_fraction - and capacity_fractions[i + 1] > capacity_fraction - ): - a = ( - fan_power_fractions[i + 1] - fan_power_fractions[i] - ) / (capacity_fractions[i + 1] - capacity_fractions[i]) - b = fan_power_fractions[i] - a * capacity_fractions[i] - return self.indoor_fan_power * (a * capacity_fraction + b) - else: # using curve - default_min_fan_power = ( - self.indoor_fan_power * 0.25 - ) # default min fan power - power_factor = self.default_fan_curve.evaluate(x=flow_fraction, y=0) - if self.indoor_fan_power * power_factor > default_min_fan_power: - return self.indoor_fan_power * power_factor - else: - return default_min_fan_power + # Full flow/power + flow_fraction = capacity_fraction # we assume flow_fraction = 1*capacity_fraction as default + if capacity_fraction == 1 or self.indoor_fan_speeds == 1: + return self.indoor_fan_power + else: + if self.indoor_fan_curve == False: + capacity_fractions = [] + fan_power_fractions = [] + for speed_info in self.indoor_fan_speeds_mapping.values(): + capacity_fractions.append(speed_info["capacity_fraction"]) + fan_power_fractions.append(speed_info["fan_power_fraction"]) + # Minimum flow/power + if capacity_fraction <= capacity_fractions[0]: + return self.indoor_fan_power * fan_power_fractions[0] + elif capacity_fraction in capacity_fractions: + return ( + self.indoor_fan_power + * fan_power_fractions[ + capacity_fractions.index(capacity_fraction) + ] + ) + else: + # In between-speeds: determine power by linear interpolation + for i, ratio in enumerate(capacity_fractions): + if ( + ratio < capacity_fraction + and capacity_fractions[i + 1] > capacity_fraction + ): + a = ( + fan_power_fractions[i + 1] - fan_power_fractions[i] + ) / (capacity_fractions[i + 1] - capacity_fractions[i]) + b = fan_power_fractions[i] - a * capacity_fractions[i] + return self.indoor_fan_power * (a * capacity_fraction + b) + else: # using curve + default_min_fan_power = ( + self.indoor_fan_power * 0.25 + ) # default min fan power + power_factor = self.default_fan_curve.evaluate(x=flow_fraction, y=0) + 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 @@ -326,7 +348,7 @@ def calc_rated_eff( eir_f_t = curves["eir-f-t"] eir_f_f = curves["eir-f-ff"] if not "plf-f-plr" in curves.keys(): - self.add_cycling_degradation_curve() + self.add_cycling_degradation_curve(set_of_curves=self.set_of_curves) curves = self.get_dx_curves() plf_f_plr = curves["plf-f-plr"] @@ -446,6 +468,158 @@ def calc_rated_eff( ieer = ieer.conversion(new_unit=self.full_eff_unit) return ieer + def calc_rated_eff_two_curves( + self, eff_type="part", unit="cop", output_report=False, alt=False + ): + """ + This is a template function for new ieer, two curves inputs. + Calculate unitary DX equipment efficiency. + + :param str eff_type: Unitary DX equipment efficiency type, currently supported `full` (full load rating) + and `part` (part load rating) + :param str unit: Efficiency unit + :param bool output_report: Indicate output report generation + :param bool alt: Indicate the DX system alternate standard rating should be used + :return: Unitary DX Equipment rated efficiency + :rtype: float + + """ + # Handle alternate ratings (not currently used) + if alt: + std = self.part_eff_ref_std_alt + else: + std = self.part_eff_ref_std + # Retrieve curves + curves_1, curves_2 = self.get_two_dx_curves() + cap_f_f1 = curves_1["cap-f-ff"] + cap_f_t1 = curves_1["cap-f-t"] + eir_f_t1 = curves_1["eir-f-t"] + eir_f_f1 = curves_1["eir-f-ff"] + if not "plf-f-plr" in curves_1.keys(): + curves_1["plf-f-plr"]=self.add_cycling_degradation_curve(set_of_curves=curves_1,return_curve=True) + plf_f_plr1 = curves_1["plf-f-plr"] + cap_f_f2 = curves_2["cap-f-ff"] + cap_f_t2 = curves_2["cap-f-t"] + eir_f_t2 = curves_2["eir-f-t"] + eir_f_f2 = curves_2["eir-f-ff"] + if not "plf-f-plr" in curves_2.keys(): + curves_2["plf-f-plr"]=self.add_cycling_degradation_curve(set_of_curves=curves_2,return_curve=True) + plf_f_plr2 = curves_2["plf-f-plr"] + # Calculate capacity and efficiency degradation as a function of flow fraction + tot_cap_flow_mod_fac1 = 1 + eir_flow_mod_fac1 = 1 + tot_cap_flow_mod_fac2 = 1 + eir_flow_mod_fac2 = 1 + # Get rated conditions + eqp_type = self.type.lower() + num_of_reduced_cap = equipment_references[eqp_type][std]["coef"][ + "numofreducedcap" + ] + reduced_plr = equipment_references[eqp_type][std]["coef"]["reducedplr"] + weighting_factor = equipment_references[eqp_type][std]["coef"][ + "weightingfactor" + ] + # Convert user-specified full load efficiency to COP + # User-specified capacity is a NET efficiency + full_eff = Units(value=self.full_eff, unit=self.full_eff_unit) + # Iterate through the different sets of rating conditions to calculate IEER + ieer = 0 + interpolation = False + degradation = False + eer_reduced = 0 + + def cal_eer(cap_f_t,eir_f_t,net_cap, ref_gross_cap,indoor_fan_power,control_power): + """Inner function to calculate reduced eer&LF + :param float cap_f_t: Capacity factor + :param float eir_f_t: EIR factor + :param float net_cap: Reduced Net Capacity + :param float ref_gross_cap: Reference Gross Capacity + :param float indoor_fan_power: Indoor Fan Power + :param float control_power: Control Power + :return: Unitary DX Equipment EER and load factor + :rtype: float + """ + net_cooling_cap_reduced = cap_f_t*ref_gross_cap-indoor_fan_power + pc_pcd = eir_f_t*self.full_eff*(net_cooling_cap_reduced+indoor_fan_power) + eer = net_cooling_cap_reduced/(pc_pcd + indoor_fan_power + control_power) + load_factor = net_cooling_cap_reduced/net_cap + return eer, load_factor + def cal_reduced_eer(cap_f_t,eir_f_t,net_cap, ref_gross_cap,indoor_fan_power,control_power,reduced_plr): + """Inner function to calculate reduced eer&LF + :param float cap_f_t: Capacity factor + :param float eir_f_t: EIR factor + :param float net_cap: Reduced Net Capacity + :param float ref_gross_cap: Reference Gross Capacity + :param float indoor_fan_power: Indoor Fan Power + :param float control_power: Control Power + :return: Unitary DX Equipment EER and load factor + :rtype: float + """ + net_cooling_cap_reduced = cap_f_t*ref_gross_cap-indoor_fan_power + pc_pcd = eir_f_t*self.full_eff*(net_cooling_cap_reduced+indoor_fan_power) + LF = reduced_plr*net_cap/net_cooling_cap_reduced + Cd = -0.13*LF + 1.13 + eer_reduced = LF*net_cooling_cap_reduced/(LF*(Cd*(pc_pcd))+control_power+indoor_fan_power) + return eer_reduced + for red_cap_num in range(num_of_reduced_cap): + outdoor_unit_inlet_air_dry_bulb_temp_reduced = self.ect[red_cap_num] + interpolation = False + degradation = False + for stage_id, capacity_ratio in enumerate(self.compressor_stages): + if stage_id + 1 < len(self.compressor_stages): + if (self.compressor_stages[stage_id + 1] > reduced_plr[red_cap_num]): + if (reduced_plr[red_cap_num] > capacity_ratio): + interpolation = True + if not interpolation: + if reduced_plr[red_cap_num]<=self.compressor_stages[0]: + degradation = True + #if reduced_plr[red_cap_num] == 0.75: + # interpolation = True + #if (reduced_plr[red_cap_num] == 0.50) | (reduced_plr[red_cap_num] == 0.25): + # degradation = True + net_cooling_cap_reduced = cap_f_t1.evaluate(self.ect[0],1)*self.ref_gross_cap-self.indoor_fan_power[0] + if ( + self.compressor_stage_input + and interpolation + ): + eer_1, load_1 = cal_eer(cap_f_t1.evaluate(outdoor_unit_inlet_air_dry_bulb_temp_reduced,1), + eir_f_t1.evaluate(outdoor_unit_inlet_air_dry_bulb_temp_reduced,1), + net_cooling_cap_reduced, self.ref_gross_cap,self.indoor_fan_power[0], + self.control_power[0]) + eer_2, load_2 = cal_eer(cap_f_t2.evaluate(outdoor_unit_inlet_air_dry_bulb_temp_reduced,1), + eir_f_t2.evaluate(outdoor_unit_inlet_air_dry_bulb_temp_reduced,1), + net_cooling_cap_reduced, self.ref_gross_cap/2,self.indoor_fan_power[1], + self.control_power[1]) + eer_reduced = ( + ( + eer_1 + - eer_2 + ) + * (reduced_plr[red_cap_num] - load_2) + ) / (load_1 - load_2) + eer_2 + else: + if degradation: + eer_reduced = cal_reduced_eer(cap_f_t2.evaluate(outdoor_unit_inlet_air_dry_bulb_temp_reduced,1), + eir_f_t2.evaluate(outdoor_unit_inlet_air_dry_bulb_temp_reduced,1), + net_cooling_cap_reduced, self.ref_gross_cap/2,self.indoor_fan_power[1], + self.control_power[1], reduced_plr[red_cap_num]) + else: + net_cap = net_cooling_cap_reduced + pc_pcd = eir_f_t1.evaluate(outdoor_unit_inlet_air_dry_bulb_temp_reduced,1)*self.full_eff*(net_cap+self.indoor_fan_power[0]) + eer_reduced = net_cap/(pc_pcd + self.indoor_fan_power[0] + self.control_power[0]) + print(reduced_plr[red_cap_num], eer_reduced) + if eff_type == "full": + ieer = eer_reduced + break + # Update IEER + #print(interpolation, curve_num, weighting_factor[red_cap_num] , eer_reduced) + ieer += weighting_factor[red_cap_num] * eer_reduced + # Convert efficiency to original unit unless specified + if unit != "cop": + ieer = Units(value=ieer, unit="cop") + ieer = ieer.conversion(new_unit=self.full_eff_unit) + return ieer + def ieer_to_eer(self, ieer): """Calculate EER from IEER and system capacity. The regression function was obtained by fitting a linear model on performance data collected from AHRI database (Sample Size = 14,268). @@ -496,6 +670,39 @@ def get_dx_curves(self): curves["plf-f-plr"] = curve return curves + def get_two_dx_curves(self): + """Retrieve DX curves from the DX set_of_curves attribute. + + :return: Dictionary of the curves associated with the object + :rtype: dict + + """ + curves_1 = {} + for curve in self.set_of_curves_1: + if curve.out_var == "cap-f-t": + curves_1["cap-f-t"] = curve + elif curve.out_var == "cap-f-ff": + curves_1["cap-f-ff"] = curve + elif curve.out_var == "eir-f-t": + curves_1["eir-f-t"] = curve + elif curve.out_var == "eir-f-ff": + curves_1["eir-f-ff"] = curve + elif curve.out_var == "plf-f-plr": + curves_1["plf-f-plr"] = curve + curves_2 = {} + for curve in self.set_of_curves_2: + if curve.out_var == "cap-f-t": + curves_2["cap-f-t"] = curve + elif curve.out_var == "cap-f-ff": + curves_2["cap-f-ff"] = curve + elif curve.out_var == "eir-f-t": + curves_2["eir-f-t"] = curve + elif curve.out_var == "eir-f-ff": + curves_2["eir-f-ff"] = curve + elif curve.out_var == "plf-f-plr": + curves_2["plf-f-plr"] = curve + return curves_1, curves_2 + def get_curves_from_lib(self, lib, filters): """Function to get the sort from the library based on chiller filters. @@ -562,12 +769,12 @@ def get_ranges(self): ranges = { "eir-f-t": { "vars_range": [(12.8, 26), (10.0, 40.0)], - "normalization": (self.aew, self.ect), + "normalization": (self.aew, self.ect[0]), }, "eir-f-ff": {"vars_range": [(0.0, 1.5)], "normalization": (1.0)}, "cap-f-t": { "vars_range": [(12.8, 26), (10.0, 40.0)], - "normalization": (self.aew, self.ect), + "normalization": (self.aew, self.ect[0]), }, "cap-f-ff": {"vars_range": [(0.0, 1.5)], "normalization": (1.0)}, "plf-f-plr": {"vars_range": [(0.0, 1.0)], "normalization": (1.0)}, diff --git a/tests/data/DX_multispeed_input_file.json b/tests/data/DX_multispeed_input_file.json new file mode 100644 index 0000000..f5adf90 --- /dev/null +++ b/tests/data/DX_multispeed_input_file.json @@ -0,0 +1,141 @@ +{ + "HighStage": { + "eqp_type": "UnitaryDirectExpansion", + "source": "Placeholder", + "model": "simplified_bf", + "condenser_type": "air", + "compressor_type": "scroll", + "compressor_speed": "variable", + "ref_net_cap": 471000, + "ref_cap_unit": "W", + "full_eff": null, + "full_eff_unit": "eer", + "sim_engine": "energyplus", + "full_eff_ref_std": null, + "full_eff_ref_std_alt": null, + "part_eff": null, + "part_eff_ref_std": null, + "part_eff_ref_std_alt": null, + "min_outdoor_fan_power": null, + "max_outdoor_fan_power": null, + "indoor_fan_power_unit": "W", + "set_of_curves": { + "cap-f-t": { + "out_var": "cap-f-t", + "type": "linear", + "coeff1": 1.304669191, + "coeff2": -0.008704834, + "x_min": 20, + "x_max": 40, + "out_min": 0, + "out_max": 999 + }, + "eir-f-ff": { + "out_var": "eir-f-ff", + "type": "linear", + "coeff1": 1, + "coeff2": 0, + "x_min": 0, + "x_max": 1, + "out_min": 0, + "out_max": 999 + }, + "eir-f-t": { + "out_var": "eir-f-t", + "type": "linear", + "coeff1": 0.457735, + "coeff2": 0.015493299, + "x_min": 20, + "x_max": 40, + "out_min": 0, + "out_max": 999 + }, + "cap-f-ff": { + "out_var": "cap-f-ff", + "type": "quad", + "coeff1": 1, + "coeff2": 0, + "coeff3": 0, + "x_min": 10, + "x_max": 30, + "out_min": 0, + "out_max": 999 + } + }, + "indoor_fan_control_mode": null, + "indoor_fan_power": null, + "ref_gross_cap": null + }, + "LowStage": { + "eqp_type": "UnitaryDirectExpansion", + "source": "Placeholder", + "model": "simplified_bf", + "condenser_type": "air", + "compressor_type": "scroll", + "compressor_speed": "variable", + "ref_net_cap": 471000, + "ref_cap_unit": "W", + "full_eff": null, + "full_eff_unit": "eer", + "sim_engine": "energyplus", + "full_eff_ref_std": null, + "full_eff_ref_std_alt": null, + "part_eff": null, + "part_eff_ref_std": null, + "part_eff_ref_std_alt": null, + "min_outdoor_fan_power": null, + "max_outdoor_fan_power": null, + "indoor_fan_power_unit": "W", + "set_of_curves": { + "cap-f-t": { + "out_var": "cap-f-t", + "type": "cubic", + "coeff1": 1.44913, + "coeff2": -0.04264, + "coeff3": 0.001574633, + "coeff4": -2.06552e-05, + "x_min": 10, + "x_max": 30, + "out_min": 0, + "out_max": 999 + }, + "eir-f-t": { + "out_var": "eir-f-t", + "type": "cubic", + "coeff1": 0.467928, + "coeff2": 0.032332, + "coeff3": -0.00114, + "coeff4": 1.8501e-05, + "x_min": 10, + "x_max": 30, + "out_min": 0, + "out_max": 999 + }, + "cap-f-ff": { + "out_var": "cap-f-ff", + "type": "quad", + "coeff1": 1, + "coeff2": 0, + "coeff3": 0, + "x_min": 10, + "x_max": 30, + "out_min": 0, + "out_max": 999 + }, + "eir-f-ff": { + "out_var": "eir-f-ff", + "type": "quad", + "coeff1": 1, + "coeff2": 0, + "coeff3": 0, + "x_min": 10, + "x_max": 30, + "out_min": 0, + "out_max": 999 + } + }, + "indoor_fan_control_mode": null, + "indoor_fan_power": null, + "ref_gross_cap": null + } +} \ No newline at end of file diff --git a/tests/test_unitarydirectexpansion.py b/tests/test_unitarydirectexpansion.py index 8dec0b1..231a195 100644 --- a/tests/test_unitarydirectexpansion.py +++ b/tests/test_unitarydirectexpansion.py @@ -7,13 +7,38 @@ import os location = os.path.dirname(os.path.realpath(__file__)) -DX_lib = os.path.join(location, "../copper/data", "unitarydirectexpansion_curves.json") - +#DX_lib = os.path.join(location, "../copper/data", "unitarydirectexpansion_curves.json") +DX_lib_test = os.path.join(location, "data", "DX_multispeed_input_file.json") class UnitaryDirectExpansion(TestCase): # Load curve library - lib = cp.Library(path=DX_lib) - + lib = cp.Library(path=DX_lib_test) + def test_new_ieer(self): + lib_in = cp.Library(path=DX_lib_test) + dx_unit_new = cp.UnitaryDirectExpansion( + compressor_type="scroll", + condenser_type="air", + compressor_speed="constant", + ref_cap_unit="W", + ref_gross_cap=119075.6/3.412,#convert the unit from Btu/hr + full_eff=0.26548, # EIR at full? + full_eff_unit="cop", + part_eff_ref_std="ahri_340/360", + model="simplified_bf", + sim_engine="energyplus", + indoor_fan_power=[1.050, 0.262], + control_power = [0.100, 0.150], + indoor_fan_power_unit="kW", + control_power_unit = "kW", + set_of_curves_1=lib_in.get_set_of_curves_by_name("HighStage").curves,# this is the part have problem + #seems it can load the json file, but cannot find the curve named 'HighStage' + set_of_curves_2=lib_in.get_set_of_curves_by_name("LowStage").curves, + compressor_stage_input=True, + compressor_stages=[0.5,1],#how to set this? if use 1.06 not 0.95, 1 will use interperlation + ) + ieer = round(dx_unit_new.calc_rated_eff_two_curves(unit="cop"), 1) + self.assertTrue(3.8 == ieer, f"{ieer} is different than 3.8") +""""" # Define equipment characteristics dx_unit_dft = cp.UnitaryDirectExpansion( compressor_type="scroll", @@ -366,3 +391,8 @@ def test_NN_wght_avg(self): assert round(set_of_curves[2].evaluate(1.0, 0), 2) == 1.0 assert round(set_of_curves[3].evaluate(1.0, 0), 2) == 1.0 assert round(set_of_curves[4].evaluate(1.0, 0), 2) == 1.0 +""""" +# Run the tests +import unittest +if __name__ == '__main__': + unittest.main()