Skip to content

Commit 52b6403

Browse files
committed
[ModelicaSystem] update ModelicaDoEABC to use ModelicaSystemABC
1 parent 4bce6d7 commit 52b6403

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

OMPython/ModelicaSystem.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2174,7 +2174,7 @@ def run_doe():
21742174
def __init__(
21752175
self,
21762176
# ModelicaSystem definition to use
2177-
mod: ModelicaSystemOMC,
2177+
mod: ModelicaSystemABC,
21782178
# simulation specific input
21792179
# TODO: add more settings (simulation options, input options, ...)
21802180
simargs: Optional[dict[str, Optional[str | dict[str, str] | numbers.Number]]] = None,
@@ -2187,7 +2187,7 @@ def __init__(
21872187
ModelicaSystem.simulate(). Additionally, the path to store the result files is needed (= resultpath) as well as
21882188
a list of parameters to vary for the Doe (= parameters). All possible combinations are considered.
21892189
"""
2190-
if not isinstance(mod, ModelicaSystemOMC):
2190+
if not isinstance(mod, ModelicaSystemABC):
21912191
raise ModelicaSystemError("Missing definition of ModelicaSystem!")
21922192

21932193
self._mod = mod
@@ -2433,6 +2433,10 @@ def __init__(
24332433
resultpath: Optional[str | os.PathLike] = None,
24342434
parameters: Optional[dict[str, list[str] | list[int] | list[float]]] = None,
24352435
) -> None:
2436+
2437+
if not isinstance(mod, ModelicaSystemOMC):
2438+
raise ModelicaSystemError(f"Invalid definition for mod: {type(mod)} - expect ModelicaSystemOMC!")
2439+
24362440
super().__init__(
24372441
mod=mod,
24382442
simargs=simargs,
@@ -2450,6 +2454,10 @@ def _prepare_structure_parameters(
24502454
build_dir.mkdir()
24512455
self._mod.setWorkDirectory(work_directory=build_dir)
24522456

2457+
# need to repeat this check to make the linters happy
2458+
if not isinstance(self._mod, ModelicaSystemOMC):
2459+
raise ModelicaSystemError(f"Invalid definition for mod: {type(self._mod)} - expect ModelicaSystemOMC!")
2460+
24532461
sim_param_structure = {}
24542462
for idx_structure, pk_structure in enumerate(param_structure.keys()):
24552463
sim_param_structure[pk_structure] = pc_structure[idx_structure]
@@ -2498,6 +2506,9 @@ def get_doe_solutions(
24982506
```
24992507
25002508
"""
2509+
if not isinstance(self._mod, ModelicaSystemOMC):
2510+
raise ModelicaSystemError(f"Invalid definition for mod: {type(self._mod)} - expect ModelicaSystemOMC!")
2511+
25012512
if not isinstance(self._doe_def, dict):
25022513
return None
25032514

0 commit comments

Comments
 (0)