# rwth-ebc/ddmpc architecture

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

- Interactive diagram: https://gitdiagram.com/rwth-ebc/ddmpc
- Repository: https://github.com/rwth-ebc/ddmpc

## Overview

DDMPC is a data-driven model-predictive-control package for simulating building energy systems. The documented workflow is to run a system with a baseline controller, collect and process training data, fit process models, then configure and run MPC, optionally with online learning. The graph keeps data preparation, feature/model construction, prediction, optimization, and simulation as distinct stages. Relationships use README workflow statements or SOURCE INDEX references; unsampled internals are not assumed to be direct calls.

Main entry points: [`ddmpc/systems/base_class.py`](https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/systems/base_class.py) (System interface), [`ddmpc/modeling/predicting.py`](https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/modeling/predicting.py) (Prediction framework), [`ddmpc/controller/model_predictive/mpc.py`](https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/controller/model_predictive/mpc.py) (MPC controller), [`ddmpc/controller/model_predictive/nlp.py`](https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/controller/model_predictive/nlp.py) (NLP optimizer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Control"]
  node_baseline["Baseline controller<br/>[conventional.py]"]
  node_mpc["MPC controller<br/>[mpc.py]"]
  node_nlp["NLP optimizer<br/>[nlp.py]"]
  node_costs["Cost functions<br/>[costs.py]"]
end

subgraph group_data["Data handling"]
  node_data_process["Training data processing<br/>[processing_data.py]"]
  node_data_store[("Training data storage<br/>[storing_data.py]")]
  node_data_analysis["Data analysis<br/>[data_analysis.py]"]
  node_linearity["Linearity detection"]
end

subgraph group_model["Modeling"]
  node_model["Process model<br/>[modeling.py]"]
  node_features["Feature definitions<br/>[features.py]"]
  node_sources["Feature sources<br/>[sources.py]"]
  node_constructed["Constructed features<br/>[constructed.py]"]
  node_prediction["Prediction framework<br/>[predicting.py]"]
  node_ann["ANN predictors<br/>[ann_predictor.py]"]
  node_regression["Regression predictors"]
  node_physics["Physics models<br/>[white_box.py]"]
  node_training["Model training<br/>[training.py]"]
end

subgraph group_systems["Systems"]
  node_system["System interface<br/>[base_class.py]"]
  node_fmu["FMU system<br/>[fmu.py]"]
  node_boptest["BOPTEST system<br/>[boptest.py]"]
  node_system_errors["System errors<br/>[exceptions.py]"]
end

subgraph group_support["Utilities"]
  node_utilities["Utilities"]
end

node_engineer(("Engineer"))
node_boptest_service(("BOPTEST service"))

node_engineer -->|"runs baseline"| node_baseline
node_baseline -->|"drives system"| node_system
node_system -->|"records data"| node_data_store
node_data_store -->|"prepares samples"| node_data_process
node_data_process -->|"supplies training data"| node_training
node_training -->|"fits predictors"| node_ann
node_engineer -->|"defines process models"| node_model
node_model -->|"uses features"| node_features
node_features -->|"uses sources"| node_sources
node_constructed -->|"extends sources"| node_sources
node_ann -->|"implements predictor"| node_prediction
node_regression -->|"implements predictors"| node_prediction
node_physics -->|"implements predictor"| node_prediction
node_engineer -->|"configures MPC"| node_mpc
node_mpc -->|"constructs optimizer"| node_nlp
node_nlp -->|"applies costs"| node_costs
node_nlp -->|"uses process model"| node_model
node_mpc -->|"runs control"| node_system
node_engineer -->|"analyzes data"| node_data_analysis
node_engineer -->|"checks linearity"| node_linearity
node_system -->|"implements interface"| node_fmu
node_system -->|"implements interface"| node_boptest
node_boptest -->|"sends requests"| node_boptest_service
node_system -->|"raises errors"| node_system_errors
node_data_store -->|"uses storage helpers"| node_utilities
node_prediction -->|"uses persistence helpers"| node_utilities

click node_baseline "https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/controller/conventional.py"
click node_mpc "https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/controller/model_predictive/mpc.py"
click node_nlp "https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/controller/model_predictive/nlp.py"
click node_costs "https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/controller/model_predictive/costs.py"
click node_data_process "https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/data_handling/processing_data.py"
click node_data_store "https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/data_handling/storing_data.py"
click node_data_analysis "https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/data_handling/data_analysis.py"
click node_linearity "https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/data_handling/linearity_detection.py"
click node_model "https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/modeling/modeling.py"
click node_features "https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/modeling/features/features.py"
click node_sources "https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/modeling/features/sources.py"
click node_constructed "https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/modeling/features/constructed.py"
click node_prediction "https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/modeling/predicting.py"
click node_ann "https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/modeling/process_models/machine_learning/artificial_neural_networks/ann_predictor.py"
click node_regression "https://github.com/rwth-ebc/ddmpc/tree/main/ddmpc/modeling/process_models/machine_learning/regression"
click node_physics "https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/modeling/process_models/physics_based/white_box.py"
click node_training "https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/modeling/process_models/machine_learning/training.py"
click node_system "https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/systems/base_class.py"
click node_fmu "https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/systems/fmu.py"
click node_boptest "https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/systems/boptest.py"
click node_system_errors "https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/systems/exceptions.py"
click node_utilities "https://github.com/rwth-ebc/ddmpc/tree/main/ddmpc/utils"

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_baseline,node_mpc,node_nlp,node_costs toneBlue
class node_data_process,node_data_store,node_data_analysis,node_linearity toneAmber
class node_model,node_features,node_sources,node_constructed,node_prediction,node_ann,node_regression,node_physics,node_training toneMint
class node_system,node_fmu,node_boptest,node_system_errors toneRose
class node_utilities,node_engineer,node_boptest_service toneIndigo
```

## Components

### Control

- [Baseline controller](https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/controller/conventional.py): `ddmpc/controller/conventional.py`
- [MPC controller](https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/controller/model_predictive/mpc.py): `ddmpc/controller/model_predictive/mpc.py`
- [NLP optimizer](https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/controller/model_predictive/nlp.py): `ddmpc/controller/model_predictive/nlp.py`
- [Cost functions](https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/controller/model_predictive/costs.py): `ddmpc/controller/model_predictive/costs.py`

### Data handling

- [Training data processing](https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/data_handling/processing_data.py): `ddmpc/data_handling/processing_data.py`
- [Training data storage](https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/data_handling/storing_data.py): `ddmpc/data_handling/storing_data.py`
- [Data analysis](https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/data_handling/data_analysis.py): `ddmpc/data_handling/data_analysis.py`
- [Linearity detection](https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/data_handling/linearity_detection.py): `ddmpc/data_handling/linearity_detection.py`

### Modeling

- [Process model](https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/modeling/modeling.py): `ddmpc/modeling/modeling.py`
- [Feature definitions](https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/modeling/features/features.py): `ddmpc/modeling/features/features.py`
- [Feature sources](https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/modeling/features/sources.py): `ddmpc/modeling/features/sources.py`
- [Constructed features](https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/modeling/features/constructed.py): `ddmpc/modeling/features/constructed.py`
- [Prediction framework](https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/modeling/predicting.py): `ddmpc/modeling/predicting.py`
- [ANN predictors](https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/modeling/process_models/machine_learning/artificial_neural_networks/ann_predictor.py): `ddmpc/modeling/process_models/machine_learning/artificial_neural_networks/ann_predictor.py`
- [Regression predictors](https://github.com/rwth-ebc/ddmpc/tree/main/ddmpc/modeling/process_models/machine_learning/regression): `ddmpc/modeling/process_models/machine_learning/regression`
- [Physics models](https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/modeling/process_models/physics_based/white_box.py): `ddmpc/modeling/process_models/physics_based/white_box.py`
- [Model training](https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/modeling/process_models/machine_learning/training.py): `ddmpc/modeling/process_models/machine_learning/training.py`

### Systems

- [System interface](https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/systems/base_class.py): `ddmpc/systems/base_class.py`
- [FMU system](https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/systems/fmu.py): `ddmpc/systems/fmu.py`
- [BOPTEST system](https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/systems/boptest.py): `ddmpc/systems/boptest.py`
- [System errors](https://github.com/rwth-ebc/ddmpc/blob/main/ddmpc/systems/exceptions.py): `ddmpc/systems/exceptions.py`

### Utilities

- [Utilities](https://github.com/rwth-ebc/ddmpc/tree/main/ddmpc/utils): `ddmpc/utils`

### Other components

- **Engineer**
- **BOPTEST service**

## Connections

- Engineer → Baseline controller: runs baseline
- Baseline controller → System interface: drives system
- System interface → Training data storage: records data (evidence: `ddmpc/systems/base_class.py`)
- Training data storage → Training data processing: prepares samples (evidence: `ddmpc/data_handling/processing_data.py`)
- Training data processing → Model training: supplies training data (evidence: `ddmpc/modeling/process_models/machine_learning/training.py`)
- Model training → ANN predictors: fits predictors (evidence: `ddmpc/modeling/process_models/machine_learning/training.py`)
- Engineer → Process model: defines process models
- Process model → Feature definitions: uses features (evidence: `ddmpc/modeling/modeling.py`)
- Feature definitions → Feature sources: uses sources (evidence: `ddmpc/modeling/features/features.py`)
- Constructed features → Feature sources: extends sources (evidence: `ddmpc/modeling/features/constructed.py`)
- ANN predictors → Prediction framework: implements predictor (evidence: `ddmpc/modeling/process_models/machine_learning/artificial_neural_networks/ann_predictor.py`)
- Regression predictors → Prediction framework: implements predictors (evidence: `ddmpc/modeling/process_models/machine_learning/regression/gpr.py`)
- Physics models → Prediction framework: implements predictor (evidence: `ddmpc/modeling/process_models/physics_based/white_box.py`)
- Engineer → MPC controller: configures MPC
- MPC controller → NLP optimizer: constructs optimizer (evidence: `ddmpc/controller/model_predictive/mpc.py`)
- NLP optimizer → Cost functions: applies costs (evidence: `ddmpc/controller/model_predictive/nlp.py`)
- NLP optimizer → Process model: uses process model (evidence: `ddmpc/controller/model_predictive/nlp.py`)
- MPC controller → System interface: runs control
- Engineer → Data analysis: analyzes data
- Engineer → Linearity detection: checks linearity
- System interface → FMU system: implements interface (evidence: `ddmpc/systems/__init__.py`)
- System interface → BOPTEST system: implements interface (evidence: `ddmpc/systems/__init__.py`)
- BOPTEST system → BOPTEST service: sends requests (evidence: `ddmpc/systems/boptest.py`)
- System interface → System errors: raises errors (evidence: `ddmpc/systems/base_class.py`)
- Training data storage → Utilities: uses storage helpers (evidence: `ddmpc/data_handling/storing_data.py`)
- Prediction framework → Utilities: uses persistence helpers (evidence: `ddmpc/modeling/predicting.py`)
