def comp_init(self, nw): r""" Perform component initialization in network preprocessing. Parameters ---------- nw : tespy.networks.network Network this component is integrated in. """ self.num_nw_fluids = len(nw.fluids) self.nw_fluids = nw.fluids self.num_nw_vars = self.num_nw_fluids + 3 self.it = 0 self.vec_res = [] self.mat_deriv = None self.num_eq = 0 self.vars = {} self.num_vars = 0 var = self.attr() for key, val in var.items(): if isinstance(val, dc_cp): if self.get_attr(key).is_var: self.get_attr(key).var_pos = self.num_vars self.num_vars += 1 self.vars[self.get_attr(key)] = key # characteristics creation elif isinstance(val, dc_cc): if self.get_attr(key).func is None: try: self.get_attr(key).func = ldc(self.component(), key, 'DEFAULT', char_line) except KeyError: self.get_attr(key).func = char_line(x=[0, 1], y=[1, 1]) if self.char_warnings is True: msg = ('Created characteristic line for parameter ' + key + ' at component ' + self.label + ' from ' 'default data.\n' 'You can specify your own data using ' 'component.' + key + '.set_attr(func=custom_char).\n' 'If you want to disable these warnings use ' 'component.char_warnings=False.') logging.warning(msg) msg = ('The component ' + self.label + ' has ' + str(self.num_vars) + ' custom variables.') logging.debug(msg)
cd.set_attr(pr1=0.99, pr2=0.99, ttd_u=5, design=['pr2', 'ttd_u'], offdesign=['zeta2', 'kA']) dhp.set_attr(eta_s=0.8, design=['eta_s'], offdesign=['eta_s_char']) cons.set_attr(pr=0.99, design=['pr'], offdesign=['zeta']) # air fan fan.set_attr(eta_s=0.65, design=['eta_s'], offdesign=['eta_s_char']) # evaporator system kA_char1 = ldc('heat exchanger', 'kA_char1', 'EVAPORATING FLUID', char_line) kA_char2 = ldc('heat exchanger', 'kA_char2', 'EVAPORATING FLUID', char_line) ev.set_attr(pr1=0.999, pr2=0.99, ttd_l=5, kA_char1=kA_char1, kA_char2=kA_char2, design=['pr1', 'ttd_l'], offdesign=['zeta1', 'kA']) su.set_attr(pr1=0.999, pr2=0.99, ttd_u=2, design=['pr1', 'pr2', 'ttd_u'], offdesign=['zeta1', 'zeta2', 'kA']) erp.set_attr(eta_s=0.8, design=['eta_s'], offdesign=['eta_s_char'])
def test_compressor(self): """Test component properties of compressors.""" instance = compressor('compressor') self.setup_network(instance) # compress NH3, other fluids in network are for turbine, pump, ... fl = {'N2': 0, 'O2': 0, 'Ar': 0, 'INCOMP::DowQ': 0, 'NH3': 1} self.c1.set_attr(fluid=fl, v=1, p=5, T=100) self.c2.set_attr(p=7) instance.set_attr(eta_s=0.8) self.nw.solve('design') self.nw.save('tmp') # test isentropic efficiency value eta_s_d = ((instance.h_os('') - self.c1.h.val_SI) / (self.c2.h.val_SI - self.c1.h.val_SI)) msg = ('Value of isentropic efficiency must be ' + str(eta_s_d) + ', is ' + str(instance.eta_s.val) + '.') eq_(round(eta_s_d, 3), round(instance.eta_s.val, 3), msg) # trigger invalid value for isentropic efficiency instance.set_attr(eta_s=1.1) self.nw.solve('design') # test calculated value eta_s = ((instance.h_os('') - self.c1.h.val_SI) / (self.c2.h.val_SI - self.c1.h.val_SI)) msg = ('Value of isentropic efficiency must be ' + str(eta_s) + ', is ' + str(instance.eta_s.val) + '.') eq_(round(eta_s, 3), round(instance.eta_s.val, 3), msg) # remove pressure at outlet, use characteristic map for pressure # rise calculation self.c2.set_attr(p=np.nan) instance.set_attr(char_map=dc_cm(func=ldc('compressor', 'char_map', 'DEFAULT', compressor_map), is_set=True), eta_s=np.nan) # offdesign test, efficiency value should be at design value self.nw.solve('offdesign', design_path='tmp') msg = ('Value of isentropic efficiency (' + str(instance.eta_s.val) + ') must be identical to design case (' + str(eta_s) + ').') eq_(round(eta_s_d, 2), round(instance.eta_s.val, 2), msg) # move to highest available speedline, mass flow below lowest value # at that line self.c1.set_attr(v=np.nan, m=self.c1.m.val * 0.8, T=30) self.nw.solve('offdesign', design_path='tmp') # should be value eta_s = eta_s_d * instance.char_map.func.z2[6, 0] msg = ('Value of isentropic efficiency (' + str(instance.eta_s.val) + ') must be at (' + str(round(eta_s, 4)) + ').') eq_(round(eta_s, 4), round(instance.eta_s.val, 4), msg) # going below lowest available speedline, above highest mass flow at # that line self.c1.set_attr(T=300) self.nw.solve('offdesign', design_path='tmp', init_path='tmp') # should be value eta_s = eta_s_d * instance.char_map.func.z2[0, 9] msg = ('Value of isentropic efficiency (' + str(instance.eta_s.val) + ') must be at (' + str(round(eta_s, 4)) + ').') eq_(round(eta_s, 4), round(instance.eta_s.val, 4), msg) # back to design properties, test eta_s_char self.c2.set_attr(p=7) self.c1.set_attr(v=1, T=100, m=np.nan) # test parameter specification for eta_s_char with unset char map instance.set_attr(eta_s_char=dc_cc(func=ldc('compressor', 'eta_s_char', 'DEFAULT', char_line), is_set=True, param='m')) instance.char_map.is_set = False self.nw.solve('offdesign', design_path='tmp') msg = ('Value of isentropic efficiency must be ' + str(eta_s_d) + ', is ' + str(instance.eta_s.val) + '.') eq_(round(eta_s_d, 3), round(instance.eta_s.val, 3), msg) # move up in volumetric flow self.c1.set_attr(v=1.5) self.nw.solve('offdesign', design_path='tmp') eta_s = round( eta_s_d * instance.eta_s_char.func.evaluate( self.c1.m.val_SI / self.c1.m.design), 3) msg = ('Value of isentropic efficiency must be ' + str(eta_s) + ', is ' + str(round(instance.eta_s.val, 3)) + '.') eq_(eta_s, round(instance.eta_s.val, 3), msg) # test parameter specification for pr instance.eta_s_char.set_attr(param='pr') self.c1.set_attr(v=1) self.c2.set_attr(p=7.5) self.nw.solve('offdesign', design_path='tmp') expr = (self.c2.p.val_SI * self.c1.p.design / (self.c2.p.design * self.c1.p.val_SI)) eta_s = round(eta_s_d * instance.eta_s_char.func.evaluate(expr), 3) msg = ('Value of isentropic efficiency must be ' + str(eta_s) + ', is ' + str(round(instance.eta_s.val, 3)) + '.') eq_(eta_s, round(instance.eta_s.val, 3), msg) shutil.rmtree('./tmp', ignore_errors=True)
def test_pump(self): """Test component properties of pumps.""" instance = pump('pump') self.setup_network(instance) fl = {'N2': 0, 'O2': 0, 'Ar': 0, 'INCOMP::DowQ': 1, 'NH3': 0} self.c1.set_attr(fluid=fl, v=1, p=5, T=50) self.c2.set_attr(p=7) instance.set_attr(eta_s=1) self.nw.solve('design') # test calculated value for efficiency eta_s = ((instance.h_os('') - self.c1.h.val_SI) / (self.c2.h.val_SI - self.c1.h.val_SI)) msg = ('Value of isentropic efficiency must be ' + str(eta_s) + ', is ' + str(instance.eta_s.val) + '.') eq_(eta_s, instance.eta_s.val, msg) # isentropic efficiency of 1 means inlet and outlet entropy are # identical s1 = round(s_mix_ph(self.c1.to_flow()), 4) s2 = round(s_mix_ph(self.c2.to_flow()), 4) msg = ('Value of entropy must be identical for inlet (' + str(s1) + ') and outlet (' + str(s2) + ') at 100 % isentropic efficiency.') eq_(s1, s2, msg) # specify realistic value for efficiency, outlet pressure from flow # char eta_s_d = 0.8 instance.set_attr(eta_s=eta_s_d) self.nw.solve('design') self.nw.save('tmp') self.c2.set_attr(p=np.nan) # flow char (pressure rise vs. volumetric flow) x = [0, 0.2, 0.4, 0.6, 0.8, 1, 1.2, 1.4] y = np.array([14, 13.5, 12.5, 11, 9, 6.5, 3.5, 0]) * 1e5 char = dc_cc(func=char_line(x, y), is_set=True) # apply flow char and eta_s char instance.set_attr(flow_char=char, eta_s=np.nan, eta_s_char=dc_cc(func=ldc('pump', 'eta_s_char', 'DEFAULT', char_line), is_set=True)) self.nw.solve('offdesign', design_path='tmp') # value for difference pressure dp = 650000.0 msg = ('Value of pressure rise must be ' + str(dp) + ', is ' + str(self.c2.p.val_SI - self.c1.p.val_SI) + '.') eq_(round(self.c2.p.val_SI - self.c1.p.val_SI, 0), dp, msg) # test ohter volumetric flow on flow char self.c1.set_attr(v=0.9) self.nw.solve('offdesign', design_path='tmp') dp = 775000.0 msg = ('Value of pressure rise must be ' + str(dp) + ', is ' + str(self.c2.p.val_SI - self.c1.p.val_SI) + '.') eq_(self.c2.p.val_SI - self.c1.p.val_SI, dp, msg) # test value of isentropic efficiency eta_s = round( eta_s_d * instance.eta_s_char.func.evaluate( self.c1.v.val_SI / self.c1.v.design), 3) msg = ('Value of isentropic efficiency must be ' + str(eta_s) + ', is ' + str(instance.eta_s.val) + '.') eq_(eta_s, round(instance.eta_s.val, 3), msg) instance.eta_s_char.is_set = False # test boundaries of characteristic line: # lower boundary self.c2.set_attr(T=ref(self.c1, 0, 20)) self.c1.set_attr(v=-0.1) self.nw.solve('design') msg = ('Value of power must be ' + str(14e5) + ', is ' + str(self.c2.p.val_SI - self.c1.p.val_SI) + '.') eq_(self.c2.p.val_SI - self.c1.p.val_SI, 14e5, msg) # upper boundary self.c1.set_attr(v=1.5) self.nw.solve('design') msg = ('Value of power must be ' + str(0) + ', is ' + str(self.c2.p.val_SI - self.c1.p.val_SI) + '.') eq_(self.c2.p.val_SI - self.c1.p.val_SI, 0, msg) shutil.rmtree('./tmp', ignore_errors=True)
cd.set_attr(pr1=0.99, pr2=0.99, ttd_u=5, design=['pr2', 'ttd_u'], offdesign=['zeta2', 'kA_char']) dhp.set_attr(eta_s=0.8, design=['eta_s'], offdesign=['eta_s_char']) cons.set_attr(pr=0.99, design=['pr'], offdesign=['zeta']) # air fan fan.set_attr(eta_s=0.65, design=['eta_s'], offdesign=['eta_s_char']) # evaporator system kA_char1 = ldc('heat exchanger', 'kA_char1', 'DEFAULT', CharLine) kA_char2 = ldc('heat exchanger', 'kA_char2', 'EVAPORATING FLUID', CharLine) ev.set_attr(pr1=0.999, pr2=0.99, ttd_l=5, kA_char1=kA_char1, kA_char2=kA_char2, design=['pr1', 'ttd_l'], offdesign=['zeta1', 'kA_char']) su.set_attr(pr1=0.999, pr2=0.99, ttd_u=2, design=['pr1', 'pr2', 'ttd_u'], offdesign=['zeta1', 'zeta2', 'kA_char']) erp.set_attr(eta_s=0.8, design=['eta_s'], offdesign=['eta_s_char'])
def test_Compressor(self): """Test component properties of compressors.""" instance = Compressor('compressor') self.setup_network(instance) # compress NH3, other fluids in network are for turbine, pump, ... fl = {'N2': 1, 'O2': 0, 'Ar': 0, 'DowQ': 0, 'NH3': 0} self.c1.set_attr(fluid=fl, v=1, p=1, T=5) self.c2.set_attr(p=6) instance.set_attr(eta_s=0.8) self.nw.solve('design') convergence_check(self.nw.lin_dep) self.nw.save('tmp') # test isentropic efficiency value eta_s_d = ((isentropic(self.c1.get_flow(), self.c2.get_flow()) - self.c1.h.val_SI) / (self.c2.h.val_SI - self.c1.h.val_SI)) msg = ('Value of isentropic efficiency must be ' + str(eta_s_d) + ', is ' + str(instance.eta_s.val) + '.') assert round(eta_s_d, 3) == round(instance.eta_s.val, 3), msg # trigger invalid value for isentropic efficiency instance.set_attr(eta_s=1.1) self.nw.solve('design') convergence_check(self.nw.lin_dep) # test calculated value eta_s = ((isentropic(self.c1.get_flow(), self.c2.get_flow()) - self.c1.h.val_SI) / (self.c2.h.val_SI - self.c1.h.val_SI)) msg = ('Value of isentropic efficiency must be ' + str(eta_s) + ', is ' + str(instance.eta_s.val) + '.') assert round(eta_s, 3) == round(instance.eta_s.val, 3), msg # remove pressure at outlet, use characteristic map for pressure # rise calculation self.c2.set_attr(p=np.nan) instance.set_attr(char_map_pr={ 'char_func': ldc('compressor', 'char_map_pr', 'DEFAULT', CharMap), 'is_set': True }, char_map_eta_s={ 'char_func': ldc('compressor', 'char_map_eta_s', 'DEFAULT', CharMap), 'is_set': True }, eta_s=np.nan, igva=0) # offdesign test, efficiency value should be at design value self.nw.solve('offdesign', design_path='tmp') convergence_check(self.nw.lin_dep) msg = ('Value of isentropic efficiency (' + str(instance.eta_s.val) + ') must be identical to design case (' + str(eta_s) + ').') assert round(eta_s_d, 2) == round(instance.eta_s.val, 2), msg # move to highest available speedline, mass flow below lowest value # at that line self.c1.set_attr(v=np.nan, m=self.c1.m.val * 0.8, T=-30) self.nw.solve('offdesign', design_path='tmp') convergence_check(self.nw.lin_dep) # should be value eta_s = eta_s_d * instance.char_map_eta_s.char_func.z[6, 0] msg = ('Value of isentropic efficiency (' + str(instance.eta_s.val) + ') must be at (' + str(round(eta_s, 4)) + ').') assert round(eta_s, 4) == round(instance.eta_s.val, 4), msg # going below lowest available speedline, above highest mass flow at # that line self.c1.set_attr(T=175) self.nw.solve('offdesign', design_path='tmp', init_path='tmp') convergence_check(self.nw.lin_dep) # should be value eta_s = eta_s_d * instance.char_map_eta_s.char_func.z[0, 9] msg = ('Value of isentropic efficiency (' + str(instance.eta_s.val) + ') must be at (' + str(round(eta_s, 4)) + ').') assert round(eta_s, 4) == round(instance.eta_s.val, 4), msg # back to design properties, test eta_s_char self.c2.set_attr(p=6) self.c1.set_attr(v=1, T=5, m=np.nan) # test parameter specification for eta_s_char with unset char map instance.set_attr( eta_s_char={ 'char_func': ldc('compressor', 'eta_s_char', 'DEFAULT', CharLine), 'is_set': True, 'param': 'm' }) instance.char_map_eta_s.is_set = False instance.char_map_pr.is_set = False self.nw.solve('offdesign', design_path='tmp') convergence_check(self.nw.lin_dep) msg = ('Value of isentropic efficiency must be ' + str(eta_s_d) + ', is ' + str(instance.eta_s.val) + '.') assert round(eta_s_d, 3) == round(instance.eta_s.val, 3), msg # move up in volumetric flow self.c1.set_attr(v=1.5) self.nw.solve('offdesign', design_path='tmp') convergence_check(self.nw.lin_dep) eta_s = round( eta_s_d * instance.eta_s_char.char_func.evaluate( self.c1.m.val_SI / self.c1.m.design), 3) msg = ('Value of isentropic efficiency must be ' + str(eta_s) + ', is ' + str(round(instance.eta_s.val, 3)) + '.') assert eta_s == round(instance.eta_s.val, 3), msg # test parameter specification for pr instance.eta_s_char.set_attr(param='pr') self.c1.set_attr(v=1) self.c2.set_attr(p=6) self.nw.solve('offdesign', design_path='tmp') convergence_check(self.nw.lin_dep) expr = (self.c2.p.val_SI * self.c1.p.design / (self.c2.p.design * self.c1.p.val_SI)) eta_s = round(eta_s_d * instance.eta_s_char.char_func.evaluate(expr), 3) msg = ('Value of isentropic efficiency must be ' + str(eta_s) + ', is ' + str(round(instance.eta_s.val, 3)) + '.') assert eta_s == round(instance.eta_s.val, 3), msg shutil.rmtree('./tmp', ignore_errors=True)
def test_Pump(self): """Test component properties of pumps.""" instance = Pump('pump') self.setup_network(instance) fl = {'N2': 0, 'O2': 0, 'Ar': 0, 'DowQ': 1, 'NH3': 0} self.c1.set_attr(fluid=fl, v=1, p=5, T=50) self.c2.set_attr(p=7) instance.set_attr(eta_s=1) self.nw.solve('design') convergence_check(self.nw.lin_dep) # test calculated value for efficiency eta_s = ((isentropic(self.c1.get_flow(), self.c2.get_flow()) - self.c1.h.val_SI) / (self.c2.h.val_SI - self.c1.h.val_SI)) msg = ('Value of isentropic efficiency must be ' + str(eta_s) + ', is ' + str(instance.eta_s.val) + '.') assert eta_s == instance.eta_s.val, msg # isentropic efficiency of 1 means inlet and outlet entropy are # identical s1 = round(s_mix_ph(self.c1.get_flow()), 4) s2 = round(s_mix_ph(self.c2.get_flow()), 4) msg = ('Value of entropy must be identical for inlet (' + str(s1) + ') and outlet (' + str(s2) + ') at 100 % isentropic efficiency.') assert s1 == s2, msg # specify realistic value for efficiency, outlet pressure from flow # char eta_s_d = 0.8 instance.set_attr(eta_s=eta_s_d) self.nw.solve('design') convergence_check(self.nw.lin_dep) self.nw.save('tmp') self.c2.set_attr(p=np.nan) # flow char (pressure rise vs. volumetric flow) x = [0, 0.2, 0.4, 0.6, 0.8, 1, 1.2, 1.4] y = np.array([14, 13.5, 12.5, 11, 9, 6.5, 3.5, 0]) * 1e5 char = {'char_func': CharLine(x, y), 'is_set': True} # apply flow char and eta_s char instance.set_attr(flow_char=char, eta_s=np.nan, eta_s_char={ 'char_func': ldc('pump', 'eta_s_char', 'DEFAULT', CharLine), 'is_set': True }) self.nw.solve('offdesign', design_path='tmp') convergence_check(self.nw.lin_dep) # value for difference pressure dp = 650000.0 msg = ('Value of pressure rise must be ' + str(dp) + ', is ' + str(self.c2.p.val_SI - self.c1.p.val_SI) + '.') assert round(self.c2.p.val_SI - self.c1.p.val_SI, 0) == dp, msg # test ohter volumetric flow on flow char self.c1.set_attr(v=0.9) self.nw.solve('offdesign', design_path='tmp') convergence_check(self.nw.lin_dep) dp = 775000.0 msg = ('Value of pressure rise must be ' + str(dp) + ', is ' + str(round(self.c2.p.val_SI - self.c1.p.val_SI, 0)) + '.') assert round(self.c2.p.val_SI - self.c1.p.val_SI, 0) == dp, msg # test value of isentropic efficiency eta_s = round( eta_s_d * instance.eta_s_char.char_func.evaluate( self.c1.v.val_SI / self.c1.v.design), 3) msg = ('Value of isentropic efficiency must be ' + str(eta_s) + ', is ' + str(instance.eta_s.val) + '.') assert eta_s == round(instance.eta_s.val, 3), msg instance.eta_s_char.is_set = False # test boundaries of characteristic line: # lower boundary instance.set_attr(eta_s=0.8) self.c1.set_attr(m=0, v=None) self.nw.solve('design') convergence_check(self.nw.lin_dep) msg = ('Value of power must be ' + str(14e5) + ', is ' + str(round(self.c2.p.val_SI - self.c1.p.val_SI, 0)) + '.') assert round(self.c2.p.val_SI - self.c1.p.val_SI, 0) == 14e5, msg # upper boundary self.c1.set_attr(v=1.5, m=None) self.nw.solve('design') convergence_check(self.nw.lin_dep) msg = ('Value of power must be 0, is ' + str(round(self.c2.p.val_SI - self.c1.p.val_SI, 0)) + '.') assert round(self.c2.p.val_SI - self.c1.p.val_SI, 0) == 0, msg shutil.rmtree('./tmp', ignore_errors=True)
def comp_init(self, nw, num_eq=0): r""" Perform component initialization in network preprocessing. Parameters ---------- nw : tespy.networks.network.Network Network this component is integrated in. """ self.num_nw_fluids = len(nw.fluids) self.nw_fluids = nw.fluids self.always_all_equations = nw.always_all_equations self.num_nw_vars = self.num_nw_fluids + 3 self.it = 0 self.num_eq = 0 self.vars = {} self.num_vars = 0 self.constraints = OrderedDict(self.get_mandatory_constraints().copy()) self.__dict__.update(self.constraints) for constraint in self.constraints.values(): self.num_eq += constraint['num_eq'] for key, val in self.variables.items(): data = self.get_attr(key) if isinstance(val, dc_cp): if data.is_var: data.var_pos = self.num_vars self.num_vars += 1 self.vars[data] = key # component characteristics elif isinstance(val, dc_cc): if data.char_func is None: try: data.char_func = ldc( self.component(), key, 'DEFAULT', CharLine) except KeyError: data.char_func = CharLine(x=[0, 1], y=[1, 1]) # component characteristics elif isinstance(val, dc_cm): if data.char_func is None: try: data.char_func = ldc( self.component(), key, 'DEFAULT', CharMap) except KeyError: data.char_func = CharLine(x=[0, 1], y=[1, 1]) # grouped component properties elif isinstance(val, dc_gcp): is_set = True for e in data.elements: if not self.get_attr(e).is_set: is_set = False if is_set: data.set_attr(is_set=True) elif data.is_set: start = ( 'All parameters of the component group have to be ' 'specified! This component group uses the following ' 'parameters: ') end = ' at ' + self.label + '. Group will be set to False.' logging.warning(start + ', '.join(val.elements) + end) val.set_attr(is_set=False) else: val.set_attr(is_set=False) # component properties if data.is_set and data.func is not None: self.num_eq += data.num_eq # print(key, data.is_set, self.num_eq) # set up Jacobian matrix and residual vector self.jacobian = np.zeros(( self.num_eq, self.num_i + self.num_o + self.num_vars, self.num_nw_vars)) self.residual = np.zeros(self.num_eq) sum_eq = 0 for constraint in self.constraints.values(): num_eq = constraint['num_eq'] if constraint['constant_deriv']: self.jacobian[sum_eq:sum_eq + num_eq] = constraint['deriv']() sum_eq += num_eq # done msg = ( 'The component ' + self.label + ' has ' + str(self.num_vars) + ' custom variables.') logging.debug(msg)
comp.set_attr(pr=15, eta_s=0.85, eta_s_char=cp_char1, design=['pr', 'eta_s'], offdesign=['eta_s_char']) comp_fuel.set_attr(eta_s=0.85, eta_s_char=cp_char2, design=['eta_s'], offdesign=['eta_s_char']) g_turb.set_attr(eta_s=0.9, eta_s_char=eta_s_gt, design=['eta_s'], offdesign=['eta_s_char', 'cone']) c_c.set_attr(lamb=2.5) eta_s_char1 = ldc('turbine', 'eta_s_char', 'TRAUPEL', char_line) eta_s_char2 = ldc('turbine', 'eta_s_char', 'TRAUPEL', char_line) # steam turbine suph.set_attr(pr1=0.99, pr2=0.98, ttd_u=50, design=['pr1', 'pr2', 'ttd_u'], offdesign=['zeta1', 'zeta2', 'kA_char']) eco.set_attr(pr1=0.99, pr2=1, design=['pr1', 'pr2'], offdesign=['zeta1', 'zeta2', 'kA_char']) evap.set_attr(pr1=0.99, ttd_l=20, design=['pr1', 'ttd_l'],
def set_attr(self): r""" # %% set the attribution of the heat pump :return: heat output of the heat pump """ HeatPump.cd.set_attr(pr1=0.99, pr2=0.99, ttd_u=15, design=['pr2', 'ttd_u'], offdesign=['zeta2', 'kA']) HeatPump.dhp.set_attr(eta_s=self.eff, design=['eta_s'], offdesign=['eta_s_char']) HeatPump.cons.set_attr(pr=0.99, design=['pr'], offdesign=['zeta']) # water pump HeatPump.pu.set_attr(eta_s=self.eff, design=['eta_s'], offdesign=['eta_s_char']) # evaporator system kA_char1 = ldc('heat exchanger', 'kA_char1', 'DEFAULT', char_line) kA_char2 = ldc('heat exchanger', 'kA_char2', 'EVAPORATING FLUID', char_line) HeatPump.ev.set_attr(pr1=0.98, pr2=0.99, ttd_l=5, kA_char1=kA_char1, kA_char2=kA_char2, design=['pr1', 'ttd_l'], offdesign=['zeta1', 'kA']) HeatPump.su.set_attr(pr1=0.98, pr2=0.99, ttd_u=2, design=['pr1', 'pr2', 'ttd_u'], offdesign=['zeta1', 'zeta2', 'kA']) HeatPump.erp.set_attr(eta_s=self.eff, design=['eta_s'], offdesign=['eta_s_char']) # compressor system HeatPump.cp1.set_attr(eta_s=self.eff, design=['eta_s'], offdesign=['eta_s_char']) HeatPump.cp2.set_attr(eta_s=self.eff, pr=3, design=['eta_s'], offdesign=['eta_s_char']) HeatPump.ic.set_attr(pr1=0.99, pr2=0.98, design=['pr1', 'pr2'], offdesign=['zeta1', 'zeta2', 'kA']) # %% connection parametrization # condenser system HeatPump.c_in_cd.set_attr(fluid={'air': 0, 'NH3': 1, 'water': 0}) HeatPump.cb_dhp.set_attr(T=20, p=10, fluid={ 'air': 0, 'NH3': 0, 'water': 1 }) HeatPump.cd_cons.set_attr(T=self.Temp) HeatPump.cons_cf.set_attr(h=ref(HeatPump.cb_dhp, 1, 0), p=ref(HeatPump.cb_dhp, 1, 0)) # evaporator system cold side HeatPump.erp_ev.set_attr(m=ref(HeatPump.ves_dr, 1.25, 0), p0=5) HeatPump.su_cp1.set_attr(p0=5, h0=1700) # evaporator system hot side # pumping at constant rate in partload HeatPump.amb_p.set_attr(T=12, p=2, fluid={ 'air': 0, 'NH3': 0, 'water': 1 }, offdesign=['v']) HeatPump.sp_su.set_attr(offdesign=['v']) HeatPump.ev_amb_out.set_attr(p=2, T=9, design=['T']) # compressor-system HeatPump.he_cp2.set_attr(Td_bp=5, p0=20, design=['Td_bp']) HeatPump.ic_out.set_attr(T=15, design=['T']) # %% key paramter HeatPump.cons.set_attr(Q=self.q)
comp.set_attr(pr=15, eta_s=0.85, eta_s_char=cp_char1, design=['pr', 'eta_s'], offdesign=['eta_s_char']) comp_fuel.set_attr(eta_s=0.85, eta_s_char=cp_char2, design=['eta_s'], offdesign=['eta_s_char']) g_turb.set_attr(eta_s=0.9, eta_s_char=eta_s_gt, design=['eta_s'], offdesign=['eta_s_char', 'cone']) c_c.set_attr(lamb=2.5) eta_s_char1 = ldc('turbine', 'eta_s_char', 'TRAUPEL', CharLine) eta_s_char2 = ldc('turbine', 'eta_s_char', 'TRAUPEL', CharLine) # steam turbine suph.set_attr(pr1=0.99, pr2=0.98, ttd_u=50, design=['pr1', 'pr2', 'ttd_u'], offdesign=['zeta1', 'zeta2', 'kA_char']) eco.set_attr(pr1=0.99, pr2=1, design=['pr1', 'pr2'], offdesign=['zeta1', 'zeta2', 'kA_char']) evap.set_attr(pr1=0.99, ttd_l=20, design=['pr1', 'ttd_l'],