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]
set_base_path(base_path)[source]

Set base path for file operations.

Parameters:

base_path (str) – Base directory path

get_base_path()[source]

Get base path.

Returns:

Current base path

Return type:

str

set_csv_path(csv_path)[source]

Set CSV file path.

Parameters:

csv_path (str) – Path to CSV file

get_csv_path()[source]

Get CSV file path.

Returns:

Current CSV file path

Return type:

str

set_json_path(json_path)[source]

Set JSON file path.

Parameters:

json_path (str) – Path to JSON file

get_json_path()[source]

Get JSON file path.

Returns:

Current JSON file path

Return type:

str

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

calculate_heat_demand(data, try_filename)[source]

Calculate heat demand profiles from building data.

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

  • try_filename (str) – Climate data filename

Returns:

Calculated heat demand profiles in kW

Return type:

tuple

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

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.

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.

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

showEvent(event)[source]

Handle widget show event to trigger initial plot.

Parameters:

event (QShowEvent) – Show event

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: QMainWindow

Main building tab window 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: