Skip to content

Commit 9ca5c6d

Browse files
committed
clean up
1 parent dd68fa9 commit 9ca5c6d

File tree

6 files changed

+13
-21
lines changed

6 files changed

+13
-21
lines changed

bim2sim/plugins/PluginTEASER/bim2sim_teaser/examples/e1_simple_project_bps_teaser.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ def run_example_simple_building_teaser():
1616
"""
1717
# Create a temp directory for the project, feel free to use a "normal"
1818
# directory
19-
# ToDo set your project directory here
20-
project_path = Path(r"/home/chris/src/bim2sim_up/projects/e1")
19+
project_path = Path(tempfile.TemporaryDirectory(
20+
prefix='bim2sim_teaser_example_e1_').name)
2121

2222
# Set the ifc path to use and define which domain the IFC belongs to
2323
ifc_paths = {
@@ -50,9 +50,8 @@ def run_example_simple_building_teaser():
5050
Path(bim2sim.__file__).parent.parent /
5151
'test/resources/weather_files/DEU_NW_Aachen.105010_TMYx.mos')
5252
# Run a simulation directly with dymola after model creation
53-
project.sim_settings.dymola_simulation = False
54-
project.sim_settings.create_plots = False
55-
53+
project.sim_settings.dymola_simulation = True
54+
project.sim_settings.create_plots = True
5655
# Select results to output:
5756
project.sim_settings.sim_results = [
5857
"heat_demand_total", "cool_demand_total",

bim2sim/project.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ def add_config_section(
4949
if not callable(getattr(sim_settings, attr)) and not
5050
attr.startswith('__')]
5151
for attr in attributes:
52-
# ToDo (chg-ext): value(defaul) here maybe already overwritten?
5352
default_value = getattr(sim_settings, attr).value
5453
if isinstance(default_value, Enum):
5554
default_value = str(default_value)
@@ -422,7 +421,6 @@ def run(self, interactive=False, cleanup=True):
422421
raise AssertionError("Project ist not set correctly!")
423422

424423
self.sim_settings.check_mandatory()
425-
426424
success = False
427425
if interactive:
428426
run = self._run_interactive
@@ -506,7 +504,6 @@ def finalize(self, success=False):
506504
self.logger.info(f'Project "{self.name}" finished successful')
507505

508506
# reset sim_settings:
509-
# Todo (chg-ext): Why load default settings here
510507
self.playground.sim_settings.load_default_settings()
511508
# clean logger
512509
log.teardown_loggers()

bim2sim/sim_settings.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@
88
import os.path
99
from typing import Union, Optional, List
1010
import sys
11-
1211
from pydantic import BaseModel, Field, model_validator, field_validator, FilePath, DirectoryPath
1312
from pydantic_core import PydanticCustomError
1413
from typing_extensions import Self
1514
from enum import Enum
16-
1715
from bim2sim.utilities import types
1816
from bim2sim.utilities.types import LOD
1917
from bim2sim.elements.base_elements import Material
@@ -68,7 +66,7 @@ def _create_settings(self):
6866
self[name] = setting
6967

7068
# Store predefined default values in the defaults dict,
71-
# so they can be set back to the default later
69+
# so they can be set back to their defaults later
7270
self.defaults[setting.name] = setting.value
7371

7472
@property
@@ -84,12 +82,13 @@ def names(self):
8482

8583

8684
class Setting(BaseModel, validate_assignment=True, validate_default=True):
87-
""" Base class for all simulation settings.
88-
The attribute value which holds the payload of the setting is introduced in derived classes,
89-
e.g. NumberSetting(Setting).
85+
"""Base class for all simulation settings.
86+
87+
The attribute "value", which contains the payload of the simulation setting, is added in
88+
the derived classes for the different data types (e.g. NumberSetting(Setting)).
9089
91-
The value which is assigned to the attribute "value", when instancing the setting, serves
92-
as a default and can be changed according to the use case, if necessary.
90+
The value, which is assigned to the attribute "value", when instancing the setting, serves
91+
as a default value and can be changed according to the use case, if necessary.
9392
9493
Args:
9594
name: Name of the setting. Is set automatically by AutoSettingNameMeta(type)
@@ -106,8 +105,8 @@ class Setting(BaseModel, validate_assignment=True, validate_default=True):
106105
mandatory: bool = Field(default=False)
107106

108107
def __set__(self, bound_simulation_settings, value):
109-
"""Creates a new attribute with name and value of the complete setting instance,
110-
stored in sim_settings. This makes it easier to access the value of a setting.
108+
"""Creates a new attribute with the name and value of the simulation setting instance,
109+
stored in sim_settings. This makes it easier to access the setting's payload.
111110
112111
Example:
113112

bim2sim/tasks/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ class Playground:
7575
def __init__(self, project: Project):
7676
self.project = project
7777
self.sim_settings = project.plugin_cls.sim_settings()
78-
7978
self.sim_settings.update_from_config(config=project.config)
8079
self.state = {}
8180
self.history = []

test/unit/tasks/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ def setUp(self) -> None:
5151
def tearDown(self) -> None:
5252
"""Clean up after each test method."""
5353
self.helper.reset()
54-
#self.playground.sim_settings.load_default_settings()
5554
self.playground.sim_settings.load_default_settings()
5655

5756
def run_task(self, answers, reads):

test/unit/tasks/bps/test_enrich_use_cond.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ def test_enrichment_single_office_common_conditions(self):
5454

5555
def test_enrichment_sim_setting_without_overwrite(self):
5656
"""Tests enrichment of single office without overwrite via settings."""
57-
# Todo (chg-ext): Side effect. Test runs separately, but not in context of the whole class
5857
print(self.playground.sim_settings.heating_tz_overwrite)
5958
print(self.playground.sim_settings.cooling_tz_overwrite)
6059
print(self.playground.sim_settings.ahu_tz_overwrite)

0 commit comments

Comments
 (0)