Skip to content

Commit 22cb40b

Browse files
Merge pull request #5 from pnnl-int/update-defaults
Update defaults
2 parents 68415c4 + d61ee33 commit 22cb40b

16 files changed

Lines changed: 106 additions & 22 deletions

File tree

comcheck_api/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
)
5353

5454
# Project Defaults
55-
from .utilities import get_project_default
55+
from . import defaults
5656

5757
# Project Operations
5858
from .project_operations import (
@@ -77,7 +77,7 @@
7777
"COMCheckSimulationError",
7878
"COMCheckProjectNotFoundError",
7979
# Project Defaults
80-
"get_project_default",
80+
"defaults",
8181
# Project Operations
8282
"project_building_area_operations",
8383
"project_envelope_operations",

comcheck_api/utilities/get_project_default.py renamed to comcheck_api/defaults.py

File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
Functions that return deep copies of pre-configured default templates for
44
projects and building components.
55

6-
::: comcheck_api.utilities.get_project_default
6+
::: comcheck_api.defaults

docs_site/getting-started.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ with COMcheckClient(api_key="your-key") as client:
5050

5151
```python
5252
from comcheck_api import COMcheckClient, project_envelope_operations
53-
from comcheck_api.utilities.get_project_default import (
53+
from comcheck_api.defaults import (
5454
get_default_roof_template,
5555
get_default_ag_wall_template,
5656
)
@@ -102,7 +102,7 @@ print(f"Performance Rating: {result['performanceRating']}")
102102

103103
```python
104104
from comcheck_api import project_building_area_operations
105-
from comcheck_api.utilities.get_project_default import (
105+
from comcheck_api.defaults import (
106106
get_default_building_area_template,
107107
)
108108

docs_site/simulation.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Simulation
2+
3+
COMcheck evaluates whether a building design meets energy code requirements
4+
by running a compliance simulation. The simulation compares the proposed
5+
building envelope against baseline performance factors and returns a
6+
**performance rating** that indicates pass/fail status.
7+
8+
## Workflow
9+
10+
A simulation run follows three steps:
11+
12+
1. **Start** the simulation with a project.
13+
2. **Poll** for completion.
14+
3. **Retrieve** the results.
15+
16+
```python
17+
import time
18+
from comcheck_api import COMcheckClient
19+
20+
client = COMcheckClient(api_key="your-key")
21+
project = client.get_project("project-id")
22+
23+
# 1. Start
24+
session_id = client.start_run_simulation(project)
25+
26+
# 2. Poll
27+
while True:
28+
status = client.get_simulation_status(session_id)
29+
if status["status"] == "COMPLETED":
30+
break
31+
time.sleep(2)
32+
33+
# 3. Results
34+
result = client.get_simulation_result(session_id)
35+
print(f"Performance Rating: {result['performanceRating']}")
36+
```
37+
38+
## Running without a saved project
39+
40+
You can simulate a project that only exists locally without saving it to the
41+
server first. Build a project from the default template, configure it, and
42+
pass it directly:
43+
44+
```python
45+
from comcheck_api import COMcheckClient
46+
from comcheck_api.defaults import get_default_project_template
47+
from comcheck_api.types.core_types import EnergyCodeOptions
48+
49+
client = COMcheckClient(api_key="your-key")
50+
51+
project = get_default_project_template()
52+
project.control.code = EnergyCodeOptions.CEZ_90_1_2022
53+
54+
session_id = client.start_run_simulation(project)
55+
```
56+
57+
## Running for an existing project
58+
59+
When you pass a `project_id`, the client saves the project via
60+
`update_project` before launching the simulation:
61+
62+
```python
63+
session_id = client.start_run_simulation(project, project_id="your-project-id")
64+
```
65+
66+
## Simulation status
67+
68+
`get_simulation_status` returns a dict with:
69+
70+
| Key | Description |
71+
| --- | --- |
72+
| `sessionId` | The session identifier |
73+
| `status` | `"RUNNING"`, `"COMPLETED"`, or `"FAILED"` |
74+
| `message` | Optional details (present on failure) |
75+
76+
## Simulation results
77+
78+
`get_simulation_result` returns a dict with:
79+
80+
| Key | Description |
81+
| --- | --- |
82+
| `sessionId` | The session identifier |
83+
| `performanceRating` | Overall compliance rating |
84+
| `energyCreditPerformanceRating` | Rating including energy credits |
85+
| `proposedBpf` | Proposed building performance factor |
86+
| `baselineBpf` | Baseline building performance factor |

examples/client/user_functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import os
44
from dotenv import load_dotenv
55
from comcheck_api.client import COMcheckClient
6-
from comcheck_api.utilities.get_project_default import get_default_project_template
6+
from comcheck_api.defaults import get_default_project_template
77

88
# Initialize client
99
load_dotenv()

examples/project_operations/building_area_operations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from dotenv import load_dotenv
55
from comcheck_api.client import COMcheckClient
66
from comcheck_api.project_operations import project_building_area_operations
7-
from comcheck_api.utilities.get_project_default import get_default_building_area_template
7+
from comcheck_api.defaults import get_default_building_area_template
88
from comcheck_api.types.core_types import WholeBuildingTypeOptions
99

1010
# Initialize client

examples/project_operations/envelope_operations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from dotenv import load_dotenv
55
from comcheck_api.client import COMcheckClient
66
from comcheck_api.project_operations import project_envelope_operations
7-
from comcheck_api.utilities.get_project_default import (
7+
from comcheck_api.defaults import (
88
get_default_roof_template,
99
get_default_ag_wall_template,
1010
get_default_window_template,

mkdocs.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,10 @@ markdown_extensions:
5757
nav:
5858
- Home: index.md
5959
- Getting Started: getting-started.md
60+
- Simulation: simulation.md
6061
- API Reference:
6162
- Client: api/client.md
6263
- Project Operations:
6364
- Building Area Operations: api/operations/building-area.md
6465
- Envelope Operations: api/operations/envelope.md
65-
- Constants:
66-
- Project Template: api/constants/common.md
67-
- Building Area Defaults: api/constants/building-area.md
68-
- Envelope Defaults: api/constants/envelope.md
66+
- Defaults: api/defaults.md

scripts/comcheck_client_tests/user_function_script.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
1010

1111
from comcheck_api.client import COMcheckClient
12-
from comcheck_api.utilities.get_project_default import get_default_project_template
12+
from comcheck_api.defaults import get_default_project_template
1313
from comcheck_api.utilities.common import export_to_json
1414

1515
load_dotenv()

0 commit comments

Comments
 (0)