Skip to content

10min guide to your first simulation

Prageeth Jayathissa edited this page May 8, 2017 · 7 revisions

See the examples folder for example simulations

Import Modules

import numpy as np
import pandas as pd
from buildingPhysics import Building #Importing Building 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 = Building()

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

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_building_energy(internal_gains=400, solar_gains=SouthWindow.solar_gains,T_out=T_out, T_m_prev=20)
Office.solve_building_lighting(illuminance=SouthWindow.transmitted_illuminance, occupancy=0.8)

Extract Results

  • Office.heatingDemand: space heating demand of the building [Wh/h]
  • Office.heatingSysElectricity: heating electricity consumption [Wh/h]
  • Office.heatingSysFossils: heating fossil fuel consumption [Wh/h]
  • Office.coolingDemand: space cooling demand of the building [Wh/h]
  • Office.coolingSysElectricity: electricity consumption from cooling [Wh/h]
  • Office.coolingSysFossils: fossil fuel consumption from cooling [Wh/h]
  • Office.electricityOut: electricty produced from combined heat pump systems [Wh/h]
  • Office.sysTotalEnergy: total exergy consumed (electricity + fossils) for heating and cooling [Wh/h]
  • Office.heatingEnergy: total exergy consumed (electricity + fossils) for heating [Wh/h]
  • Office.coolingEnergy: 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 annualSimulation.py in the examples folder

Clone this wiki locally