ensemble.tools package¶
Submodules¶
ensemble.tools.checkers module¶
Check module¶
This module contains functions to check
- ensemble.tools.checkers.check_library_path(library_path: str, simulation_platform: str)[source]¶
Returns true if platform is available
ensemble.tools.connector_configurator module¶
This module contains a base configurator to support methods and properties for the connector particularly tied to the ENSEMBLE project.
ensemble.tools.constants module¶
Constants module¶
This module contains a constants and default parameters. These parameters can be accessed at any time by whatever of the modules.
Some of the values here will be used to parametrize simulations to multiple platforms and some for specific ones. Specific zones within the source code have been marked to place the corresponding constant values. Please, use uppercase letters for defining new constant values.
- Example:
To use the
Constants
import the module as:>>> import ensemble.tools.constants as ct >>> ct.BUFFER_STRING # access the buffer size
Variable
Description
BUFFER_STRING
Buffer size
DEFAULT_PATH_SYMUFLOW
Default Path Towards SymuVia
DEFAULT_LIB_OSX
Default OS X library path (SymuVia)
DEFAULT_LIB_LINUX
Default Linux library path (SymuVia)
DEFAULT_LIB_WINDOWS
Default Windows library path (Vissim)
DCT_SIMULATORS
Simulator according to SO
DCT_DEFAULT_PATHS
Available combinations SO/simulator
DCT_RUNTIME_PARAM
Runtime default parameters
DCT_VEH_PARAM
Vehicle default parameters
DCT_VEH_DATA
Vehicle data default parameters
DCT_PLT_DATA
Platoon parameters
DCT_LIB_CACC
Default CACC library path
FIELD_DATA
Vehicle trajectory data
FIELD_FORMAT
Trajectory data types
HOUR_FORMAT
Time format
FIELD_FORMATAGG
Format aggretations
DCT_SIMULATION_INFO`
XML Simulation information
DCT_EXPORT_INFO
XML Export information
DCT_TRAFIC_INFO
XML Traffic information
DCT_NETWORK_INFO
XML Network information
DCT_SCENARIO_INFO
XML Scenario information
TP_VEHTYPES
Vehicle type information
TP_ACCEL
Vehicle acceleration boundaries
ensemble.tools.decorators module¶
Decorator utilities¶
This module contains a series of decorators in order to add logging functionalities to some of the class methods. The decorators are regularly purposed for logging, printing, neutering funcitons. etc.
- ensemble.tools.decorators.conditional(cond: bool, warning: str = '') Callable [source]¶
Disables the execution of the decorated method/function
- Parameters
cond (bool) – Flag to execute
warning (str, optional) – Warning to login. Defaults to “”.
- Returns
Wrapped method
- Return type
Callable
- ensemble.tools.decorators.logger_func(orig_func: Callable)[source]¶
Logs execution of a function/method and arguments into a file called with the function name
- Parameters
orig_func (Callable) – A function/method to be logged
- Returns
Wrapped method after log
- Return type
(Callable)
- ensemble.tools.decorators.printer_time(orig_func: Callable) Callable [source]¶
Prints in terminal the current time step of a simulation.
- Parameters
orig_func (Callable) – Connector class containing the simulationstep status via an attribute. Decorated method is run_step
- Returns
Wrapped step execution
- Return type
Callable
ensemble.tools.exceptions module¶
A module containing basic exception handlers for better error detection
- exception ensemble.tools.exceptions.EnsembleAPIError(error_message: str, target_dir: str = '')[source]¶
Bases:
Exception
- property get_messsage: str¶
- property target_dir: str¶
- exception ensemble.tools.exceptions.EnsembleAPILoadFileError(error_message: str, target_dir: str = '')[source]¶
ensemble.tools.geometry module¶
Auxiliary geometry¶
ensemble.tools.screen module¶
Module to log on screen¶
- ensemble.tools.screen.log_error(message, *args, **kwargs) None [source]¶
Logs an error message in red
- ensemble.tools.screen.log_in_terminal(message: str, *args, **kwargs) None [source]¶
This function logs in the terminal a message with a specific color
- Parameters
message (str) – Message to log on the console
foreground (str) – Foreground color see click.style for options
- ensemble.tools.screen.log_success(message, *args, **kwargs) None [source]¶
Logs a success message in green