def ReadHVACdesignLoads(resultpath): ''' :return: ''' filehandle = open(resultpath, 'r').read() tables = readhtml.lines_table(filehandle) line2 = 'Estimated Cooling Peak Load Components' line3 = 'Estimated Heating Peak Load Components' d = {} i = 1 for table2 in tables: if line2 in table2[0]: targettable = table2[-1] d['Zonename' + str(i)] = str(table2[0][2]).split(": ")[1] d['LoadClg_' + d['Zonename' + str(i)]] = targettable[26][5] d['LoadClg' + d['Zonename' + str(i)] + '_Latent'] = targettable[26][4] d['LoadClg' + d['Zonename' + str(i)] + '_Sensible'] = targettable[26][1] + targettable[26][2] elif line3 in table2[0]: targettable2 = table2[-1] d['LoadHtg_' + d['Zonename' + str(i)]] = targettable2[26][5] d['LoadHtg' + d['Zonename' + str(i)] + '_Latent'] = targettable2[26][4] d['LoadHtg' + d['Zonename' + str(i)] + '_Sensible'] = targettable2[26][1] + targettable2[26][2] i += 1 return d
def test_lines_table(): """py.test for lines_table""" # soup = BeautifulSoup(SAMPLE_HTML) result = readhtml.lines_table(SAMPLE_HTML, False) assert result == [[[ 'Table of Contents', 'Report: Annual Building Utility Performance Summary', 'For: Entire Facility', 'Timestamp: 2014-01-13\n 16:47:19', 'Values gathered over 8760.00 hours', 'Site and Source Energy' ], [['a', '2'], ['3', '4']]], [['Site to Source Energy Conversion Factors'], [['b', '6'], ['7', '8']]], [[ 'Report: COMPONENTS OF PEAK ELECTRICAL DEMAND', 'For: Meter', 'Timestamp: 2014-01-13\n 16:47:19', 'Custom Monthly Report' ], [['c', '16'], ['17', '18']]], [[ 'Report: COMPONENTS OF PEAK NET ELECTRICAL DEMAND', 'For: Meter', 'Timestamp: 2014-01-13\n 16:47:19', 'Custom Monthly Report' ], [['d', '26'], ['27', '28']]]]
def test_lines_table(): """py.test for lines_table""" # soup = BeautifulSoup(SAMPLE_HTML) result = readhtml.lines_table(SAMPLE_HTML, False) assert result == [ [ [ 'Table of Contents', 'Report: Annual Building Utility Performance Summary', 'For: Entire Facility', 'Timestamp: 2014-01-13\n 16:47:19', 'Values gathered over 8760.00 hours', 'Site and Source Energy' ], [['a', '2'], ['3', '4']] ], [ ['Site to Source Energy Conversion Factors'], [['b', '6'], ['7', '8']] ], [ [ 'Report: COMPONENTS OF PEAK ELECTRICAL DEMAND', 'For: Meter', 'Timestamp: 2014-01-13\n 16:47:19', 'Custom Monthly Report' ], [['c', '16'], ['17', '18']]], [ [ 'Report: COMPONENTS OF PEAK NET ELECTRICAL DEMAND', 'For: Meter', 'Timestamp: 2014-01-13\n 16:47:19', 'Custom Monthly Report' ], [['d', '26'], ['27', '28']] ]]
def test_lines_table(): """py.test for lines_table""" # soup = BeautifulSoup(SAMPLE_HTML) result = readhtml.lines_table(SAMPLE_HTML, False) assert result == [ [ [ "Table of Contents", "Report: Annual Building Utility Performance Summary", "For: Entire Facility", "Timestamp: 2014-01-13\n 16:47:19", "Values gathered over 8760.00 hours", "Site and Source Energy", ], [["a", "2"], ["3", "4"]], ], [["Site to Source Energy Conversion Factors"], [["b", "6"], ["7", "8"]]], [ [ "Report: COMPONENTS OF PEAK ELECTRICAL DEMAND", "For: Meter", "Timestamp: 2014-01-13\n 16:47:19", "Custom Monthly Report", ], [["c", "16"], ["17", "18"]], ], [ [ "Report: COMPONENTS OF PEAK NET ELECTRICAL DEMAND", "For: Meter", "Timestamp: 2014-01-13\n 16:47:19", "Custom Monthly Report", ], [["d", "26"], ["27", "28"]], ], ]
def ReadHVACdesignLoads(resultsdir): ''' This function is used to read the HVAC peak load results from ZoneComponentSummary Report generated from the AirIdealLoads simulation :param resultsdir : This is the directory where the results for the first simulation are stored :return: This function returns a dictionary with zonenames, heating peak loads, and cooling peak loads ''' resultpath = resultsdir + '\\eplustbl.htm' filehandle = open(resultpath, 'r').read() tables = readhtml.lines_table(filehandle) line2 = 'Estimated Cooling Peak Load Components' line3 = 'Estimated Heating Peak Load Components' d = {} i = 1 for table2 in tables: if line2 in table2[0]: targettable = table2[-1] d['Zonename' + str(i)] = str(table2[0][2]).split(": ")[1] d['LoadClg_' + d['Zonename' + str(i)]] = targettable[26][5] elif line3 in table2[0]: targettable2 = table2[-1] d['LoadHtg_' + d['Zonename' + str(i)]] = targettable2[26][5] i += 1 return d