def test_solar_collector(self): """ Test component properties of solar collector. """ instance = cmp.solar_collector('solar collector') c1, c2 = self.setup_network_11(instance) fl = { 'N2': 0, 'O2': 0, 'Ar': 0, 'INCOMP::DowQ': 0, 'H2O': 1, 'NH3': 0, 'CO2': 0, 'CH4': 0 } c1.set_attr(fluid=fl, m=1, p=10, T=100) # trigger solar collector parameter groups (see heat exchanger simple) instance.set_attr(hydro_group='HW', L=100, ks=100, pr=0.99, Tamb=20) instance.hydro_group.is_set = True instance.energy_group.is_set = True self.nw.solve('design', init_only=True) eq_(instance.hydro_group.is_set, False, 'Hydro group must no be set, if one parameter is missing!') eq_(instance.energy_group.is_set, False, 'Energy group must no be set, if one parameter is missing!')
from matplotlib import pyplot as plt import pandas as pd # %% network fluid_list = ['H2O'] nw = nwk.network(fluids=fluid_list, p_unit='bar', T_unit='C') # %% components # sinks & sources back = cmp.source('to collector') feed = cmp.sink('from collector') # collector coll = cmp.solar_collector(label='solar thermal collector') # %% connections b_c = con.connection(back, 'out1', coll, 'in1') c_f = con.connection(coll, 'out1', feed, 'in1') nw.add_conns(b_c, c_f) # %% component parameters # set pressure ratio and heat flow, as well as dimensional parameters of # the collector. E is missing, thus energy balance for radiation is not # performed at this point coll.set_attr(pr=0.99, Q=8e3, lkf_lin=1, lkf_quad=0.005, A=10, Tamb=10)
def setup_network_individual_offdesign(self): """ Set up network for individual offdesign tests. """ so = cmp.source('source') sp = cmp.splitter('splitter', num_out=2) self.pump1 = cmp.pump('pump 1') self.sc1 = cmp.solar_collector('collector field 1') v1 = cmp.valve('valve1') self.pump2 = cmp.pump('pump 2') self.sc2 = cmp.solar_collector('collector field 2') v2 = cmp.valve('valve2') me = cmp.merge('merge', num_in=2) si = cmp.sink('sink') self.pump1.set_attr(eta_s=0.8, design=['eta_s'], offdesign=['eta_s_char']) self.pump2.set_attr(eta_s=0.8, design=['eta_s'], offdesign=['eta_s_char']) self.sc1.set_attr(pr=0.95, lkf_lin=3.33, lkf_quad=0.011, A=1252, E=700, Tamb=20, design=['pr'], offdesign=['zeta']) self.sc2.set_attr(pr=0.95, lkf_lin=3.5, lkf_quad=0.011, A=700, E=800, Tamb=20, design=['pr'], offdesign=['zeta']) fl = { 'N2': 0, 'O2': 0, 'Ar': 0, 'INCOMP::DowQ': 0, 'H2O': 1, 'NH3': 0, 'CO2': 0, 'CH4': 0 } inlet = con.connection(so, 'out1', sp, 'in1', T=50, p=3, fluid=fl) outlet = con.connection(me, 'out1', si, 'in1', p=3) sp_p1 = con.connection(sp, 'out1', self.pump1, 'in1') p1_sc1 = con.connection(self.pump1, 'out1', self.sc1, 'in1') self.sc1_v1 = con.connection(self.sc1, 'out1', v1, 'in1', p=3.1, T=90) v1_me = con.connection(v1, 'out1', me, 'in1') self.sp_p2 = con.connection(sp, 'out2', self.pump2, 'in1') self.p2_sc2 = con.connection(self.pump2, 'out1', self.sc2, 'in1') self.sc2_v2 = con.connection(self.sc2, 'out1', v2, 'in1', p=3.1, m=0.1) v2_me = con.connection(v2, 'out1', me, 'in2') self.nw.add_conns(inlet, outlet, sp_p1, p1_sc1, self.sc1_v1, v1_me, self.sp_p2, self.p2_sc2, self.sc2_v2, v2_me)