From b21f7a9f65945adc5d79f9f38e64e7602ddfe5ea Mon Sep 17 00:00:00 2001 From: Soroush Samareh Abolhassani Date: Tue, 31 Aug 2021 17:48:35 -0400 Subject: [PATCH] doe_idf is modified to read the XML format of doe idf addresses and connect it to the rest of the code. --- imports/schedules/doe_idf.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/imports/schedules/doe_idf.py b/imports/schedules/doe_idf.py index e5623631..746ab47d 100644 --- a/imports/schedules/doe_idf.py +++ b/imports/schedules/doe_idf.py @@ -26,11 +26,20 @@ class DoeIdf: for _, hour in enumerate(panda_hours): self._hours.append(str(hour).replace('0 days ', '').replace(':00:00', ':00')) self._city = city - self._idf_schedules_path = base_path / 'ASHRAE901_OfficeSmall_STD2019_Buffalo.idf' - with open(self._idf_schedules_path, 'r') as file: - idf = parseidf.parse(file.read()) - self._load_schedule(idf, 'small_office') - self._load_schedule(idf, 'residential') + + 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: + idf = parseidf.parse(file.read()) + self._load_schedule(idf, archetype_keys['@building_type']) def _load_schedule(self, idf, building_usage): schedules_day = {}