doe_idf is modified to read the XML format of doe idf addresses and connect it to the rest of the code.

This commit is contained in:
Soroush Samareh Abolhassani 2021-08-31 17:48:35 -04:00
parent a626d83a63
commit b21f7a9f65

View File

@ -26,11 +26,20 @@ class DoeIdf:
for _, hour in enumerate(panda_hours): for _, hour in enumerate(panda_hours):
self._hours.append(str(hour).replace('0 days ', '').replace(':00:00', ':00')) self._hours.append(str(hour).replace('0 days ', '').replace(':00:00', ':00'))
self._city = city self._city = city
self._idf_schedules_path = base_path / 'ASHRAE901_OfficeSmall_STD2019_Buffalo.idf'
path = str(base_path / doe_idf_file)
with open(path) as xml:
self._library = xmltodict.parse(xml.read())
for archetype in self._library['archetypes']['archetypes']:
self._archetype_keys = {}
for key, value in archetype.items():
if key[0] == '@':
archetype_keys[key] = value
self._idf_schedules_path = archetype['idf']['path']
with open(self._idf_schedules_path, 'r') as file: with open(self._idf_schedules_path, 'r') as file:
idf = parseidf.parse(file.read()) idf = parseidf.parse(file.read())
self._load_schedule(idf, 'small_office') self._load_schedule(idf, archetype_keys['@building_type'])
self._load_schedule(idf, 'residential')
def _load_schedule(self, idf, building_usage): def _load_schedule(self, idf, building_usage):
schedules_day = {} schedules_day = {}