# natlabrockies/openstudio architecture

> Architecture diagram of the GitHub repository natlabrockies/openstudio, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/natlabrockies/openstudio
- Repository: https://github.com/natlabrockies/openstudio

## Overview

#### Purpose and entry points
OpenStudio is a cross-platform C++ SDK for whole-building energy modeling, EnergyPlus simulation, and Radiance daylight analysis. Primary user-facing entry point is the `openstudio` CLI at `src/cli/main.cpp`, which dispatches run/update/measure-management commands. The SDK exposes native and generated APIs to C++, Ruby, Python, and C#.

#### Build and distribution
CMake defines the native build graph and platform packaging; Conan supplies locked third-party dependencies. Core build roots are `CMakeLists.txt`, `conanfile.py`, and `src/lib/CMakeLists.txt`. CI builds Windows, macOS, and Linux variants through GitHub Actions. The repository packages an SDK/CLI rather than a web service.

#### Core model domain
The central abstraction is an in-memory, object-oriented building model: geometry, constructions, schedules, HVAC, plant equipment, loads, controls, and simulation settings. `src/model/Model.hpp` and `src/model/ModelObject.hpp` establish the object graph; concrete domain objects such as `src/model/Building.hpp` and `src/model/AirLoopHVAC.hpp` compose it. This model is the main boundary between authoring APIs and downstream translators/workflows.

#### Schema, workspace, and persistence
Energy-model object definitions and generic IDF workspaces underpin model serialization and translation. `src/utilities/idd/IddFile.hpp` represents IDD schemas; `src/utilities/idf/Workspace.hpp` and `src/utilities/idf/IdfFile.hpp` manage IDF-like object graphs/files. Version migration is a separate boundary: `src/osversion/VersionTranslator.hpp` upgrades older OpenStudio model formats before normal model processing.

#### Translation and simulation adapters
The EnergyPlus adapter converts the OpenStudio model to EnergyPlus input and can reconstruct supported models from EnergyPlus workspaces. Its orchestration boundaries are `src/energyplus/ForwardTranslator.hpp`, `src/energyplus/ReverseTranslator.hpp`, and `src/energyplus/GeometryTranslator.hpp`; per-object mapping is decomposed under `src/energyplus/ForwardTranslator/`. Other format/engine adapters include gbXML (`src/gbxml/ForwardTranslator.hpp`), Radiance (`src/radiance/ForwardTranslator.hpp`), CONTAM airflow (`src/airflow/contam/ForwardTranslator.hpp`), ISO model (`src/isomodel/ForwardTranslator.hpp`), and glTF (`src/gltf/GltfForwardTranslator.hpp`).

#### Workflow execution pipeline
An OpenStudio Workflow (`.osw`) is parsed into workflow steps and executed by the CLI. `src/workflow/OSWorkflow.hpp` coordinates staged execution: initialization, model measures, translation, EnergyPlus measures/simulation, reporting measures, post-processing, and cleanup (`src/workflow/RunInitialization.cpp`, `src/workflow/RunTranslator.cpp`, `src/workflow/RunEnergyPlus.cpp`). Inputs include `.osm`, `.osw`, weather files, measures, and EnergyPlus resources; outputs include translated simulation inputs, logs, result artifacts, and EnergyPlus SQLite results accessed through `src/utilities/sql/SqlFile.hpp`.

#### Extensibility and language runtimes
Measures are plug-ins that mutate models, generated EnergyPlus inputs, or reports through a runner/argument/output contract in `src/measure/OSMeasure.hpp`, `src/measure/OSRunner.hpp`, and `src/measure/OSArgument.hpp`. Embedded Ruby and Python engines execute measure code (`ruby/engine/RubyEngine.hpp`, `python/engine/PythonEngine.hpp`). SWIG-facing interface files and modules provide SDK bindings: `ruby/module/openstudio_rb.cpp`, `python/module/openstudio.py`, and `csharp/openstudio_csharp.cpp`.

#### Shared services and external dependencies
`src/utilities` provides cross-cutting filesystem, logging, JSON/XML, geometry, units, weather/CSV/workflow parsing, and BCL component support. The major external execution/services boundary is EnergyPlus; Radiance is an advanced daylight engine. BCL supports local and remote component catalogs via `src/utilities/bcl/LocalBCL.hpp` and `src/utilities/bcl/RemoteBCL.hpp`. Resources and reference inputs bundled for workflows/translators reside under `resources/energyplus`, `resources/model`, and `resources/workflow`.

Main entry points: [`src/workflow/RunEnergyPlus.cpp`](https://github.com/natlabrockies/openstudio/blob/develop/src/workflow/RunEnergyPlus.cpp) (Workflow stages), [`src/model/Model.hpp`](https://github.com/natlabrockies/openstudio/blob/develop/src/model/Model.hpp) (OpenStudio Model), [`src/measure/OSMeasure.hpp`](https://github.com/natlabrockies/openstudio/blob/develop/src/measure/OSMeasure.hpp) (Measure plug-in contract), [`src/energyplus/ForwardTranslator.hpp`](https://github.com/natlabrockies/openstudio/blob/develop/src/energyplus/ForwardTranslator.hpp) (EnergyPlus translators)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_build["Build &amp; distribution"]
  node_cmake{{"CMake build graph<br/>build system<br/>[CMakeLists.txt]"}}
  node_conan["Conan dependencies<br/>dependency manager<br/>[conanfile.py]"]
end

subgraph group_sdk["SDK model &amp; persistence"]
  node_model{{"OpenStudio Model<br/>object graph<br/>[Model.hpp]"}}
  node_model_objects["Domain model objects<br/>model entities<br/>[AirLoopHVAC.hpp]"]
  node_version_translator["Version translator<br/>model migration"]
  node_idd["IDD schemas<br/>object schema<br/>[IddFile.hpp]"]
  node_workspace[("IDF workspace &amp; files<br/>persistence graph<br/>[Workspace.hpp]")]
end

subgraph group_execution["Workflow &amp; simulation"]
  node_cli["openstudio CLI<br/>CLI entry point<br/>[main.cpp]"]
  node_workflow["OSWorkflow coordinator<br/>workflow orchestrator<br/>[OSWorkflow.hpp]"]
  node_workflow_stages["Workflow stages<br/>pipeline stages<br/>[RunEnergyPlus.cpp]"]
  node_energyplus_translation["EnergyPlus translators<br/>simulation adapter"]
  node_energyplus{{"EnergyPlus<br/>external simulation engine"}}
  node_sql_results[("Simulation SQL results<br/>result store<br/>[SqlFile.hpp]")]
  node_other_adapters["Other engine translators<br/>format adapters"]
  node_resources["Bundled resources<br/>reference inputs"]
end

subgraph group_extensions["Extensions &amp; bindings"]
  node_measures["Measure plug-in contract<br/>extension API<br/>[OSMeasure.hpp]"]
  node_script_engines["Ruby &amp; Python engines<br/>embedded runtimes<br/>[RubyEngine.hpp]"]
  node_bindings["Language bindings<br/>generated SDK APIs<br/>[openstudio_rb.cpp]"]
  node_bcl["BCL component catalogs<br/>component service<br/>[RemoteBCL.hpp]"]
end

node_cmake -->|"resolves dependencies"| node_conan
node_cmake -->|"builds"| node_cli
node_cmake -->|"builds generated APIs"| node_bindings
node_cli -->|"runs .osw"| node_workflow
node_cli -->|"updates models"| node_version_translator
node_workflow -->|"coordinates"| node_workflow_stages
node_workflow_stages -->|"loads and modifies"| node_model
node_workflow_stages -->|"executes"| node_measures
node_workflow_stages -->|"translates"| node_energyplus_translation
node_workflow_stages -->|"collects results"| node_sql_results
node_model -->|"contains"| node_model_objects
node_version_translator -->|"upgrades into"| node_model
node_model -->|"exports"| node_energyplus_translation
node_model -->|"exports"| node_other_adapters
node_idd -->|"defines objects"| node_workspace
node_workspace -->|"simulation input/output boundary"| node_energyplus_translation
node_energyplus_translation -->|"generates input and invokes"| node_energyplus
node_energyplus -->|"produces"| node_sql_results
node_measures -->|"model measures mutate"| node_model
node_measures -->|"executes through"| node_script_engines
node_script_engines -->|"uses SDK APIs"| node_bindings
node_bcl -.->|"supplies components"| node_measures
node_resources -.->|"provides reference inputs"| node_workflow_stages

click node_cmake "https://github.com/natlabrockies/openstudio/blob/develop/CMakeLists.txt"
click node_conan "https://github.com/natlabrockies/openstudio/blob/develop/conanfile.py"
click node_cli "https://github.com/natlabrockies/openstudio/blob/develop/src/cli/main.cpp"
click node_workflow "https://github.com/natlabrockies/openstudio/blob/develop/src/workflow/OSWorkflow.hpp"
click node_workflow_stages "https://github.com/natlabrockies/openstudio/blob/develop/src/workflow/RunEnergyPlus.cpp"
click node_model "https://github.com/natlabrockies/openstudio/blob/develop/src/model/Model.hpp"
click node_model_objects "https://github.com/natlabrockies/openstudio/blob/develop/src/model/AirLoopHVAC.hpp"
click node_version_translator "https://github.com/natlabrockies/openstudio/blob/develop/src/osversion/VersionTranslator.hpp"
click node_idd "https://github.com/natlabrockies/openstudio/blob/develop/src/utilities/idd/IddFile.hpp"
click node_workspace "https://github.com/natlabrockies/openstudio/blob/develop/src/utilities/idf/Workspace.hpp"
click node_energyplus_translation "https://github.com/natlabrockies/openstudio/blob/develop/src/energyplus/ForwardTranslator.hpp"
click node_sql_results "https://github.com/natlabrockies/openstudio/blob/develop/src/utilities/sql/SqlFile.hpp"
click node_other_adapters "https://github.com/natlabrockies/openstudio/blob/develop/src/radiance/ForwardTranslator.hpp"
click node_measures "https://github.com/natlabrockies/openstudio/blob/develop/src/measure/OSMeasure.hpp"
click node_script_engines "https://github.com/natlabrockies/openstudio/blob/develop/ruby/engine/RubyEngine.hpp"
click node_bindings "https://github.com/natlabrockies/openstudio/blob/develop/ruby/module/openstudio_rb.cpp"
click node_bcl "https://github.com/natlabrockies/openstudio/blob/develop/src/utilities/bcl/RemoteBCL.hpp"
click node_resources "https://github.com/natlabrockies/openstudio/tree/develop/resources/energyplus"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cmake,node_conan toneBlue
class node_model,node_model_objects,node_version_translator,node_idd,node_workspace toneAmber
class node_cli,node_workflow,node_workflow_stages,node_energyplus_translation,node_energyplus,node_sql_results,node_other_adapters,node_resources toneMint
class node_measures,node_script_engines,node_bindings,node_bcl toneRose
```

## Components

### Build & distribution

- [CMake build graph](https://github.com/natlabrockies/openstudio/blob/develop/CMakeLists.txt): build system · `CMakeLists.txt`
- [Conan dependencies](https://github.com/natlabrockies/openstudio/blob/develop/conanfile.py): dependency manager · `conanfile.py`

### SDK model & persistence

- [OpenStudio Model](https://github.com/natlabrockies/openstudio/blob/develop/src/model/Model.hpp): object graph · Central in-memory building-model boundary. · `src/model/Model.hpp`
- [Domain model objects](https://github.com/natlabrockies/openstudio/blob/develop/src/model/AirLoopHVAC.hpp): model entities · Building, HVAC, geometry, schedules, loads, and controls. · `src/model/AirLoopHVAC.hpp`
- [Version translator](https://github.com/natlabrockies/openstudio/blob/develop/src/osversion/VersionTranslator.hpp): model migration · `src/osversion/VersionTranslator.hpp`
- [IDD schemas](https://github.com/natlabrockies/openstudio/blob/develop/src/utilities/idd/IddFile.hpp): object schema · `src/utilities/idd/IddFile.hpp`
- [IDF workspace & files](https://github.com/natlabrockies/openstudio/blob/develop/src/utilities/idf/Workspace.hpp): persistence graph · `src/utilities/idf/Workspace.hpp`

### Workflow & simulation

- [openstudio CLI](https://github.com/natlabrockies/openstudio/blob/develop/src/cli/main.cpp): CLI entry point · `src/cli/main.cpp`
- [OSWorkflow coordinator](https://github.com/natlabrockies/openstudio/blob/develop/src/workflow/OSWorkflow.hpp): workflow orchestrator · Runs staged .osw execution. · `src/workflow/OSWorkflow.hpp`
- [Workflow stages](https://github.com/natlabrockies/openstudio/blob/develop/src/workflow/RunEnergyPlus.cpp): pipeline stages · Initialization, translation, EnergyPlus execution, and cleanup. · `src/workflow/RunEnergyPlus.cpp`
- [EnergyPlus translators](https://github.com/natlabrockies/openstudio/blob/develop/src/energyplus/ForwardTranslator.hpp): simulation adapter · Forward, reverse, and geometry translation. · `src/energyplus/ForwardTranslator.hpp`
- **EnergyPlus**: external simulation engine
- [Simulation SQL results](https://github.com/natlabrockies/openstudio/blob/develop/src/utilities/sql/SqlFile.hpp): result store · `src/utilities/sql/SqlFile.hpp`
- [Other engine translators](https://github.com/natlabrockies/openstudio/blob/develop/src/radiance/ForwardTranslator.hpp): format adapters · gbXML, Radiance, CONTAM, ISO model, and glTF. · `src/radiance/ForwardTranslator.hpp`
- [Bundled resources](https://github.com/natlabrockies/openstudio/tree/develop/resources/energyplus): reference inputs · EnergyPlus, model, and workflow resources. · `resources/energyplus`

### Extensions & bindings

- [Measure plug-in contract](https://github.com/natlabrockies/openstudio/blob/develop/src/measure/OSMeasure.hpp): extension API · Measures mutate models, inputs, or reports. · `src/measure/OSMeasure.hpp`
- [Ruby & Python engines](https://github.com/natlabrockies/openstudio/blob/develop/ruby/engine/RubyEngine.hpp): embedded runtimes · `ruby/engine/RubyEngine.hpp`
- [Language bindings](https://github.com/natlabrockies/openstudio/blob/develop/ruby/module/openstudio_rb.cpp): generated SDK APIs · C++, Ruby, Python, and C# access the native SDK. · `ruby/module/openstudio_rb.cpp`
- [BCL component catalogs](https://github.com/natlabrockies/openstudio/blob/develop/src/utilities/bcl/RemoteBCL.hpp): component service · Local and remote measure/component catalogs. · `src/utilities/bcl/RemoteBCL.hpp`

## Connections

- CMake build graph → Conan dependencies: resolves dependencies
- CMake build graph → openstudio CLI: builds
- CMake build graph → Language bindings: builds generated APIs
- openstudio CLI → OSWorkflow coordinator: runs .osw
- openstudio CLI → Version translator: updates models
- OSWorkflow coordinator → Workflow stages: coordinates
- Workflow stages → OpenStudio Model: loads and modifies
- Workflow stages → Measure plug-in contract: executes
- Workflow stages → EnergyPlus translators: translates
- Workflow stages → Simulation SQL results: collects results
- OpenStudio Model → Domain model objects: contains
- Version translator → OpenStudio Model: upgrades into
- OpenStudio Model → EnergyPlus translators: exports
- OpenStudio Model → Other engine translators: exports
- IDD schemas → IDF workspace & files: defines objects
- IDF workspace & files → EnergyPlus translators: simulation input/output boundary
- EnergyPlus translators → EnergyPlus: generates input and invokes
- EnergyPlus → Simulation SQL results: produces
- Measure plug-in contract → OpenStudio Model: model measures mutate
- Measure plug-in contract → Ruby & Python engines: executes through
- Ruby & Python engines → Language bindings: uses SDK APIs
- BCL component catalogs → Measure plug-in contract: supplies components
- Bundled resources → Workflow stages: provides reference inputs
