diff --git a/hub/exports/building_energy/trnsys.py b/hub/exports/building_energy/trnsys.py index 50d4c4e1..66075213 100644 --- a/hub/exports/building_energy/trnsys.py +++ b/hub/exports/building_energy/trnsys.py @@ -6,6 +6,7 @@ Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca """ from pathlib import Path +from hub.version import __version__ class Trnsys: @@ -23,12 +24,45 @@ class Trnsys: buildings.append(self._city.city_object(building)) self._buildings = buildings - def _building_information(self, f, building): - f.write('[Building Information]\n') - f.write(f'Name: {building.name}\n') - f.write(f'Location: {self._city.location.city}, {self._city.location.country}\n') - f.write(f'Total Floors: {building.storeys_above_ground}\n') - f.write(f'Year Build: {building.year_of_construction}\n') + def _header(self, f, building): + f.write('***************************************\n') + f.write(f'* Cerc Hub {__version__}\n') + f.write('***************************************\n') + f.write('* Building descriptions file TRNSYS\n') + location = ( + self._city.location.climate_reference_city_latitude, self._city.location.climate_reference_city_longitude + ) + f.write(f'* Export: {self._city.location.city} {self._city.location.country} {location}') + f.write(f'* For building: {building.name}') + if building.aliases is not None: + f.write(f' {building.aliases})') + f.write('\n') + f.write(f'* Total floors: {building.storeys_above_ground}\n') + f.write(f'* Year build: {building.year_of_construction}\n') + f.write('***************************************\n') + + def _properties(self, f): + f.write('***************************************\n') + f.write(f'* Properties\n') + f.write('***************************************\n') + f.write('PROPERTIES\n') + # todo: from where does this values come from? + f.write(f' DENSITY=1.204 : CAPACITY=1.012 : PRESSURE=101325.000 : HVAPOR=2454.0 : SIGMA=2.041e-007 : RTEMP=293.15\n') + f.write('* Convective heat transfer coefficient calculation\n') + f.write(' KFLOORUP=7.2 : EFLOORUP=0.31 : KFLOORDOWN=3.888 : EFLOORDOWN=0.31\n') + f.write(' KCEILUP=7.2 : ECEILUP=0.31 : KCEILDOWN=3.888 : ECEILDOWN=0.31\n') + f.write(' KVERTICAL=5.76 : EVERTICAL=0.3\n') + f.write('* Radiance parameters\n') + f.write(' SCENE_ROTATION_ANGLE=0 : GROUND_IDS= : GROUND_REFLECTANCE=0.2 : SHADER_REFLECTANCE=0\n') + f.write(' CALC_MODE=RAD : LATITUDE=48 : LONGITUDE=-9.2 : TIME_ZONE=-15 : SITE_ELEVATION=200\n') + f.write(' AB=5 : AD=1000 : AS=20 : AR=300 : AA=0.1\n') + f.write(' LR=6 : ST=0.15 : SJ=1 : LW=0.004 : DJ=0 : DS=0.2 : DR=2 : DP=512\n') + f.write('* Comfort parameters\n') + f.write(' DIAM-SENSOR=0.07 : EPS-SENSOR=0.82 : REFL-SENSOR=0.47 : ELV_AIRSPEED1=0.3 : ELV_AIRSPEED2=0.7 : ELV_AIRSPEED3=1.2\n') + f.write('* Other parameters\n') + f.write(' FSCAL_TREGENZA=MEDIUM : SHM_MODE=0 : SURFGRID=0.2\n') + f.write('* Daylight parameters\n') + f.write(' UDIMIN=100 : UDIMAX=2000 : DAMIN=300\n') @staticmethod def _geometry_information(f, building): @@ -60,6 +94,8 @@ class Trnsys: for building in self._buildings: path = Path(self._path / f'{building.name}.b18') with open(path, 'w', encoding='utf-8') as f: + self._header(f, building) + self._properties(f) self._building_information(f, building) Trnsys._geometry_information(f, building) Trnsys._wall_information(f, building)