Skip to content

Commit 88a228b

Browse files
committed
[ModelicaSystem] update ModelicaDoEABC to use ModelicaSystemABC
1 parent 2ca3f16 commit 88a228b

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
@@ -2183,7 +2183,7 @@ def run_doe():
21832183
def __init__(
21842184
self,
21852185
# ModelicaSystem definition to use
2186-
mod: ModelicaSystemOMC,
2186+
mod: ModelicaSystemABC,
21872187
# simulation specific input
21882188
# TODO: add more settings (simulation options, input options, ...)
21892189
simargs: Optional[dict[str, Optional[str | dict[str, str] | numbers.Number]]] = None,
@@ -2196,7 +2196,7 @@ def __init__(
21962196
ModelicaSystem.simulate(). Additionally, the path to store the result files is needed (= resultpath) as well as
21972197
a list of parameters to vary for the Doe (= parameters). All possible combinations are considered.
21982198
"""
2199-
if not isinstance(mod, ModelicaSystemOMC):
2199+
if not isinstance(mod, ModelicaSystemABC):
22002200
raise ModelicaSystemError("Missing definition of ModelicaSystem!")
22012201

22022202
self._mod = mod
@@ -2442,6 +2442,10 @@ def __init__(
24422442
resultpath: Optional[str | os.PathLike] = None,
24432443
parameters: Optional[dict[str, list[str] | list[int] | list[float]]] = None,
24442444
) -> None:
2445+
2446+
if not isinstance(mod, ModelicaSystemOMC):
2447+
raise ModelicaSystemError(f"Invalid definition for mod: {type(mod)} - expect ModelicaSystemOMC!")
2448+
24452449
super().__init__(
24462450
mod=mod,
24472451
simargs=simargs,
@@ -2459,6 +2463,10 @@ def _prepare_structure_parameters(
24592463
build_dir.mkdir()
24602464
self._mod.setWorkDirectory(work_directory=build_dir)
24612465

2466+
# need to repeat this check to make the linters happy
2467+
if not isinstance(self._mod, ModelicaSystemOMC):
2468+
raise ModelicaSystemError(f"Invalid definition for mod: {type(self._mod)} - expect ModelicaSystemOMC!")
2469+
24622470
sim_param_structure = {}
24632471
for idx_structure, pk_structure in enumerate(param_structure.keys()):
24642472
sim_param_structure[pk_structure] = pc_structure[idx_structure]
@@ -2507,6 +2515,9 @@ def get_doe_solutions(
25072515
```
25082516
25092517
"""
2518+
if not isinstance(self._mod, ModelicaSystemOMC):
2519+
raise ModelicaSystemError(f"Invalid definition for mod: {type(self._mod)} - expect ModelicaSystemOMC!")
2520+
25102521
if not isinstance(self._doe_def, dict):
25112522
return None
25122523

0 commit comments

Comments
 (0)