예제 #1
0
    def load_tespy_model(self):

        # load tespy models with the network_reader module
        self.tespy_charge = load_network(self.wdir + self.tespy_charge_path)
        self.tespy_charge.set_printoptions(print_level='none')
        self.tespy_discharge = load_network(self.wdir +
                                            self.tespy_discharge_path)
        self.tespy_discharge.set_printoptions(print_level='none')

        self.power_plant_layout()
예제 #2
0
    def load_tespy_model(self):

        # load tespy models with the network_reader module
        self.charge = load_network(self.wdir + self.tespy_charge_path)
        self.charge.set_attr(iterinfo=False)
        self.charge.solve('design', init_only=True)
        self.discharge = load_network(self.wdir + self.tespy_discharge_path)
        self.discharge.set_attr(iterinfo=False)
        self.discharge.solve('design', init_only=True)

        self.power_plant_layout()
예제 #3
0
파일: test_network.py 프로젝트: oemof/tespy
    def test_Network_reader_no_chars_busses(self):
        """Test import of network without characteristics or busses."""
        self.setup_Network_tests()
        a = Connection(self.source, 'out1', self.sink, 'in1')
        self.nw.add_conns(a)
        self.nw.solve('design', init_only=True)
        self.nw.save('tmp')

        imported_nwk = load_network('tmp')
        imported_nwk.solve('design', init_only=True)
        msg = ('If the network import was successful the network check '
               'should have been successful, too, but it is not.')
        assert imported_nwk.checked, msg
        shutil.rmtree('./tmp', ignore_errors=True)
예제 #4
0
    def load_tespy_model(self):

        # load tespy models with the network_reader module
        self.instance = load_network(
            os.path.join(self.wdir, self.model_data['path']))
        self.instance.set_attr(m_range=self.model_data['m_range'],
                               iterinfo=False)
        if self.model_data['debug'] is True:
            self.instance.set_attr(iterinfo=True)

        # design heat flow
        self.instance.busses[self.model_data['heat_bus_sys']].set_attr(
            P=self.model_data['Q_design'])

        # design system temperatures
        self.instance.connections[self.model_data['ff_sys']].set_attr(
            T=self.model_data['T_ff_sys_design'])

        self.instance.connections[self.model_data['rf_sys']].set_attr(
            T=self.model_data['T_rf_sys_design'])

        # design storage temperatures
        self.instance.connections[self.model_data['ff_sto']].set_attr(
            T=self.model_data['T_ff_sto_design'])

        self.instance.connections[self.model_data['rf_sto']].set_attr(
            T=self.model_data['T_rf_sto_design'])

        # solve design case and save to path
        self.instance.solve('design')
        self.new_design = self.wdir + self.model_data['path'] + '_design'
        self.instance.save(self.new_design)

        # offdesign test
        self.instance.solve('offdesign',
                            design_path=self.new_design,
                            init_path=self.new_design)

        # create low load data
        Q_range = np.linspace(self.model_data['Q_low'], 1,
                              3)[::-1] * self.model_data['Q_design']
        for Q in Q_range:
            self.instance.busses[self.model_data['heat_bus_sys']].set_attr(P=Q)

            self.instance.solve('offdesign', design_path=self.new_design)
        self.instance.save(self.new_design + '_low_Q')
예제 #5
0
파일: test_network.py 프로젝트: oemof/tespy
    def test_Network_reader_deleted_chars(self):
        """Test import of network with missing characteristics."""
        self.setup_Network_tests()
        comp = Compressor('compressor')
        a = Connection(self.source, 'out1', comp, 'in1')
        b = Connection(comp, 'out1', self.sink, 'in1')
        self.nw.add_conns(a, b)
        self.nw.solve('design', init_only=True)
        self.nw.save('tmp')

        # # remove char_line and char_map folders
        os.unlink('tmp/components/char_line.csv')
        os.unlink('tmp/components/char_map.csv')

        # import network with missing files
        imported_nwk = load_network('tmp')
        imported_nwk.solve('design', init_only=True)
        msg = ('If the network import was successful the network check '
               'should have been successful, too, but it is not.')
        assert imported_nwk.checked, msg
        shutil.rmtree('./tmp', ignore_errors=True)
예제 #6
0
from tespy.networks import load_network

path = 'powerplant/hp_discharge'
nw = load_network(path)
nw.imp_busses["heat system"].set_attr(P=1e6)
nw.imp_conns["condenser:out2_system feed:in1"].set_attr(T=70)
nw.imp_conns["system return:out1_condenser:in2"].set_attr(T=57)
nw.imp_conns["evaporator:out1_storage feed:in1"].set_attr(T=15)
nw.imp_conns["storage return:out1_superheater:in1"].set_attr(T=25)

nw.solve('design')
nw.print_results()
nw.save('test')
nw.print_results()

nw.imp_conns["condenser:out2_system feed:in1"].set_attr(T=80.3)
nw.imp_conns["system return:out1_condenser:in2"].set_attr(T=47.6)
nw.imp_conns["storage return:out1_superheater:in1"].set_attr(T=20)
nw.solve('offdesign', design_path='test')

nw.imp_conns["condenser:out2_system feed:in1"].set_attr(T=80.3)
nw.imp_conns["system return:out1_condenser:in2"].set_attr(T=47.6)
nw.imp_conns["storage return:out1_superheater:in1"].set_attr(T=16.26)
nw.solve('offdesign', design_path='test')
print(nw.imp_conns["evaporator:out1_storage feed:in1"].T.val)

nw.imp_conns["condenser:out2_system feed:in1"].set_attr(T=83.9)
nw.imp_conns["system return:out1_condenser:in2"].set_attr(T=48.4)
nw.imp_conns["storage return:out1_superheater:in1"].set_attr(T=16.26)
nw.solve('offdesign', design_path='test')
print(nw.imp_conns["evaporator:out1_storage feed:in1"].T.val)
예제 #7
0
            pre_Tin_val = Tin_val
            norm = np.linalg.norm(
                abs(np.asarray(pre_Tin_val) - np.asarray(cur_Tin_val)))
            if norm < 10e-6:
                if_success = True
            # return to OGS
            return (True, if_success, cur_Tin_val, cur_flowrate)


# main
# initialize the tespy model of the bhe network
# load path of network model:
# loading the TESPy model
project_dir = os.getcwd()
print("Project dir is: ", project_dir)
nw = load_network('./pre/tespy_nw')
# set if print the network iteration info
nw.set_attr(iterinfo=False)

# create bhe dataframe of the network system from bhe_network.csv
df = create_dataframe()
n_BHE = np.size(df.iloc[:, 0])

# create local variables of the components label and connections label in
# network
localVars = locals()
data_index = df.index.tolist()
for i in range(n_BHE):
    for c in nw.conns.index:
        # bhe inlet and outlet conns
        if c.target.label == data_index[i]:  # inlet conns of bhe
예제 #8
0
파일: bcs_tespy.py 프로젝트: TomFischer/ogs
            if_success = False
            pre_Tin_val = Tin_val
            norm = np.linalg.norm(
                abs(np.asarray(pre_Tin_val) - np.asarray(cur_Tin_val)))
            if norm < 10e-6:
                if_success = True
            # return to OGS
            return (True, if_success, cur_Tin_val, cur_flowrate)


# main
# initialize the tespy model of the bhe network
# load path of network model:
# loading the TESPy model
project_dir = os.chdir(ogs_prj_directory)
nw = load_network("./pre/tespy_nw")
# set if print the network iteration info
nw.set_attr(iterinfo=False)

# create bhe dataframe of the network system from bhe_network.csv
df = create_dataframe()
n_BHE = np.size(df.iloc[:, 0])

# create local variables of the components label and connections label in
# network
localVars = locals()
data_index = df.index.tolist()
for i in range(n_BHE):
    for c in nw.conns.index:
        # bhe inlet and outlet conns
        if c.target.label == data_index[i]:  # inlet conns of bhe
예제 #9
0
        norm = np.linalg.norm(
            abs(np.asarray(pre_cal_Tin_val) - np.asarray(cur_cal_Tin_val)))
        if norm < 10e-6:
            if_success = True
        # return to OGS
        return (if_success, cur_cal_f_r_val, cur_cal_Tin_val)


#%%main
    ###TESPy initialise
# initialize the tespy model of the bhe network
# load path of network model:
# loading the TESPy model
project_dir = os.getcwd()
print("Project dir is: ", project_dir)
nw = load_network('./base_module/pre/tespy_nw')
# set if print the network iteration info
nw.set_attr(iterinfo=False)

# create bhe dataframe of the network system from bhe_network.csv
df_nw = create_dataframe()
n_BHE = np.size(df_nw.iloc[:, 0])
# create local variables of the components label and connections label in
# network
localVars = locals()
data_index = df_nw.index.tolist()
for i in range(n_BHE):
    for c in nw.conns.index:
        # bhe inlet and outlet conns
        if c.t.label == data_index[i]:  # inlet conns of bhe
            localVars['inlet_BHE' + str(i + 1)] = c
예제 #10
0
            norm_dx = np.linalg.norm(
                abs(np.asarray(pre_Tin_val) - np.asarray(cur_Tin_val)))
            norm_x = np.linalg.norm(np.asarray(cur_Tin_val))
            if norm_dx / norm_x < 1e-6:
                if_success = True
            # return to OGS
            return (True, if_success, cur_Tin_val, cur_flowrate)


# main
# initialize the tespy model of the bhe network
# load path of network model:
# loading the TESPy model
project_dir = os.getcwd()
print("Project dir is: ", project_dir)
nw = load_network("./pre/tespy_nw_closedloop")
# set if print the network iteration info
nw.set_attr(iterinfo=False)

# create bhe dataframe of the network system from bhe_network.csv
df = create_dataframe()
n_BHE = np.size(df.iloc[:, 0])

# create local variables of the components label and connections label in
# network
localVars = locals()
data_index = df.index.tolist()
for i in range(n_BHE):
    for c in nw.conns.index:
        # bhe inlet and outlet conns
        if c.target.label == data_index[i]:  # inlet conns of bhe
예제 #11
0
            norm_dx = np.linalg.norm(
                abs(np.asarray(pre_Tin_val) - np.asarray(cur_Tin_val)))
            norm_x = np.linalg.norm(np.asarray(cur_Tin_val))
            if norm_dx / norm_x < 1e-6:
                if_success = True
            # return to OGS
            return (True, if_success, cur_Tin_val, cur_flowrate)


# main
# initialize the tespy model of the bhe network
# load path of network model:
# loading the TESPy model
project_dir = os.getcwd()
print("Project dir is: ", project_dir)
nw = load_network('./pre/tespy_nw_closedloop')
# set if print the network iteration info
nw.set_attr(iterinfo=False)

# create bhe dataframe of the network system from bhe_network.csv
df = create_dataframe()
n_BHE = np.size(df.iloc[:, 0])

# create local variables of the components label and connections label in
# network
localVars = locals()
data_index = df.index.tolist()
for i in range(n_BHE):
    for c in nw.conns.index:
        # bhe inlet and outlet conns
        if c.target.label == data_index[i]:  # inlet conns of bhe