uesgraphs.teaser_integration.utilities

This module includes TEASER for the demand estimation based on the .geojson

Functions

create_district(info_path, prj[, logger])

Create TEASER buildings using modern API, according to infos in geojson.

create_project()

Create a TEASER project for current version.

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.

read_results(prj, buildings, signals, index, ...)

Read simulation data from .mat file and save them into csv.

run_sim_teaser(buildings_info_path, save_path)

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

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.teaser_integration.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.teaser_integration.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.teaser_integration.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.teaser_integration.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.teaser_integration.utilities.create_project()[source]

Create a TEASER project for current version.

uesgraphs.teaser_integration.utilities.create_district(info_path, prj, logger=None)[source]

Create TEASER buildings using modern API, according to infos in geojson.

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

  • district_name (string) – Name of district

  • prj (TEASER project) – Project class where buildings should be added to.

uesgraphs.teaser_integration.utilities.read_results(prj, buildings, signals, index, stop_time, timestep, results_path=None, csv_path=None, indoor_air=False, logger=None)[source]

Read simulation data from .mat file and save them into csv.

Reads Dymola result files and saves them as time series in csv. Naming convention of time series follows proposed naming schema of Team GA. It assumes that all thermal_zones in PostgreSQL database are modeled as a thermal zone in Modelica. Thus this approach is not yet ready to be used with archetypes.

Parameters:
  • prj (TEASER Project() instance) – TEASER Project with all buildings that have been simulated. Names need to be identical.

  • buidlings (list) – List of buildings whose results should be read.

  • signals (list) – List of signals to be read from the results file.

  • index (Pandas date_range) – Pandas date range of the simulation data. Must fit the length of simulation data. (default: hourly for year 2015)

  • results_path (str) – Path where Dymola results are stored.

  • csv_path (str) – Path where csv results should be stored.

  • indoor_air (boolean) – If true, output csv-file contains dataframe with one column for each given signal. If false, Heater and Cooler signals are expected and seperate output csv-files are created for both signals.

uesgraphs.teaser_integration.utilities.run_sim_teaser(buildings_info_path, save_path, weather_path=None, timestep=3600, stop_time=31536000, sim_setup_path=None, logger=None, log_level=10, number_of_workers=None)[source]

Run TEASER simulations 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.

weather_pathstr, optional

The path to the weather file (.mos) to be used in the simulation. If not provided, a default weather file will be used.

timestepint, optinal

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

stop_timeint, optional

Total simulation time in seconds (default is 8760*3600 for one year of hourly data)

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

number_of_workersint, optional

Number of parallel workers for simulation. If None, it will be set to (number of CPU cores - 4) to avoid overloading the system.

Returns:

tuple

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