Exemplo n.º 1
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
Exemplo n.º 2
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
Exemplo n.º 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", "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
Exemplo n.º 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
Exemplo n.º 5
0
# make a new pipe component
pipe1 = idf.newidfobject("PIPE:ADIABATIC", 'np1')

# make a new chiller
chiller = idf.newidfobject("Chiller:Electric".upper(), 'Central_Chiller')

# make another pipe component
pipe2 = idf.newidfobject("PIPE:ADIABATIC", 'np2')

# get the loop we are trying to modify
loop = idf.getobject('PLANTLOOP', 'p_loop') # args are (key, name)
# get the branch we are trying to modify
branch = idf.getobject('BRANCH', 'sb0') # args are (key, name)
listofcomponents = [chiller, pipe1, pipe2] # the new components are connected in this order

newbr = hvacbuilder.replacebranch(idf, loop, branch, listofcomponents, fluid='Water')
# in "loop"
# this replaces the components in "branch" with the components in "listofcomponents"

idf.saveas("hhh_new.idf")

# <markdowncell>

# We have saved this as  file "hhh_new.idf".  
# Let us draw the diagram of this file.  (run this from eppy/eppy folder)

# <rawcell>

# python ex_loopdiagram.py hhh_new.idf

# <codecell>
Exemplo n.º 6
0
chiller = idf.newidfobject("Chiller:Electric".upper(), "Central_Chiller")

# make another pipe component
pipe2 = idf.newidfobject("PIPE:ADIABATIC", "np2")

# get the loop we are trying to modify
loop = idf.getobject("PLANTLOOP", "p_loop")  # args are (key, name)
# get the branch we are trying to modify
branch = idf.getobject("BRANCH", "sb0")  # args are (key, name)
listofcomponents = [
    chiller,
    pipe1,
    pipe2,
]  # the new components are connected in this order

newbr = hvacbuilder.replacebranch(idf, loop, branch, listofcomponents, fluid="Water")
# in "loop"
# this replaces the components in "branch" with the components in "listofcomponents"

idf.saveas("hhh_new.idf")

# <markdowncell>

# We have saved this as  file "hhh_new.idf".
# Let us draw the diagram of this file.  (run this from eppy/eppy folder)

# <rawcell>

# python ex_loopdiagram.py hhh_new.idf

# <codecell>