def test_raised_exception_method_selection_01(): """Test if an exception is raised if unknown method name is passed.""" with pytest.raises(ValueError): ac.calc_characteristic_temp(t_hot=[85], t_cool=[30], t_chill=[15], coef_a=2.5, coef_e=1.8, method='shaken_not_stirred')
def test_raised_exception_argument_length_02(): """Test if an exception is raised if input argument is too short.""" with pytest.raises(ValueError): ac.calc_characteristic_temp(t_hot=[85] * 3, t_cool=[30] * 2, t_chill=[15] * 3, coef_a=2.5, coef_e=1.8, method='kuehn_and_ziegler')
def test_raised_exception_argument_type_03(): """Test if an exception is raised if input argument is not a list.""" with pytest.raises(TypeError): ac.calc_characteristic_temp(t_hot=[85], t_cool=[30], t_chill=15, coef_a=2.5, coef_e=1.8, method='kuehn_and_ziegler')
def test_calc_characteristic_temp_input_list_single_entry(): """Test if calc_characteristic_temp works with lists of length 1 (a single entry) as input for all three temperatures.""" ddt = ac.calc_characteristic_temp(t_hot=[85], t_cool=[30], t_chill=[15], coef_a=2.5, coef_e=1.8, method='kuehn_and_ziegler') assert ddt == [37]
def test_calc_characteristic_temp_Safarik(): """Test characteristic temperature calculation for chiller 'Safarik'.""" filename_charpara = os.path.join( os.path.dirname(__file__), '../examples/absorption_heatpump_and_chiller/' 'data/characteristic_parameters.csv') charpara = pd.read_csv(filename_charpara) chiller_name = 'Safarik' n = 2 ddt = ac.calc_characteristic_temp( t_hot=[85] * n, t_cool=[30], t_chill=[15], coef_a=charpara[(charpara['name'] == chiller_name)]['a'].values[0], coef_e=charpara[(charpara['name'] == chiller_name)]['e'].values[0], method='kuehn_and_ziegler') assert ddt == [approx(54.64), approx(54.64)]
import oemof.thermal.absorption_heatpumps_and_chillers as abs_hp_chiller import matplotlib.pyplot as plt import os import pandas as pd filename = os.path.join(os.path.dirname(__file__), 'data/characteristic_parameters.csv') charpara = pd.read_csv(filename) chiller_name = 'Kuehn' t_cooling = [23, 25, 27, 29, 31, 33, 35, 36, 37, 38, 39, 40] ddt_75 = abs_hp_chiller.calc_characteristic_temp( t_hot=[75], t_cool=t_cooling, t_chill=[15], coef_a=charpara[(charpara['name'] == chiller_name)]['a'].values[0], coef_e=charpara[(charpara['name'] == chiller_name)]['e'].values[0], method='kuehn_and_ziegler') Q_dots_evap_75 = abs_hp_chiller.calc_heat_flux( ddts=ddt_75, coef_s=charpara[(charpara['name'] == chiller_name)]['s_E'].values[0], coef_r=charpara[(charpara['name'] == chiller_name)]['r_E'].values[0], method='kuehn_and_ziegler') Q_dots_gen_75 = abs_hp_chiller.calc_heat_flux( ddts=ddt_75, coef_s=charpara[(charpara['name'] == chiller_name)]['s_G'].values[0], coef_r=charpara[(charpara['name'] == chiller_name)]['r_G'].values[0], method='kuehn_and_ziegler') COPs_75 = [Qevap / Qgen for Qgen, Qevap in zip(Q_dots_gen_75, Q_dots_evap_75)]