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


Python modeleditor.IDF类代码示例

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


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

示例1: test_makepipebranch

def test_makepipebranch():
    """py.test for makepipebranch"""
    tdata = ((
        "p_branch",
        ['BRANCH',
         'p_branch',
         '0',
         '',
         'Pipe:Adiabatic',
         'p_branch_pipe',
         'p_branch_pipe_inlet',
         'p_branch_pipe_outlet',
         'Bypass'],
        [
            'PIPE:ADIABATIC',
            'p_branch_pipe',
            'p_branch_pipe_inlet',
            'p_branch_pipe_outlet']
        ), # pb_name, branch_obj, pipe_obj
            )
    for pb_name, branch_obj, pipe_obj in tdata:
        fhandle = StringIO("")
        idf = IDF(fhandle)
        result = hvacbuilder.makepipebranch(idf, pb_name)
        assert result.obj == branch_obj
        thepipe = idf.getobject('PIPE:ADIABATIC', result.Component_1_Name)
        assert thepipe.obj == pipe_obj
开发者ID:jamiebull1,项目名称:eppy,代码行数:27,代码来源:test_hvacbuilder.py

示例2: test_reproduce_run_issue

def test_reproduce_run_issue():
    """This is for use as a debugging tool.

    Add the files used in the run as reported/provided by a user.
    Make any additional changes required for reproducing/diagnosing the issue.
    """
    # update the following four lines if necessary
    ep_version = "8-9-0"
    idffile = "V8_9/smallfile.idf"
    iddfile = "Energy+V8_9_0.idd"
    epwfile = "USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw"

    _, eplus_home = paths_from_version(ep_version)
    idfname = os.path.join(IDF_FILES, idffile)
    iddfile = os.path.join(IDD_FILES, iddfile)
    epwfile = os.path.join(eplus_home, "WeatherData", epwfile)
    modeleditor.IDF.setiddname(iddfile, testing=True)
    idf = IDF(idfname, epwfile)
    # make any changes to the IDF here
    try:
        # Add any additional `run` kwargs here
        # `ep_version` kwarg is required due to buggy test isolation
        idf.run(output_directory="test_dir", ep_version=ep_version)
        # Add any tests for expected/unexpected outputs here
    except Exception:
        # Add any tests for expected/unexpected exceptions here
        raise
    finally:
        shutil.rmtree("test_dir", ignore_errors=True)
开发者ID:santoshphilip,项目名称:eppy,代码行数:29,代码来源:test_reproduce_bugs.py

示例3: test_new

def test_new():
    """py.test for IDF.new()"""
    idf = IDF()
    idf.new()
    # assert idf.idfobjects['building'.upper()] == Idf_MSequence()
    assert idf.idfobjects['building'.upper()].list1 == []
    assert idf.idfobjects['building'.upper()].list2 == []
开发者ID:santoshphilip,项目名称:eppy,代码行数:7,代码来源:test_modeleditor.py

示例4: test_initinletoutlet

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,代码行数:32,代码来源:test_hvacbuilder.py

示例5: test_makeductbranch

def test_makeductbranch():
    """py.test for makeductbranch"""
    tdata = (
        (
            "d_branch",
            [
                "BRANCH",
                "d_branch",
                "0",
                "",
                "duct",
                "d_branch_duct",
                "d_branch_duct_inlet",
                "d_branch_duct_outlet",
                "Bypass",
            ],
            ["DUCT", "d_branch_duct", "d_branch_duct_inlet", "d_branch_duct_outlet"],
        ),  # db_name, branch_obj, duct_obj
    )
    for db_name, branch_obj, duct_obj in tdata:
        fhandle = StringIO("")
        idf = IDF(fhandle)
        result = hvacbuilder.makeductbranch(idf, db_name)
        assert result.obj == branch_obj
        theduct = idf.getobject("DUCT", result.Component_1_Name)
        assert theduct.obj == duct_obj
开发者ID:eayoungs,项目名称:eppy,代码行数:26,代码来源:test_hvacbuilder.py

示例6: test_makepipebranch

def test_makepipebranch():
    """py.test for makepipebranch"""
    tdata = (
        (
            "p_branch",
            [
                "BRANCH",
                "p_branch",
                "0",
                "",
                "Pipe:Adiabatic",
                "p_branch_pipe",
                "p_branch_pipe_inlet",
                "p_branch_pipe_outlet",
                "Bypass",
            ],
            ["PIPE:ADIABATIC", "p_branch_pipe", "p_branch_pipe_inlet", "p_branch_pipe_outlet"],
        ),  # pb_name, branch_obj, pipe_obj
    )
    for pb_name, branch_obj, pipe_obj in tdata:
        fhandle = StringIO("")
        idf = IDF(fhandle)
        result = hvacbuilder.makepipebranch(idf, pb_name)
        assert result.obj == branch_obj
        thepipe = idf.getobject("PIPE:ADIABATIC", result.Component_1_Name)
        assert thepipe.obj == pipe_obj
开发者ID:eayoungs,项目名称:eppy,代码行数:26,代码来源:test_hvacbuilder.py

示例7: test_save_copy

    def test_save_copy(self):
        """Test savecopy with a new filename.

        IDF.savecopy(fname) doesn't change the filename. The next save should
        save with the original name.
        
        Fails if on a following save, the copy is changed.

        """
        idf = IDF(self.startfile)
        idf.savecopy(self.copyfile)
        setversion(idf, '7.5')
        idf.save()
        idf2 = IDF(self.copyfile)

        result = getversion(idf2)
        expected = '7.3'  # unchanged since version was changed after savecopy
        
        assert result == expected
        
        idf3 = IDF(self.startfile)
        result = getversion(idf3)
        expected = '7.5' # should be changed in the original file

        assert result == expected
开发者ID:jamiebull1,项目名称:eppy,代码行数:25,代码来源:test_integration.py

示例8: test_replacebranch

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,代码行数:35,代码来源:test_hvacbuilder.py

示例9: test_makeductbranch

def test_makeductbranch():
    """py.test for makeductbranch"""
    tdata = ((
        'd_branch',
        [
            'BRANCH',
            'd_branch',
            '0',
            '',
            'duct',
            'd_branch_duct',
            'd_branch_duct_inlet',
            'd_branch_duct_outlet',
            'Bypass'],
        [
            'DUCT',
            'd_branch_duct',
            'd_branch_duct_inlet',
            'd_branch_duct_outlet']), # db_name, branch_obj, duct_obj
            )
    for db_name, branch_obj, duct_obj in tdata:
        fhandle = StringIO("")
        idf = IDF(fhandle)
        result = hvacbuilder.makeductbranch(idf, db_name)
        assert result.obj == branch_obj
        theduct = idf.getobject('DUCT', result.Component_1_Name)
        assert theduct.obj == duct_obj
开发者ID:jamiebull1,项目名称:eppy,代码行数:27,代码来源:test_hvacbuilder.py

示例10: getidfkeyswithnodes

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,代码行数:11,代码来源:idf_helpers.py

示例11: test_IDF

def test_IDF():
    """py.test for class IDF"""
    stored_idd = IDF.iddname
    IDF.iddname = None
    assert IDF.iddname == None
    IDF.setiddname("gumby", testing=True)
    assert IDF.iddname == "gumby"
    IDF.setiddname("karamba", testing=True)
    assert IDF.iddname != "karamba"
    assert IDF.iddname == "gumby"
    IDF.iddname = stored_idd
开发者ID:jamiebull1,项目名称:eppy,代码行数:11,代码来源:test_IDF.py

示例12: test_getiddgroupdict

def test_getiddgroupdict():
    """py.test for IDF.getiddgroupdict()"""
    data = ((
    {
        None: ['Lead Input', 'Simulation Data']
    },
    ),  # gdict,
    )
    for gdict, in data:
        fhandle = StringIO("")
        idf = IDF(fhandle)
        result = idf.getiddgroupdict()
        assert result[None] == gdict[None]
开发者ID:santoshphilip,项目名称:eppy,代码行数:13,代码来源:test_modeleditor.py

示例13: test_componentsintobranch

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,代码行数:50,代码来源:test_hvacbuilder.py

示例14: test_save

def test_save():
    """
    Test the IDF.save() function using a filehandle to avoid external effects.
    """
    file_text = "Material,TestMaterial,  !- Name"
    idf = IDF(StringIO(file_text))
    # test save with just a filehandle
    file_handle = StringIO()
    idf.save(file_handle)
    expected = "TestMaterial"
    file_handle.seek(0)
    result = file_handle.read()
    # minimal test that TestMaterial is being written to the file handle
    assert expected in result
开发者ID:santoshphilip,项目名称:eppy,代码行数:14,代码来源:test_modeleditor.py

示例15: setup

 def setup(self):
     """Set the IDD and file paths, and make a copy of the original file.
     """
     iddfile = os.path.join(IDD_FILES, "Energy+V7_2_0.idd")
     IDF.setiddname(iddfile, testing=True)
     
     self.origfile = os.path.join(INTEGRATION_FILES, "origfile.idf")
     
     #set tempfile names
     self.startfile = os.path.join(INTEGRATION_FILES, "startfile.idf")
     self.saveasfile = os.path.join(INTEGRATION_FILES, "saveas.idf")
     self.copyfile = os.path.join(INTEGRATION_FILES, "savecopy.idf")
 
     # make a copy of test file
     shutil.copy(self.origfile, self.startfile)
开发者ID:jamiebull1,项目名称:eppy,代码行数:15,代码来源:test_integration.py


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