NetSimulationTab package

calculation_tab – backward-compatibility shim

The God-Class CalculationTab has been split into focused sub-widgets (network_plot_widget, pipe_config_table, network_info_panel, time_series_widget) orchestrated by NetSimulationTab.

This module re-exports NetSimulationTab under the old name so that existing code (e.g. main_view.py) keeps working without modification.

author:

Dipl.-Ing. (FH) Jonas Pfeiffer

districtheatingsim.gui.NetSimulationTab.calculation_tab.CalculationTab

alias of NetSimulationTab

Diameter Optimization Tab Module

UI tab for pipe diameter optimization settings in district heating networks.

author:

Dipl.-Ing. (FH) Jonas Pfeiffer

class districtheatingsim.gui.NetSimulationTab.diameter_optimization_tab.DiameterOptimizationTab(dialog_config, parent=None)[source]

Bases: QWidget

Widget for configuring pipe diameter optimization parameters.

__init__(dialog_config, parent=None)[source]

Initialize diameter optimization tab.

Parameters:
  • dialog_config (dict) – Configuration data for dialog settings.

  • parent (QWidget) – Parent widget.

initUI()[source]

Initialize user interface components.

createDiameterOptCheckbox()[source]

Create checkbox for enabling diameter optimization.

Returns:

Layout containing checkbox.

Return type:

QVBoxLayout

createDiameterOptInput()[source]

Create input fields for diameter optimization parameters.

Returns:

Layout containing input fields.

Return type:

QVBoxLayout

updateInputFieldsVisibility()[source]

Update visibility of input fields based on checkbox state.

getValues()[source]

Get current parameter values from input fields.

Returns:

Dictionary containing diameter optimization parameters.

Return type:

dict

Network Calculation Threads Module

Threaded network initialization and calculation functionality.

author:

Dipl.-Ing. (FH) Jonas Pfeiffer

class districtheatingsim.gui.NetSimulationTab.net_calculation_threads.NetInitializationThread(NetworkGenerationData)[source]

Bases: QThread

Thread for network initialization tasks.

calculation_done

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

calculation_error

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__(NetworkGenerationData)[source]

Initialize network initialization thread.

Parameters:

NetworkGenerationData (object) – Network generation data object.

run()[source]

Run network initialization process.

stop()[source]

Stop thread execution.

class districtheatingsim.gui.NetSimulationTab.net_calculation_threads.NetRecalculationThread(NetworkGenerationData)[source]

Bases: QThread

Thread for steady-state network recalculation (pipeflow + controllers).

Runs the recalculation off the UI thread so the GUI does not freeze while the solver runs (e.g. after the user edits pipe parameters).

calculation_done

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

calculation_error

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__(NetworkGenerationData)[source]
Parameters:

NetworkGenerationData – Network generation data object (recalculated in place).

run()[source]

Run the steady-state recalculation.

stop()[source]

Stop thread execution.

class districtheatingsim.gui.NetSimulationTab.net_calculation_threads.NetCalculationThread(NetworkGenerationData, simplified=False)[source]

Bases: QThread

Thread for network time series calculations.

calculation_done

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

calculation_error

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__(NetworkGenerationData, simplified=False)[source]

Initialize calculation thread.

Parameters:
  • NetworkGenerationData (object) – Network generation data object.

  • simplified (bool) – Use simplified fast calculation instead of detailed simulation.

run()[source]

Run time series calculation process.

stop()[source]

Stop thread execution.

Network Generation Dialog Module

Dialog for configuring network generation parameters with tabbed interface.

author:

Dipl.-Ing. (FH) Jonas Pfeiffer

districtheatingsim.gui.NetSimulationTab.net_generation_dialog.load_dialog_config(config_path='dialog_config.json')[source]

Load dialog configuration from JSON file.

Parameters:

config_path (str) – Path to configuration file.

Returns:

Configuration data.

Return type:

dict

districtheatingsim.gui.NetSimulationTab.net_generation_dialog.save_dialog_config(config, config_path='dialog_config.json')[source]

Save dialog configuration to JSON file.

Parameters:
  • config (dict) – Configuration data to save.

  • config_path (str) – Path to configuration file.

class districtheatingsim.gui.NetSimulationTab.net_generation_dialog.NetGenerationDialog(generate_callback, base_path, parent=None, config_path='dialog_config.json')[source]

Bases: QDialog

Dialog for network generation configuration with multiple tabs.

__init__(generate_callback, base_path, parent=None, config_path='dialog_config.json')[source]

Initialize network generation dialog.

Parameters:
  • generate_callback (callable) – Callback function for network generation.

  • base_path (str) – Base path for file operations.

  • parent (QWidget) – Parent widget.

  • config_path (str) – Path to configuration file.

initUI()[source]

Initialize dialog user interface with tabs.

generateNetwork()[source]

Generate network based on user inputs and execute callback.

Network Configuration Tab Module

Tab for network configuration parameters in district heating systems.

author:

Dipl.-Ing. (FH) Jonas Pfeiffer

class districtheatingsim.gui.NetSimulationTab.network_config_tab.NetworkConfigTab(dialog_config, parent=None)[source]

Bases: QWidget

Widget for configuring district heating network parameters.

__init__(dialog_config, parent=None)[source]

Initialize network configuration tab.

Parameters:
  • dialog_config (dict) – Configuration data.

  • parent (QWidget) – Parent widget.

initUI()[source]

Initialize user interface components.

createNetconfigurationControlInput()[source]

Create network configuration selection input.

Returns:

Layout containing configuration controls.

Return type:

QVBoxLayout

createTemperatureControlInput()[source]

Create temperature control selection input.

Returns:

Layout containing temperature controls.

Return type:

QVBoxLayout

createSupplyTemperatureCheckbox()[source]

Create supply temperature configuration checkbox.

Returns:

Layout containing supply temperature checkbox.

Return type:

QVBoxLayout

createReturnTemperatureCheckbox()[source]

Create return temperature configuration checkbox.

Returns:

Layout containing return temperature checkbox.

Return type:

QVBoxLayout

createBuildingTemperatureCheckbox()[source]

Create building temperature configuration checkbox.

Returns:

Layout containing building temperature checkbox.

Return type:

QVBoxLayout

createNetParameterInputs()[source]

Create network parameter input fields.

Returns:

Layout containing parameter inputs.

Return type:

QVBoxLayout

createHeatConsumerParameterInputs()[source]

Create heat consumer parameter input fields.

Returns:

Layout containing heat consumer inputs.

Return type:

QVBoxLayout

createParameterRow(label_text, default_text)[source]

Create a parameter input row with label and text field.

Parameters:
  • label_text (str) – Label text.

  • default_text (str) – Default input value.

Returns:

Layout containing label and input field.

Return type:

QHBoxLayout

createinitialpipetypeInput()[source]

Create pipe type selection input.

Returns:

Layout containing pipe type selection.

Return type:

QVBoxLayout

set_layout_visibility(layout, visible)[source]

Set visibility of all widgets in a layout.

Parameters:
  • layout (QLayout) – Layout to update.

  • visible (bool) – Visibility state.

set_default_value(parameter_row, value)[source]

Set default value for a parameter row.

Parameters:
  • parameter_row (QHBoxLayout) – Parameter row layout.

  • value (str) – Default value to set.

updateInputFieldsVisibility()[source]

Update visibility of input fields based on selected options.

getSupplyTemperatureHeatGenerator()[source]

Calculate temperature curve based on selected control mode.

Network Data Tab Module

Tab for network data file selection and preview visualization.

author:

Dipl.-Ing. (FH) Jonas Pfeiffer

class districtheatingsim.gui.NetSimulationTab.network_data_tab.NetworkDataTab(base_path, dialog_config, parent=None)[source]

Bases: QWidget

Widget for selecting network data files and previewing GeoJSON data.

__init__(base_path, dialog_config, parent=None)[source]

Initialize network data tab.

Parameters:
  • base_path (str) – Base path for file operations.

  • dialog_config (dict) – Configuration data.

  • parent (QWidget) – Parent widget.

initUI()[source]

Initialize user interface components.

createGeojsonInputs()[source]

Create GeoJSON file input layouts.

Returns:

List of input layouts.

Return type:

list

createFileInputsGeoJSON(default_network_path)[source]

Create file input widget for unified network GeoJSON file.

Parameters:

default_network_path (str) – Default path to Wärmenetz.geojson.

Returns:

Layout containing file input.

Return type:

QVBoxLayout

createFileInput(label_text, default_text)[source]

Create file input row with label, text field, and browse button.

Parameters:
  • label_text (str) – Label text.

  • default_text (str) – Default file path.

Returns:

Layout containing file input components.

Return type:

QHBoxLayout

browseJsonFile()[source]

Open file dialog for JSON file selection.

selectFilename(line_edit)[source]

Open file dialog and update line edit with selected file.

Parameters:

line_edit (QLineEdit) – Line edit widget to update.

update_plot()[source]

Update plot visualization based on selected unified GeoJSON file.

set_layout_visibility(layout, visible)[source]

Set visibility of all widgets in a layout.

Parameters:
  • layout (QLayout) – Layout to update.

  • visible (bool) – Visibility state.

set_default_value(parameter_row, value)[source]

Set default value for a parameter row.

Parameters:
  • parameter_row (QHBoxLayout) – Parameter row layout.

  • value (str) – Default value to set.

updateInputFieldsVisibility()[source]

Update visibility of input fields based on selected options.

Producer Order Tab Module

Tab for selecting and ordering heat producers in district heating networks.

author:

Dipl.-Ing. (FH) Jonas Pfeiffer

class districtheatingsim.gui.NetSimulationTab.producer_order_tab.ProducerOrderTab(dialog_config, parent=None)[source]

Bases: QWidget

Widget for configuring heat producer selection and priority order.

__init__(dialog_config, parent=None)[source]

Initialize producer order tab.

Parameters:
  • dialog_config (dict) – Configuration data.

  • parent (QWidget) – Parent widget.

initUI()[source]

Initialize user interface components.

create_producer_selection()[source]

Create producer selection interface components.

Returns:

Layout containing producer selection widgets.

Return type:

QVBoxLayout

load_producers()[source]

Load producers from unified GeoJSON file and populate list widget.

read_producers_from_geojson(filepath)[source]

Read producer data from unified GeoJSON file.

Parameters:

filepath (str) – Path to unified network GeoJSON file.

Returns:

List of producer dictionaries.

Return type:

list

Raises:

FileNotFoundError – If GeoJSON file not found.

add_producer_to_order()[source]

Add selected producer to the order list.

remove_producer_from_order()[source]

Remove selected producer from the order list.

update_producer_percentage_inputs()[source]

Update percentage input fields for secondary producers.

Network Plot Widget

Interactive Plotly/WebEngine network visualization with pipe click detection and parameter overlay dropdown.

author:

Dipl.-Ing. (FH) Jonas Pfeiffer

class districtheatingsim.gui.NetSimulationTab.network_plot_widget.NetworkPlotWidget(parent=None)[source]

Bases: QWidget

Interactive Plotly network visualization embedded in a QWebEngineView.

Emits pipe_selected whenever the user clicks a pipe in the plot. Call set_network() with a NetworkGenerationData instance to render the network; call highlight_pipe() to programmatically highlight a pipe from an external selection.

pipe_selected

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]
set_network(net_data)[source]

Set network data and refresh the plot.

Parameters:

net_data (NetworkGenerationData) – Simulation result data with net attribute.

refresh(force: bool = False)[source]

Render or reload the network plot.

Parameters:

force (bool) – If True, regenerate the HTML even when cached.

highlight_pipe(pipe_idx: int)[source]

Highlight pipe_idx in the plot via JavaScript.

Parameters:

pipe_idx (int) – Index of the pipe to highlight.

Time Series Dialog Module

Dialog for configuring time series calculation parameters.

author:

Dipl.-Ing. (FH) Jonas Pfeiffer

class districtheatingsim.gui.NetSimulationTab.timeseries_dialog.TimeSeriesCalculationDialog(base_path, parent=None)[source]

Bases: QDialog

Dialog for time series calculation configuration.

__init__(base_path, parent=None)[source]

Initialize time series calculation dialog.

Parameters:
  • base_path (str) – Base path for file dialogs.

  • parent (QWidget) – Parent widget.

initUI()[source]

Initialize user interface components.

onAccept()[source]

Validate inputs and accept dialog if valid.

validateInputs()[source]

Validate start and end time steps.

Returns:

True if inputs are valid.

Return type:

bool

selectFilename(lineEdit)[source]

Open file dialog and update line edit with selected file.

Parameters:

lineEdit (QLineEdit) – Line edit widget to update.

getValues()[source]

Get dialog values.

Returns:

Dictionary containing results filename, start and end time steps, and calculation method.

Return type:

dict