Beispiel #1
0
def test_makeplantloop():
    """pytest for makeplantloop"""
    tdata = (
        (
            "",
            "p_loop",
            ["sb0", ["sb1", "sb2", "sb3"], "sb4"],
            ["db0", ["db1", "db2", "db3"], "db4"],
            """BRANCH, sb0, 0, , Pipe:Adiabatic, sb0_pipe, p_loop Supply Inlet,
        sb0_pipe_outlet, Bypass;BRANCH, sb1, 0, , Pipe:Adiabatic, sb1_pipe,
        sb1_pipe_inlet, sb1_pipe_outlet, Bypass;BRANCH, sb2, 0, ,
        Pipe:Adiabatic, sb2_pipe, sb2_pipe_inlet, sb2_pipe_outlet,
        Bypass;BRANCH, sb3, 0, , Pipe:Adiabatic, sb3_pipe, sb3_pipe_inlet,
        sb3_pipe_outlet, Bypass;BRANCH, sb4, 0, , Pipe:Adiabatic, sb4_pipe,
        sb4_pipe_inlet, p_loop Supply Outlet, Bypass;BRANCH, db0, 0, ,
        Pipe:Adiabatic, db0_pipe, p_loop Demand Inlet, db0_pipe_outlet,
        Bypass;BRANCH, db1, 0, , Pipe:Adiabatic, db1_pipe, db1_pipe_inlet,
        db1_pipe_outlet, Bypass;BRANCH, db2, 0, , Pipe:Adiabatic, db2_pipe,
        db2_pipe_inlet, db2_pipe_outlet, Bypass;BRANCH, db3, 0, ,
        Pipe:Adiabatic, db3_pipe, db3_pipe_inlet, db3_pipe_outlet,
        Bypass;BRANCH, db4, 0, , Pipe:Adiabatic, db4_pipe, db4_pipe_inlet,
        p_loop Demand Outlet, Bypass;BRANCHLIST, p_loop Supply Branchs,
        sb0, sb1, sb2, sb3, sb4;BRANCHLIST, p_loop Demand Branchs, db0,
        db1, db2, db3, db4;CONNECTOR:SPLITTER, p_loop_supply_splitter,
        sb0, sb1, sb2, sb3;CONNECTOR:SPLITTER, p_loop_demand_splitter,
        db0, db1, db2, db3;CONNECTOR:MIXER, p_loop_supply_mixer, sb4,
        sb1, sb2, sb3;CONNECTOR:MIXER, p_loop_demand_mixer, db4, db1,
        db2, db3;CONNECTORLIST, p_loop Supply Connectors, Connector:Splitter,
        p_loop_supply_splitter, Connector:Mixer,
        p_loop_supply_mixer;CONNECTORLIST, p_loop Demand Connectors,
        Connector:Splitter, p_loop_demand_splitter, Connector:Mixer,
        p_loop_demand_mixer;PIPE:ADIABATIC, sb0_pipe, p_loop Supply Inlet,
        sb0_pipe_outlet;PIPE:ADIABATIC, sb1_pipe, sb1_pipe_inlet,
        sb1_pipe_outlet;PIPE:ADIABATIC, sb2_pipe, sb2_pipe_inlet,
        sb2_pipe_outlet;PIPE:ADIABATIC, sb3_pipe, sb3_pipe_inlet,
        sb3_pipe_outlet;PIPE:ADIABATIC, sb4_pipe, sb4_pipe_inlet,
        p_loop Supply Outlet;PIPE:ADIABATIC, db0_pipe,
        p_loop Demand Inlet, db0_pipe_outlet;PIPE:ADIABATIC, db1_pipe,
        db1_pipe_inlet, db1_pipe_outlet;PIPE:ADIABATIC, db2_pipe,
        db2_pipe_inlet, db2_pipe_outlet;PIPE:ADIABATIC, db3_pipe,
        db3_pipe_inlet, db3_pipe_outlet;PIPE:ADIABATIC, db4_pipe,
        db4_pipe_inlet, p_loop Demand Outlet;PLANTLOOP, p_loop, Water, , ,
        , , , , 0.0, Autocalculate, p_loop Supply Inlet,
        p_loop Supply Outlet, p_loop Supply Branchs,
        p_loop Supply Connectors, p_loop Demand Inlet, p_loop Demand Outlet,
        p_loop Demand Branchs, p_loop Demand Connectors, Sequential, ,
        SingleSetpoint, None, None;""",
        ),  # blankidf, loopname, sloop, dloop, nidf
    )
    for blankidf, loopname, sloop, dloop, nidf in tdata:
        fhandle = StringIO("")
        idf1 = IDF(fhandle)
        loopname = "p_loop"
        sloop = ["sb0", ["sb1", "sb2", "sb3"], "sb4"]
        dloop = ["db0", ["db1", "db2", "db3"], "db4"]
        hvacbuilder.makeplantloop(idf1, loopname, sloop, dloop)
        idf2 = IDF(StringIO(nidf))
        assert str(idf1.model) == str(idf2.model)
Beispiel #2
0
def test_makeplantloop():
    """pytest for makeplantloop"""
    tdata = (
        ("", "p_loop", ['sb0', ['sb1', 'sb2', 'sb3'],
                        'sb4'], ['db0', ['db1', 'db2', 'db3'], 'db4'],
         """BRANCH, sb0, 0, , Pipe:Adiabatic, sb0_pipe, p_loop Supply Inlet,
        sb0_pipe_outlet, Bypass;BRANCH, sb1, 0, , Pipe:Adiabatic, sb1_pipe,
        sb1_pipe_inlet, sb1_pipe_outlet, Bypass;BRANCH, sb2, 0, ,
        Pipe:Adiabatic, sb2_pipe, sb2_pipe_inlet, sb2_pipe_outlet,
        Bypass;BRANCH, sb3, 0, , Pipe:Adiabatic, sb3_pipe, sb3_pipe_inlet,
        sb3_pipe_outlet, Bypass;BRANCH, sb4, 0, , Pipe:Adiabatic, sb4_pipe,
        sb4_pipe_inlet, p_loop Supply Outlet, Bypass;BRANCH, db0, 0, ,
        Pipe:Adiabatic, db0_pipe, p_loop Demand Inlet, db0_pipe_outlet,
        Bypass;BRANCH, db1, 0, , Pipe:Adiabatic, db1_pipe, db1_pipe_inlet,
        db1_pipe_outlet, Bypass;BRANCH, db2, 0, , Pipe:Adiabatic, db2_pipe,
        db2_pipe_inlet, db2_pipe_outlet, Bypass;BRANCH, db3, 0, ,
        Pipe:Adiabatic, db3_pipe, db3_pipe_inlet, db3_pipe_outlet,
        Bypass;BRANCH, db4, 0, , Pipe:Adiabatic, db4_pipe, db4_pipe_inlet,
        p_loop Demand Outlet, Bypass;BRANCHLIST, p_loop Supply Branchs,
        sb0, sb1, sb2, sb3, sb4;BRANCHLIST, p_loop Demand Branchs, db0,
        db1, db2, db3, db4;CONNECTOR:SPLITTER, p_loop_supply_splitter,
        sb0, sb1, sb2, sb3;CONNECTOR:SPLITTER, p_loop_demand_splitter,
        db0, db1, db2, db3;CONNECTOR:MIXER, p_loop_supply_mixer, sb4,
        sb1, sb2, sb3;CONNECTOR:MIXER, p_loop_demand_mixer, db4, db1,
        db2, db3;CONNECTORLIST, p_loop Supply Connectors, Connector:Splitter,
        p_loop_supply_splitter, Connector:Mixer,
        p_loop_supply_mixer;CONNECTORLIST, p_loop Demand Connectors,
        Connector:Splitter, p_loop_demand_splitter, Connector:Mixer,
        p_loop_demand_mixer;PIPE:ADIABATIC, sb0_pipe, p_loop Supply Inlet,
        sb0_pipe_outlet;PIPE:ADIABATIC, sb1_pipe, sb1_pipe_inlet,
        sb1_pipe_outlet;PIPE:ADIABATIC, sb2_pipe, sb2_pipe_inlet,
        sb2_pipe_outlet;PIPE:ADIABATIC, sb3_pipe, sb3_pipe_inlet,
        sb3_pipe_outlet;PIPE:ADIABATIC, sb4_pipe, sb4_pipe_inlet,
        p_loop Supply Outlet;PIPE:ADIABATIC, db0_pipe,
        p_loop Demand Inlet, db0_pipe_outlet;PIPE:ADIABATIC, db1_pipe,
        db1_pipe_inlet, db1_pipe_outlet;PIPE:ADIABATIC, db2_pipe,
        db2_pipe_inlet, db2_pipe_outlet;PIPE:ADIABATIC, db3_pipe,
        db3_pipe_inlet, db3_pipe_outlet;PIPE:ADIABATIC, db4_pipe,
        db4_pipe_inlet, p_loop Demand Outlet;PLANTLOOP, p_loop, Water, , ,
        , , , , 0.0, Autocalculate, p_loop Supply Inlet,
        p_loop Supply Outlet, p_loop Supply Branchs,
        p_loop Supply Connectors, p_loop Demand Inlet, p_loop Demand Outlet,
        p_loop Demand Branchs, p_loop Demand Connectors, Sequential, ,
        SingleSetpoint, None, None;"""
         ),  # blankidf, loopname, sloop, dloop, nidf
    )
    for blankidf, loopname, sloop, dloop, nidf in tdata:
        fhandle = StringIO("")
        idf1 = IDF(fhandle)
        loopname = "p_loop"
        sloop = ['sb0', ['sb1', 'sb2', 'sb3'], 'sb4']
        dloop = ['db0', ['db1', 'db2', 'db3'], 'db4']
        hvacbuilder.makeplantloop(idf1, loopname, sloop, dloop)
        idf2 = IDF(StringIO(nidf))
        assert str(idf1.model) == str(idf2.model)
Beispiel #3
0
def test_replacebranch():
    """py.test for replacebranch"""
    tdata = (
        ("p_loop", ['sb0', ['sb1', 'sb2', 'sb3'], 'sb4'], [
            'db0', ['db1', 'db2', 'db3'], 'db4'
        ], 'sb0', [
            ("Chiller:Electric".upper(), 'Central_Chiller', 'Chilled_Water_'),
            ("PIPE:ADIABATIC", 'np1', None), ("PIPE:ADIABATIC", 'np2', None)
        ], 'Water', [
            'BRANCH',
            'sb0', '0',
            '', 'CHILLER:ELECTRIC',
            'Central_Chiller', 'p_loop Supply Inlet',
            'Central_Chiller_np1_node', '', 'PIPE:ADIABATIC', 'np1',
            'Central_Chiller_np1_node', 'np1_np2_node', '', 'PIPE:ADIABATIC',
            'np2', 'np1_np2_node', 'np2_Outlet_Node_Name', ''
        ]),  # loopname, sloop, dloop, branchname, componenttuple, fluid, outbranch
    )
    for (loopname, sloop, dloop, branchname, componenttuple, fluid,
         outbranch) in tdata:
        fhandle = StringIO("")
        idf = IDF(fhandle)
        loop = hvacbuilder.makeplantloop(idf, loopname, sloop, dloop)
        components_thisnodes = [(idf.newidfobject(key, nm), thisnode)
                                for key, nm, thisnode in componenttuple]
        branch = idf.getobject('BRANCH', branchname)
        newbr = hvacbuilder.replacebranch(idf,
                                          loop,
                                          branch,
                                          components_thisnodes,
                                          fluid=fluid)
        assert newbr.obj == outbranch
Beispiel #4
0
def test_replacebranch():
    """py.test for replacebranch"""
    tdata = (
        (
            "p_loop", ['sb0', ['sb1', 'sb2', 'sb3'], 'sb4'],
            ['db0', ['db1', 'db2', 'db3'], 'db4'],
            'sb0',
            [
                ("Chiller:Electric".upper(), 'Central_Chiller',
                 'Chilled_Water_'),
                ("PIPE:ADIABATIC", 'np1', None),
                ("PIPE:ADIABATIC", 'np2', None)
            ],
            'Water',
            [
                'BRANCH', 'sb0', '0', '', 'CHILLER:ELECTRIC', 'Central_Chiller',
                'p_loop Supply Inlet', 'Central_Chiller_np1_node', '',
                'PIPE:ADIABATIC',
                'np1', 'Central_Chiller_np1_node', 'np1_np2_node', '',
                'PIPE:ADIABATIC',
                'np2', 'np1_np2_node', 'np2_Outlet_Node_Name', ''
            ]
        ), # loopname, sloop, dloop, branchname, componenttuple, fluid, outbranch
    )
    for (loopname, sloop, dloop, branchname,
         componenttuple, fluid, outbranch) in tdata:
        fhandle = StringIO("")
        idf = IDF(fhandle)
        loop = hvacbuilder.makeplantloop(idf, loopname, sloop, dloop)
        components_thisnodes = [(idf.newidfobject(key, nm), thisnode)
                                for key, nm, thisnode in componenttuple]
        branch = idf.getobject('BRANCH', branchname)
        newbr = hvacbuilder.replacebranch(idf, loop, branch,
                                          components_thisnodes, fluid=fluid)
        assert newbr.obj == outbranch
Beispiel #5
0
def test_replacebranch():
    """py.test for replacebranch"""
    tdata = (
        (
            "p_loop",
            ["sb0", ["sb1", "sb2", "sb3"], "sb4"],
            ["db0", ["db1", "db2", "db3"], "db4"],
            "sb0",
            [
                ("Chiller:Electric", "Central_Chiller", "Chilled_Water_"),
                ("PIPE:ADIABATIC", "np1", None),
                ("PIPE:ADIABATIC", "np2", None),
            ],
            "Water",
            [
                "BRANCH",
                "sb0",
                0.0,
                "",
                "CHILLER:ELECTRIC",
                "Central_Chiller",
                "p_loop Supply Inlet",
                "Central_Chiller_np1_node",
                "",
                "PIPE:ADIABATIC",
                "np1",
                "Central_Chiller_np1_node",
                "np1_np2_node",
                "",
                "PIPE:ADIABATIC",
                "np2",
                "np1_np2_node",
                "np2_Outlet_Node_Name",
                "",
            ],
        ),  # loopname, sloop, dloop, branchname, componenttuple, fluid, outbranch
    )
    for (loopname, sloop, dloop, branchname, componenttuple, fluid,
         outbranch) in tdata:
        fhandle = StringIO("")
        idf = IDF(fhandle)
        loop = hvacbuilder.makeplantloop(idf, loopname, sloop, dloop)
        components_thisnodes = [(idf.newidfobject(key, Name=nm), thisnode)
                                for key, nm, thisnode in componenttuple]
        branch = idf.getobject("BRANCH", branchname)
        newbr = hvacbuilder.replacebranch(idf,
                                          loop,
                                          branch,
                                          components_thisnodes,
                                          fluid=fluid)
        assert newbr.obj == outbranch
Beispiel #6
0
def test_replacebranch():
    """py.test for replacebranch"""
    tdata = (
        (
            "p_loop",
            ["sb0", ["sb1", "sb2", "sb3"], "sb4"],
            ["db0", ["db1", "db2", "db3"], "db4"],
            "sb0",
            [
                ("Chiller:Electric".upper(), "Central_Chiller", "Chilled_Water_"),
                ("PIPE:ADIABATIC", "np1", None),
                ("PIPE:ADIABATIC", "np2", None),
            ],
            "Water",
            [
                "BRANCH",
                "sb0",
                "0",
                "",
                "CHILLER:ELECTRIC",
                "Central_Chiller",
                "p_loop Supply Inlet",
                "Central_Chiller_np1_node",
                "",
                "PIPE:ADIABATIC",
                "np1",
                "Central_Chiller_np1_node",
                "np1_np2_node",
                "",
                "PIPE:ADIABATIC",
                "np2",
                "np1_np2_node",
                "np2_Outlet_Node_Name",
                "",
            ],
        ),  # loopname, sloop, dloop, branchname, componenttuple, fluid, outbranch
    )
    for (loopname, sloop, dloop, branchname, componenttuple, fluid, outbranch) in tdata:
        fhandle = StringIO("")
        idf = IDF(fhandle)
        loop = hvacbuilder.makeplantloop(idf, loopname, sloop, dloop)
        components_thisnodes = [(idf.newidfobject(key, nm), thisnode) for key, nm, thisnode in componenttuple]
        branch = idf.getobject("BRANCH", branchname)
        newbr = hvacbuilder.replacebranch(idf, loop, branch, components_thisnodes, fluid=fluid)
        assert newbr.obj == outbranch
Beispiel #7
0
from eppy.modeleditor import IDF
from eppy import hvacbuilder

from StringIO import StringIO
iddfile = "../eppy/resources/iddfiles/Energy+V7_0_0_036.idd"
IDF.setiddname(iddfile)

# <codecell>

# make the topology of the loop
idf = IDF(StringIO('')) # makes an empty idf file in memory with no file name
loopname = "p_loop"
sloop = ['sb0', ['sb1', 'sb2', 'sb3'], 'sb4'] # supply side of the loop
dloop = ['db0', ['db1', 'db2', 'db3'], 'db4'] # demand side of the loop
hvacbuilder.makeplantloop(idf, loopname, sloop, dloop)
idf.saveas("hhh1.idf")

# <markdowncell>

# We have made plant loop and saved it as hhh1.idf.  
# Now let us look at what the loop looks like.  

# <headingcell level=3>

# Diagram of the loop

# <markdowncell>

# Let us use the script "eppy/useful_scripts/loopdiagrams.py" to draw this diagram
Beispiel #8
0
from eppy.modeleditor import IDF
from eppy import hvacbuilder

from io import StringIO

iddfile = "../eppy/resources/iddfiles/Energy+V7_0_0_036.idd"
IDF.setiddname(iddfile)

# <codecell>

# make the topology of the loop
idf = IDF(StringIO(""))  # makes an empty idf file in memory with no file name
loopname = "p_loop"
sloop = ["sb0", ["sb1", "sb2", "sb3"], "sb4"]  # supply side of the loop
dloop = ["db0", ["db1", "db2", "db3"], "db4"]  # demand side of the loop
hvacbuilder.makeplantloop(idf, loopname, sloop, dloop)
idf.saveas("hhh1.idf")

# <markdowncell>

# We have made plant loop and saved it as hhh1.idf.
# Now let us look at what the loop looks like.

# <headingcell level=3>

# Diagram of the loop

# <markdowncell>

# Let us use the script "eppy/useful_scripts/loopdiagrams.py" to draw this diagram