Example #1
0
def test_EpBunch1():
    """py.test for EpBunch1"""
    iddfile = StringIO(iddtxt)
    idffile = StringIO(bldfidf)
    block, data, commdct, idd_index = readidf.readdatacommdct1(idffile, 
            iddfile=iddfile)
    key = "BUILDING"
    objs = data.dt[key]
    obj = objs[0]
    obj_i = data.dtls.index(key)
    bunchobj = idfreader.makeabunch(commdct, obj, obj_i)

    # assertions
    assert bunchobj.Name == "Empire State Building"
    bunchobj.Name = "Kutub Minar"
    assert bunchobj.Name == "Kutub Minar"
    prnt = bunchobj.__repr__()
    result = """
BUILDING,                 
    Kutub Minar,              !- Name
    30.0,                     !- North Axis
    City,                     !- Terrain
    0.04,                     !- Loads Convergence Tolerance Value
    0.4,                      !- Temperature Convergence Tolerance Value
    FullExterior,             !- Solar Distribution
    25,                       !- Maximum Number of Warmup Days
    6;                        !- Minimum Number of Warmup Days
"""
    assert prnt == result
Example #2
0
def test_EpBunch1():
    """py.test for EpBunch1"""
    iddfile = StringIO(iddtxt)
    idffile = StringIO(bldfidf)
    block, data, commdct = readidf.readdatacommdct1(idffile, iddfile=iddfile)
    key = "BUILDING"
    objs = data.dt[key]
    obj = objs[0]
    obj_i = data.dtls.index(key)
    bunchobj = idfreader.makeabunch(commdct, obj, obj_i)

    # assertions
    assert bunchobj.Name == "Empire State Building"
    bunchobj.Name = "Kutub Minar"
    assert bunchobj.Name == "Kutub Minar"
    prnt = bunchobj.__repr__()
    result = """
BUILDING,                 
    Kutub Minar,              !- Name
    30.0,                     !- North Axis
    City,                     !- Terrain
    0.04,                     !- Loads Convergence Tolerance Value
    0.4,                      !- Temperature Convergence Tolerance Value
    FullExterior,             !- Solar Distribution
    25,                       !- Maximum Number of Warmup Days
    6;                        !- Minimum Number of Warmup Days
"""
    assert prnt == result
Example #3
0
def obj2bunch(data, commdct, obj):
    """make a new bunch object using the data object"""
    dtls = data.dtls
    key = obj[0].upper()
    key_i = dtls.index(key)
    abunch = makeabunch(commdct, obj, key_i)
    return abunch
Example #4
0
def test_obj2bunch():
    """py.test for obj2bunch"""
    thedata = (
        ([
            "ZONE",
            "",
            "0",
            "0",
            "0",
            "0",
            "1",
            "1",
            "autocalculate",
            "autocalculate",
            "autocalculate",
            "",
            "",
            "Yes",
        ]),  # obj
    )
    for obj in thedata:
        key_i = data.dtls.index(obj[0].upper())
        abunch = idfreader.makeabunch(commdct, obj, key_i)
        result = modeleditor.obj2bunch(data, commdct, obj)
        assert result.__repr__() == abunch.__repr__()
Example #5
0
def obj2bunch(data, commdct, obj):
    """make a new bunch object using the data object"""
    dtls = data.dtls
    key = obj[0].upper()
    key_i = dtls.index(key)
    abunch = makeabunch(commdct, obj, key_i)
    return abunch
Example #6
0
def test_obj2bunch():
    """py.test for obj2bunch"""
    thedata = ((['ZONE', '', '0', '0', '0', '0', '1', '1', 'autocalculate', 
        'autocalculate', 'autocalculate', '', '', 'Yes']), # obj
    )
    for obj in thedata:
        key_i = data.dtls.index(obj[0].upper())
        abunch = idfreader.makeabunch(commdct, obj, key_i)
        result = modeleditor.obj2bunch(data, commdct, obj)
        assert result.__repr__() == abunch.__repr__()
Example #7
0
def makebunches(data, commdct, theidf):
    """make bunches with data"""
    bunchdt = {}
    dt, dtls = data.dt, data.dtls
    for obj_i, key in enumerate(dtls):
        key = key.upper()
        objs = dt[key]
        list1 = []
        for obj in objs:
            bobj = makeabunch(commdct, obj, obj_i)
            list1.append(bobj)
        bunchdt[key] = Idf_MSequence(list1, objs, theidf)
    return bunchdt