Skip to content

10min guide to your first simulation

Prageeth Jayathissa edited this page Aug 9, 2020 · 7 revisions

A pip install is currently under development to speed up this process

See the examples folder for example simulations

Import Modules

import numpy as np
import pandas as pd
from buildingPhysics import Zone #Importing Zone Class
import supplySystem
import emissionSystem
from radiation import Location
from radiation import Window 

Initialise the Location and building

# Initialise Zurich location with a Zurich weather file in the auxillary folder
Zurich = Location(epwfile_path='Zurich-Kloten_2013.epw')
# Initialise a building with default parameters
Office = Zone()

A full description of inputs for Building() can be found in buildingPhysics.py documentation

Define Windows

SouthWindow = Window(azimuth_tilt=0, alititude_tilt = 90, glass_solar_transmittance=0.7,
glass_light_transmittance=0.8, area = 4)

Calculate Sun Position for a specific coordinate

hour=3993 # define the hour of the year
Altitude, Azimuth = Zurich.calc_sun_position(latitude_deg=47.480, 
longitude_deg=8.536, year=2015, hoy=hour)
#hoy: Hour of the Year

Get Outdoor Temperature

# Extract the outdoor temperature in Zurich for that hour
    t_out = Zurich.weather_data['drybulb_C'][hour]

Calculate solar gains and transmitted Illuminance

SouthWindow.calc_solar_gains(sun_altitude = Altitude, sun_azimuth = Azimuth, 
normal_direct_radiation= Zurich.weather_data['dirnorrad_Whm2'][hour], 
horizontal_diffuse_radiation = Zurich.weather_data['difhorrad_Whm2'][hour])

SouthWindow.calc_illuminance(sun_altitude = Altitude, sun_azimuth = Azimuth, 
normal_direct_illuminance = Zurich.weather_data['dirnorillum_lux'][hour], 
horizontal_diffuse_illuminance = Zurich.weather_data['difhorillum_lux'][hour])

Solve for building energy and lighting

Office.solve_energy(internal_gains=400, solar_gains=SouthWindow.solar_gains,t_out=t_out, t_m_prev=20)
Office.solve_lighting(illuminance=SouthWindow.transmitted_illuminance, occupancy=0.8)

Extract Results

  • Office.heating_demand: space heating demand of the building [Wh/h]
  • Office.heating_sys_electricity: heating electricity consumption [Wh/h]
  • Office.heating_sys_fossils: heating fossil fuel consumption [Wh/h]
  • Office.cooling_demand: space cooling demand of the building [Wh/h]
  • Office.cooling_sys_electricity: electricity consumption from cooling [Wh/h]
  • Office.cooling_sys_fossils: fossil fuel consumption from cooling [Wh/h]
  • Office.electricity_out: electricty produced from combined heat pump systems [Wh/h]
  • Office.sys_total_energy: total exergy consumed (electricity + fossils) for heating and cooling [Wh/h]
  • Office.heating_energy: total exergy consumed (electricity + fossils) for heating [Wh/h]
  • Office.cooling_energy: total exergy consumed (electricity + fossils) for cooling [Wh/h]
  • Office.cop: COP of the heating or cooling system
  • Office.has_heating_demand: Boolean
  • Office.has_cooling_demand: Boolean
  • Office.t_air: New air temperature of the building [C]
  • Office.t_m: New thermal mass temperature of the building [C]
  • Office.t_s: New surface temperature[C]

Running an annual simulation

Repeat this methodology, but loop through 8760 hours of the year

See annual_simulation.py in the examples folder