You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**This library allows you to quickly and easily use the BuildSimHub Web API v1 via Python.**
5
-
This library represents the beginning of the Cloud Simulation function on BuildSimHub. Please browse the rest of this README for further detail.
5
+
This library represents the beginning of the Cloud Simulation function on BuildSimHub. We want this library to be community driven and BuildSimHub led. We need your help to realize this goal. To help, make sure we are building the right things in the right order, we ask that you create [issues](https://github.com/weilix88/buildsimhub_python_api/issues) and [pull requests](https://github.com/weilix88/buildsimhub_python_api/pulls) or simply upvote or comment on existing issues or pull requests.
6
6
We appreciate your continued support, thank you!
7
7
8
8
# Table of Contents
@@ -44,20 +44,22 @@ The following is the minimum needed code to initiate a regular simulation with t
###############NOW, START THE CODE########################
54
+
55
+
bsh = buildsimhub.BuildSimHubAPIClient()
56
+
newSJ = bsh.new_simulation_job(model_key)
57
+
response = newSj.create_model(file_dir)
57
58
58
-
#print success means the simulation job has successfully
59
-
#started a simulation, if there is an error, then
60
-
#you will receive the correspondent error message
59
+
############### WE DONE! #################################
60
+
61
+
#You can print the responses to verify whether the simulation
62
+
#is success or not.
61
63
print (response)
62
64
```
63
65
The `BuildSimHubAPIClient` creates a [portal object](https://github.com/weilix88/buildsimhub_python_api/blob/master/BuildSimHubAPI/buildsimhub.py) that manages simulation workflow.
@@ -69,17 +71,17 @@ from BuildSimHubAPI import buildsimhub
######BELOW ARE THE CODE TO RETRIEVE SIMULATION RESULTS#########
108
-
response = newSJ.getSimulationResults('html')
110
+
response = newSJ.get_simulation_results('html')
109
111
print(response)
110
112
```
111
-
If the Job is completed, you can get results by calling `getSimulationResults(type)` function.
113
+
If the Job is completed, you can get results by calling `get_simulation_results(type)` function.
112
114
113
115
<aname="functions"></a>
114
116
@@ -123,7 +125,7 @@ The `folder_key` can be found under each folder of your project
123
125
## simulationType
124
126
[SimulationType](https://github.com/weilix88/buildsimhub_python_api/blob/master/BuildSimHubAPI/helpers/simulationType.py) class helps you configure the cloud simulation. There are two simulation types: `regular` and `fast`. Also, ou can increase the number of agent by calling the `increaseAgents()` function.
125
127
```python
126
-
simulationType = bsh.getSimulationType()
128
+
simulationType = bsh.get_simulation_type()
127
129
numOfAgents = simulationType.increaseAgents();
128
130
print (numOfAgents)
129
131
```
@@ -132,37 +134,65 @@ It should be noted that the maximum number of agents working on one simulation j
132
134
## SimulationJob
133
135
A simulation job manages one type of cloud simulation. It contains three main functions which are listed below:
134
136
135
-
### createdModel
136
-
The `createModel()` function has in total 4 parameters.
137
+
### create_model
138
+
The `create_model()` function has in total 4 parameters.
137
139
1.`file_dir` (required): the absolute local directory of your EnergyPlus / OpenStudio model (e.g., "/Users/weilixu/Desktop/5ZoneAirCooled.idf")
138
140
2.`comment`(optional): The description of the model version that will be uploaded to your folder. The default message is `Upload through Python API`
139
-
3.`simulationType` (optional): The simulation Type should be generated from [SimulationType](https://github.com/weilix88/buildsimhub_python_api/blob/master/BuildSimHubAPI/helpers/simulationType.py) class. This class manages the simulation type as well as how many agents you want to assign to this simulation job. Default is `regular` simulation which uses 1 agent to do the cloud simulation.
141
+
3.`simulationType` (optional): The simulation Type should be generated from [SimulationType](https://github.com/weilix88/buildsimhub_python_api/blob/master/BuildSimHubAPI/helpers/simulationType.py) class. This class manages the simulation type as well as how many agents you want to assign to this simulation job. **It should be noted that if this parameter is not used, then create_model method will not run simulation**
140
142
4.`agent` (optional): The agent number is a property of [SimulationType](https://github.com/weilix88/buildsimhub_python_api/blob/master/BuildSimHubAPI/helpers/simulationType.py) class. If fast simulation is selected, then the default of agent will be 2.
141
143
142
144
This method returns two types of information:
143
145
If sucess: `success`
144
146
or error message states what was wrong in your request.
145
147
146
-
### trackSimulation
147
-
The `trackSimulation()` function does not require any parameters. However, it is required that a successful cloud simulation is created and running on the cloud. Otherwise, you will receive this message by calling this function:
148
+
### run_simulation
149
+
The `run_simulation()` function can be called inside a simulation job if the simulation is not conducted. The function has two parameters:
150
+
1.`simulationType` (optional): The simulation Type should be generated from [SimulationType](https://github.com/weilix88/buildsimhub_python_api/blob/master/BuildSimHubAPI/helpers/simulationType.py) class. This class manages the simulation type as well as how many agents you want to assign to this simulation job. **It should be noted that if this parameter is not used, then create_model method will not run simulation**
151
+
2.`agent` (optional): The agent number is a property of [SimulationType](https://github.com/weilix88/buildsimhub_python_api/blob/master/BuildSimHubAPI/helpers/simulationType.py) class. If fast simulation is selected, then the default of agent will be 2.
152
+
153
+
### track_simulaiton
154
+
The `track_simulation()` function does not require any parameters. However, it is required that a successful cloud simulation is created and running on the cloud. Otherwise, you will receive this message by calling this function:
148
155
`No simulation is running or completed in this Job - please start simulation using createModel method.`
149
156
If there is a simulation running on the cloud for this simulationJob, then, this function will return `true` and you can retrieve the simulation status by get the class parameter `trackStatus`. Example code is below:
150
157
```python
151
-
if(newSimulationJob.trackSimulation()):
158
+
if(newSimulationJob.track_simulation()):
152
159
print(newSimulationJob.trackStatus)
153
160
```
154
-
### getSimulationResults
155
-
The `getSimulationResults(type)` function requires 1 parameter, the result type. Currently, you can retrieve three types of results: the error file (`err`), eso file (`eso`) and html file (`html`), generated from EnergyPlus simulation.
161
+
### get_simulation_results
162
+
The `get_simulation_results(type)` function requires 1 parameter, the result type. Currently, you can retrieve three types of results: the error file (`err`), eso file (`eso`) and html file (`html`), generated from EnergyPlus simulation.
The model class contains a set of methods that provides the model information and results (after simulation)
170
+
### Pre-simulation methods
171
+
1.*num_total_floor()*: can be called before simulation is completed. It returns the number of floors, or -1 if there is an error.
172
+
2.*num_zones()*: can be called before simulation is completed. It returns the total number of thermal zones, or -1 if there is an error.
173
+
3.*num_condition_zones()*: can be called before simulation is completed. It returns the total number of conditioned zones, or -1 if there is an error.
174
+
4.*conditioned_floor_area (unit)*: can be called before simulation is completed. It returns the floor areas of conditioned spaces, or -1 if there is an error. This method has an optional input: unit. If you wish to get ft2 unit, then you need to specify 'ip' for the unit parameter:
175
+
` m.condition_floor_area("ip")
176
+
`
177
+
5.*gross_floor_area(unit)*: can be called before simulation is completed. It returns the total floor areas (including plenum spaces), or -1 if there is an error. This method has an optional input: unit. If you wish to get ft2 unit, then you need to specify 'ip' for the unit parameter:
178
+
` m.gross_floor_area("ip")
179
+
`
180
+
6.*window_wall_ratio()*: can be called before simulation is completed. It returns the total window to wall ratio (above floor surface area) or -1 if there is an error.
181
+
182
+
### Post-simulation methods
183
+
1.*new_site_eui()*: It returns the net site eui of the simulation (includes generators such as PV). The unit should be based on model specification: SI (kWh/m2 or MJ/m2), IP(kWh/m2).
184
+
2.*total_site_eui()*: It returns the total site eui of the simulation. The unit should be based on model specification: SI (kWh/m2 or MJ/m2), IP(kWh/m2).
185
+
3.*not_met_hour_cooling()*: returns the time sepoint not met hours during cooling condition period. unit: hour
186
+
4.*not_met_hour_heating()*: returns the time sepoint not met hours during heating condition period. unit: hour
187
+
5.*not_met_hour_total()*: returns the time sepoint not met hours during heating and cooling condition period. unit: hour
188
+
6.*total_end_use_electricity()*: returns the total electricity consumption of the design. unit: kWh or GJ, IP is kBtu
189
+
7.*total_end_use_naturalgas()*: returns the total natural gas consumption of the design. unit: kWh or GJ, IP is kBtu
190
+
191
+
161
192
<aname="roadmap"></a>
162
193
# Roadmap
163
-
1. Certainly, the first thing is to get the project into Pip to enable `pip install` command.
164
-
2. We are also working on an HTML compiler, which let users to retrieve any values from the html output
165
-
3. If you are interested in the future direction of this project, please take a look at our open [issues](https://github.com/weilix88/buildsimhub_python_api/issues) and [pull requests](https://github.com/weilix88/buildsimhub_python_api/pulls). We would love to hear your feedback.
194
+
1. We are also working on APIs for results retrieving, which let users to get simulation results for post-processing.
195
+
2. If you are interested in the future direction of this project, please take a look at our open [issues](https://github.com/weilix88/buildsimhub_python_api/issues) and [pull requests](https://github.com/weilix88/buildsimhub_python_api/pulls). We would love to hear your feedback.
0 commit comments