EnergySystemTab package
Das EnergySystemTab-Paket enthält die GUI-Komponenten für die Konfiguration und Verwaltung von Energiesystemen in der DistrictHeatingSim-Anwendung.
Energy System Main Tab Module
- author:
Dipl.-Ing. (FH) Jonas Pfeiffer
Main tab for managing energy system design, including technology definitions, cost calculations, and results display.
- class districtheatingsim.gui.EnergySystemTab._01_energy_system_main_tab.EnergySystemTab(folder_manager, data_manager, config_manager, parent=None)[source]
Bases:
QWidgetMain tab for defining and managing energy mix design for heat generation projects.
- Signal data_added:
Signal emitted when new data is added.
- 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 the EnergySystemTab.
- updateDefaultPath(new_base_path)[source]
Update project default path.
- Parameters:
new_base_path (str) – New base path for the project.
- createAction(title, method)[source]
Create a menu action.
- Parameters:
title (str) – Action title.
method (function) – Method to be called when triggered.
- Returns:
Created action.
- Return type:
QAction
- createMainLayout()[source]
Create main layout for the tab.
- Returns:
Main layout.
- Return type:
QVBoxLayout
- validateInputs()[source]
Validate inputs for calculation.
- Returns:
True if inputs are valid, False otherwise.
- Return type:
- on_calculation_done(result)[source]
Handle calculation completion.
- Parameters:
result (dict) – Calculation results.
- on_calculation_error(error_message)[source]
Handle calculation errors.
- Parameters:
error_message (str) – Error message.
- sensitivity(gas_range, electricity_range, wood_range, weights=None)[source]
Perform sensitivity analysis over a range of prices.
- calculate_sensitivity(gas_price, electricity_price, wood_price, weights)[source]
Calculate energy mix for given prices and weights.
- save_heat_generation_results_to_csv(show_dialog=True)[source]
Save heat generation results to CSV file.
- Parameters:
show_dialog (bool) – Whether to show dialogs.
Energy System Dialogs Module
- author:
Dipl.-Ing. (FH) Jonas Pfeiffer
Dialogs for the Energy System Tab, including economic parameters input, cost calculation, and weight settings for optimization.
- class districtheatingsim.gui.EnergySystemTab._02_energy_system_dialogs.EconomicParametersDialog(parent=None)[source]
Bases:
QDialogDialog for inputting economic parameters.
- __init__(parent=None)[source]
Initialize the EconomicParametersDialog.
- Parameters:
parent (QWidget) – Parent widget.
- loadValues(values)[source]
Load values into input fields.
- Parameters:
values (dict) – Dictionary containing values to load.
- getValues()[source]
Get values from input fields.
- Returns:
Dictionary containing input values.
- Return type:
- updateValues(new_values)[source]
Update default values and reload them into input fields.
- Parameters:
new_values (dict) – Dictionary containing new values.
- class districtheatingsim.gui.EnergySystemTab._02_energy_system_dialogs.KostenBerechnungDialog(parent=None, label=None, value=None, type=None)[source]
Bases:
QDialogDialog for calculating costs based on a geoJSON file.
- class districtheatingsim.gui.EnergySystemTab._02_energy_system_dialogs.WeightDialog[source]
Bases:
QDialogDialog for setting weights for optimization.
Technology Tab Module
- author:
Dipl.-Ing. (FH) Jonas Pfeiffer
Managing and displaying technologies in district heating simulation, including add, edit, remove, and schematic visualization.
- class districtheatingsim.gui.EnergySystemTab._03_technology_tab.CustomListWidget(parent=None)[source]
Bases:
QListWidgetCustom list widget with drag-drop functionality for technology ordering.
- class districtheatingsim.gui.EnergySystemTab._03_technology_tab.TechnologyTab(data_manager, config_manager, parent=None)[source]
Bases:
QWidgetTab for managing and displaying heat generation technologies.
- Signal data_added:
Signal that emits data as an object.
- global_counters = {'Abwärmepumpe': 0, 'AqvaHeat': 0, 'BHKW': 0, 'Biomassekessel': 0, 'Flusswärmepumpe': 0, 'Gaskessel': 0, 'Geothermie': 0, 'Holzgas-BHKW': 0, 'Power-to-Heat': 0, 'Saisonaler Wärmespeicher': 0, 'Solarthermie': 0}
- 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
- updateDefaultPath(new_base_path)[source]
Update default path for file inputs.
- Parameters:
new_base_path (str) – New base path.
- addHorizontalLayout(*widgets)[source]
Add horizontal layout with given widgets to main layout.
- Parameters:
widgets (tuple) – Widgets to add to horizontal layout.
- editTech(item)[source]
Edit selected technology.
- Parameters:
item (QListWidgetItem) – Selected item to edit.
- removeSelectedTech()[source]
Remove selected technology object and update counters and object names.
- updateTechNames(tech_type)[source]
Update names and labels of remaining objects of a technology class.
- Parameters:
tech_type (str) – Technology type.
- formatTechForDisplay(tech)[source]
Delegate formatting of display text to technology object.
- Parameters:
tech (Technology) – Technology object.
- Returns:
Formatted string for display.
- Return type:
- createMainLayout()[source]
Create main layout for TechnologyTab.
- Returns:
Main layout.
- Return type:
QVBoxLayout
- loadFileAndPlot()[source]
Load file and plot data, display message if file unavailable or has issues.
- plotData(data)[source]
Plot data on canvas with modern styling and hour-based x-axis.
- Parameters:
data (DataFrame) – Data to plot.
Technology Input Dialogs Module
- author:
Dipl.-Ing. (FH) Jonas Pfeiffer
Dialogs for inputting technology-specific data in Energy System Tab.
- class districtheatingsim.gui.EnergySystemTab._04_technology_dialogs.TechInputDialog(tech_type, tech_data=None)[source]
Bases:
QDialogDialog for inputting technology-specific data based on technology type.
- class districtheatingsim.gui.EnergySystemTab._04_technology_dialogs.SolarThermalDialog(tech_data=None)[source]
Bases:
QWidgetA dialog for inputting data specific to solar thermal technology.
- class districtheatingsim.gui.EnergySystemTab._04_technology_dialogs.BiomassBoilerDialog(tech_data=None)[source]
Bases:
QDialogA dialog for inputting data specific to biomass boiler technology.
- __init__(tech_data=None)[source]
Initializes the BiomassBoilerDialog with the given data.
- Parameters:
tech_data (dict or None) – The data for the biomass boiler technology
- class districtheatingsim.gui.EnergySystemTab._04_technology_dialogs.GasBoilerDialog(tech_data=None)[source]
Bases:
QDialogA QDialog subclass for configuring gas boiler parameters.
- PowerFactorGKInput
Input field for the dimensioning factor of the gas boiler.
- Type:
QLineEdit
- effGKInput
Input field for the efficiency of the gas boiler.
- Type:
QLineEdit
- spezcostGKInput
Input field for the specific investment costs.
- Type:
QLineEdit
- class districtheatingsim.gui.EnergySystemTab._04_technology_dialogs.PowerToHeatDialog(tech_data=None)[source]
Bases:
QDialogA QDialog subclass for configuring Power-to-Heat parameters.
- PowerFactorGKInput
Input field for the dimensioning factor of the Power-to-Heat.
- Type:
QLineEdit
- effGKInput
Input field for the efficiency of the Power-to-Heat.
- Type:
QLineEdit
- spezcostGKInput
Input field for the specific investment costs.
- Type:
QLineEdit
- class districtheatingsim.gui.EnergySystemTab._04_technology_dialogs.CHPDialog(tech_data=None)[source]
Bases:
QDialogA QDialog subclass for configuring combined heat and power (CHP) parameters.
- Various QLineEdit and QCheckBox widgets for different CHP parameters.
- __init__(tech_data=None)[source]
Initializes the CHPDialog.
- Parameters:
tech_data (dict or None) – Dictionary containing initial values for the CHP parameters
- class districtheatingsim.gui.EnergySystemTab._04_technology_dialogs.HolzgasCHPDialog(tech_data=None)[source]
Bases:
QDialogA QDialog subclass for configuring Holzgas-CHP (combined heat and power) parameters.
- Various QLineEdit and QCheckBox widgets for different Holzgas-CHP parameters.
- __init__(tech_data=None)[source]
Initializes the HolzgasCHPDialog.
- Parameters:
tech_data (dict or None) – Dictionary containing initial values for the Holzgas-CHP parameters
- class districtheatingsim.gui.EnergySystemTab._04_technology_dialogs.GeothermalDialog(tech_data=None)[source]
Bases:
QWidgetA QWidget subclass for configuring geothermal parameters.
- areaGInput
Input field for the area of the borehole field.
- Type:
QLineEdit
- depthInput
Input field for the depth of the boreholes.
- Type:
QLineEdit
- tempGInput
Input field for the source temperature.
- Type:
QLineEdit
- distholeInput
Input field for the distance between boreholes.
- Type:
QLineEdit
- costdethInput
Input field for the specific drilling costs.
- Type:
QLineEdit
- spezPInput
Input field for the specific extraction performance.
- Type:
QLineEdit
- VBHInput
Input field for the full load hours of the borehole field.
- Type:
QLineEdit
- WPGcostInput
Input field for the specific investment costs of the heat pump.
- Type:
QLineEdit
- figure
Matplotlib figure for plotting the borehole configuration.
- Type:
Figure
- ax
Matplotlib axes for plotting.
- Type:
Axes
- canvas
Canvas to display the Matplotlib figure.
- Type:
FigureCanvas
- class districtheatingsim.gui.EnergySystemTab._04_technology_dialogs.WasteHeatPumpDialog(tech_data=None)[source]
Bases:
QDialogA QDialog subclass for configuring waste heat pump parameters.
- PWHInput
Input field for the cooling capacity of waste heat.
- Type:
QLineEdit
- TWHInput
Input field for the temperature of waste heat.
- Type:
QLineEdit
- WHcostInput
Input field for the specific investment costs of waste heat utilization.
- Type:
QLineEdit
- WPWHcostInput
Input field for the specific investment costs of the heat pump.
- Type:
QLineEdit
- class districtheatingsim.gui.EnergySystemTab._04_technology_dialogs.RiverHeatPumpDialog(tech_data=None)[source]
Bases:
QDialogA QDialog subclass for configuring river heat pump parameters.
- PFWInput
Input field for the thermal capacity of the heat pump.
- Type:
QLineEdit
- TFWInput
Input field for the river temperature.
- Type:
QLineEdit
- DTFWInput
Input field for the permissible deviation of the heat pump’s supply temperature from the network supply temperature.
- Type:
QLineEdit
- RHcostInput
Input field for the specific investment costs of river heat utilization.
- Type:
QLineEdit
- WPRHcostInput
Input field for the specific investment costs of the heat pump.
- Type:
QLineEdit
- csvButton
Button to open and load a CSV file containing river temperatures.
- Type:
QPushButton
- canvas
Canvas to display the Matplotlib figure.
- Type:
FigureCanvas
- __init__(tech_data=None)[source]
Initializes the RiverHeatPumpDialog.
- Parameters:
tech_data (dict or None) – Dictionary containing initial values for the river heat pump parameters
- class districtheatingsim.gui.EnergySystemTab._04_technology_dialogs.AqvaHeatDialog(tech_data=None)[source]
Bases:
QDialogA QDialog subclass for configuring AqvaHeat parameters.
- PFWInput
Input field for the thermal capacity of the heat pump.
- Type:
QLineEdit
- TFWInput
Input field for the river temperature.
- Type:
QLineEdit
- DTFWInput
Input field for the permissible deviation of the heat pump’s supply temperature from the network supply temperature.
- Type:
QLineEdit
- RHcostInput
Input field for the specific investment costs of river heat utilization.
- Type:
QLineEdit
- WPRHcostInput
Input field for the specific investment costs of the heat pump.
- Type:
QLineEdit
- csvButton
Button to open and load a CSV file containing river temperatures.
- Type:
QPushButton
- canvas
Canvas to display the Matplotlib figure.
- Type:
FigureCanvas
- __init__(tech_data=None)[source]
Initializes the RiverHeatPumpDialog.
- Parameters:
tech_data (dict or None) – Dictionary containing initial values for the river heat pump parameters
- class districtheatingsim.gui.EnergySystemTab._04_technology_dialogs.TemperatureStratifiedThermalStorageDialog(tech_data=None)[source]
Bases:
QDialogA QDialog subclass for configuring temperature stratified thermal storage parameters.
Attributes:
Cost Tab Module
- author:
Dipl.-Ing. (FH) Jonas Pfeiffer
Displaying and managing cost-related data for heat generation project components.
- class districtheatingsim.gui.EnergySystemTab._05_cost_tab.CostTab(folder_manager, config_manager, parent=None)[source]
Bases:
QWidgetTab for displaying and managing cost-related data for heat generation project components.
- Signal data_added:
Signal emitted when new data is added.
- 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
- updateDefaultPath(new_base_path)[source]
Updates the default path for the project.
- Parameters:
new_base_path (str) – The new base path for the project
- initData()[source]
Initializes the data as a pandas DataFrame with an index name and calculates the Annuität.
- Returns:
DataFrame with infrastructure costs and calculated annuity values
- Return type:
pd.DataFrame
- createMainScrollArea()[source]
Creates the main scroll area for the tab and sets it to take full width and height.
- createMainLayout()[source]
Creates the main layout for the tab with adjusted spacing and margins for better alignment.
- Returns:
The main layout for the tab
- Return type:
QVBoxLayout
- addLabel(text)[source]
Adds a label to the main layout.
- Parameters:
text (str) – The text for the label
- updateInfrastructureTable()[source]
Updates the infrastructure costs table with data from the DataFrame. Ensures proper formatting and correct handling of indices.
- format_cost(value)[source]
Formats the cost value in European style with spaces as thousand separators.
- updateDataFromTable(item)[source]
Updates the DataFrame with values from the QTableWidget and recalculates Annuität.
- Parameters:
item (QTableWidgetItem) – The changed table item
- addRow()[source]
Adds a new row to the table and DataFrame, with default values and calculated Annuität. The new row is added above the summary row.
- openHeaderContextMenu(position)[source]
Opens the context menu for the vertical header.
- Parameters:
position (QPoint) – The position where the context menu should be opened
- renameHeader(row)[source]
Renames the header item at the specified row.
- Parameters:
row (int) – The row index of the header item to rename
- calc_annuität(A0, TN, f_Inst, f_W_Insp, Bedienaufwand)[source]
Calculates the annuity for a given set of parameters.
- berechneWaermenetzKosten()[source]
Opens the dialog to calculate the cost of the heating network and updates the table.
- berechneHausanschlussKosten()[source]
Opens the dialog to calculate the cost of house connection stations and updates the table.
- updateTechDataTable(tech_objects)[source]
Updates the technology data table with the given technology objects.
- Parameters:
tech_objects (list) – List of technology objects
- updateSumLabel()[source]
Updates the label displaying the total costs using the summary row from the DataFrame.
- addFigure()[source]
Creates and returns a new figure and its canvas.
- Returns:
The figure and canvas
- Return type:
- plotCostComposition()[source]
Plots the cost composition with two separate figures: a bar chart and a pie chart. Clears the diagrams before replotting.
Calculate Energy System Thread Module
- author:
Dipl.-Ing. (FH) Jonas Pfeiffer
Thread for calculating heat generation mix in district heating simulation, running calculations in a separate thread.
- class districtheatingsim.gui.EnergySystemTab._06_calculate_energy_system_thread.CalculateEnergySystemThread(energy_system, optimize, weights)[source]
Bases:
QThreadThread for calculating heat generation mix.
- Signal calculation_done:
Emitted when calculation is done.
- Signal calculation_error:
Emitted when error occurs during calculation.
- 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
Results Tab Module
- author:
Dipl.-Ing. (FH) Jonas Pfeiffer
Displaying results of energy system calculations with diagrams and tables, including stack plots, pie charts, and result tables.
- class districtheatingsim.gui.EnergySystemTab._07_results_tab.ResultsTab(data_manager, parent=None)[source]
Bases:
QWidgetA QWidget subclass representing the ResultsTab.
- data_added
A signal that emits data as an object.
- Type:
pyqtSignal
- data_manager
An instance of the DataManager class for managing data.
- Type:
- parent
The parent widget.
- Type:
QWidget
- 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__(data_manager, parent=None)[source]
Initializes the ResultsTab.
- Parameters:
data_manager (DataManager) – The data manager
parent (QWidget or None) – The parent widget
- updateDefaultPath(new_base_path)[source]
Updates the default base path.
- Parameters:
new_base_path (str) – The new base path
- setupCollapsibleResultsSections()[source]
Sets up the collapsible sections for displaying results tables.
- setupResultsTable()[source]
Sets up the results table with additional columns for operational hours and starts.
- adjustTableSize(table)[source]
Adjusts the size of the table to fit its contents.
- Parameters:
table (QTableWidget) – The table to adjust
- updateResults(energy_system)[source]
Updates the results in the ResultsTab.
- Parameters:
energy_system (EnergySystem) – The energy system instance containing results
- showResultsInTable()[source]
Displays the results in the results table, including calculated operational metrics. Resets the table rows before populating to avoid leftover rows from previous calculations.
Sensitivity Tab Module
- author:
Dipl.-Ing. (FH) Jonas Pfeiffer
Performing sensitivity analysis on heat generation costs based on varying parameters, with 3D visualization.
- class districtheatingsim.gui.EnergySystemTab._08_sensitivity_tab.SensitivityTab(data_manager, parent=None)[source]
Bases:
QWidgetA QWidget subclass representing the SensitivityTab.
- data_added
A signal that emits data as an object.
- Type:
pyqtSignal
- data_manager
An instance of the DataManager class for managing data.
- Type:
- parent
The parent widget.
- Type:
QWidget
- 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__(data_manager, parent=None)[source]
Initializes the SensitivityTab.
- Parameters:
data_manager (DataManager) – The data manager
parent (QWidget or None) – The parent widget
- updateDefaultPath(new_base_path)[source]
Updates the default base path.
- Parameters:
new_base_path (str) – The new base path
- createRangeInputField(label_text, unit_text, ll=10, ul=50, nP=5)[source]
Creates a range input field for sensitivity analysis.
- parse_range(layout)[source]
Parses the range input fields and returns the range values.
- Parameters:
layout (QVBoxLayout) – The layout containing the input fields
- Returns:
The lower limit, upper limit, and number of points if valid, otherwise None
- Return type:
tuple or None
Sankey Dialog Module
- author:
Dipl.-Ing. (FH) Jonas Pfeiffer
Displaying Sankey diagram using Plotly to visualize energy flows in district heating systems.
- class districtheatingsim.gui.EnergySystemTab._09_sankey_dialog.SankeyDialog(results=None, parent=None)[source]
Bases:
QDialogDialog to display a Sankey diagram using Plotly in a QWebEngineView.
Energy System Tab Utilities Module
- author:
Dipl.-Ing. (FH) Jonas Pfeiffer
Utility classes for Energy System Tab, including collapsible sections, checkable combo boxes, and custom JSON encoding.
- class districtheatingsim.gui.EnergySystemTab._10_utilities.CheckableComboBox(parent=None)[source]
Bases:
QComboBoxCombo box that allows multiple items to be checked.
- __init__(parent=None)[source]
Initialize the CheckableComboBox.
- Parameters:
parent (QWidget) – Parent widget.
- handleItemPressed(index)[source]
Handle item pressed event to toggle check state.
- Parameters:
index (QModelIndex) – Index of the pressed item.
- addItem(text, data=None)[source]
Add item to combo box.
- Parameters:
text (str) – Item text.
data (Any) – Associated data.
- addItems(texts)[source]
Add multiple items to combo box.
- Parameters:
texts (list) – List of item texts to add.
- class districtheatingsim.gui.EnergySystemTab._10_utilities.CollapsibleHeader(title, content_widget)[source]
Bases:
QWidget
- class districtheatingsim.gui.EnergySystemTab._10_utilities.CustomJSONEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]
Bases:
JSONEncoderCustom JSON Encoder for handling numpy arrays, pandas DataFrames, and custom objects.
- default(obj)[source]
Implement this method in a subclass such that it returns a serializable object for
o, or calls the base implementation (to raise aTypeError).For example, to support arbitrary iterators, you could implement default like this:
def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return super().default(o)
Generator Schematic Module
- author:
Dipl.-Ing. (FH) Jonas Pfeiffer
Custom QGraphicsScene and QGraphicsView for generator schematic editor with custom items and connections.
- class districtheatingsim.gui.EnergySystemTab._11_generator_schematic.CustomGraphicsView(scene)[source]
Bases:
QGraphicsView- resizeEvent(event)[source]
Ensures the scene fits into the view whenever the window is resized.
- Parameters:
event (QResizeEvent) – The resize event
- wheelEvent(event)[source]
Handles zooming with mouse wheel.
- Parameters:
event (QWheelEvent) – The wheel event
- class districtheatingsim.gui.EnergySystemTab._11_generator_schematic.CustomGraphicsScene(x, y, width, height, parent=None)[source]
Bases:
QGraphicsScene- mouse_position_changed
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
- class districtheatingsim.gui.EnergySystemTab._11_generator_schematic.SchematicScene(width, height, parent=None)[source]
Bases:
CustomGraphicsScene- GRID_SIZE = 1
- GENERATOR_SPACING = 100
- GENERATOR_SPACING_STORAGE = 100
- LINE_Y_OFFSET_GENERATOR = 100
- GENERATOR_X_START = 20
- LINE_THICKNESS = 3
- FLOW_LINE_COLOR = 7
- RETURN_LINE_COLOR = 9
- TEXT_FONT = <PyQt6.QtGui.QFont object>
- OBJECTS = {'Aqva Heat Pump': {'color': <PyQt6.QtGui.QColor object>, 'counter': 0, 'geometry': PyQt6.QtCore.QRectF(-25.0, -25.0, 50.0, 50.0), 'shape': 'rect'}, 'Biomass Boiler': {'color': <PyQt6.QtGui.QColor object>, 'counter': 0, 'geometry': PyQt6.QtCore.QRectF(-25.0, -20.0, 50.0, 40.0), 'shape': 'rect'}, 'CHP': {'color': <PyQt6.QtGui.QColor object>, 'counter': 0, 'geometry': PyQt6.QtCore.QRectF(-30.0, -15.0, 60.0, 30.0), 'shape': 'rect'}, 'Consumer': {'color': <PyQt6.QtGui.QColor object>, 'counter': 0, 'geometry': PyQt6.QtCore.QRectF(-30.0, -15.0, 60.0, 30.0), 'shape': 'rect'}, 'Gas Boiler': {'color': <PyQt6.QtGui.QColor object>, 'counter': 0, 'geometry': PyQt6.QtCore.QRectF(-25.0, -25.0, 50.0, 50.0), 'shape': 'rect'}, 'Geothermal Heat Pump': {'color': <PyQt6.QtGui.QColor object>, 'counter': 0, 'geometry': PyQt6.QtCore.QRectF(-25.0, -25.0, 50.0, 50.0), 'shape': 'rect'}, 'Power-to-Heat': {'color': <PyQt6.QtGui.QColor object>, 'counter': 0, 'geometry': PyQt6.QtCore.QRectF(-25.0, -25.0, 50.0, 50.0), 'shape': 'rect'}, 'River Heat Pump': {'color': <PyQt6.QtGui.QColor object>, 'counter': 0, 'geometry': PyQt6.QtCore.QRectF(-25.0, -25.0, 50.0, 50.0), 'shape': 'rect'}, 'Seasonal Thermal Storage': {'color': <PyQt6.QtGui.QColor object>, 'counter': 0, 'geometry': PyQt6.QtCore.QRectF(-30.0, -20.0, 60.0, 40.0), 'shape': 'trapezoid'}, 'Solar': {'color': <PyQt6.QtGui.QColor object>, 'counter': 0, 'geometry': PyQt6.QtCore.QRectF(-20.0, -20.0, 40.0, 40.0), 'shape': 'circle'}, 'Storage': {'color': <PyQt6.QtGui.QColor object>, 'counter': 0, 'geometry': PyQt6.QtCore.QRectF(-20.0, -40.0, 40.0, 80.0), 'shape': 'rect'}, 'Waste Heat Pump': {'color': <PyQt6.QtGui.QColor object>, 'counter': 0, 'geometry': PyQt6.QtCore.QRectF(-25.0, -25.0, 50.0, 50.0), 'shape': 'rect'}, 'Wood-CHP': {'color': <PyQt6.QtGui.QColor object>, 'counter': 0, 'geometry': PyQt6.QtCore.QRectF(-30.0, -20.0, 60.0, 40.0), 'shape': 'rect'}}
- update_scene_size()[source]
Updates the scene size dynamically based on the positions of all items.
- update_selected_item()[source]
Updates the selected object when the selection in the scene changes.
- snap_to_grid(position)[source]
Snaps the given position to the nearest grid point.
- Parameters:
position (QPointF) – The position to snap
- Returns:
The snapped position
- Return type:
QPointF
- create_parallel_lines()[source]
Creates or updates the parallel Vorlauf (red) and Rücklauf (blue) lines and adds labels.
- update_parallel_labels(start_x, end_x)[source]
Updates the labels for the Vorlauf and Rücklauf lines dynamically.
- add_generator(item_type, item_name, connect_to_lines=True)[source]
Adds a generator at a fixed position and optionally connects it to the parallel lines.
- Parameters:
- Returns:
The created generator component
- Return type:
- add_storage(position, item_type='Storage', item_name='Speicher')[source]
Helper function to create and add a storage unit with custom geometry.
- Parameters:
- Returns:
The created storage component
- Return type:
- add_generator_with_storage(item_name, name)[source]
Adds a generator and a storage unit, connecting them and the storage to the consumer.
- Parameters:
- Returns:
The created generator component
- Return type:
- add_consumer_net(item_type, item_name='Wärmenetz', connect_to_lines=False)[source]
Adds the consumer (network).
- add_seasonal_storage(item_type='Saisonaler Wärmespeicher', item_name='Speicher', connect_to_lines=True)[source]
Adds a seasonal storage unit at a fixed position and optionally connects it to the parallel lines.
- Parameters:
- Returns:
The created storage component
- Return type:
- check_label_collision(new_label_rect)[source]
Checks if a new label would collide with existing component labels.
- Parameters:
new_label_rect (QRectF) – Rectangle of the new label
- Returns:
True if collision detected, False otherwise
- Return type:
- find_optimal_label_position(item, label)[source]
Finds optimal position for label to avoid collisions.
- Parameters:
item (ComponentItem) – The component item
label (QGraphicsTextItem) – The label to position
- Returns:
The optimal position
- Return type:
QPointF
- update_all_label_positions()[source]
Updates positions of all component labels to avoid collisions.
- update_label(item, new_text)[source]
Updates the label of a given item with new text.
- Parameters:
item (ComponentItem) – The component item
new_text (str) – The new label text
- connect_generator_to_storage(generator, storage)[source]
Connects two items (generator, storage, or consumer) using their connection points.
- Parameters:
generator (ComponentItem) – The generator component
storage (ComponentItem) – The storage component
- connect_items_to_lines(component, is_storage=False)[source]
Connects a component to the parallel Vorlauf (red) and Rücklauf (blue) lines.
- Parameters:
component (ComponentItem) – The component to connect
is_storage (bool) – Whether the component is a storage unit
- add_component(item_name, name, storage=False)[source]
Adds a component (generator or storage) to the scene.
- delete_selected()[source]
Deletes the selected component, ensuring that connected generators and storage are deleted together.
- delete_all()[source]
Deletes all components, pipes, and resets all counters except for the consumer and its connections.
- is_connected_to_consumer(item)[source]
Helper method to check if a pipe is connected to the consumer.
- find_linked_generator(storage)[source]
Finds the generator linked to the given storage unit.
- Parameters:
storage (ComponentItem) – The storage component
- Returns:
The linked generator or None
- Return type:
ComponentItem or None
- find_linked_storage(generator)[source]
Finds the storage unit linked to the given generator.
- Parameters:
generator (ComponentItem) – The generator component
- Returns:
The linked storage or None
- Return type:
ComponentItem or None
- class districtheatingsim.gui.EnergySystemTab._11_generator_schematic.ComponentItem(position, item_type, item_name, color, geometry, flow_line_color=GlobalColor.red, return_line_color=GlobalColor.blue)[source]
Bases:
QGraphicsItem- __init__(position, item_type, item_name, color, geometry, flow_line_color=GlobalColor.red, return_line_color=GlobalColor.blue)[source]
Creates a general visual representation of a component.
- Parameters:
position (QPointF) – The position of the component
item_type (str) – Type of component
item_name (str) – Name of the component
color (QColor) – Color of the component
geometry (QRectF) – Geometry of the component
flow_line_color (Qt.GlobalColor) – Color for flow line
return_line_color (Qt.GlobalColor) – Color for return line
- create_connection_points()[source]
Create connection points (ports) for the item based on the shape.
- class districtheatingsim.gui.EnergySystemTab._11_generator_schematic.ConnectionPoint(parent, x_offset, y_offset, direction, color)[source]
Bases:
QGraphicsLineItem- __init__(parent, x_offset, y_offset, direction, color)[source]
Create a connection point as a short line extending from the parent item.
- class districtheatingsim.gui.EnergySystemTab._11_generator_schematic.Pipe(point1, point2, color, line_thickness)[source]
Bases:
QGraphicsPathItem- __init__(point1, point2, color, line_thickness)[source]
Create a flexible pipe (supply/return) between component and parallel lines