BuildingTab package

Building data management and heat demand calculation module.

Provides MVP architecture for building heat requirement calculations using BDEW profiles and Test Reference Year (TRY) climate data.

author:

Dipl.-Ing. (FH) Jonas Pfeiffer

class districtheatingsim.gui.BuildingTab.building_tab.BuildingModel[source]

Bases: object

Data model for building information and heat demand calculations.

Manages CSV input data, JSON results, and heat profile generation.

__init__()[source]
load_csv()[source]

Load CSV data into DataFrame.

Raises:

Exception – If CSV loading fails

save_csv()[source]

Save DataFrame to CSV file.

Raises:

Exception – If CSV saving fails

load_json()[source]

Load results from JSON file.

Raises:

Exception – If JSON loading fails

save_json(combined_data)[source]

Save results to JSON file.

Parameters:

combined_data (dict) – Data to save

Raises:

Exception – If JSON saving fails

class HeatDemandResult(time_steps, total_kw, heating_kw, warmwater_kw, max_kw, supply_temp, return_temp, air_temp)

Bases: tuple

air_temp

Alias for field number 7

heating_kw

Alias for field number 2

max_kw

Alias for field number 4

return_temp

Alias for field number 6

supply_temp

Alias for field number 5

time_steps

Alias for field number 0

total_kw

Alias for field number 1

warmwater_kw

Alias for field number 3

calculate_heat_demand(data, try_filename, year: int = 2023)[source]

Calculate heat demand profiles from building data.

Parameters:
  • data (pd.DataFrame) – Building input data

  • try_filename (str) – Climate data filename

  • year (int) – Calculation year for profile generation (BDEW/VDI 4655), defaults to 2023

Returns:

Calculated heat demand profiles in kW

Return type:

HeatDemandResult

class districtheatingsim.gui.BuildingTab.building_tab.BuildingPresenter(model, view, folder_manager, data_manager, config_manager)[source]

Bases: object

Presenter managing interaction between BuildingModel and BuildingTabView.

Coordinates building data operations, heat demand calculations, and UI updates.

__init__(model, view, folder_manager, data_manager, config_manager)[source]

Initialize building presenter.

Parameters:
standard_path(path)[source]

Update default file paths.

Parameters:

path (str) – New base path

create_csv_template()[source]

Save an empty CSV template with the required column headers and one example row. The user picks the save location via file dialog.

load_csv(fname=None, show_dialog=True)[source]

Load CSV file with file dialog.

Parameters:
  • fname (str, optional) – Filename to load.

  • show_dialog (bool, optional) – Whether to show success/error dialogs. Default is True.

save_csv(fname=None, show_dialog=True)[source]

Save CSV file with file dialog.

Parameters:

fname (str, optional) – Filename to save.

load_json(fname=None, show_dialog=True)[source]

Load JSON results with optional file dialog.

Parameters:
  • fname (str, optional) – Filename to load.

  • show_dialog (bool, optional) – Whether to show file dialog if no filename provided. Default is True.

save_json(fname=None, show_dialog=True)[source]

Save JSON results with file dialog.

Parameters:

fname (str, optional) – Filename to save.

calculate_heat_demand(_=None)[source]

Calculate heat demand profiles and save results.

format_results(results, data)[source]

Format calculation results for JSON storage.

Parameters:
  • results (tuple) – Raw calculation results

  • data (pd.DataFrame) – Input building data

Returns:

Formatted results dictionary

Return type:

dict

combine_data_with_results(data, results)[source]

Combine input data with calculation results.

Parameters:
  • data (pd.DataFrame) – Input data

  • results (dict) – Calculation results

Returns:

Combined data dictionary

Return type:

dict

on_combobox_selection_changed()[source]

Update plot when combobox selection changes.

class districtheatingsim.gui.BuildingTab.building_tab.BuildingTabView(parent=None)[source]

Bases: QWidget

View component for building tab UI.

Provides table for building data input and interactive plotting of heat demand profiles.

create_csv_template_signal

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

load_csv_signal

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

save_csv_signal

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

load_json_signal

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

save_json_signal

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

calculate_heat_demand_signal

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

__init__(parent=None)[source]

Initialize building tab view.

Parameters:

parent (QWidget) – Parent widget (optional)

initUI()[source]

Initialize UI components.

initMenuBar()[source]

Initialize menu bar with file operations.

initDataTable()[source]

Initialize data table widget.

initPlotAndComboboxes()[source]

Initialize plot area and data selection controls.

createCsvTemplate()[source]

Emit signal to create a new CSV template.

loadCsvFile()[source]

Emit signal to load CSV file.

saveCsvFile()[source]

Emit signal to save CSV file.

loadJsonFile()[source]

Emit signal to load JSON file.

saveJsonFile()[source]

Emit signal to save JSON file.

calculateHeatDemand()[source]

Emit signal to calculate heat demand.

populate_table(data)[source]

Populate table with DataFrame data.

Parameters:

data (pd.DataFrame) – Data to display in table

get_table_data()[source]

Extract data from table widget.

Returns:

Table data as DataFrame

Return type:

pd.DataFrame

populate_building_combobox(results)[source]

Populate building selection combobox.

Parameters:

results (dict) – Results data for building selection

plot(results=None)[source]

Plot heat demand profiles for selected buildings and data types.

Parameters:

results (dict) – Heat demand calculation results

show_error_message(title, message)[source]

Display error message dialog.

Parameters:
  • title (str) – Dialog title

  • message (str) – Error message

show_message(title, message)[source]

Display information message dialog.

Parameters:
  • title (str) – Dialog title

  • message (str) – Information message

class districtheatingsim.gui.BuildingTab.building_tab.BuildingTab(folder_manager, data_manager, config_manager, parent=None)[source]

Bases: QWidget

Main building tab widget integrating MVP components.

Central interface for building data management and heat demand analysis.

__init__(folder_manager, data_manager, config_manager, parent=None)[source]

Initialize building tab with MVP architecture.

Parameters: