Main application

Main entry point for the DistrictHeatingSim application.

This module provides a PyQt6-based GUI application for planning and optimizing district heating networks. It implements the Model-View-Presenter (MVP) pattern with clear separation between data management, business logic, and user interface.

author:

Dipl.-Ing. (FH) Jonas Pfeiffer

The application provides:

  • Project management with variant support

  • Building heat demand calculation using BDEW profiles

  • Network generation from GIS data (OpenStreetMap)

  • Thermohydraulic simulation with pandapipes

  • Heat generator sizing and economic analysis

  • Multi-variant comparison

Architecture:

  • Model: ProjectConfigManager, DataManager, ProjectFolderManager

  • View: HeatSystemDesignGUI (main window with tab-based interface)

  • Presenter: HeatSystemPresenter (coordinates business logic)

Note

The application uses time-based theme selection (light/dark mode) and supports Windows taskbar integration when available.

districtheatingsim.DistrictHeatingSim.main()[source]

Initialize and launch the DistrictHeatingSim application.

This function sets up the Qt application, initializes all managers (config, data, folder), creates the main GUI window, connects the MVP components, applies the theme, and starts the event loop.

Raises:
  • SystemExit – Normal application termination

  • Exception – Caught by global exception handler for user-friendly error reporting

Note

Windows-specific taskbar integration is applied if available but fails gracefully on other platforms.

Central physical constants and emission/energy factors.

Single source of truth for values that were previously hard-coded (and sometimes inconsistent) across the codebase (BACKLOG D3): the water heat capacity (cp was both 4.18 and 4.2 kJ/kgK), the Kelvin offset (hard-coded ~20×), and the CO₂ / primary-energy / subsidy factors duplicated across heat generators.

author:

Dipl.-Ing. (FH) Jonas Pfeiffer

districtheatingsim.constants.KELVIN_OFFSET = 273.15

Celsius ↔ Kelvin offset.

districtheatingsim.constants.CP_WATER_KJ_KGK = 4.18

Specific heat capacity of water [kJ/kg·K]. Unified to 4.18 (≈ value near typical district-heating temperatures; consistent with the 4187 J/kgK in thermal_storage).

districtheatingsim.constants.CO2_FACTOR_GAS = 0.201

natural gas

districtheatingsim.constants.CO2_FACTOR_WOOD = 0.036

wood pellets / wood gas

districtheatingsim.constants.CO2_FACTOR_ELECTRICITY = 0.4

grid electricity (mix / displacement)

districtheatingsim.constants.CO2_FACTOR_SOLAR = 0.0

solar thermal heat

districtheatingsim.constants.PRIMARY_ENERGY_FACTOR_ELECTRICITY_PTH = 2.4

power-to-heat (grid mix)

districtheatingsim.constants.PRIMARY_ENERGY_FACTOR_ELECTRICITY_HP = 1.8

heat pumps

districtheatingsim.constants.BEW_SUBSIDY_SHARE = 0.4

BEW (Bundesförderung effiziente Wärmenetze) funding share (40 %).