Skip to content

Commit c40bc06

Browse files
committed
[ModelicaSystem] limit to local OMC process
1 parent f9bfcf6 commit c40bc06

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__)
@@ -323,7 +323,7 @@ def __init__(
323323
variableFilter: Optional[str] = None,
324324
customBuildDirectory: Optional[str | os.PathLike | pathlib.Path] = None,
325325
omhome: Optional[str] = None,
326-
session: Optional[OMCSessionZMQ] = None,
326+
omc_process: Optional[OMCProcessLocal] = None,
327327
build: bool = True,
328328
) -> None:
329329
"""Initialize, load and build a model.
@@ -351,8 +351,8 @@ def __init__(
351351
directory will be created.
352352
omhome: OPENMODELICAHOME value to be used when creating the OMC
353353
session.
354-
session: OMC session to be used. If unspecified, a new session
355-
will be created.
354+
omc_process: definition of a (local) OMC process to be used. If
355+
unspecified, a new local session will be created.
356356
build: Boolean controlling whether or not the model should be
357357
built when constructor is called. If False, the constructor
358358
simply loads the model without compiling.
@@ -387,10 +387,10 @@ def __init__(
387387
self.linearoutputs: list[str] = [] # linearization output list
388388
self.linearstates: list[str] = [] # linearization states list
389389

390-
if session is not None:
391-
if not isinstance(session, OMCSessionZMQ):
392-
raise ModelicaSystemError("Invalid session data provided!")
393-
self.getconn = session
390+
if omc_process is not None:
391+
if not isinstance(omc_process, OMCProcessLocal):
392+
raise ModelicaSystemError("Invalid (local) omc process definition provided!")
393+
self.getconn = OMCSessionZMQ(omc_process=omc_process)
394394
else:
395395
self.getconn = OMCSessionZMQ(omhome=omhome)
396396

0 commit comments

Comments
 (0)