uesgraphs.teaser_integration.simulate

Module to control multiprocessing of simulation of TEASER buildings.

You need to set a couple of environment variables for you conda environment to use this module:

PYTHONPATH

Functions

queue_simulation(sim_function, prj[, ...])

Simulate multiple buildings in a JoinableQueue.

set_up_terminal_logger(name[, level])

Set up a simple console-only logger for small functions.

simulate(sim_part, prj, model_path, ...)

Simulate building models in serial using Dymola.

Classes

WorkerSimulation(sim_function, sim_part, ...)

Helper class to enable simulation in a JoinableQueue.

uesgraphs.teaser_integration.simulate.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.teaser_integration.simulate.WorkerSimulation(sim_function, sim_part, prj, model_path, results_path, start_time, stop_time, output_interval, method, tolerance, process_number, result_queue, aixlib_path)[source]

Helper class to enable simulation in a JoinableQueue.

This class inherits from multiprocessing.Proccess. Pass over your simulation function and all parameters that are necessary for this function.

Parameters:
  • sim_function (simulate() function) –

  • sim_part (Django QuerySet, NumPy Array or any other iterable) – Iterable collection of BuildingEnergy objects

  • prj (Scenario instance) – Scenario instance of the buildings that are simulated. Please ensure if you are using multiprocessing that all buildings are within the same prj.

  • model_path (str) – Path where Modelica model from TEASER is located. This is TEASER output path.

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

  • start_time (int) – Start time of the simulation

  • stop_time (int) – Stop time of the simulation

  • output_interval (int) – Output interval of the simulation

  • solver (string) – Used solver in Dymola. All Dymola solvers are supported(default: ‘Dassl’

  • tolerance (float) – Tolerance of used solver

  • process_number (int) – Counter of parallel processes, if multiprocessing is used. Default is None which indicates that no multuprocessing is used. Otherwise please set an individual number for every process that is used.

  • result_queue (multiprocessing.JoinableQueue()) – JoinableQueue instance for each worker.

__init__(sim_function, sim_part, prj, model_path, results_path, start_time, stop_time, output_interval, method, tolerance, process_number, result_queue, aixlib_path)[source]

Init function of WorkerSimulation.

run()[source]

Run the specified simulation function with all parameters.

uesgraphs.teaser_integration.simulate.simulate(sim_part, prj, model_path, results_path, start_time, stop_time, output_interval, method, tolerance, process_number, aixlib_path)[source]

Simulate building models in serial using Dymola.

This function simulates all buidlings given in the building_query_set in serial(one after another). This function can be used for parallel processing of simulation. There are no default values because it caused trouble with multiprocessing.

Note: Please ensure that for all buildings corresponding models have been generated. Also ensure that all models are within the same prj, otherwise this will neither work for single nor for multiprocessing.

Parameters:
  • sim_part (any iterable) – Iterable collection of Building objects

  • prj (Scenario instance) – Scenario instance of the buildings that are simulated. Please ensure if you are using multiprocessing that all buildings are within the same prj.

  • model_path (str) – Path where Modelica model from TEASER is located. This is TEASER output path.

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

  • start_time (int) – Start time of the simulation

  • stop_time (int) – Stop time of the simulation

  • output_interval (int) – Output interval of the simulation

  • solver (string) – Used solver in Dymola. All Dymola solvers are supported(default: ‘Dassl’

  • tolerance (float) – Tolerance of used solver

  • process_number (int) – Counter of parallel processes, if multiprocessing is used. Default is None which indicates that no multuprocessing is used. Otherwise please set an individual number for every process that is used.

uesgraphs.teaser_integration.simulate.queue_simulation(sim_function, prj, number_of_workers=3, model_path='/home/runner/TEASEROutput', results_path='/home/runner/djangoteaserout', start_time=0.0, stop_time=31532400.0, output_interval=3600.0, method='Dassl', tolerance=0.0001, aixlib_path=None)[source]

Simulate multiple buildings in a JoinableQueue.

This function simulates all buidlings given in the building_query_set. It uses JoinableQueue for multiprocessing.

Note: Please ensure that for all buildings corresponding models have been generated. Also ensure that all models are within the same prj, otherwise this will neither work for single nor for multiprocessing.

Parameters:
  • sim_function (simulate() function) –

  • prj (Scenario instance) – Scenario instance of the buildings that are simulated. Please ensure if you are using multiprocessing that all buildings are within the same prj.

  • number_of_workers (int) – Number of workers used for the simulation. (default: number of physical processors - 1)

  • model_path (str) – Path where Modelica model from TEASER is located. This is TEASER output path.

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

  • start_time (int) – Start time of the simulation

  • stop_time (int) – Stop time of the simulation

  • output_interval (int) – Output interval of the simulation

  • solver (string) – Used solver in Dymola. All Dymola solvers are supported(default: ‘Dassl’

  • tolerance (float) – Tolerance of used solver