예제 #1
0
this_idd = idd_parser_library.iddFile(idd_file)
idd_objects = sorted(this_idd.iddObjects)
for idd_obj in idd_objects:
    mainObjectDictionary[idd_obj.upper()] = []
    totalReferences[idd_obj.upper()] = 0

# then loop over the idfs and create dictionaries as needed
idf_set = sorted(glob.glob(path.join(idf_dir, '*.idf')))
idf_summaries = []
processing_idf_num = 0
for idf in idf_set:
    processing_idf_num += 1
    # filename only
    idf_name = path.basename(idf)
    # create an idf library class, and a summary instance
    this_idf = idf_parser_library.idfFile(idf)

    # loop over objects, processing stuff
    for idf_object in this_idf.idf_objects:
        upperObjName = idf_object.objectName.upper()
        if idf_name == 'GSHPSimple-GLHE.idf':
            pass  # print(upperObjName)
        if upperObjName not in mainObjectDictionary:
            # theres a few things we can ignore:
            if upperObjName in [
                    "LEAD INPUT", "END LEAD INPUT", "END SIMULATION DATA",
                    "REPORT VARIABLE DICTIONARY"
            ]:
                continue
            print("***Found object not in IDD:")
            print("  IDF = " + idf_name)
if len(sys.argv) != 3:
    print("ERROR ARGUMENTS")
    sys.exit(1)
else:
    idf_dir = sys.argv[1]
    html_file = sys.argv[2]

idf_set = sorted(glob.glob(path.join(idf_dir, "*.idf")))
idf_summaries = []
processing_idf_num = 0
for idf in idf_set:
    processing_idf_num += 1
    # filename only
    idf_name = path.basename(idf)
    # create an idf library class, and a summary instance
    this_idf = idf_parser_library.idfFile(idf)
    idf_summary = idf_summary_class.IDFSummary(idf_name)
    # loop over objects, processing stuff
    for idf_object in this_idf.idf_objects:
        upperObjName = idf_object.objectName.upper()
        try:
            if "SITE:LOCATION" == upperObjName:
                idf_summary.location = idf_object.fields[0]  # weather file name **could** be inferred I guess
            elif "SIZINGPERIOD:" in upperObjName:
                idf_summary.numSizingPeriods += 1
            elif "ZONE" == upperObjName:
                idf_summary.numberZones += 1
            elif "INTERNALMASS" == upperObjName:
                idf_summary.internalMass = True
            elif "PEOPLE" == upperObjName:
                idf_summary.people = True