Skip to content

Commit 01255ad

Browse files
committed
[ModelicaSystem] limit to local OMC process
1 parent d2cea9c commit 01255ad

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

OMPython/ModelicaSystem.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
import warnings
5050
import xml.etree.ElementTree as ET
5151

52-
from OMPython.OMCSession import OMCSessionException, OMCSessionZMQ
52+
from OMPython.OMCSession import OMCSessionException, OMCSessionZMQ, OMCProcessLocal
5353

5454
# define logger using the current module name as ID
5555
logger = logging.getLogger(__name__)
@@ -303,7 +303,7 @@ def __init__(
303303
variableFilter: Optional[str] = None,
304304
customBuildDirectory: Optional[str | os.PathLike | pathlib.Path] = None,
305305
omhome: Optional[str] = None,
306-
session: Optional[OMCSessionZMQ] = None,
306+
omc_process: Optional[OMCProcessLocal] = None,
307307
build: bool = True,
308308
) -> None:
309309
"""Initialize, load and build a model.
@@ -331,8 +331,8 @@ def __init__(
331331
directory will be created.
332332
omhome: OPENMODELICAHOME value to be used when creating the OMC
333333
session.
334-
session: OMC session to be used. If unspecified, a new session
335-
will be created.
334+
omc_process: definition of a (local) OMC process to be used. If
335+
unspecified, a new local session will be created.
336336
build: Boolean controlling whether or not the model should be
337337
built when constructor is called. If False, the constructor
338338
simply loads the model without compiling.
@@ -367,10 +367,10 @@ def __init__(
367367
self._linearized_outputs: list[str] = [] # linearization output list
368368
self._linearized_states: list[str] = [] # linearization states list
369369

370-
if session is not None:
371-
if not isinstance(session, OMCSessionZMQ):
372-
raise ModelicaSystemError("Invalid session data provided!")
373-
self._getconn = session
370+
if omc_process is not None:
371+
if not isinstance(omc_process, OMCProcessLocal):
372+
raise ModelicaSystemError("Invalid (local) omc process definition provided!")
373+
self._getconn = OMCSessionZMQ(omc_process=omc_process)
374374
else:
375375
self._getconn = OMCSessionZMQ(omhome=omhome)
376376

0 commit comments

Comments
 (0)