NetSimulationTab package

Network Simulation Tab Module

District heating network simulation and calculation interface with pandapipes integration.

author:

Dipl.-Ing. (FH) Jonas Pfeiffer

class districtheatingsim.gui.NetSimulationTab.calculation_tab.CalculationTab(folder_manager, data_manager, config_manager, parent=None)[source]

Bases: QWidget

Network simulation tab for district heating system calculations.

Note

Provides interface for network generation, time series simulation, and visualization of heating network data using pandapipes.

data_added

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__(folder_manager, data_manager, config_manager, parent=None)[source]

Initialize calculation tab.

Parameters:
  • folder_manager (object) – Project folder manager.

  • data_manager (object) – Application data manager.

  • config_manager (object) – Configuration manager.

  • parent (QWidget) – Parent widget.

updateDefaultPath(new_base_path)[source]

Update project base path.

Parameters:

new_base_path (str) – New base path.

initUI()[source]

Initialize user interface components.

initMenuBar()[source]

Initialize menu bar with file and calculation actions.

setupPlotLayout()[source]

Setup layout with network plot and info on top, time series full width below.

createPlotControlDropdown()[source]

Create dropdown for selecting plot data types.

openNetGenerationDialog()[source]

Open network generation dialog.

generateNetworkCallback(NetworkGenerationData)[source]

Handle network generation callback.

Parameters:

NetworkGenerationData (object) – Network generation data.

opencalculateNetDialog()[source]

Open time series calculation dialog.

create_and_initialize_net_geojson()[source]

Create and initialize network from GeoJSON files.

common_thread_initialization()[source]

Initialize common thread connections and progress.

on_initialization_done(NetworkGenerationData)[source]

Handle initialization completion.

Parameters:

NetworkGenerationData (object) – Network generation data.

create_info_card(title, value, unit='', description='')[source]

Create a compact info card for displaying network data.

Parameters:
  • title (str) – Card title.

  • value (float or str) – Display value.

  • unit (str) – Unit string.

  • description (str) – Description text.

Returns:

Info card widget.

Return type:

QFrame

display_results()[source]

Display network simulation results in compact card layout.

plot_pandapipes_net(force_refresh: bool = False)[source]

Plot pandapipes network visualization using interactive Plotly.

Parameters:

force_refresh (bool) – If True, regenerate the plot even if cached version exists.

time_series_simulation()[source]

Perform time series simulation.

on_time_series_simulation_done(NetworkGenerationData)[source]

Handle time series simulation completion.

Parameters:

NetworkGenerationData (object) – Network generation data with results.

on_time_series_simulation_error(error_message)[source]

Handle simulation errors.

Parameters:

error_message (str) – Error message to display.

update_time_series_plot()[source]

Update time series plot based on selected data with modern styling.

get_data_path()[source]

Get absolute path to data directory.

Returns:

Data directory path.

Return type:

str

saveNet(show_dialog=True)[source]

Save network data to pickle, CSV, and JSON files.

Parameters:

show_dialog (bool) – Whether to show success/error dialogs.

loadNet(show_dialog=True)[source]

Load network data from saved files.

Parameters:

show_dialog (bool) – Whether to show success/error dialogs.

load_net_results(show_dialog=True)[source]

Load network simulation results from CSV file.

Parameters:

show_dialog (bool) – Whether to show warning dialogs.

exportNetGeoJSON(show_dialog=True)[source]

Export dimensioned network to unified GeoJSON format.

Parameters:

show_dialog (bool) – Whether to show success/error dialogs.

apply_table_changes_to_net()[source]

Apply all table changes to the network before calculation.

recalculateNetwork()[source]

Recalculate network with current pipe parameters (pipeflow only, no optimization).

populate_pipe_table()[source]

Populate pipe configuration table with data from net.pipe DataFrame.

on_pipe_selected_in_table()[source]

Handle table row selection - highlight pipe in plot.

on_std_type_changed(row, new_std_type)[source]

Handle standard type change in ComboBox.

Parameters:
  • row (int) – Table row index.

  • new_std_type (str) – New standard type name.

on_table_item_changed(item)[source]

Handle direct table cell edits (diameter, k).

Parameters:

item (QTableWidgetItem) – Changed table item.

restore_pipe_defaults()[source]

Restore pipe parameters to original values.

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.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.

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