Skip to content

model_management

Weili edited this page Sep 7, 2018 · 2 revisions

Model Management

There are many reasons to start energy mdoelings - it helps resolve the design conflicts, do parametric study, check code compliance, or even assist building operation decisions.

Different workflows have different objectives and approaches, and it may even require different set of skills. However, one thing that everyone has to deal with, is the models.

We typically have to deal with 10s or hundreds of model revisions in every study. Sometimes, it is easy to manage them - use the "save as" to distinguish every major revisions. But accidental "save" happens, and they often happens close to the deadline... What's worse, this traditional way prevents energy modeling from collaborations - more people is not equal to faster model delivery. As companies' most important asset, insufficient use of human intelligence is a huge waste to business.

BuildSim cloud adopts a three-level structures, EplusGIT system, to help energy modelers and their team managing the energy modeling project. It is proven to help team collaborating in an energy model project, boost modeling efficiency up to 40%.

structures

The 1st level is project. A project represents a research project or building project. It contains the location and building types of all the models submitted to the project. This means, the design day in the submitted models will be updated with the location information.

Under project, there are models. Each model represents one energy model design or parametric study. It acts like a Folder in Window OS or Branch in GIT system, but with more characteristics tailored to energy modeling workflow.

Lastly, the hisotry level. It traces the model developments and keep all the update in record. Just like having an assisstant to help you press the "save as" button, every submitted model will be saved as a new instance under the Model level - Just like the Commit in Git system. This function serves as the time machine for your energy modeling, adding one more security to every step of model development. So you will never worried about lost models or forget the previous changes.

Below are some examples of using EplusGIT to manage your energy modeling projects:

Get list of models under a project

import BuildSimHubAPI as bshapi
import pandas as pd

project_api_key = "f98aadb3-254f-428d-82a6e4b9424c"
bsh = bshapi.BuildSimHubAPIClient()
project_list = bsh.project_model_list(project_api_key)
df = pd.DataFrame(project_list)
print(df.to_string())
"""
                                  api_key                                 branch_description  branch_id                                        branch_name branch_type   last_modified_time
0    1e0095ff-23c2-46cc-a63382a48839                      5zoneaircooled.idf parametric        576                                 5zoneaircooled.idf         idf  2018-07-16 17:48:20
1    de1e284b-76ba-4c96-d38bdc4836a9                      5zoneaircooled.idf parametric        575                                 5zoneaircooled.idf         idf  2018-07-16 17:46:21
2    862a6999-997c-4c6c-d6cda6acef53                      5zoneaircooled.idf parametric        574                                 5zoneaircooled.idf         idf  2018-07-16 17:42:47
"""

The branch_name and branch_description indicates the model information. After finding the correct model, you can then access the model with itsapi_key. The next example demonstrates how to access the model histories under one model.

Access a model commit

# We will use the first model in the previous example to demo this feature
import BuildSimHubAPI as bshapi
import pandas as pd

project_api_key = 'f98aadb3-254f-428d-82a6e4b9424c'
model_api_key = '1e0095ff-23c2-46cc-a63382a48839'

bsh = bshapi.BuildSimHubAPIClient()  
data_list = bsh.model_list(project_api_key, model_api_key)  
df = pd.DataFrame(data_list)  
# the INIT is the seed model in parametric study
# need to drop it.
df = df[df.commit_msg != 'INIT']  
print(df.to_string())
"""
    commit_date   commit_id                                         commit_msg
0    2018-07-16  1-576-1721  LPD: 0.809, ChillerCOP: 3.78, HeatingEff: 0.82...
1    2018-07-16  1-576-1720  LPD: 0.977, ChillerCOP: 4.36, HeatingEff: 0.91...
2    2018-07-16  1-576-1719  LPD: 1.026, ChillerCOP: 4.54, HeatingEff: 0.82...
"""

commit_id is the key that allow you to access a model development step, and commmit_msg shows the comment attach to this history.

Examples

Now we know how to access models on BuildSim Cloud, let's see how we can properly manage all the models and commits.

Search for a model

Assume we just submitted a bunch of commits to a model and we want to search for a particular set of measures among the submitted commits. We can utilize the search and filter function on pandas dataframe.

import BuildSimHubAPI as bshapi
import pandas as pd

project_api_key = 'f98aadb3-254f-428d-82a6e4b9424c'
model_api_key = '1e0095ff-23c2-46cc-a63382a48839'

bsh = bshapi.BuildSimHubAPIClient()  
models = bsh.model_list(project_api_key, model_api_key)  
  
for model in models:  
    commit_msg = model['commit_msg'].split(',')  
    if len(commit_msg) > 1:  
        for msg in commit_msg:  
            key, val = msg.split(':')  
            if key not in model:  
                key = key.strip()  
                model[key] = float(val) 
    # we don't want the commit message 
    model.pop('commit_msg')

param_df = pd.DataFrame(models)
# if we want to find the commit which has roof r value of R-29.071 and Window SHGC of 0.21 at east orientation:
target_commit_id = param_df.loc[(param_df['Roof_R'] == 29.071) & (param_df['Window_SHGC_East'] == 0.21)]['commit_id'][1]  

target_model = bsh.model_results(project_api_key, target_commit_id)
print(target_model.net_site_eui())

Compare two models

Compare two models is a very useful operations for energy modeling. With EplusGIT, you can easily compare two commits through API.

# Let's start it with the previous example
target_commit_id = param_df.loc[(param_df['Roof_R'] == 29.071) & (param_df['Window_SHGC_East'] == 0.21)]['commit_id'][1]
target_model = bsh.model_results(project_api_key, target_commit_id)

# So under the same commit list, let's find one commit that has Roof R value of 33.422
source_commit_id = param_df.loc[(param_df['Roof_R'] == 33.422)]['commit_id'][1]
# Retrieve this model
source_model = bsh.model_results(project_api_key, source_commit_id)

# Now let's compare!
bsh.compare_models(source_model, target_model)

This operation will instantly open the BuildSimHub compare page with your favorite browser. Picture

Merge two models

Similarly, merge models also requires a source model which contains the new building system or component, and target model, which is the model we want to merge to. To initiate merge function through API is simple!

# Same as the compare
bsh.merge_models(source_model, target_model)

This function will then take you to the merge interface.

Clone this wiki locally