uesgraphs.DHW_estimation.utilities

Functions

create_profiles(info_path, timestep, ...[, ...])

Create DHW profiles according to infos in geojson.

generate_DHW_profiles_from_geojson(...[, ...])

Run OpenDHW for demand estimation based on building information from a .geojson file.

load_component_parameters(excel_path, ...)

Load component parameters from an Excel file.

load_simulation_settings_from_excel(excel_path)

Load simulation settings from Excel 'Simulation' sheet.

set_up_file_logger(name[, log_dir, level])

Set up a full file+console logger for major functions.

set_up_logger(name[, log_dir, level])

Sets up a configured logger with file handler.

uesgraphs.DHW_estimation.utilities.set_up_file_logger(name: str, log_dir: str | None = None, level: int = 40) Logger[source]

Set up a full file+console logger for major functions.

Parameters:
  • name – Logger name

  • log_dir – Directory for log files (default: temp directory)

  • level – Logging level (default: ERROR)

Returns:

Configured file+console logger

uesgraphs.DHW_estimation.utilities.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:
  • name (str) – Name of the logger, also used for filename

  • log_dir (str, optional) – Directory for log files. Defaults to None (uses temp directory)

  • level (int, optional) – Logging level (e.g. logging.ERROR, logging.INFO). Defaults to logging.ERROR

Returns:

Configured logger object

Return type:

logging.Logger

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.DHW_estimation.utilities.load_simulation_settings_from_excel(excel_path, logger=None)[source]

Load simulation settings from Excel ‘Simulation’ sheet.

Parameters:
  • excel_path (str or Path) – Path to Excel file containing simulation settings

  • logger (logging.Logger, optional) – Logger instance

Returns:

sim_params – Dictionary of simulation parameters

Return type:

dict

Raises:

ValueError – If required simulation parameters are missing

uesgraphs.DHW_estimation.utilities.load_component_parameters(excel_path, component_type)[source]

Load component parameters from an Excel file.

Reads a specific sheet from an Excel file and returns parameters as a dictionary. Expected Excel structure: - Column A: Parameter (parameter names) - Column B: Value (parameter values)

Parameters:
  • excel_path (str or Path) – Path to the Excel file containing component parameters

  • component_type (str) – Type of component, must be one of: ‘pipes’, ‘supply’, ‘demands’, ‘simulation’ This determines which sheet to read from the Excel file

Returns:

Dictionary with parameter names as keys and their values Returns empty dict if sheet not found

Return type:

dict

Raises:
  • FileNotFoundError – If the Excel file does not exist

  • ValueError – If the component_type is not valid or Excel structure is incorrect

Examples

>>> params = load_component_parameters('parameters.xlsx', 'pipes')
>>> print(params['dp_nominal'])
0.10
uesgraphs.DHW_estimation.utilities.create_profiles(info_path, timestep, mean_drawoff_vol_per_day, temp_dT_dhw, holidays=[1, 108, 111, 121, 149, 160, 276, 359, 360], logger=None)[source]

Create DHW profiles according to infos in geojson.

Parameters:
  • info_path (path) – Full path to json with building infos.

  • timestep (int) – Timestep in seconds for the generated time-series.

  • holidays (list of datetime.date, optional) – List of holiday dates to consider in the profile generation (default: German holidays for 2025).

  • mean_drawoff_vol_per_day (float) – Average drawoff volume per day in liters per occupant

  • logger (logging.Logger, optional) – Logger instance for logging progress and warnings (default: None, creates a new logger if not provided).

Returns:

DataFrame containing the generated DHW profiles for each building

Return type:

pd.DataFrame

uesgraphs.DHW_estimation.utilities.generate_DHW_profiles_from_geojson(buildings_info_path, save_path, timestep=3600, mean_drawoff_vol_per_day=40, temp_dT_dhw=35, sim_setup_path=None, logger=None, log_level=10)[source]

Run OpenDHW for demand estimation based on building information from a .geojson file.

Parameters:

buildings_info_pathstr

The path to the .geojson file containing building information for TEASER model creation.

save_pathstr or Path

Directory path where the resulting demand CSV files will be saved.

timestepint, optinal

Simulation timestep in seconds (default is 3600 for hourly data)

mean_drawoff_vol_per_dayfloat, optional

Average drawoff volume per day in liters per occupant (default is 40 L/day/occupant)

temp_dT_dhwfloat, optional

Temperature difference for Heat calculation from mass flows in K (default is 35 K)

sim_setup_pathstr or Path, optional

Path to the simulation setup for timestep and stop time. If not provided, default values will be used.

loggerlogging.Logger, optional

Logger instance. If None, creates a new file logger in temp directory

log_levelint, optional

Logging level (default is logging.DEBUG). Only used if logger is None

Returns:

tuple

Paths to the generated demand CSV files: (heating_demand_csv, cooling_demand_csv)