completed schedules and constructions in trnsys
This commit is contained in:
parent
39951a76a9
commit
a6f9425068
@ -111,7 +111,6 @@ class Trnsys:
|
|||||||
if layer.density is not None:
|
if layer.density is not None:
|
||||||
density = layer.density
|
density = layer.density
|
||||||
|
|
||||||
|
|
||||||
layers[layer.material_name] = {
|
layers[layer.material_name] = {
|
||||||
'conductivity': conductivity,
|
'conductivity': conductivity,
|
||||||
'capacity': capacity, # todo: transform units
|
'capacity': capacity, # todo: transform units
|
||||||
@ -120,8 +119,8 @@ class Trnsys:
|
|||||||
'penrt': '0'
|
'penrt': '0'
|
||||||
}
|
}
|
||||||
f.write('PROPERTIES\n')
|
f.write('PROPERTIES\n')
|
||||||
for layer_name, values in layers.items():
|
for name, values in layers.items():
|
||||||
f.write(f'LAYER {layer_name.replace(" ", "_").upper()}\n')
|
f.write(f'LAYER {name.replace(" ", "_").upper()}\n')
|
||||||
for attribute, value in values.items():
|
for attribute, value in values.items():
|
||||||
f.write(f'{attribute.upper()}=\t{value}\t')
|
f.write(f'{attribute.upper()}=\t{value}\t')
|
||||||
f.write('\n')
|
f.write('\n')
|
||||||
@ -140,6 +139,22 @@ class Trnsys:
|
|||||||
f.write('MAX_ISHADE : any : max shading factor of internal shading\n')
|
f.write('MAX_ISHADE : any : max shading factor of internal shading\n')
|
||||||
f.write('MAX_ESHADE : any : max shading factor of external shading\n')
|
f.write('MAX_ESHADE : any : max shading factor of external shading\n')
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _add_schedule(f, schedule, name):
|
||||||
|
if schedule.time_step is cte.HOUR:
|
||||||
|
for day_type in schedule.day_types:
|
||||||
|
f.write(f'{name} {day_type.upper()}\n')
|
||||||
|
hours = 'HOURS= '
|
||||||
|
values = 'VALUES= '
|
||||||
|
previous = math.inf
|
||||||
|
for hour, value in enumerate(schedule.values):
|
||||||
|
if previous != value:
|
||||||
|
hours = f'{hours} {hour}.000'
|
||||||
|
values = f'{values} {value}'
|
||||||
|
previous = value
|
||||||
|
f.write(f'{hours} 24.0\n')
|
||||||
|
f.write(f'{values} {schedule.values[0]}\n')
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _schedules(f, building):
|
def _schedules(f, building):
|
||||||
f.write('***************************************\n')
|
f.write('***************************************\n')
|
||||||
@ -148,19 +163,39 @@ class Trnsys:
|
|||||||
for thermal_zone in building.thermal_zones_from_internal_zones:
|
for thermal_zone in building.thermal_zones_from_internal_zones:
|
||||||
for usage in thermal_zone.usages:
|
for usage in thermal_zone.usages:
|
||||||
for schedule in usage.occupancy.occupancy_schedules:
|
for schedule in usage.occupancy.occupancy_schedules:
|
||||||
if schedule.time_step is cte.HOUR:
|
Trnsys._add_schedule(f, schedule, 'SCHEDULE OCCUPANCY')
|
||||||
for day_type in schedule.day_types:
|
for schedule in usage.lighting.schedules:
|
||||||
f.write(f'SCHEDULE {day_type.upper()}\n')
|
Trnsys._add_schedule(f, schedule, 'SCHEDULE LIGHTING ')
|
||||||
hours = 'HOURS= '
|
|
||||||
values = 'VALUES= '
|
@staticmethod
|
||||||
previous = math.inf
|
def _construction(f, building):
|
||||||
for hour, value in enumerate(schedule.values):
|
f.write('***************************************\n')
|
||||||
if previous != value:
|
f.write(f'* Construction\n')
|
||||||
hours = f'{hours} {hour}.000'
|
f.write('***************************************\n')
|
||||||
values = f'{values} {value}'
|
constructions = {}
|
||||||
previous = value
|
for thermal_zone in building.thermal_zones_from_internal_zones:
|
||||||
f.write(f'{hours} 24.0\n')
|
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||||
f.write(f'{values} {schedule.values[0]}\n')
|
constructions[thermal_boundary.construction_name] = {
|
||||||
|
'layers': '',
|
||||||
|
'thickness': '',
|
||||||
|
'absortance-front': thermal_boundary.layers[0].solar_absorptance,
|
||||||
|
'absortance-back': thermal_boundary.layers[-1].solar_absorptance,
|
||||||
|
'resistance-front': 1 - thermal_boundary.layers[0].thermal_absorptance,
|
||||||
|
'resistance-back': 1 - thermal_boundary.layers[-1].thermal_absorptance,
|
||||||
|
'he': thermal_boundary.he,
|
||||||
|
'hi': thermal_boundary.hi
|
||||||
|
}
|
||||||
|
for layer in thermal_boundary.layers:
|
||||||
|
constructions[thermal_boundary.construction_name]['layers'] = f'{constructions[thermal_boundary.construction_name]["layers"]} {layer.material_name.replace(" ", "_").upper()} '
|
||||||
|
constructions[thermal_boundary.construction_name]['thickness'] = f'{constructions[thermal_boundary.construction_name]["thickness"]} {layer.thickness} '
|
||||||
|
for name, values in constructions.items():
|
||||||
|
f.write(f'CONSTRUCTION {name.replace(" ", "_").upper()}\n')
|
||||||
|
f.write(f'LAYERS = {constructions[thermal_boundary.construction_name]["layers"]}\n')
|
||||||
|
f.write(f'THICKNESS = {constructions[thermal_boundary.construction_name]["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'EPS-FRONT = {constructions[thermal_boundary.construction_name]["resistance-front"]} : EPS-BACK = {constructions[thermal_boundary.construction_name]["resistance-back"]}\n')
|
||||||
|
f.write(f'HFRONT = {constructions[thermal_boundary.construction_name]["he"]} : HBACK = {constructions[thermal_boundary.construction_name]["hi"]}\n')
|
||||||
|
f.write('\n')
|
||||||
|
|
||||||
def export(self):
|
def export(self):
|
||||||
print("export")
|
print("export")
|
||||||
@ -173,5 +208,6 @@ 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)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user