# openstudiocoalition/openstudioapplication architecture

> Architecture diagram of the GitHub repository openstudiocoalition/openstudioapplication, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/openstudiocoalition/openstudioapplication
- Repository: https://github.com/openstudiocoalition/openstudioapplication

## Overview

##### Main Components
- Core Application (openstudio_app): Encompasses the entry point of the GUI application (main.cpp, OpenStudioApp.cpp/hpp, resources, dialogs, menus, etc.).
- Model Editor (src/model_editor): Contains the modules responsible for editing and managing models, such as various dialogs (InspectorDialog, ModalDialogs), custom Qt views/widgets, and QRC resources.
- Core Library (openstudio_lib): Implements the building modeling logic, managing domain-specific components (constructions, HVAC systems, spaces, schedules, etc.) and provides UI integration points.
- Shared GUI Components (src/shared_gui_components): Provides reusable user interface elements like custom controls, collapsible views, common dialogs, and widgets that are used by various parts of the application.
- External Integrations & Modules:
- BIMserver Integration (src/bimserver): Responsible for connecting and communicating with BIMserver APIs.
- Ruby and Developer Scripts: Tools in directories like developer/ruby and ruby for supporting tasks (e.g., build, version validation, testing, code formatting).
- Utilities & CI/CD/Build Modules: CMake scripts (CMake/, ProjectMacros.cmake), Jenkinsfiles, and GitHub Actions workflows that facilitate cross-platform builds and testing.
- External Dependencies: Integration with the OpenStudio SDK (and its associated tools like EnergyPlus and Radiance), plus licensing files and third-party frameworks (for example, the Qt framework is clearly at work here).

##### Relationships and Interactions
- The application core (openstudio_app) is the orchestrator that invokes modules such as the model editor and then uses functions from openstudio_lib to access building energy modeling functionalities.
- The shared_gui_components serve as an abstraction layer for common UI functionalities and are consumed by both the openstudio_app and model_editor components.
- BIMserver and perhaps other modules (like the sketchup integration via SketchUpInstallName.rb) act as connectors to external systems or services.
- All components are built and integrated via CMake and are under continuous integration—and likely continuous deployment—pipelines as indicated by GitHub Actions and Jenkins configurations.
- Developer tools and scripts help automate testing, code validation, and other maintenance tasks.
- The dependency on the OpenStudio SDK indicates that while this application layer handles the user interface and interaction, the heavy lifting of simulation or energy analysis is offloaded to the SDK.

##### Architectural Patterns and Design Principles
- Modularity: The architecture is clearly split into separate modules (application, model editor, core library, shared GUI components) reflecting separation of concerns.
- Layering: There is a presentation layer (UI components), a business logic layer (openstudio_lib and other model components), and an integration/adaptation layer (BIMserver, Ruby developer scripts, external utilities).
- Build and Deployment Abstraction: The use of CMake and CI workflows signals an emphasis on cross-platform compatibility and modular builds.
- UI Framework: Given the use of Qt (observed in .qrc files, QT license inclusion, and many UI components), the design follows principles consistent with modern C++ GUI applications.

##### Final Steps
- Component interactions, data flows, and dependencies clearly.

## Diagram (Mermaid)

```mermaid
flowchart TD

  %% Presentation Layer
  subgraph "Presentation Layer"
    OSAC["OpenStudio Application Core"]:::ui
    ME["Model Editor"]:::ui
    SG["Shared GUI Components"]:::ui
  end

  %% Business Logic Layer
  subgraph "Business Logic Layer"
    OSL["Core Library"]:::business
  end

  %% Integration Layer
  subgraph "Integration Layer"
    BIM["BIMserver Integration"]:::integration
    ED["External Dependencies (OpenStudio SDK, EnergyPlus, Radiance)"]:::integration
  end

  %% Developer & Build Tools Layer
  subgraph "Developer & Build Tools"
    RDS["Ruby & Developer Scripts"]:::dev
    CI["Utilities & CI/CD/Build Modules"]:::dev
  end

  %% Connections
  OSAC -->|"invokes"| ME
  OSAC -->|"uses"| SG
  OSAC -->|"calls"| OSL
  ME -->|"editsModel"| OSL
  SG -->|"supports"| OSAC
  SG -->|"supports"| ME
  BIM ---|"integratesWith"| OSAC
  OSL -->|"reliesOn"| ED
  RDS -->|"automates"| OSAC
  CI -->|"builds"| OSAC
  CI -->|"builds"| OSL

  %% Click Events
  click OSAC "https://github.com/openstudiocoalition/openstudioapplication/tree/develop/src/openstudio_app"
  click ME "https://github.com/openstudiocoalition/openstudioapplication/tree/develop/src/model_editor"
  click OSL "https://github.com/openstudiocoalition/openstudioapplication/tree/develop/src/openstudio_lib"
  click SG "https://github.com/openstudiocoalition/openstudioapplication/tree/develop/src/shared_gui_components"
  click BIM "https://github.com/openstudiocoalition/openstudioapplication/tree/develop/src/bimserver"
  click RDS "https://github.com/openstudiocoalition/openstudioapplication/tree/develop/developer/ruby"
  click CI "https://github.com/openstudiocoalition/openstudioapplication/tree/develop/CMake"

  %% Styles
  classDef ui fill:#ADD8E6,stroke:#333,stroke-width:2px;
  classDef business fill:#90EE90,stroke:#333,stroke-width:2px;
  classDef integration fill:#FFD700,stroke:#333,stroke-width:2px;
  classDef dev fill:#FFB6C1,stroke:#333,stroke-width:2px;
```
