dhw schedule fix attempt

This commit is contained in:
Guille Gutierrez 2023-04-12 10:16:14 -04:00
parent 89faa92103
commit f62df2e873
3 changed files with 28 additions and 23 deletions

View File

@ -101,6 +101,7 @@ class Idf:
self._adjacent_buildings = adjacent_buildings
if self._adjacent_buildings is None:
self._adjacent_buildings = []
self._export()
@staticmethod
@ -248,16 +249,24 @@ class Idf:
return
return self._add_standard_compact_hourly_schedule(usage, schedule_type, new_schedules)
def _add_servicetemp_schedules(self, thermal_zone):
def _add_constant_hourly_year_schedules(self, thermal_zone, value, schedule_type):
_schedule = Schedule()
_schedule.type = cte.DOMESTIC_HOT_WATER
_schedule.data_type = cte.TEMPERATURE
_schedule.type = schedule_type
_schedule.data_type = cte.ANY_NUMBER
_schedule.time_step = cte.HOUR
_schedule.time_range = cte.DAY
_schedule.values = [thermal_zone.domestic_hot_water.service_temperature for _ in range(0, 8760)]
print(_schedule.values)
return self._add_standard_compact_hourly_schedule(thermal_zone.usage, cte.DOMESTIC_HOT_WATER, _schedule)
_schedule.time_range = cte.YEAR
_schedule.day_types = ['monday',
'tuesday',
'wednesday',
'thursday',
'friday',
'saturday',
'sunday',
'holiday',
'winter_design_day',
'summer_design_day']
_schedule.values = [value for _ in range(0, 8760)]
return self._add_standard_compact_hourly_schedule(thermal_zone.usage_name, schedule_type, [_schedule])
def _add_construction(self, thermal_boundary):
for construction in self._idf.idfobjects[self._CONSTRUCTION]:
@ -414,21 +423,19 @@ class Idf:
Design_Flow_Rate_Calculation_Method='AirChanges/Hour',
Air_Changes_per_Hour=thermal_zone.infiltration_rate_system_off*factorreduct
)
def _add_DHW(self, thermal_zone, zone_name):
fuel_type = 'Electricity'
method = 'Watts/Area'
factor_size = thermal_zone.total_floor_area / thermal_zone.footprint_area
peak_flow_rate = thermal_zone.domestic_hot_water.peak_flow*factor_size
#_object = self._idf.newidfobject(self._DHW)
#print(vars(_object))
_object = self._idf.newidfobject(self._DHW)
print(vars(_object))
self._idf.newidfobject(self._DHW,
Name=f'{zone_name}_DHW',
Zone_or_ZoneList_Name=zone_name,
Schedule_Name=f'DHW {thermal_zone.usage_name}',
Peak_flow_rate=peak_flow_rate,
Peak_Flow_Rate=peak_flow_rate,
Flow_Rate_Fraction_Schedule_Name=f'DHW_prof {thermal_zone.usage_name}',
Target_Temperature_Schedule_Name=f'DHW_temp {thermal_zone.usage_name}',
Cold_Water_Supply_Temperature_Schedule_Name=f'CW_temp {thermal_zone.usage_name}',
EndUse_Subcategory=f'DHW {thermal_zone.usage_name}'
)
def _rename_building(self, city_name):
@ -480,11 +487,10 @@ class Idf:
self._add_schedules(usage, 'Lighting', thermal_zone.lighting.schedules)
self._add_schedules(usage, 'Appliance', thermal_zone.appliances.schedules)
self._add_schedules(usage, 'DHW_prof', thermal_zone.domestic_hot_water.schedules)
self._add_servicetemp_schedules(thermal_zone)
self._add_schedules(usage, 'CW_temp', building.cold_water_temperature.hour)
# self._add_service_temp_schedules(thermal_zone)
value = int(thermal_zone.domestic_hot_water.service_temperature)
self._add_constant_hourly_year_schedules(thermal_zone, value, cte.DOMESTIC_HOT_WATER)
self._add_people_activity_level_schedules(thermal_zone)
self._add_zone(thermal_zone, building.name)
self._add_heating_system(thermal_zone, building.name)
self._add_infiltration(thermal_zone, building.name)
@ -492,7 +498,7 @@ class Idf:
self._add_lighting(thermal_zone, building.name)
self._add_appliances(thermal_zone, building.name)
self._add_DHW(thermal_zone, building.name)
print('after schedules')
if self._export_type == "Surfaces":
if building.name in self._target_buildings or building.name in self._adjacent_buildings:
if building.internal_zones[0].thermal_zones is not None:

View File

@ -31,6 +31,7 @@ class EnergyBuildingsExportsFactory:
self._target_buildings = target_buildings
self._adjacent_buildings = adjacent_buildings
@property
def _energy_ade(self):
"""

View File

@ -106,12 +106,10 @@ class TestExports(TestCase):
path=file_path,
function_to_hub=Dictionaries().alkis_function_to_hub_function).city
self.assertIsNotNone(city, 'city is none')
# EnergyBuildingsExportsFactory('idf', city, self._output_path).export()
# ConstructionFactory('nrcan', city).enrich()
# EnergyBuildingsExportsFactory('idf', city, self._output_path).export()
ConstructionFactory('nrcan', city).enrich()
UsageFactory('nrcan', city).enrich()
try:
EnergyBuildingsExportsFactory('idf', city, self._output_path).export()
EnergyBuildingsExportsFactory('idf', city, self._output_path).export_debug()
except Exception:
self.fail("Idf ExportsFactory raised ExceptionType unexpectedly!")