uesgraphs.systemmodels_pp.systemmodelheating
This module includes the uesgraph to write a pandapipes model and simulation
Functions
|
Sets up a configured logger with file handler. |
|
Set up a simple console-only logger for small functions. |
Classes
|
Writes pandapipes model for system models from uesgraphs information |
- uesgraphs.systemmodels_pp.systemmodelheating.set_up_logger(name, log_dir=None, level=40)[source]
Sets up a configured logger with file handler.
Creates a logger with specified name and logging level. Log files are stored in a directory with timestamp in filename. If no directory is specified, the system’s temporary directory is used.
- Parameters:
- Returns:
Configured logger object
- Return type:
Example
>>> logger = set_up_logger("my_app", "/var/log", logging.INFO) >>> logger.info("Application started")
Notes
Log filename format: {name}_{YYYYMMDD_HHMMSS}.log
Log entry format: time - logger_name - [file:line] - level - message
- uesgraphs.systemmodels_pp.systemmodelheating.set_up_terminal_logger(name: str, level: int = 20) Logger[source]
Set up a simple console-only logger for small functions.
- Parameters:
name – Logger name
level – Logging level (default: INFO)
- Returns:
Configured console logger
- class uesgraphs.systemmodels_pp.systemmodelheating.SystemModelHeating(stop_time, start_time, timestep, network_type='heating', logger=None)[source]
Writes pandapipes model for system models from uesgraphs information
While a uesgraph object uses edges and nodes to describe the network topology, the pandapipes model uses junctions and pipes. Therefore, each node in the uesgraph is represented by two junctions in the pandapipes model (supply and return). At the current stage, only heating networks are supported.
- graph["T_ground"]
Ground temperature in Kelvin
- Type:
- pp_network
Pandapipes network object
- Type:
pp.net
- __init__(stop_time, start_time, timestep, network_type='heating', logger=None)[source]
Constructor for UESGraph class.
- import_nodes_from_uesgraph(uesgraph_input, logger=None)[source]
Imports nodes from UESGraph into pandapipes junctions.
- Parameters:
uesgraph_input (uesgraphs.uesgraph.UESGraph object) – At current stage, this uesgraph should contain only 1 network of 1 type that is indexed in the corrsponding nodelist as ‘default’
logger (logging.Logger, optional) – Logger instance for debugging
- Returns:
Tuple containing: - junction_ids: Mapping of uesgraph node IDs to pandapipes junction IDs - heat_source_id: ID of the heat source junction - heat_source_r_id: ID of the heat source return junction
- Return type:
- import_edges_from_uesgraph(uesgraph_input, junction_ids, logger=None)[source]
Imports edges from UESGraph into pandapipes pipes.
- Parameters:
uesgraph_input (uesgraphs.uesgraph.UESGraph object) – At current stage, this uesgraph should contain only 1 network of 1 type that is indexed in the corrsponding nodelist as ‘default’
junction_ids (dict) – Mapping of uesgraph node IDs to pandapipes junction IDs
logger (logging.Logger, optional) – Logger instance for debugging
- Returns:
Tuple containing: - pipe_list: List of pipes with their details
- Return type:
- import_from_uesgraph(uesgraph_input, logger=None)[source]
Imports full UESGraph into pandapipes model.
- Parameters:
uesgraph_input (uesgraphs.uesgraph.UESGraph object) – At current stage, this uesgraph should contain only 1 network of 1 type that is indexed in the corrsponding nodelist as ‘default’
logger (logging.Logger, optional) – Logger instance for debugging
- Returns:
Tuple containing: - junction_ids: Mapping of uesgraph node IDs to pandapipes junction IDs - pipe_list: List of pipes with their details - heat_source_id: ID of the heat source junction - heat_source_r_id: ID of the heat source return junction
- Return type:
- find_pipe_parameter(inner_diameter: float)[source]
Finds the insulation thickness for a given inner diameter of the pipe.
Uses a lookup table based on standard district heating pipe dimensions for insulation class 3 according to district heating planning handbook.
- Parameters:
(float) (inner_diameter) –
- Returns:
Tuple[float, float]
- Return type:
Inner diameter in meters, insulation thickness in meters
Note
If the exact pipe diameter is not in the reference table, the closest size will be selected.
- estimate_xi(l_pipe: float)[source]
Estimates the total loss coefficient for a pipe based on its length.
Calculates pressure losses from: - 90° elbows (approx. every 25m a U-form with 4x90° elbows) - Tee junctions (flow separation and association at ends) - Installed slide valves
- Parameters:
l_pipe (float) – Length of the pipe in meters
- Returns:
float
- Return type:
Total loss coefficient (xi) for the pipe
References
Horlacher2016, Rohrleitungen 2 (S.519-521)
Boehmer Fernwärme documentation (S.46)
- run_test_simulation(logger=None)[source]
Does a test simulation of the pandapipes network to check if it runs without errors.
- Parameters:
logger (logging.Logger, optional) – Logger instance for debugging
- Raises:
Exception – If the test simulation fails
- calculate_temperature_pipe_profile_implicit(T_in, T_prev, mdot, cp, alpha, d_in, T_ground, dx, dt, rho, sections)[source]
This function calculates with an implicit euler scheme the temperature distribution within one pipe.
- Parameters:
(float) (rho) –
(list) (T_prev) –
(float) –
(float) –
(float) –
(float) –
(float) –
(float) –
(float) –
(float) –
(int) (sections) –
- Returns:
list
- Return type:
Temperature distrubtion list in the pipe for the next time step
- mix_junction_temperatures(pp_network, pipe_temp_history, pipe_subset, logger=None)[source]
This function calculates a mixing temperature if two pipes flow into one pipe.
- run_timeseries_dpp(pipe_list, heat_source_ids, heat_source_r_ids, save_at, logger=None)[source]
This function runs the dynamic simulation of the pandapipes network and logs the results.
- Parameters:
pipe_list (list) – List of pipes with their details
heat_source_ids (list) – List of heat source junction IDs
heat_source_r_ids (list) – List of heat source return junction IDs
save_at (str) – Folder path to save the results
logger (logging.Logger, optional) – Logger instance for debugging
- Return type:
—
- resample_profile_constant(df, factor)[source]
duplicate each row in the dataframe factor times to resample the profile with a constant value.
df: DataFrame with timesteps as index factor: int, number of times each row should be duplicated
- run_timeseries_spp(save_at, mode, logger=None)[source]
Does timeseries calculation of the pandapipes network and saves the results in save_at.
- Parameters:
save_at (str) – Path where the results will be saved
mode (str) – Mode of the simulation, either “static” for static simulation or “transient” for transient pandapipes simulation.
logger (logging.Logger, optional) – Logger instance for debugging
- Raises:
Exception – If the timeseries simulation fails