windows included
This commit is contained in:
parent
7fbc199479
commit
0c74ff26e7
|
@ -168,7 +168,7 @@ class Trnsys:
|
||||||
Trnsys._add_schedule(f, schedule, 'SCHEDULE LIGHTING ')
|
Trnsys._add_schedule(f, schedule, 'SCHEDULE LIGHTING ')
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _construction(f, building):
|
def _constructions(f, building):
|
||||||
f.write('***************************************\n')
|
f.write('***************************************\n')
|
||||||
f.write(f'* Construction\n')
|
f.write(f'* Construction\n')
|
||||||
f.write('***************************************\n')
|
f.write('***************************************\n')
|
||||||
|
@ -190,13 +190,116 @@ class Trnsys:
|
||||||
constructions[thermal_boundary.construction_name]['thickness'] = f'{constructions[thermal_boundary.construction_name]["thickness"]} {layer.thickness} '
|
constructions[thermal_boundary.construction_name]['thickness'] = f'{constructions[thermal_boundary.construction_name]["thickness"]} {layer.thickness} '
|
||||||
for name, values in constructions.items():
|
for name, values in constructions.items():
|
||||||
f.write(f'CONSTRUCTION {name.replace(" ", "_").upper()}\n')
|
f.write(f'CONSTRUCTION {name.replace(" ", "_").upper()}\n')
|
||||||
f.write(f'LAYERS = {constructions[thermal_boundary.construction_name]["layers"]}\n')
|
f.write(f'LAYERS = {values["layers"]}\n')
|
||||||
f.write(f'THICKNESS = {constructions[thermal_boundary.construction_name]["thickness"]}\n')
|
f.write(f'THICKNESS = {values["thickness"]}\n')
|
||||||
f.write(f'ABS-FRONT = {constructions[thermal_boundary.construction_name]["absortance-front"]} : ABS-BACK = {constructions[thermal_boundary.construction_name]["absortance-back"]}\n')
|
f.write(f'ABS-FRONT = {values["absortance-front"]} : ABS-BACK = {values["absortance-back"]}\n')
|
||||||
f.write(f'EPS-FRONT = {constructions[thermal_boundary.construction_name]["resistance-front"]} : EPS-BACK = {constructions[thermal_boundary.construction_name]["resistance-back"]}\n')
|
f.write(f'EPS-FRONT = {values["resistance-front"]} : EPS-BACK = {values["resistance-back"]}\n')
|
||||||
f.write(f'HFRONT = {constructions[thermal_boundary.construction_name]["he"]} : HBACK = {constructions[thermal_boundary.construction_name]["hi"]}\n')
|
f.write(f'HFRONT = {values["he"]} : HBACK = {values["hi"]}\n')
|
||||||
f.write('\n')
|
f.write('\n')
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _windows(f, building):
|
||||||
|
f.write('***************************************\n')
|
||||||
|
f.write(f'* Windows\n')
|
||||||
|
f.write('***************************************\n')
|
||||||
|
windows = {}
|
||||||
|
for thermal_zone in building.thermal_zones_from_internal_zones:
|
||||||
|
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||||
|
polygon = thermal_boundary.parent_surface.solid_polygon
|
||||||
|
min_z = math.inf
|
||||||
|
max_z = -math.inf
|
||||||
|
Z = 2
|
||||||
|
for point in polygon.points:
|
||||||
|
min_z = min(min_z, point.coordinates[Z])
|
||||||
|
max_z = max(max_z, point.coordinates[Z])
|
||||||
|
height = max_z - min_z
|
||||||
|
if height == 0:
|
||||||
|
height = 1
|
||||||
|
|
||||||
|
for opening_id, thermal_opening in enumerate(thermal_boundary.thermal_openings):
|
||||||
|
absortance = 0.6
|
||||||
|
if thermal_opening.conductivity is not None:
|
||||||
|
absortance = 1 - thermal_opening.conductivity
|
||||||
|
windows[f'{thermal_opening.construction_name}'] = {
|
||||||
|
'window_id': opening_id,
|
||||||
|
'hi': thermal_opening.hi,
|
||||||
|
'he': thermal_opening.he,
|
||||||
|
'slope': -999,
|
||||||
|
'space_id': 3,
|
||||||
|
'width': thermal_opening.area / height, # todo: this is just an estimation as the surfaces may not be squares.
|
||||||
|
'height': height,
|
||||||
|
'frame_f': 0,
|
||||||
|
'frame_u': thermal_opening.overall_u_value,
|
||||||
|
'abs_frame': absortance,
|
||||||
|
'ri_shade': 0,
|
||||||
|
're_shade': 0,
|
||||||
|
're_fli_shade': 0.5,
|
||||||
|
're_flo_shade': 0.5,
|
||||||
|
'cci_shade': 0.5,
|
||||||
|
'eps_frame': 0.9,
|
||||||
|
'epsi_shade': 0.9,
|
||||||
|
'it_shade_close': 0,
|
||||||
|
'it_shade_open': 0,
|
||||||
|
'flow_to_air_node': 1,
|
||||||
|
'pert': 0,
|
||||||
|
'penrt': 0,
|
||||||
|
'rad_material': 'undefined',
|
||||||
|
'rad_material_shd1': 'undefined'
|
||||||
|
}
|
||||||
|
for name, values in windows.items():
|
||||||
|
f.write(f'WINDOW {name.replace(" ", "_").upper()}\n')
|
||||||
|
f.write(f' WINID={values["window_id"]} :')
|
||||||
|
f.write(f' HINSIDE={values["hi"]} :')
|
||||||
|
f.write(f' HOUTSIDE={values["he"]} :')
|
||||||
|
f.write(f' SLOPE={values["slope"]} :')
|
||||||
|
f.write(f' SPACID={values["space_id"]} :')
|
||||||
|
f.write(f' WWID={values["width"]} :')
|
||||||
|
f.write(f' WHEIG={values["height"]} :')
|
||||||
|
f.write(f' FFRAME={values["frame_f"]} :')
|
||||||
|
f.write(f' UFRAME={values["frame_u"]} :')
|
||||||
|
f.write(f' ABSFRAME={values["abs_frame"]} :')
|
||||||
|
f.write(f' RISHADE={values["ri_shade"]} :')
|
||||||
|
f.write(f' RESHADE={values["re_shade"]} :')
|
||||||
|
f.write(f' REFLISHADE={values["re_fli_shade"]} :')
|
||||||
|
f.write(f' REFLOSHADE={values["re_flo_shade"]} :')
|
||||||
|
f.write(f' CCISHADE={values["cci_shade"]} :')
|
||||||
|
f.write(f' EPSFRAME={values["eps_frame"]} :')
|
||||||
|
f.write(f' EPSIFRAME={values["epsi_shade"]} :')
|
||||||
|
f.write(f' ITSHADECLOSE={values["it_shade_close"]} :')
|
||||||
|
f.write(f' ITSHADEOPEN={values["it_shade_open"]} :')
|
||||||
|
f.write(f' FLOWTOAIRNODE={values["flow_to_air_node"]} :')
|
||||||
|
f.write(f' PERT={values["pert"]} :')
|
||||||
|
f.write(f' PENRT={values["penrt"]} :')
|
||||||
|
f.write(f' RADMATERIAL={values["rad_material"]} :')
|
||||||
|
f.write(f' RADMATERIAL_SHD1={values["rad_material_shd1"]}\n')
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _empty_sections(f):
|
||||||
|
f.write('***************************************\n')
|
||||||
|
f.write(f'* Gains / Losses\n')
|
||||||
|
f.write('***************************************\n')
|
||||||
|
f.write('***************************************\n')
|
||||||
|
f.write(f'* Confort\n')
|
||||||
|
f.write('***************************************\n')
|
||||||
|
f.write('***************************************\n')
|
||||||
|
f.write(f'* Infiltration\n')
|
||||||
|
f.write('***************************************\n')
|
||||||
|
f.write('***************************************\n')
|
||||||
|
f.write(f'* Ventilation\n')
|
||||||
|
f.write('***************************************\n')
|
||||||
|
f.write('***************************************\n')
|
||||||
|
f.write(f'* Cooling\n')
|
||||||
|
f.write('***************************************\n')
|
||||||
|
f.write('***************************************\n')
|
||||||
|
f.write(f'* Heating\n')
|
||||||
|
f.write('***************************************\n')
|
||||||
|
f.write('***************************************\n')
|
||||||
|
f.write(f'* Daylight control\n')
|
||||||
|
f.write('***************************************\n')
|
||||||
|
f.write('***************************************\n')
|
||||||
|
f.write(f'* Confort\n')
|
||||||
|
f.write('***************************************\n')
|
||||||
|
|
||||||
def export(self):
|
def export(self):
|
||||||
for building in self._buildings:
|
for building in self._buildings:
|
||||||
path = Path(self._path / f'{building.name}.b18')
|
path = Path(self._path / f'{building.name}.b18')
|
||||||
|
@ -207,6 +310,8 @@ class Trnsys:
|
||||||
Trnsys._types(f, building)
|
Trnsys._types(f, building)
|
||||||
Trnsys._inputs(f)
|
Trnsys._inputs(f)
|
||||||
Trnsys._schedules(f, building)
|
Trnsys._schedules(f, building)
|
||||||
Trnsys._construction(f, building)
|
Trnsys._constructions(f, building)
|
||||||
|
Trnsys._windows(f, building)
|
||||||
|
Trnsys._empty_sections(f)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -165,4 +165,4 @@ class TestExports(TestCase):
|
||||||
ConstructionFactory('nrcan', city).enrich()
|
ConstructionFactory('nrcan', city).enrich()
|
||||||
UsageFactory('nrcan', city).enrich()
|
UsageFactory('nrcan', city).enrich()
|
||||||
WeatherFactory('epw', city).enrich()
|
WeatherFactory('epw', city).enrich()
|
||||||
EnergyBuildingsExportsFactory('trnsys', city, self._output_path).export()
|
EnergyBuildingsExportsFactory('trnsys', city, self._output_path).export()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user