Educational Python library for building energy simulation using FMU (Functional Mock-up Units). Designed for training courses on thermal building physics and energy performance analysis.
- ποΈ FMU Simulation: High-level wrapper for FMPy to run building energy simulations
- π Visualization: Interactive Plotly-based plotting for temperature, heat flux, and energy analysis
- π Material Database: Comprehensive thermal properties of construction and insulation materials
- π Training Notebooks: Hands-on exercises covering:
- Heat conduction and thermal resistance
- Infrared and solar radiation
- Building loss assessment
- Weather data analysis
- Case studies with optimization
Open this repository in VS Code and click "Reopen in Container". Everything will be set up automatically.
uv venv --system-site-packages
source .venv/bin/activate
uv pip install -e '.[dev,test]'python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -e '.[dev,test]'from kub.course.simlib import FMUSimulation
from kub.course.plotlib import SimulationPlotFactory
from pathlib import Path
# Load and run an FMU simulation
fmu_path = Path("database/day1/FMUs/Exercises_Conduction_SteStaWalResCon_01.fmu")
sim = FMUSimulation(fmu_path)
# Configure simulation
sim.initialize(startTime=0.0, stopTime=3600.0, timeStep=1.0)
sim.initParameters({"Wall_Resistor.R": 1.5, "Wall_Conductor.G": 0.75})
sim.exitInitialization()
# Run and collect results
data = sim.run(["Wall_Resistor.port_b.T", "Wall_Conductor.port_b.Q_flow"])
sim.terminate()
# Visualize results
factory = SimulationPlotFactory()
factory.plot_subplots(
time=data["time"],
data_type="temperature",
data_dict={"Temperature": data["Wall_Resistor.port_b.T"]},
title="Wall Temperature Over Time"
)from kub.course.simlib.materials import insulation_materials, structural_materials
# Access thermal properties
glass_wool = insulation_materials["glass_wool"]
print(f"Lambda: {glass_wool['lambda']} W/(mΒ·K)")
print(f"Density: {glass_wool['rho']} kg/mΒ³")
print(f"Specific heat: {glass_wool['Cp']} J/(kgΒ·K)")course.kub/
βββ .devcontainer/ # Development container configuration
βββ .github/workflows/ # CI/CD pipelines
βββ .vscode/ # VS Code settings
βββ database/ # FMU files and data
β βββ day1/ # Day 1 exercises (conduction, radiation)
β βββ day2/ # Day 2 exercises (optimization, weather)
βββ notebooks/ # Jupyter training notebooks
β βββ trainingDay1/ # Basic physics exercises
β βββ trainingDay2/ # Advanced case studies
βββ src/python/kub/course/ # Main package
β βββ plotlib/ # Visualization utilities
β βββ simlib/ # Simulation and materials
βββ tests/ # Unit tests (coming soon)
pytest # Run all tests
pytest --cov=kub --cov-report=html # With coverage reportruff check . # Lint code
ruff format . # Format code
ruff check --fix . # Auto-fix issuespython -m build
pip install dist/*.whlContributions are welcome! Please read CONTRIBUTING.md for guidelines.
This project is licensed under the MIT License - see the LICENSE file for details.
- Philippe PinΓ§on - [email protected]
- GwennolΓ© Chappron - [email protected]
- Christophe Prud'homme - [email protected]