Skip to content

Parametric

Weili edited this page Jun 25, 2018 · 9 revisions

Parametric Simulation

Quick Start

import BuildSimHubAPI as bsh_api

# 1. Set project and model key  
project_api_key = 'f98aadb3-254f-428d-82a6e4b9424c'  
model_api_key = '48003d7a-143f-45c1-4ab4d1968bbd'

# start running parametric simulation
bsh = bsh_api.BuildSimHubAPIClient()
new_pj = bsh.new_parametric_job(project_api_key)
new_pj.submit_parametric_study_local(model_api_key, track=True)

This is the minimum code to start a parametric study. However, since there is no energy efficient measures defined in the above code, the effect of this code is essentially the same as a single simulation.

Now, let's dig deeper to see how we can do a proper parametric study.

Energy Efficient Measures

  1. BuildingOrientation():
# This measure changes the orientation of the building.
import BuildSimHubAPI as bsh_api

bldg_orientation = bsh_api.measures.BuildingOrientation()
# define the list of data.
data = [0, 90, 180, 270]
bldg_orientation.set_datalist(data)
  1. WallRValue(unit)
# This changes the r value of wall insulation layer
import BuildSimHubAPI as bsh_api

wall_rvalue = bsh_api.measures.WallRValue('ip')
# define the list of data.
data = [20, 30, 40]
wall_rvalue.set_datalist(data)
  1. RoofRValue(unit)
# This changes the r value of roof insulation layer. 
# For attic roof, the floor and ceiling insulation will be changed.
import BuildSimHubAPI as bsh_api

roof_rvalue = bsh_api.measures.RoofRValue('si')
# define the list of data.
data = [5.0, 6.0, 7.0]
roof_rvalue.set_datalist(data)
  1. RoofSolarAbsorption()
# This update the solar absorption on the outmost layer of the roof.
import BuildSimHubAPI as bsh_api

roof_solar_absorption = bsh_api.measures.RoofSolarAbsorption()
# define the list of data.
data = [0.2, 0.3 ,0.4]
roof_solar_absorption.set_datalist(data)
  1. WindowUValue(unit)
# Update window u value - 
# if using simple method, this will change the u value
# if using detail method, this will delete the detail method and then use simple method with 0.4 SHGC or the SHGC value specified in SHGC measure
import BuildSimHubAPI as bsh_api

window_u = bsh_api.measures.WindowUValue('si')
# define the list of data.
data = [3.2, 2.2 ,1.8]
window_u.set_datalist(data)
  1. WindowSHGC()
# Update window u value - 
# if using simple method, this will change the shgc
# if using detail method, this will delete the detail method and then use simple method with 2.2 u-value or the u value specified in window u value measure
import BuildSimHubAPI as bsh_api

window_shgc = bsh_api.measures.WindowSHGC()
# define the list of data.
data = [0.3, 0.4 ,0.5]
window_shgc.set_datalist(data)
  1. WindowWallRatio()
# This measure proportionally change the WWR at four orientations to match the target overall WWR.
# If shrink (target WWR is smaller than actual model WWR) - reduce the size of the windows
# If expand (target WWR is larger than actual model WWR) - delete all the windows and redraw windows on each surface
import BuildSimHubAPI as bsh_api

wwr = bsh_api.measures.WindowWallRatio()
# define the list of data.
data = [0.3, 0.4 ,0.5]
wwr.set_datalist(data)
  1. WindowWallRatioEast()
# This measure proportionally change the WWR at east orientation
import BuildSimHubAPI as bsh_api

wwr_e = bsh_api.measures.WindowWallRatioEast()
# define the list of data.
data = [0.3, 0.4 ,0.5]
wwr_e.set_datalist(data)
  1. WindowWallRatioNorth()
# This measure proportionally change the WWR at north orientation
import BuildSimHubAPI as bsh_api

wwr_n = bsh_api.measures.WindowWallRatioNorth()
# define the list of data.
data = [0.3, 0.4 ,0.5]
wwr_n.set_datalist(data)
  1. WindowWallRatioSouth()
# This measure proportionally change the WWR at south orientation
import BuildSimHubAPI as bsh_api

wwr_s = bsh_api.measures.WindowWallRatioSouth()
# define the list of data.
data = [0.3, 0.4 ,0.5]
wwr_s.set_datalist(data)
  1. WindowWallRatioWest()
# This measure proportionally change the WWR at west orientation
import BuildSimHubAPI as bsh_api

wwr_w = bsh_api.measures.WindowWallRatioWest()
# define the list of data.
data = [0.3, 0.4 ,0.5]
wwr_w.set_datalist(data)
  1. ShadeFin()
# This measure add Fin to left and right side of every window
# The data is the depth of Fin
# If set to 0, it means there is no Fin
import BuildSimHubAPI as bsh_api

fin = bsh_api.measures.ShadeFin()
# define the list of data.
data = [0.5, 1.0 ,1.5]
fin.set_datalist(data)
  1. ShadeFinEast()
# This measure add Fin to left and right side of east facing window
# The data is the depth of Fin
# If set to 0, it means there is no Fin
import BuildSimHubAPI as bsh_api

fin_e = bsh_api.measures.ShadeFineEast()
# define the list of data.
data = [0.5, 1.0 ,1.5]
fin_e.set_datalist(data)
  1. ShadeFinNorth()
# This measure add Fin to left and right side of north facing window
# The data is the depth of Fin
# If set to 0, it means there is no Fin
import BuildSimHubAPI as bsh_api

fin_n = bsh_api.measures.ShadeFineNorth()
# define the list of data.
data = [0.5, 1.0 ,1.5]
fin_n.set_datalist(data)
  1. ShadeFinSouth()
# This measure add Fin to left and right side of south facing window
# The data is the depth of Fin
# If set to 0, it means there is no Fin
import BuildSimHubAPI as bsh_api

fin_s = bsh_api.measures.ShadeFineSouth()
# define the list of data.
data = [0.5, 1.0 ,1.5]
fin_s.set_datalist(data)
  1. ShadeFineWest()
# This measure add Fin to left and right side of west facing window
# The data is the depth of Fin
# If set to 0, it means there is no Fin
import BuildSimHubAPI as bsh_api

fin_w = bsh_api.measures.ShadeFineWest()
# define the list of data.
data = [0.5, 1.0 ,1.5]
fin_w.set_datalist(data)
  1. ShadeOverhang()
# This measure add overhang to every window
# The data is the depth of overhang
# If set to 0, it means there is no overhang
import BuildSimHubAPI as bsh_api

overhang = bsh_api.measures.ShadeOverhang()
# define the list of data.
data = [0.5, 1.0 ,1.5]
overhang.set_datalist(data)
  1. ShadeOverhangEast()
# This measure add overhang to every east facing window
# The data is the depth of overhang
# If set to 0, it means there is no overhang
import BuildSimHubAPI as bsh_api

overhang_e = bsh_api.measures.ShadeOverhangEast()
# define the list of data.
data = [0.5, 1.0 ,1.5]
overhang_e.set_datalist(data)
  1. ShadeOverhangNorth()
# This measure add overhang to every north facing window
# The data is the depth of overhang
# If set to 0, it means there is no overhang
import BuildSimHubAPI as bsh_api

overhang_n = bsh_api.measures.ShadeOverhangNorth()
# define the list of data.
data = [0.5, 1.0 ,1.5]
overhang_n.set_datalist(data)
  1. ShadeOverhangSouth()
# This measure add overhang to every south facing window
# The data is the depth of overhang
# If set to 0, it means there is no overhang
import BuildSimHubAPI as bsh_api

overhang_s = bsh_api.measures.ShadeOverhangSouth()
# define the list of data.
data = [0.5, 1.0 ,1.5]
overhang_s.set_datalist(data)
  1. ShadeOverhangWest()
# This measure add overhang to every west facing window
# The data is the depth of overhang
# If set to 0, it means there is no overhang
import BuildSimHubAPI as bsh_api

overhang_w = bsh_api.measures.ShadeOverhangWest()
# define the list of data.
data = [0.5, 1.0 ,1.5]
overhang_w.set_datalist(data)
  1. LightLPD(unit)
# change the lighting power density
import BuildSimHubAPI as bsh_api

lpd = bsh_api.measures.LightLPD('ip')
# define the list of data.
data = [0.8, 1.2 ,1.5]
lpd.set_datalist(data)
  1. LightLPDPercent()
# change % of LPD
import BuildSimHubAPI as bsh_api

lpd_percent = bsh_api.measures.LightLPDPercent('ip')
# define the list of data - LPD change to 40%, 80% and 120%
data = [0.4, 0.8 ,1.2]
lpd_percent.set_datalist(data)
  1. EquipmentEPD()
# change the equipment power density
import BuildSimHubAPI as bsh_api

epd = bsh_api.measures.EquipmentEPD('ip')
# define the list of data.
data = [0.8, 1.2 ,1.5]
epd.set_datalist(data)
  1. EquipmentEPDPercent()
# change the equipment power density
import BuildSimHubAPI as bsh_api

epd_percent = bsh_api.measures.EquipmentEPDPercent('ip')
# define the list of data - EPD change to 40%, 80% and 120%.
data = [0.4, 0.8, 1,2]
epd_percent.set_datalist(data)
  1. OccupancySensor()
# Occupancy sensor has only 1 (yes) and 0 (no) two options. If apply, 10% LPD credit will be apply to all the lights classes.
import BuildSimHubAPI as bsh_api
occ_sensor = bsh_api.measures.OccupancySensor()
  1. DaylightingSensor()
# Daylighting sensor has only 1 (yes) and 0 (no) two options. If apply, the location of the sensor will be placed in the middle of the floor, which has the longest exterior perimeter line.
import BuildSimHubAPI as bsh_api
occ_sensor = bsh_api.measures.DaylightingSensor()
  1. CoolingCOP()
# Apply COP changes to all the coils and chillers
import BuildSimHubAPI as bsh_api
cop = bsh_api.measures.CoolingCOP()
data = [3.5, 4.5, 5.5]
cop.set_datalist(data)
  1. CoolingChillerCOP()
# Apply COP changes to all the chillers
import BuildSimHubAPI as bsh_api
cop_chiller = bsh_api.measures.CoolingChillerCOP()
data = [3.5, 4.5, 5.5]
cop_chiller.set_datalist(data)
  1. CoolingCoilCOP()
# Apply COP changes to all the coils
import BuildSimHubAPI as bsh_api
cop_coils = bsh_api.measures.CoolingCoilCOP()
data = [3.5, 4.5, 5.5]
cop_coils.set_datalist(data)
  1. HeatingDXEfficiency()
# Apply COP changes to all heating DX coils
import BuildSimHubAPI as bsh_api
cop_coils = bsh_api.measures.HeatingDXEfficiency()
data = [2.8, 3.4, 4.2]
cop_coils.set_datalist(data)
  1. HeatingEfficiency()
# Apply thermal efficiencies to burners, furnaces, and boilers
import SimHubAPI as bsh_api
furnace_eff = bsh_api.measures.HeatingEfficiency()
data = [0.8, 0.85, 0.9]
furnace_eff.set_datalist(data)
  1. WaterHeaterEfficiency()
# change the thermal efficiency of water heaters
import SimHubAPI as bsh_api
water_heater_eff = bsh_api.measures.WaterHeaterEfficiency()
data = [0.8, 0.85, 0.9]
water_heater_eff.set_datalist(data)
  1. WaterUseReduction()
# apply changes to the water use 
import SimHubAPI as bsh_api
water_use = bsh_api.measures.WaterUseReduction()
data = [0.6, 0.8, 1.2]
water_use.set_datalist(data)

Start Parametric Run

  1. Initialize the study
import BuildSimHubAPI as bsh_api  
import BuildSimHubAPI.postprocess as pp  
  
# 1. set your folder key  
project_key = 'f98aadb3-254f-428d-82a6e4b9424c'  
file_dir = "/Users/Desktop/5ZoneAirCooled.idf"  
  
bsh = bsh_api.BuildSimHubAPIClient()   
new_pj = bsh.new_parametric_job(project_key)
  1. Apply measures Apply window wall ratio and lighting power density measures to the parametric study.
measure_list = list()
# Define EEMs  
wwr = bsh_api.measures.WindowWallRatio()  
wwr_ratio = [0.6, 0.4]  
wwr.set_datalist(wwr_ratio)  
  
lpd = bsh_api.measures.LightLPD('ip')  
lpdValue = [1.2, 0.9]  
lpd.set_datalist(lpdValue)

measure_list.append(wwr)
measure_list.append(lpd)

# add measure list to the parametric study
new_pj.add_model_measures(measure_list)
  1. Run parametric simulation
results = new_pj.submit_parametric_study_local(file_dir, track=True)

The full script example can be found in this link.

submit_parametric_study()

If the seed model is on the cloud instead of local, the parametric can also pick up this model on the cloud to run parametric study

model_api_key = "48003d7a-143f-45c-4ab4d1968bbd"

new_pj = bsh.new_parametric_job(project_key, model_api_key)
# ... measures

results = new_pj.submit_parametric_study( track=True)

Monte Carlo Method

The monte carlo method is the broad class of computation algorithms that rely on repeated random sampling to obtain numerical results. It is often used in optimization, parameter sensitivity analysis, as well as generating training data for AI algorithms. The BuildSim Cloud implements latin hypercube sampling to generate random variables. This type of MC algorithms explores the distributions of multi-variable more effectively with less samples. For most the building design problems, research demonstrated that around 200-250 samples should be enough to provide a high-resolution dataset for design analysis.

A full example of using Monte Carlo method is included in the monte_carlo_test.py.

To activate the algorithm, we can start from the regular parametric study:

results = new_pj.submit_parametric_study(algorithm='montecarlo', size=200, track=True)

and the rest will be exactly the same as the regular parametric study.

To learn more about how to retrieve the results from the parametric study, check out Parametric Simulation Results.

Clone this wiki locally