当前位置: 首页>>代码示例>>Python>>正文


Python IDF.newidfobject方法代码示例

本文整理汇总了Python中eppy.modeleditor.IDF.newidfobject方法的典型用法代码示例。如果您正苦于以下问题:Python IDF.newidfobject方法的具体用法?Python IDF.newidfobject怎么用?Python IDF.newidfobject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eppy.modeleditor.IDF的用法示例。


在下文中一共展示了IDF.newidfobject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_newidfobject

# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import newidfobject [as 别名]
def test_newidfobject():
    """py.test for newidfobject"""
    # make a blank idf
    # make a function for this and then continue.
    idf = IDF()
    idf.new()
    objtype = 'material:airgap'.upper()
    obj = idf.newidfobject(objtype, Name='Argon')
    obj = idf.newidfobject(objtype, Name='Krypton')
    obj = idf.newidfobject(objtype, Name='Xenon')
    assert idf.model.dt[objtype] == [['MATERIAL:AIRGAP', 'Argon'],
                                     ['MATERIAL:AIRGAP', 'Krypton'],
                                     ['MATERIAL:AIRGAP', 'Xenon'],
                                     ]
    # remove an object
    idf.popidfobject(objtype, 1)
    assert idf.model.dt[objtype] == [['MATERIAL:AIRGAP', 'Argon'],
                                     ['MATERIAL:AIRGAP', 'Xenon'],
                                     ]
    lastobject = idf.idfobjects[objtype][-1]
    idf.removeidfobject(lastobject)
    assert idf.model.dt[objtype] == [['MATERIAL:AIRGAP', 'Argon'], ]
    # copyidfobject
    onlyobject = idf.idfobjects[objtype][0]
    idf.copyidfobject(onlyobject)

    assert idf.model.dt[objtype] == [['MATERIAL:AIRGAP', 'Argon'],
                                     ['MATERIAL:AIRGAP', 'Argon'],
                                     ]
    # test some functions
    objtype = 'FENESTRATIONSURFACE:DETAILED'
    obj = idf.newidfobject(objtype, Name='A Wall')
    assert obj.coords == []
    assert obj.fieldvalues[1] == 'A Wall'
开发者ID:jamiebull1,项目名称:eppy,代码行数:36,代码来源:test_modeleditor.py

示例2: test_connectcomponents

# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import newidfobject [as 别名]
def test_connectcomponents():
    """py.test for connectcomponents"""
    fhandle = StringIO("")
    idf = IDF(fhandle)

    tdata = (
        (
            [(idf.newidfobject("PIPE:ADIABATIC", "pipe1"), None),
             (idf.newidfobject("PIPE:ADIABATIC", "pipe2"), None)],
            ["pipe1_Inlet_Node_Name", ["pipe2_Inlet_Node_Name",
                                       "pipe1_pipe2_node"]],
            [["pipe1_Outlet_Node_Name", "pipe1_pipe2_node"],
             "pipe2_Outlet_Node_Name"], '',
        ),
        # components_thisnodes, inlets, outlets, fluid
        (
            [(idf.newidfobject("Coil:Cooling:Water".upper(), "pipe1"),
              'Water_'),
             (idf.newidfobject("Coil:Cooling:Water".upper(), "pipe2"),
              'Water_')],
            ['pipe1_Water_Inlet_Node_Name', '',
             'pipe2_Water_Inlet_Node_Name',
             ['', 'pipe1_pipe2_node']],
            [['pipe1_Water_Outlet_Node_Name', 'pipe1_pipe2_node'], '',
             'pipe2_Water_Outlet_Node_Name', ''],
            'Air'
        ),
        # components_thisnodes, inlets, outlets, fluid
        (
            [(idf.newidfobject("PIPE:ADIABATIC".upper(), "pipe1"), None),
             (idf.newidfobject("Coil:Cooling:Water".upper(), "pipe2"),
              'Water_')],
            ["pipe1_Inlet_Node_Name", "pipe2_Water_Inlet_Node_Name",
             ['pipe2_Air_Inlet_Node_Name', 'pipe1_pipe2_node']],
            [['pipe1_Outlet_Node_Name', 'pipe1_pipe2_node'],
             "pipe2_Water_Outlet_Node_Name", ""],
            'Air'
        ),
        # components_thisnodes, inlets, outlets, fluid
    )
    for components_thisnodes, inlets, outlets, fluid in tdata:
        # init the nodes in the new components
        for component, thisnode in components_thisnodes:
            hvacbuilder.initinletoutlet(idf, component, thisnode)
        hvacbuilder.connectcomponents(idf, components_thisnodes, fluid)
        inresult = []
        for component, thisnode in components_thisnodes:
            fldnames = hvacbuilder.getfieldnamesendswith(component,
                                                         "Inlet_Node_Name")
            for name in fldnames:
                inresult.append(component[name])
        assert inresult == inresult
        outresult = []
        for component, thisnode in components_thisnodes:
            fldnames = hvacbuilder.getfieldnamesendswith(component,
                                                         "Outlet_Node_Name")
            for name in fldnames:
                outresult.append(component[name])
        assert outresult == outlets
开发者ID:jamiebull1,项目名称:eppy,代码行数:61,代码来源:test_hvacbuilder.py

示例3: test_initinletoutlet

# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import newidfobject [as 别名]
def test_initinletoutlet():
    """py.test for initinletoutlet"""
    tdata = (
        ("PIPE:ADIABATIC", "apipe", None, True, ["apipe_Inlet_Node_Name"], ["apipe_Outlet_Node_Name"]),
        # idfobjectkey, idfobjname, thisnode, force, inlets, outlets
        ("PIPE:ADIABATIC", "apipe", None, False, ["Gumby"], ["apipe_Outlet_Node_Name"]),
        # idfobjectkey, idfobjname, thisnode, force, inlets, outlets
        (
            "Coil:Cooling:Water".upper(),
            "acoil",
            "Water_",
            True,
            ["acoil_Water_Inlet_Node_Name", ""],
            ["acoil_Water_Outlet_Node_Name", ""],
        ),
        # idfobjectkey, idfobjname, thisnode, force, inlets, outlets
    )
    fhandle = StringIO("")
    idf = IDF(fhandle)
    for idfobjectkey, idfobjname, thisnode, force, inlets, outlets in tdata:
        idfobject = idf.newidfobject(idfobjectkey, idfobjname)
        inodefields = hvacbuilder.getfieldnamesendswith(idfobject, "Inlet_Node_Name")
        idfobject[inodefields[0]] = "Gumby"
        hvacbuilder.initinletoutlet(idf, idfobject, thisnode, force=force)
        inodefields = hvacbuilder.getfieldnamesendswith(idfobject, "Inlet_Node_Name")
        for nodefield, inlet in zip(inodefields, inlets):
            result = idfobject[nodefield]
            assert result == inlet
        onodefields = hvacbuilder.getfieldnamesendswith(idfobject, "Outlet_Node_Name")
        for nodefield, outlet in zip(onodefields, outlets):
            result = idfobject[nodefield]
            assert result == outlet
开发者ID:eayoungs,项目名称:eppy,代码行数:34,代码来源:test_hvacbuilder.py

示例4: test_replacebranch

# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import newidfobject [as 别名]
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
开发者ID:jamiebull1,项目名称:eppy,代码行数:37,代码来源:test_hvacbuilder.py

示例5: test_idfinmsequence

# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import newidfobject [as 别名]
def test_idfinmsequence():
    """py.test for setting of theidf in Idf_MSequence"""
    idftxt = """Version, 6.0;"""
    # theidf set in Idf_MSequence.__init__
    idf = IDF(StringIO(idftxt))
    versions = idf.idfobjects['version'.upper()]
    assert versions.theidf == idf
    assert versions[0].theidf == idf
    # theidf set in Idf_MSequence.insert()
    material = idf.newidfobject('material'.upper())
    assert material.theidf == idf
    # theidf set when you pop an item
    newmaterial = idf.newidfobject('material'.upper())
    materials = idf.idfobjects['material'.upper()]
    material = materials.pop(0)
    assert material.theidf == None
    assert materials[0].theidf == idf
开发者ID:santoshphilip,项目名称:eppy,代码行数:19,代码来源:test_modeleditor.py

示例6: getidfkeyswithnodes

# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import newidfobject [as 别名]
def getidfkeyswithnodes():
    """return a list of keys of idfobjects that hve 'None Name' fields"""
    idf = IDF(StringIO(""))
    keys = idfobjectkeys(idf)
    keysfieldnames = ((key, idf.newidfobject(key.upper()).fieldnames) 
                for key in keys)
    keysnodefdnames = ((key,  (name for name in fdnames 
                                if (name.endswith('Node_Name')))) 
                            for key, fdnames in keysfieldnames)
    nodekeys = [key for key, fdnames in keysnodefdnames if list(fdnames)]
    return nodekeys
开发者ID:santoshphilip,项目名称:eppy,代码行数:13,代码来源:idf_helpers.py

示例7: test_popidfobject

# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import newidfobject [as 别名]
 def test_popidfobject(self):
     idftxt = ""
     idfhandle = StringIO(idftxt)
     idf = IDF(idfhandle)
     key = "BUILDING"
     idf.newidfobject(key, Name="Building_remove")
     idf.newidfobject(key, Name="Building1")
     idf.newidfobject(key, Name="Building_remove")
     idf.newidfobject(key, Name="Building2")
     buildings = idf.idfobjects["building".upper()]
     removethis = buildings[-2]
     idf.popidfobject(key, 2)
     assert buildings[2].Name == "Building2"
     assert idf.model.dt[key][2][1] == "Building2"
开发者ID:jamiebull1,项目名称:eppy,代码行数:16,代码来源:test_IDF.py

示例8: test_get_referenced_object

# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import newidfobject [as 别名]
    def test_get_referenced_object(self):
        """py.test for get_referenced_object"""
        idf = IDF()
        idf.initnew('test.idf')
        idf.newidfobject('VERSION') # does not have a field "Name"

        # construction material        
        construction = idf.newidfobject('CONSTRUCTION', 'construction')
        construction.Outside_Layer = 'TestMaterial'
        
        expected = idf.newidfobject('MATERIAL', 'TestMaterial')
        
        fetched = idf.getobject('MATERIAL', 'TestMaterial')
        assert fetched == expected
    
        material = construction.get_referenced_object('Outside_Layer')
        assert material == expected
        
        # window material
        glazing_group = idf.newidfobject(
            'WINDOWMATERIAL:GLAZINGGROUP:THERMOCHROMIC', 'glazing_group')
        glazing_group.Window_Material_Glazing_Name_1 = 'TestWindowMaterial'

        expected = idf.newidfobject(
            'WINDOWMATERIAL:GLAZING', 'TestWindowMaterial') # has several \references
        
        fetched = idf.getobject('WINDOWMATERIAL:GLAZING', 'TestWindowMaterial')
        assert fetched == expected
        
        material = glazing_group.get_referenced_object(
            'Window_Material_Glazing_Name_1')
        assert material == expected
开发者ID:jamiebull1,项目名称:eppy,代码行数:34,代码来源:test_bunch_subclass.py

示例9: test_componentsintobranch

# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import newidfobject [as 别名]
def test_componentsintobranch():
    """py.test for componentsintobranch"""
    tdata = (
    ("""BRANCH,
         sb0,
         0,
         ,
         Pipe:Adiabatic,
         sb0_pipe,
         p_loop Supply Inlet,
         sb0_pipe_outlet,
         Bypass;
    """, 
    [("PIPE:ADIABATIC", "pipe1"), ("PIPE:ADIABATIC", "pipe2")],
    '',
    ['PIPE:ADIABATIC', 'pipe1', 'pipe1_Inlet_Node_Name', 
    'pipe1_Outlet_Node_Name', '', 'PIPE:ADIABATIC', 'pipe2', 
    'pipe2_Inlet_Node_Name', 'pipe2_Outlet_Node_Name', '']
    ), 
    # idftxt, complst, fluid, branchcomps
    
    ("""BRANCH,
         sb0,
         0,
         ,
         Pipe:Adiabatic,
         sb0_pipe,
         p_loop Supply Inlet,
         sb0_pipe_outlet,
         Bypass;
    """, 
    [("PIPE:ADIABATIC", "pipe1"), ('CHILLER:ELECTRIC', "chiller")],
    '',
    ['PIPE:ADIABATIC', 'pipe1', 'pipe1_Inlet_Node_Name', 
    'pipe1_Outlet_Node_Name', '', 'CHILLER:ELECTRIC', 'chiller', 
    'chiller_Chilled_Water_Inlet_Node_Name', 
    'chiller_Chilled_Water_Outlet_Node_Name', '']
    ), 
    # idftxt, complst, fluid, branchcomps
    )                                                    
    for idftxt, complst, fluid, branchcomps in tdata:
        fhandle = StringIO(idftxt)
        idf = IDF(fhandle)
        components = [idf.newidfobject(key, nm) for key, nm in complst]
        fnc = hvacbuilder.initinletoutlet
        components = [fnc(idf, cp) for cp in components]
        branch = idf.idfobjects['BRANCH'][0]
        branch = hvacbuilder.componentsintobranch(idf, branch, components, 
                                                                    fluid)
        assert branch.obj[4:] == branchcomps
开发者ID:JasonGlazer,项目名称:eppy,代码行数:52,代码来源:test_hvacbuilder.py

示例10: test_replacebranch

# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import newidfobject [as 别名]
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
开发者ID:eayoungs,项目名称:eppy,代码行数:47,代码来源:test_hvacbuilder.py

示例11: test_getnodefieldname

# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import newidfobject [as 别名]
def test_getnodefieldname():
    """py.test for getnodefieldname"""
    tdata = (
        ("PIPE:ADIABATIC", "pipe1", "Inlet_Node_Name", "", "Inlet_Node_Name"),
        # objtype, objname, endswith, fluid, nodefieldname
        ("CHILLER:ELECTRIC", "pipe1", "Inlet_Node_Name", "", "Chilled_Water_Inlet_Node_Name"),
        # objtype, objname, endswith, fluid, nodefieldname
        ("COIL:COOLING:WATER", "pipe1", "Inlet_Node_Name", "Water", "Water_Inlet_Node_Name"),
        # objtype, objname, endswith, fluid, nodefieldname
        ("COIL:COOLING:WATER", "pipe1", "Inlet_Node_Name", "Air", "Air_Inlet_Node_Name"),
        # objtype, objname, endswith, fluid, nodefieldname
        ("COIL:COOLING:WATER", "pipe1", "Outlet_Node_Name", "Air", "Air_Outlet_Node_Name"),
        # objtype, objname, endswith, fluid, nodefieldname
    )
    for objtype, objname, endswith, fluid, nodefieldname in tdata:
        fhandle = StringIO("")
        idf = IDF(fhandle)
        idfobject = idf.newidfobject(objtype, objname)
        result = hvacbuilder.getnodefieldname(idfobject, endswith, fluid)
        assert result == nodefieldname
开发者ID:eayoungs,项目名称:eppy,代码行数:22,代码来源:test_hvacbuilder.py

示例12: test_getnodefieldname

# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import newidfobject [as 别名]
def test_getnodefieldname():
    """py.test for getnodefieldname"""
    tdata = (
        ('PIPE:ADIABATIC', 'pipe1', 'Inlet_Node_Name', '', 'Inlet_Node_Name'),
        # objtype, objname, endswith, fluid, nodefieldname
        ('CHILLER:ELECTRIC', 'pipe1', 'Inlet_Node_Name', '',
         'Chilled_Water_Inlet_Node_Name'),
        # objtype, objname, endswith, fluid, nodefieldname
        ('COIL:COOLING:WATER', 'pipe1', 'Inlet_Node_Name', 'Water',
         'Water_Inlet_Node_Name'),
        # objtype, objname, endswith, fluid, nodefieldname
        ('COIL:COOLING:WATER', 'pipe1', 'Inlet_Node_Name', 'Air',
         'Air_Inlet_Node_Name'),
        # objtype, objname, endswith, fluid, nodefieldname
        ('COIL:COOLING:WATER', 'pipe1', 'Outlet_Node_Name', 'Air',
         'Air_Outlet_Node_Name'),
        # objtype, objname, endswith, fluid, nodefieldname
        )
    for objtype, objname, endswith, fluid, nodefieldname in tdata:
        fhandle = StringIO("")
        idf = IDF(fhandle)
        idfobject = idf.newidfobject(objtype, objname)
        result = hvacbuilder.getnodefieldname(idfobject, endswith, fluid)
        assert result == nodefieldname
开发者ID:jamiebull1,项目名称:eppy,代码行数:26,代码来源:test_hvacbuilder.py

示例13: test_newidfobject_warning

# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import newidfobject [as 别名]
def test_newidfobject_warning():
    """Test that the warning for newidfobject created with `aname` is working.

    Fails if the warning is not issued when `aname` is used, or if the warning
    is issued when `aname` is not used.
    """
    # make a blank idf
    # make a function for this and then continue.
    idf = IDF()
    idf.new()
    objtype = 'material:airgap'.upper()
    # expect warnings here
    with pytest.warns(UserWarning):
        idf.newidfobject(objtype, aname="Krypton")
    with pytest.warns(UserWarning):
        idf.newidfobject(objtype, "Krypton")

    # expect no warnings here - we pass None so as not to trigger the `Failed: DID NOT WARN` message from pytest
    with pytest.warns(None) as captured_warnings:
        idf.newidfobject(objtype, Name="Krypton")
    assert len(captured_warnings) == 0
开发者ID:santoshphilip,项目名称:eppy,代码行数:23,代码来源:test_modeleditor.py

示例14: test_newidfobject

# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import newidfobject [as 别名]
def test_newidfobject():
    """py.test for newidfobject"""
    # make a blank idf
    # make a function for this and then continue.
    idf = IDF()
    idf.new()
    objtype = 'material:airgap'.upper()
    obj = idf.newidfobject(objtype, Name='Argon')
    obj = idf.newidfobject(objtype, Name='Krypton')
    obj = idf.newidfobject(objtype, Name='Xenon')
    assert idf.model.dt[objtype] == [['MATERIAL:AIRGAP', 'Argon'],
                                     ['MATERIAL:AIRGAP', 'Krypton'],
                                     ['MATERIAL:AIRGAP', 'Xenon'],
                                     ]
    # remove an object
    idf.popidfobject(objtype, 1)
    assert idf.model.dt[objtype] == [['MATERIAL:AIRGAP', 'Argon'],
                                     ['MATERIAL:AIRGAP', 'Xenon'],
                                     ]
    lastobject = idf.idfobjects[objtype][-1]
    idf.removeidfobject(lastobject)
    assert idf.model.dt[objtype] == [['MATERIAL:AIRGAP', 'Argon'], ]
    # copyidfobject
    onlyobject = idf.idfobjects[objtype][0]
    idf.copyidfobject(onlyobject)

    assert idf.model.dt[objtype] == [['MATERIAL:AIRGAP', 'Argon'],
                                     ['MATERIAL:AIRGAP', 'Argon'],
                                     ]
    # test some functions
    objtype = 'FENESTRATIONSURFACE:DETAILED'
    obj = idf.newidfobject(objtype, Name='A Wall')
    assert obj.coords == []
    assert obj.fieldvalues[1] == 'A Wall'
    
    # test defaultvalues=True and defaultvalues=False
    sim_deftrue = idf.newidfobject('SimulationControl'.upper(), defaultvalues=True)
    assert sim_deftrue.Do_Zone_Sizing_Calculation == 'No'
    sim_deffalse = idf.newidfobject('SimulationControl'.upper(), defaultvalues=False)
    assert sim_deffalse.Do_Zone_Sizing_Calculation == ''
开发者ID:santoshphilip,项目名称:eppy,代码行数:42,代码来源:test_modeleditor.py

示例15: test_componentsintobranch

# 需要导入模块: from eppy.modeleditor import IDF [as 别名]
# 或者: from eppy.modeleditor.IDF import newidfobject [as 别名]
def test_componentsintobranch():
    """py.test for componentsintobranch"""
    tdata = (
        (
            """BRANCH,
             sb0,
             0,
             ,
             Pipe:Adiabatic,
             sb0_pipe,
             p_loop Supply Inlet,
             sb0_pipe_outlet,
             Bypass;
             """,
            [("PIPE:ADIABATIC", "pipe1", None), ("PIPE:ADIABATIC", "pipe2", None)],
            "",
            [
                "PIPE:ADIABATIC",
                "pipe1",
                "pipe1_Inlet_Node_Name",
                "pipe1_Outlet_Node_Name",
                "",
                "PIPE:ADIABATIC",
                "pipe2",
                "pipe2_Inlet_Node_Name",
                "pipe2_Outlet_Node_Name",
                "",
            ],
        ),
        # idftxt, complst, fluid, branchcomps
        (
            """BRANCH,
            sb0,
            0,
            ,
            Pipe:Adiabatic,
            sb0_pipe,
            p_loop Supply Inlet,
            sb0_pipe_outlet,
            Bypass;
            """,
            [("PIPE:ADIABATIC", "pipe1", None), ("CHILLER:ELECTRIC", "chiller", "Chilled_Water_")],
            "",
            [
                "PIPE:ADIABATIC",
                "pipe1",
                "pipe1_Inlet_Node_Name",
                "pipe1_Outlet_Node_Name",
                "",
                "CHILLER:ELECTRIC",
                "chiller",
                "chiller_Chilled_Water_Inlet_Node_Name",
                "chiller_Chilled_Water_Outlet_Node_Name",
                "",
            ],
        ),
        # idftxt, complst, fluid, branchcomps
    )
    for ii, (idftxt, complst, fluid, branchcomps) in enumerate(tdata):
        fhandle = StringIO(idftxt)
        idf = IDF(fhandle)
        components_thisnodes = [(idf.newidfobject(key, nm), thisnode) for key, nm, thisnode in complst]
        fnc = hvacbuilder.initinletoutlet
        components_thisnodes = [(fnc(idf, cp, thisnode), thisnode) for cp, thisnode in components_thisnodes]
        branch = idf.idfobjects["BRANCH"][0]
        branch = hvacbuilder.componentsintobranch(idf, branch, components_thisnodes, fluid)
        assert branch.obj[4:] == branchcomps
开发者ID:eayoungs,项目名称:eppy,代码行数:69,代码来源:test_hvacbuilder.py


注:本文中的eppy.modeleditor.IDF.newidfobject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。