示例#1
0
"""make a new idf ofject"""

from io import StringIO
from pprint import pprint

from eppy3000.modelmaker import IDF

iddfname = "/Applications/EnergyPlus-8-9-0/Energy+.schema.epJSON"
fname = "./eppy3000/resources/snippets/V8_9/a.epJSON"

idf = IDF(idfname=StringIO("{}"), iddname=iddfname)

# def newidfobject(idf, key, objname):
#     """create a new idf object"""
#     # TODO test for dup name
#     objidd = idf.idd.iddobjects[key]
#     try:
#         idf.idf[key][objname]
#     except KeyError as e:
#         idf.idf[key] = Munch()
#         nobj = idf.idf[key][objname] = Munch()
#     for fieldname in objidd.fieldnames():
#         try:
#             nobj[fieldname] = objidd.fieldproperty(fieldname)['default']
#         except AttributeError as e:
#             nobj[fieldname] = "gumby"
#
#make a newidfobject
# key = "Building"
# # key = "AirLoopHVAC"
# key = "Schedule:Compact"
示例#2
0
            "minimum_number_of_warmup_days": 6,
            "north_axis": 0.0,
            "solar_distribution": "MinimalShadowing",
            "temperature_convergence_tolerance_value": 0.05,
            "terrain": "Suburbs"
        }
    }
}
"""

fhandle = StringIO(txt)
idfhandle = StringIO(idftxt)
iddfname = "/Applications/EnergyPlus-8-9-0/Energy+.schema.epJSON"
fname = "./eppy3000/resources/snippets/V8_9/a.epJSON"

idf = IDF(idfname=fname, iddname=iddfname)
print(idf)

# idf = IDF(idfname=fname)

# pprint(idf.idd.iddobjects['AirLoopHVAC'].fieldproperty('branch_list_name'))
# print(idf.idfobjects['AirLoopHVAC'][0])
# for fname in idf.idd.iddobjects['AirLoopHVAC'].fieldnames():
#     print(fname)
# pprint(idf.idd.iddobjects['AirLoopHVAC'].fieldnames())

# print(idf)

# idf.saveas('karamba.txt')
# idfobjects = {key:[val1 for val1 in val.values()] for key, val in idf.idf.items()}
示例#3
0
                {
                    "vertex_x_coordinate": 15.24,
                    "vertex_y_coordinate": 15.24,
                    "vertex_z_coordinate": 0.0
                }
            ],
            "view_factor_to_ground": 1.0,
            "wind_exposure": "NoWind",
            "zone_name": "Main Zone"
        }
    }
}"""

fhandle = StringIO(txt)
iddfname = "/Applications/EnergyPlus-8-9-0/Energy+.schema.epJSON"
idf = IDF(idfname=fhandle, iddname=iddfname)
print(idf)

surfs = idf.idfobjects["BuildingSurface:Detailed"]
surf = surfs[0]
print(surf.eppy_objidd.fieldnames())

print(surf.vertices)

print(surf.vertices[0])

print(surf.vertices[0].vertex_x_coordinate)

surf.vertices[0].vertex_x_coordinate = 88
surf.vertices.append(
    dict(vertex_x_coordinate=1.2,
示例#4
0
"""snip a single object in the idf"""


from io import StringIO
from eppy3000.modelmaker import IDF
from pprint import pprint

iddfname = "/Applications/EnergyPlus-8-9-0/Energy+.schema.epJSON"
fname = "./eppy3000/resources/snippets/V8_9/a.epJSON"

idf = IDF(idfname=fname, iddname=iddfname)

selectedkey = "BuildingSurface:Detailed"
objname = "Zn001:Flr001"
keys = [key for key in idf.idf.keys() if key != selectedkey]
for key in keys:
    idf.idf.pop(key)
surfs = idf.idf[selectedkey]
keys = [key for key in surfs.keys() if key != objname]
for key in keys:
    surfs.pop(key)
print(idf)
outname = "a.json"
idf.saveas(outname, indent=4)