Beispiel #1
0
def main(argv=None):
    if argv is None:
        argv = sys.argv
    try:
        try:
            opts, args = getopt.getopt(argv[1:], "ho:v", ["help", "output="])
        except getopt.error, msg:
            raise Usage(msg)
    
        # option processing
        for option, value in opts:
            if option == "-v":
                verbose = True
            if option in ("-h", "--help"):
                raise Usage(help_message)
            if option in ("-o", "--output"):
                output = value
                
        iddfile = "../iddfiles/Energy+V6_0.idd"
        fname = args[0]
        iddfile = "../../iddfiles/Energy+V6_0.idd"
        data, commdct = readidf.readdatacommdct(fname, iddfile=iddfile)
        print "constructing the loops"
        edges = maketheairloop(data, commdct)
        print "making the diagram"
        g = makethediagram(edges)
        dotname = '%s.dot' % (os.path.splitext(fname)[0])
        pngname = '%s.png' % (os.path.splitext(fname)[0])
        g.write(dotname)
        g.write_png(pngname)
Beispiel #2
0
def main():

    # read code
    # iddfile = "../iddfiles/Energy+V6_0.idd"
    iddfile = "./walls.idd"
    fname = "./walls.idf" # small file with only surfaces
    data, commdct = readidf.readdatacommdct(fname, iddfile=iddfile)

    # setup code walls - can be generic for any object
    dt = data.dt
    dtls = data.dtls
    wall_i = dtls.index('BuildingSurface:Detailed'.upper())
    wallkey = 'BuildingSurface:Detailed'.upper()

    dwalls = dt[wallkey]
    dwall = dwalls[0]

    wallfields = [comm.get('field') for comm in commdct[wall_i]]
    wallfields[0] = ['key']
    wallfields = [field[0] for field in wallfields]
    wall_fields = [bunchhelpers.makefieldname(field) for field in wallfields]
    print wall_fields[:20]

    bwall = EpBunch(dwall, wall_fields)

    print bwall.Name
    print data.dt[wallkey][0][1]
    bwall.Name = 'Gumby'
    print bwall.Name
    print data.dt[wallkey][0][1]
    print

    # set aliases
    bwall.__aliases = {'Constr':'Construction_Name'} 

    print "wall.Construction_Name = %s" % (bwall.Construction_Name, )
    print "wall.Constr = %s" % (bwall.Constr, )
    print
    print "change wall.Constr"
    bwall.Constr = 'AnewConstr'
    print "wall.Constr = %s" % (bwall.Constr, )
    print "wall.Constr = %s" % (data.dt[wallkey][0][3], )
    print

    # add functions
    bwall.__functions = {'svalues':somevalues} 

    print bwall.svalues
    print bwall.__functions
Beispiel #3
0
def idfreader(fname, iddfile, conv=True):
    """read idf file and reutrn bunches"""
    data, commdct = readidf.readdatacommdct(fname, iddfile=iddfile)
    if conv:
        convertallfields(data, commdct)
    # fill gaps in idd
    dt, dtls = data.dt, data.dtls
    # skiplist = ["TABLE:MULTIVARIABLELOOKUP"]
    nofirstfields = iddgaps.missingkeys_standard(commdct, dtls, 
                skiplist=["TABLE:MULTIVARIABLELOOKUP"]) 
    iddgaps.missingkeys_nonstandard(commdct, dtls, nofirstfields)
    bunchdt = makebunches(data, commdct)
    # TODO : add functions here.
    # - 
    addfunctions(dtls, bunchdt)
    # - 
    return bunchdt, data, commdct
Beispiel #4
0
def main(argv=None):
    if argv is None:
        argv = sys.argv
    try:
        try:
            opts, args = getopt.getopt(argv[1:], "ho:v", ["help", "output="])
        except getopt.error, msg:
            raise Usage(msg)

        # option processing
        for option, value in opts:
            if option == "-v":
                verbose = True
            if option in ("-h", "--help"):
                raise Usage(help_message)
            if option in ("-o", "--output"):
                output = value

        if len(args) == 1:
            # iddfile = "../iddfiles/Energy+V6_0.idd"
            iddfile = "./resources/iddfiles/Energy+V7_0_0_036.idd"
            fname = args[0]
        elif len(args) == 2:
            iddfile = args[0]
            fname = args[1]
        # iddfile = "../iddfiles/Energy+V6_0.idd"
        print "readingfile"
        data, commdct = readidf.readdatacommdct(fname, iddfile=iddfile)
        print "constructing the loops"
        edges = makeairplantloop(data, commdct)
        # print edges
        print "making the diagram"
        g = makediagram(edges)
        dotname = '%s.dot' % (os.path.splitext(fname)[0])
        pngname = '%s.png' % (os.path.splitext(fname)[0])
        g.write(dotname)
        g.write_png(pngname)
Beispiel #5
0
def getedges(fname, iddfile):
    """return the edges of the idf file fname"""
    data, commdct = readidf.readdatacommdct(fname, iddfile=iddfile)
    edges = makeairplantloop(data, commdct)
    return edges
Beispiel #6
0
# usage below
from EPlusInterfaceFunctions import readidf


fname = "5ZoneDD.idf"
fname = "../HospitalLowEnergy.idf"
data, commdct = readidf.readdatacommdct(fname)
#
# autosizeds = getautosizeds(data, commdct)
#
# print autosizeds
Beispiel #7
0
# Eppy is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with eppy.  If not, see <http://www.gnu.org/licenses/>.

"""do a type conversion for all variables in data.dt"""
from EPlusInterfaceFunctions import readidf

iddfile = "../iddfiles/Energy+V7_0_0_036.idd"
fname = "../idffiles/V_7_0/5ZoneSupRetPlenRAB.idf"
 
data, commdct = readidf.readdatacommdct(fname, iddfile=iddfile)
 
def convertfields(key_comm, obj):
    """convert the float and interger fields"""
    def apass(a):
        return a
    typefunc = dict(integer=int, real=float)
    types = [comm.get('type', [None])[0] for comm in key_comm]
    convs = [typefunc.get(typ, apass) for typ in types]
    for i, (val, conv) in enumerate(zip(obj, convs)):
        try:
            val = conv(val)
            obj[i] = val
        except ValueError, e:
            pass
    return obj
Beispiel #8
0
def getedges(fname, iddfile):
    """return the edges of the idf file fname"""
    data, commdct = readidf.readdatacommdct(fname, iddfile=iddfile)
    edges = makeairplantloop(data, commdct)
    return edges