topotherm.simultaneity
Calculate the simultaneity factor of a given graph of the optimal district heating network.
Functions
|
Calculate the simultaneity factor of a given graph of the optimal district |
|
Compute the Laplacian matrix of a given graph. |
|
Resolve loops in the graph and update the Laplacian matrix accordingly. |
|
Resolves multiple incoming connections for nodes in a directed graph by propagating 'connections' attributes |
|
Identify and mark end consumers in the graph based on the Laplacian matrix. |
Calculate the simultaneity factor for edges in the graph. |
|
|
Update the edge and node data with simultaneity attributes. |
Module Contents
- topotherm.simultaneity.calculate(graph)[source]
Calculate the simultaneity factor of a given graph of the optimal district heating network.
- Args:
graph: A NetworkX graph object representing the network.
- Returns:
nx.DiGraph: A graph containing the simultaneity factors of the graph in the attribute ‘simultaneity’.
- Parameters:
graph (networkx.DiGraph)
- Return type:
networkx.DiGraph
- topotherm.simultaneity.compute_laplacian(graph)[source]
Compute the Laplacian matrix of a given graph.
- Args:
graph: A NetworkX graph object of the solved network connections.
- Returns:
pd.DataFrame: A pandas DataFrame representing the Laplacian matrix.
- Parameters:
graph (networkx.DiGraph)
- Return type:
numpy.array
- topotherm.simultaneity.resolve_loops(graph, laplace)[source]
Resolve loops in the graph and update the Laplacian matrix accordingly.
- Args:
graph: A NetworkX graph object. laplace: The Laplacian matrix of the graph.
- Returns:
A tuple containing the updated graph and Laplacian matrix.
- Parameters:
graph (networkx.DiGraph)
laplace (pandas.DataFrame)
- Return type:
tuple[networkx.DiGraph, numpy.array]
- topotherm.simultaneity.resolve_multi_connections(G_copy, laplace)[source]
Resolves multiple incoming connections for nodes in a directed graph by propagating ‘connections’ attributes and updating the Laplacian matrix accordingly.
Parameters: G_copy: A copy of the directed graph from the previous step. laplace: The Laplacian matrix to be updated.
Returns: laplace: Updated Laplacian matrix with modified diagonal elements.
- Parameters:
G_copy (networkx.DiGraph)
laplace (numpy.array)
- Return type:
numpy.array
- topotherm.simultaneity.get_n_end_consumers(graph, laplace)[source]
Identify and mark end consumers in the graph based on the Laplacian matrix.
- Args:
graph: A NetworkX graph object. laplace: The Laplacian matrix of the graph.
- Returns:
The graph with ‘n_consumers’ attributes added to nodes.
- Parameters:
graph (networkx.DiGraph)
laplace (numpy.array)
- Return type:
networkx.DiGraph
- topotherm.simultaneity.calculate_simultaneity_factor(graph)[source]
Calculate the simultaneity factor for edges in the graph.
- Args:
graph: A NetworkX graph object with number of end consumers marked as n_consumers attributes.
- Returns:
nx.DiGraph: A graph that has edge names and values for the simultaneity factor
- Parameters:
graph (networkx.DiGraph)
- Return type:
networkx.DiGraph
- topotherm.simultaneity.update_data(df_nodes, df_edges, network)[source]
Update the edge and node data with simultaneity attributes.
- Args:
node_data: A DataFrame containing edge data. edge_data: A DataFrame containing node data. network_simultaneity: A NetworkX graph object with simultaneity factors, needs to contain power, simultaneity attributes
- Returns:
tuple[pd.DataFrame, pd.DataFrame]: Updated edge and node data DataFrames.
- Parameters:
df_nodes (pandas.DataFrame)
df_edges (pandas.DataFrame)
network (networkx.DiGraph)
- Return type:
tuple[pandas.DataFrame, pandas.DataFrame]