Skip to content

Commit 5a58d7a

Browse files
committed
[ModelicaSystem.definition()] check if it was called before
1 parent f5defcf commit 5a58d7a

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 model(
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(name, str):
466470
raise ModelicaSystemError("A model name must be provided (argument name)!")
467471

0 commit comments

Comments
 (0)