Skip to content

buildSim_plot

Weili edited this page Jun 26, 2018 · 7 revisions

BuildSim Plot

Introduction

BuildSim Plot is a project that encourages creative thinkings in use of python plot packages for better communications and collaborations. The project will soon be released to the public. Many scripts are included in the BuildSimPlot folder. This page shows a few selected workflow and the plots.

hourly_data_plot

The hourly_data_retrieve presents how to retrieve the hourly data. The post-processing method BuildSimHubAPI.postprocess.HourlyPlot() reform the hourly data into pandas database. Two plots available:

hourly_plot = BuildSimHubAPI.postprocess.HourlyPlot(hourly_data, 'Zone Mean Air Dewpoint Temperature:SPACE3-1')
hourly_plot.heat_map_plot()

heat_map Play with a heat map.

Another plot is line chart:

hourly_plot.line_chart_plot()

line chart Play with a line plot.

The line chart is also available for multiple variables - with the constraint that only two units (e.g., C and Watts)

variable_data = results.hourly_data('Heating Coil Heating Rate:SPACE1-1 ZONE COIL')
hourly_plot = pp.HourlyPlot(variable_data, 'Heating Coil Heating Rate:SPACE1-1 ZONE COIL')

# add another variable
variable_data = results.hourly_data('Site Outdoor Air Drybulb Temperature:Environment')
hourly_plot.add_column(variable_data, 'Site Outdoor Air Drybulb Temperature:Environment')
hourly_plot.line_chart_plot()

two line variables

html_table_plot

The html_table_test is one example that demonstrates how to extract a specific table from the HTML output and how to plot the table. In this example, we will extract the End Uses table under the Annual Building Utility Performance Summary report and plot the energy end uses.

Firstly, we need to get the model's result object.

import BuildSimHubAPI as bshapi  
import BuildSimHubAPI.postprocess as pp

# initialize the client  
bsh = bshapi.BuildSimHubAPIClient()  
results = bsh.model_results(project_api_key, model_api_key)

Then, let's get the HTML table:

table_data = results.html_table('Annual Building Utility Performance Summary', 'End Uses')
data = pp.HTMLTable(table_data)

- table_bar_chart_plot(orientation, skip_rows, skip_cols, title, image_name)

data.table_bar_chart_plot(orientation='row', skip_rows=['Total End Uses'], skip_cols=['Water'],title='End Uses', image_name='bar_table')

EndUse_Table_Row

The orientation parameter controls the legend and X-axis. If it is row, then the legend will use row's header. If the orientation = 'column', the legend and X-axis will exchange.

data.table_bar_chart_plot(orientation='column', skip_rows=['Total End Uses'], skip_cols=['Water'], title='End Uses', image_name='bar_table')

EndUse_Table_Column

Skip_rows will skip plot the data from some rows. In this example, we skip the Total End Uses row because we do not want to plot it with the rest of the data.

-table_pie_chart_plot(orientation, skip_rows, skip_cols, title, image_name)

data.table_pie_chart_plot(orientation='column', skip_rows=['Total End Uses'], title='End Uses', image_name='pie_table')

Pie_Table_Column Again, we can also reverse the plot:

data.table_pie_chart_plot(orientation='row', skip_rows=['Total End Uses'], title='End Uses', image_name='pie_table')

Pie_Table_Row

zone_load_plot

Zone loads are critical information for the design team. Having visuals help the team communicate better and collaborate more effectively. Assume we have the results object returned.

import BuildSimHubAPI.postprocess as pp

zone_load_data = results.zone_load()
zone_level_load = pp.ZoneLoad(zone_load_data)
# Let's plot! and we are going to plot the load density
zone_level_load.load_bar_chart_plot('density')

zone_load_test

Zone load components

one_zone_load_data = results.zone_load('SPACE1-1')
one_zone_load = pp.OneZoneLoad(one_zone_load_data)
one_zone_load.load_component_plot('cooling')

Load_component

one_zone_load.load_type_plot('cooling')

load_type

monte_carlo_plot

monte_carlo_test shows the example of the possible plot for parametric study. Assume we just conducted 200 simulations using Monte Carlo approach.

  
import BuildSimHubAPI as bshapi  
import BuildSimHubAPI.postprocess as pp  
  
project_api_key = "f98aadb3-254f-428d-a321-82a6e4b9424c"  
model_api_key = 'aa09eabf-693f-4437-88cc-a522a25fba01'

bsh = bshapi.BuildSimHubAPIClient()
results = bsh.parametric_Results(project_api_key, model_api_key)

# We will get the net site eui as value
net_eui = results.net_site_eui()
#  and now, we will post-process the net_eui
param_plot = pp.ParametricPlot(net_eui)

Now, let's start the plot!

param_plot.parallel_coordinate_plot()

Parallel_Coordinate_Plot This looks a bit messy. But we can investigate one variable, ChillerCOP?

param_plot.parallel_coordinate_plot('ChillerCOP')

Chiller Play with a parallel coordinate chart

So it looks better now! We can investigate other variables by changing the investigate parameter in the parallel_coordinate_plot method.

In addition, we can also do scatter plot.

param_plot.scatter_chart_plot()

Scatter plot