How to use the tespy.cmp.sink function in tespy

To help you get started, we’ve selected a few tespy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github oemof / tespy / tests / component_tests.py View on Github external
def test_cogeneration_unit(self):
        """
        Test component properties of cogeneration unit.
        """
        amb = cmp.source('ambient')
        sf = cmp.source('fuel')
        fg = cmp.sink('flue gas outlet')
        cw_in1 = cmp.source('cooling water inlet1')
        cw_in2 = cmp.source('cooling water inlet2')
        cw_out1 = cmp.sink('cooling water outlet1')
        cw_out2 = cmp.sink('cooling water outlet2')
        chp = cmp.cogeneration_unit('cogeneration unit', fuel='CH4')
        amb_comb = con.connection(amb, 'out1', chp, 'in3')
        sf_comb = con.connection(sf, 'out1', chp, 'in4')
        comb_fg = con.connection(chp, 'out3', fg, 'in1')
        self.nw.add_conns(sf_comb, amb_comb, comb_fg)
        cw1_chp1 = con.connection(cw_in1, 'out1', chp, 'in1')
        cw2_chp2 = con.connection(cw_in2, 'out1', chp, 'in2')
        self.nw.add_conns(cw1_chp1, cw2_chp2)
        chp1_cw = con.connection(chp, 'out1', cw_out1, 'in1')
        chp2_cw = con.connection(chp, 'out2', cw_out2, 'in1')
        self.nw.add_conns(chp1_cw, chp2_cw)

        air = {'N2': 0.7556, 'O2': 0.2315, 'Ar': 0.0129, 'INCOMP::DowQ': 0, 'H2O': 0, 'NH3': 0, 'CO2': 0, 'CH4': 0}
        fuel = {'N2': 0, 'O2': 0, 'Ar': 0, 'INCOMP::DowQ': 0, 'H2O': 0, 'NH3': 0, 'CO2': 0.04, 'CH4': 0.96}
        water1 = {'N2': 0, 'O2': 0, 'Ar': 0, 'INCOMP::DowQ': 0, 'H2O': 1, 'NH3': 0, 'CO2': 0, 'CH4': 0}
        water2 = {'N2': 0, 'O2': 0, 'Ar': 0, 'INCOMP::DowQ': 0, 'H2O': 1, 'NH3': 0, 'CO2': 0, 'CH4': 0}
github oemof / tespy / tests / component_tests.py View on Github external
def setup_network_electrolyzer(self, instance):
        """
        Set up network for electrolyzer tests.
        """
        fw = cmp.source('feed water')
        cw_in = cmp.source('cooling water')
        o2 = cmp.sink('oxygen sink')
        h2 = cmp.sink('hydrogen sink')
        cw_out = cmp.sink('cooling water sink')

        instance.set_attr(pr_c=0.99)

        cw_el = con.connection(cw_in, 'out1', instance, 'in1', fluid={'H2O': 1, 'H2': 0, 'O2': 0}, T=20, p=1)
        el_cw = con.connection(instance, 'out1', cw_out, 'in1', T=45)

        self.nw.add_conns(cw_el, el_cw)

        fw_el = con.connection(fw, 'out1', instance, 'in2', m=0.1, T=20, p=10)
        el_o2 = con.connection(instance, 'out2', o2, 'in1')
        el_h2 = con.connection(instance, 'out3', h2, 'in1', T=50)

        self.nw.add_conns(fw_el, el_o2, el_h2)
github oemof / tespy / tests / component_tests.py View on Github external
def setup_network_electrolyzer(self, instance):
        """
        Set up network for electrolyzer tests.
        """
        fw = cmp.source('feed water')
        cw_in = cmp.source('cooling water')
        o2 = cmp.sink('oxygen sink')
        h2 = cmp.sink('hydrogen sink')
        cw_out = cmp.sink('cooling water sink')

        instance.set_attr(pr_c=0.99)

        cw_el = con.connection(cw_in, 'out1', instance, 'in1', fluid={'H2O': 1, 'H2': 0, 'O2': 0}, T=20, p=1)
        el_cw = con.connection(instance, 'out1', cw_out, 'in1', T=45)

        self.nw.add_conns(cw_el, el_cw)

        fw_el = con.connection(fw, 'out1', instance, 'in2', m=0.1, T=20, p=10)
        el_o2 = con.connection(instance, 'out2', o2, 'in1')
        el_h2 = con.connection(instance, 'out3', h2, 'in1', T=50)

        self.nw.add_conns(fw_el, el_o2, el_h2)
github oemof / tespy / tests / component_tests.py View on Github external
def test_heat_ex(self):
        """
        Test component properties of heat exchanger.
        """
        tesin = cmp.sink('TES in')
        tesout = cmp.source('TES out')
        hsin = cmp.sink('HS in')
        hsout = cmp.source('HS out')
        he = cmp.heat_exchanger('heat exchanger')
        tes_he = con.connection(tesout, 'out1', he, 'in2')
        he_tes = con.connection(he, 'out2', tesin, 'in1')
        hs_he = con.connection(hsout, 'out1', he, 'in1')
        he_hs = con.connection(he, 'out1', hsin, 'in1')
        self.nw.add_conns(tes_he, he_tes, hs_he, he_hs)
        # design specification
        he.set_attr(pr1=0.98, pr2=0.98, ttd_u=5, design=['pr1', 'pr2', 'ttd_u'], offdesign=['zeta1', 'zeta2', 'kA'])
        hs_he.set_attr(T=120, p=3, fluid={'N2': 0, 'O2': 0, 'Ar': 0, 'INCOMP::DowQ': 0, 'H2O': 1, 'NH3': 0, 'CO2': 0, 'CH4': 0})
        he_hs.set_attr(T=70)
        tes_he.set_attr(T=40, p=5, fluid={'N2': 0, 'O2': 0, 'Ar': 1, 'INCOMP::DowQ': 0, 'H2O': 0, 'NH3': 0, 'CO2': 0, 'CH4': 0})
        b = con.bus('heat transfer', P=-80e3)
        b.add_comps({'c': he})
github oemof / tespy / tests / component_tests.py View on Github external
def setup_network_electrolyzer(self, instance):
        """
        Set up network for electrolyzer tests.
        """
        fw = cmp.source('feed water')
        cw_in = cmp.source('cooling water')
        o2 = cmp.sink('oxygen sink')
        h2 = cmp.sink('hydrogen sink')
        cw_out = cmp.sink('cooling water sink')

        instance.set_attr(pr_c=0.99)

        cw_el = con.connection(cw_in, 'out1', instance, 'in1', fluid={'H2O': 1, 'H2': 0, 'O2': 0}, T=20, p=1)
        el_cw = con.connection(instance, 'out1', cw_out, 'in1', T=45)

        self.nw.add_conns(cw_el, el_cw)

        fw_el = con.connection(fw, 'out1', instance, 'in2', m=0.1, T=20, p=10)
        el_o2 = con.connection(instance, 'out2', o2, 'in1')
        el_h2 = con.connection(instance, 'out3', h2, 'in1', T=50)

        self.nw.add_conns(fw_el, el_o2, el_h2)
github oemof / tespy / docs / build / html / _downloads / CHP.py View on Github external
split=cmp.splitter(label='splitter1')
turbine_lp=cmp.turbine(label='turbine_lp',eta_s=0.9)

# condenser and preheater
condenser=cmp.condenser(label='condenser',dp1=0.95,dp2=0.95,ttd_u=7)
preheater=cmp.condenser(label='preheater',dp1=0.95,dp2=0.99,ttd_u=7)
vessel=cmp.vessel(label='vessel1',mode='man')
merge=cmp.merge(label='merge1')

# feed water
pump=cmp.pump(label='pump',eta_s=0.8,mode='man')
steam_generator=cmp.heat_exchanger_simple(label='steam generator',dp=0.95,mode='man')

# sources and sinks
source=cmp.source(label='source')
sink=cmp.sink(label='sink')

# for cooling water
source_cw=cmp.source(label='source_cw',)
sink_cw=cmp.sink(label='sink_cw')

# %% connections

# turbine part
fs_in=con.connection(source,'out1',vessel_turb,'in1',p=100,T=550)
fs=con.connection(vessel_turb,'out1',turbine_hp,'in1',p=100,m=47,fluid={'water':1})
ext=con.connection(turbine_hp,'out1',split,'in1',p=10)
ext_pre=con.connection(split,'out1',preheater,'in1')
ext_turb=con.connection(split,'out2',turbine_lp,'in1',h0=2800000)

# preheater and condenser
ext_cond=con.connection(preheater,'out1',vessel,'in1',h0=600000)
github oemof / tespy / examples / simple_cr.py View on Github external
@author: witte
"""
from tespy import con, nwk, cmp
from CoolProp.CoolProp import PropsSI
import math
import matplotlib.pyplot as plt

# %% components

# main components
turbine=cmp.turbine('turbine',eta_s=0.9)
condenser=cmp.condenser('condenser',dp1=1,dp2=1)
pump=cmp.pump('pump',eta_s=0.8)
steam_generator=cmp.heat_exchanger_simple('steam generator',dp=0.95,mode='man')
source=cmp.source('source1')
sink=cmp.sink('sink1')

# cooling water
source_cw=cmp.source('source2')
sink_cw=cmp.sink('sink2')

# %% connections

# main cycle
fs=con.connection(source,'out1',turbine,'in1',p=100,T=500,m=100,fluid={'water':1})
ws=con.connection(turbine,'out1',condenser,'in1',p=1)
cond=con.connection(condenser,'out1',pump,'in1')
fw=con.connection(pump,'out1',steam_generator,'in1')
# closing the cylce:
# fluid properties are the same as at the turbine inlet
out=con.connection(steam_generator,'out1',sink,'in1',p=con.ref(fs,1,0),h=con.ref(fs,1,0))
github oemof / tespy / examples / simple_clausius_rankine.py View on Github external
fluids = ['water']

nw = nwk.network(fluids=fluids)
nw.set_attr(p_unit='bar', T_unit='C', h_unit='kJ / kg',
            p_range=[0.01, 150], T_range=[5, 800], h_range=[10, 5000])

# %% components

# main components
turbine = cmp.turbine('turbine')
condenser = cmp.condenser('condenser')
pump = cmp.pump('pump')
steam_generator = cmp.heat_exchanger_simple('steam generator')
source = cmp.source('cycle opener')
sink = cmp.sink('cycle closer')

# cooling water
source_cw = cmp.source('cooling water inlet')
sink_cw = cmp.sink('cooling water outlet')

# %% connections

# main cycle
fs_in = con.connection(source, 'out1', turbine, 'in1')
ws = con.connection(turbine, 'out1', condenser, 'in1')
cond = con.connection(condenser, 'out1', pump, 'in1')
fw = con.connection(pump, 'out1', steam_generator, 'in1')
fs_out = con.connection(steam_generator, 'out1', sink, 'in1')
nw.add_conns(fs_in, ws, cond, fw, fs_out)

# cooling water
github oemof / tespy / docs / build / html / _downloads / CHP.py View on Github external
condenser=cmp.condenser(label='condenser',dp1=0.95,dp2=0.95,ttd_u=7)
preheater=cmp.condenser(label='preheater',dp1=0.95,dp2=0.99,ttd_u=7)
vessel=cmp.vessel(label='vessel1',mode='man')
merge=cmp.merge(label='merge1')

# feed water
pump=cmp.pump(label='pump',eta_s=0.8,mode='man')
steam_generator=cmp.heat_exchanger_simple(label='steam generator',dp=0.95,mode='man')

# sources and sinks
source=cmp.source(label='source')
sink=cmp.sink(label='sink')

# for cooling water
source_cw=cmp.source(label='source_cw',)
sink_cw=cmp.sink(label='sink_cw')

# %% connections

# turbine part
fs_in=con.connection(source,'out1',vessel_turb,'in1',p=100,T=550)
fs=con.connection(vessel_turb,'out1',turbine_hp,'in1',p=100,m=47,fluid={'water':1})
ext=con.connection(turbine_hp,'out1',split,'in1',p=10)
ext_pre=con.connection(split,'out1',preheater,'in1')
ext_turb=con.connection(split,'out2',turbine_lp,'in1',h0=2800000)

# preheater and condenser
ext_cond=con.connection(preheater,'out1',vessel,'in1',h0=600000)
cond_ws=con.connection(vessel,'out1',merge,'in2')
turb_ws=con.connection(turbine_lp,'out1',merge,'in1')
ws=con.connection(merge,'out1',condenser,'in1')