-
Notifications
You must be signed in to change notification settings - Fork 10
buildSim_plot
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.
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()
Play with a heat map.
Another plot is line chart:
hourly_plot.line_chart_plot()
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()
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)
data.table_bar_chart_plot(orientation='row', skip_rows=['Total End Uses'], skip_cols=['Water'],title='End Uses', image_name='bar_table')
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')
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.
data.table_pie_chart_plot(orientation='column', skip_rows=['Total End Uses'], title='End Uses', image_name='pie_table')
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')
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')
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')
one_zone_load.load_type_plot('cooling')
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()
This looks a bit messy. But we can investigate one variable, ChillerCOP?
param_plot.parallel_coordinate_plot('ChillerCOP')
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()