Ejemplo n.º 1
0
def test_getobjectswithnode():
    """py.test for getobjectswithnode"""
    idf = IDF(StringIO(""))
    nodekeys = idf_helpers.getidfkeyswithnodes()
    plantloop = idf.newidfobject(
        "PlantLoop",
        Name="Chilled Water Loop",
        Plant_Side_Inlet_Node_Name="CW Supply Inlet Node",
    )
    branch = idf.newidfobject(
        "Branch",
        Name="CW Pump Branch",
        Component_1_Inlet_Node_Name="CW Supply Inlet Node",
    )
    pump = idf.newidfobject(
        "Pump:VariableSpeed",
        Name="CW Circ Pump",
        Inlet_Node_Name="CW Supply Inlet Node",
    )
    zone = idf.newidfobject("zone")
    foundobjs = idf_helpers.getobjectswithnode(idf, nodekeys,
                                               "CW Supply Inlet Node")
    expected = [plantloop, branch, pump]
    expectedset = set([item.key for item in expected])
    resultset = set([item.key for item in foundobjs])
    assert resultset == expectedset
    expectedset = set([item.Name for item in expected])
    resultset = set([item.Name for item in foundobjs])
    assert resultset == expectedset
Ejemplo n.º 2
0
def test_getobjectswithnode():
    """py.test for getobjectswithnode"""
    idf = IDF(StringIO(""))
    nodekeys = idf_helpers.getidfkeyswithnodes() 
    plantloop = idf.newidfobject('PlantLoop'.upper(), 
                    Name='Chilled Water Loop',
                    Plant_Side_Inlet_Node_Name='CW Supply Inlet Node')
    branch = idf.newidfobject('Branch'.upper(), 
                    Name='CW Pump Branch',
                    Component_1_Inlet_Node_Name='CW Supply Inlet Node')
    pump = idf.newidfobject('Pump:VariableSpeed'.upper(), 
                    Name='CW Circ Pump',
                    Inlet_Node_Name='CW Supply Inlet Node')
    zone = idf.newidfobject('zone'.upper())
    foundobjs = idf_helpers.getobjectswithnode(idf, nodekeys, 
                                        'CW Supply Inlet Node')
    expected = [plantloop, branch, pump] 
    expectedset = set([item.key for item in expected])
    resultset = set([item.key for item in foundobjs]) 
    assert  resultset ==  expectedset
    expectedset = set([item.Name for item in expected])
    resultset = set([item.Name for item in foundobjs]) 
    assert  resultset ==  expectedset
Ejemplo n.º 3
0
def test_getidfkeyswithnodes():
    """py.test for getidfkeyswithnodes"""
    nodekeys = idf_helpers.getidfkeyswithnodes()
    # print(len(nodekeys))
    assert 'PLANTLOOP' in nodekeys
    assert 'ZONE' not in nodekeys
Ejemplo n.º 4
0
iddfile = './Energy+.idd'

def getfnames(fnametxt='./idffilenames.txt'):
    """return the idf filenames"""
    fhandle = open(fnametxt, 'r')
    lines = (removecomment(line.strip(), "#") for line in fhandle)
    lines = (line for line in lines if line)
    for line in lines:
        yield line

fnames = getfnames()
if IDF.getiddname() == None:
    IDF.setiddname(iddfile)
idfs = [IDF(fname) for fname in fnames]
alledges = [loopdiagram.getedges(idf.idfname, iddfile) for idf in idfs]
nodekeys = idf_helpers.getidfkeyswithnodes()


def getidfs():
    """return an idf"""
    return idfs
    
def getalledges():
    """return edges"""
    return alledges
    
def idfsandedges():
    """return idfs and edges"""
    return idfs, alledges
    
def an_idfedges(index):