Skip to content

Commit e7d2376

Browse files
committed
[ModelicaSystem.definition()] check if it was called before
1 parent 9127f4e commit e7d2376

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

OMPython/ModelicaSystem.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,10 @@ def definition(
462462
mod.setup_model(model="modelName", file="ModelicaModel.mo", libraries=[("Modelica","3.2.3"), "PowerSystems"])
463463
"""
464464

465+
if self._model_name is not None:
466+
raise ModelicaSystemError("Can not reuse this instance of ModelicaSystem "
467+
f"defined for {repr(self._model_name)}!")
468+
465469
if not isinstance(model, str):
466470
raise ModelicaSystemError("A model name must be provided (argument modelName)!")
467471

0 commit comments

Comments
 (0)