bim2sim package

bim2sim library

bim2sim.run_project(project: Project, handler: DecisionHandler)

Run project using decision handler.

Subpackages

Submodules

bim2sim.project module

Project handling

class bim2sim.project.FolderStructure(path=None)

Bases: object

Project related file and folder handling.

CONFIG = 'config.toml'
DECISIONS = 'decisions.json'
EXPORT = 'export'
FINDER = 'finder'
IFC_BASE = 'ifc'
LOG = 'log'
property assets
property b2sroot

absolute path of bim2sim root folder

complete_project_folder()

Adds missing sub folders to given path

property config

absolute path to config

copy_assets(path)

copy assets to project folder

classmethod create(rootpath: str, ifc_paths: Dict | None = None, target: str | None = None, open_conf: bool = False)

Create ProjectFolder and set it up.

Create instance, set source path, create project folder copy ifc, base config setup and open config if needed.

Args:

rootpath: path of root folder ifc_paths: dict with key: bim2sim domain and value: path

to corresponding ifc which gets copied into project folder

target: the target simulation tool open_conf: flag to open the config file in default application

create_project_folder()

Creates a project folder on given path

property decisions

absolute path to decisions

delete(confirm=True)

Delete project folder and all files in it.

Raises:

AssertionError: if not existing on file system

property enrichment
property export

absolute path to export folder

property finder

absolute path to finder

property ifc_base

absolute path to ifc folder

is_project_folder(path=None)

Check if root path (or given path) is a project folder

property log

absolute path to log folder

property root

absolute root path

property sub_dirs

list of paths to sub folders

class bim2sim.project.Project(path: str | None = None, plugin: Type[Plugin] | None = None)

Bases: object

Project resource handling.

Args:

path: path to load project from plugin: Plugin to use. This overwrites plugin from config.

Raises:

AssertionError: on invalid path. E.g. if not existing

property config

returns configparser instance. Basic config is done if file is not present

classmethod create(project_folder, ifc_paths: Dict | None = None, plugin: str | Type[Plugin] | None = None, open_conf: bool = False)

Create new project

Args:

project_folder: directory of project ifc_paths: dict with key: IFCDomain and value: path

to corresponding ifc which gets copied into project folder

plugin: Plugin to use with this project. If passed as string,

make sure it is importable (see plugins.load_plugin)

open_conf: flag to open the config file in default application updated from config

delete()

Delete the project.

finalize(success=False)

cleanup method

formatter = <bim2sim.kernel.log.CustomFormatter object>
is_active() bool

Return True if current project is active, False otherwise.

static is_project_folder(path: str) bool
reset()

Reset the current project.

rewrite_config()
run(interactive=False, cleanup=True)

Run project.

Args:
interactive: if True the Task execution order is determined by

Decisions else its derived by plugin

cleanup: execute cleanup logic. Not doing this is only relevant for

debugging

Raises:

AssertionError: if project setup is broken or on invalid Decisions

set_user_logging_handler(user_handler: Handler, set_formatter=True)

Set a project specific logging Handler for user loggers.

Args:

user_handler: the handler instance to use for this project set_formatter: if True, the user_handlers formatter is set

bim2sim.project.add_config_section(config: ConfigParser, sim_settings: BaseSimSettings, name: str) ConfigParser

Add a section to config with all attributes and default values.

bim2sim.project.config_base_setup(path, backend=None)

Initial setup for config file

bim2sim.project.open_config(path)

Open config for user and wait for closing before continue.

bim2sim.sim_settings module

Module for defining simulation model specific process settings. This targets both, settings to set for the later simulation and settings for the model generation process in bim2sim.

class bim2sim.sim_settings.AutoSettingNameMeta(name, bases, namespace)

Bases: type

Adds the name to every SimulationSetting attribute based on its instance name.

This makes the definition of an extra attribute ‘name’ obsolete, as the attributes ‘name’ is automatic defined based on the instance name.

Example:
>>> # create new simulation settings for your awesome simulation
>>> class MyAwesomeSimulationSettings(BaseSimSettings):
...     def __init__(self):
...         super().__init__()
>>> # create a new simulation setting, name will be taken automatic from
>>> # instance name
>>> make_simulation_extra_fast = Setting(
...     default=True,
...     choices={
    ...         True: 'This simulation will be incredible fast.',
    ...         False: 'This simulation will be increbdile slow.'
    ...     },
    ...     description='Run the simulation in extra fast mode?',
    ...     for_frontend=True
    ... )
>>> # create a SimulationSettings instance and get the value
>>> my_awesome_settings = MyAwesomeSimulationSettings()
>>> # get initial value which is always none
>>> print(my_awesome_settings.make_simulation_extra_fast)
None
>>> # set default values and get the value
>>> my_awesome_settings.load_default_settings()
>>> print(my_awesome_settings.make_simulation_extra_fast)
True
class bim2sim.sim_settings.BaseSimSettings(filters: list | None = None)

Bases: object

Specification of basic bim2sim simulation settings which are common for all simulations

add_space_boundaries
check_mandatory()

Check if mandatory settings have a value.

close_space_boundary_gaps
correct_space_boundaries
create_external_elements
dymola_simulation
fuzzy_threshold
group_unidentified
load_default_settings()

loads default values for all settings

max_wall_thickness
reset_guids
update_from_config(config)

Updates the simulation settings specification from the config file

weather_file_path
class bim2sim.sim_settings.BooleanSetting(default=None, description: str | None = None, for_frontend: bool = False, any_string: bool = False, mandatory=False)

Bases: Setting

check_value(bound_simulation_settings, value)

Checks the value that should be set for correctness

Args:

bound_simulation_settings: the sim setting belonging to the value value: value that should be checked for correctness

Returns:

True: if check was successful

Raises:

ValueError: if check was not successful

class bim2sim.sim_settings.BuildingSimSettings

Bases: BaseSimSettings

add_shadings
add_space_boundaries
close_space_boundary_gaps
construction_class_walls
construction_class_windows
cooling
correct_space_boundaries
create_plots
deactivate_ahu
fix_type_mismatches_with_sb
heating
layers_and_materials
plot_singe_zone_guid
prj_custom_usages
prj_use_conditions
run_period_end_day
run_period_end_month
run_period_start_day
run_period_start_month
set_run_period
setpoints_from_template
sim_results
split_bounds
split_shadings
year_of_construction_overwrite
class bim2sim.sim_settings.ChoiceSetting(default=None, description: str | None = None, for_frontend: bool = False, any_string: bool = False, choices: dict | None = None, multiple_choice: bool = False)

Bases: Setting

check_setting_config()

make sure str choices don’t hold ‘.’ as this is seperator for enums.

check_value(bound_simulation_settings, value)

Checks the value that should be set for correctness

Checks if the selected value is in choices. Args:

bound_simulation_settings: the sim setting belonging to the value value: value that should be checked for correctness

Returns:

True: if check was successful

Raises:

ValueError: if check was not successful

class bim2sim.sim_settings.NumberSetting(default=None, description: str | None = None, for_frontend: bool = False, any_string: bool = False, min_value: float | None = None, max_value: float | None = None)

Bases: Setting

check_setting_config()

Make sure min and max values are reasonable

check_value(bound_simulation_settings, value)

Checks the value that should be set for correctness

Checks if value is in limits. Args:

bound_simulation_settings: the sim setting belonging to the value value: value that should be checked for correctness

Returns:

True: if check was successful

Raises:

ValueError: if check was not successful

class bim2sim.sim_settings.PathSetting(default=None, description: str | None = None, for_frontend: bool = False, any_string: bool = False, mandatory=False)

Bases: Setting

check_value(bound_simulation_settings, value)

Checks the value that should be set for correctness

Checks if the value is a valid path Args:

bound_simulation_settings: the sim setting belonging to the value value: value that should be checked for correctness

Returns:

True: if check was successful

Raises:

ValueError: if check was not successful

class bim2sim.sim_settings.PlantSimSettings

Bases: BaseSimSettings

aggregations
tolerance_connect_by_position
class bim2sim.sim_settings.Setting(default=None, description: str | None = None, for_frontend: bool = False, any_string: bool = False, mandatory=False)

Bases: object

Define specific settings regarding model creation and simulation.

Args:

default: default value that will be applied when calling load_default() choices: dict of possible choice for this setting as key and a description per choice as value description: description of what the settings does as Str for_frontend: should this setting be shown in the frontend multiple_choice: allows multiple choice any_string: any string is allowed instead of a given choice mandatory: whether a setting needs to be set

check_setting_config()

Checks if the setting is configured correctly

check_value(bound_simulation_settings, value)

Checks the value that should be set for correctness

Args:

bound_simulation_settings: the sim setting belonging to the value value: value that should be checked for correctness

Returns:

True: if check was successful

Raises:

ValueError: if check was not successful

initialize(manager)

Link between manager stored setting and direct setting of simulation

load_default()
class bim2sim.sim_settings.SettingsManager(bound_simulation_settings)

Bases: dict

Manages the different settings of a SimulationSettings instance.

The manager is needed to maintain the different attributes of a simulation (e.g. choices) while making the read and write access to the setting still easy. This way you can call sim_settings.<setting_name> and get the value directly while under sim_settings.manager.<setting_name> you can still find all information.

Args:

bound_simulation_settings: instance of sim_settings this manager is bound to. E.g. BuildingSimSettings.

property names

Returns a generator object with all settings that the bound_simulation_settings owns.