|
49 | 49 | import warnings |
50 | 50 | import xml.etree.ElementTree as ET |
51 | 51 |
|
52 | | -from OMPython.OMCSession import OMCSessionException, OMCSessionZMQ |
| 52 | +from OMPython.OMCSession import OMCSessionException, OMCSessionZMQ, OMCProcessLocal |
53 | 53 |
|
54 | 54 | # define logger using the current module name as ID |
55 | 55 | logger = logging.getLogger(__name__) |
@@ -303,7 +303,7 @@ def __init__( |
303 | 303 | variableFilter: Optional[str] = None, |
304 | 304 | customBuildDirectory: Optional[str | os.PathLike | pathlib.Path] = None, |
305 | 305 | omhome: Optional[str] = None, |
306 | | - session: Optional[OMCSessionZMQ] = None, |
| 306 | + omc_process: Optional[OMCProcessLocal] = None, |
307 | 307 | build: bool = True, |
308 | 308 | ) -> None: |
309 | 309 | """Initialize, load and build a model. |
@@ -331,8 +331,8 @@ def __init__( |
331 | 331 | directory will be created. |
332 | 332 | omhome: OPENMODELICAHOME value to be used when creating the OMC |
333 | 333 | 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. |
336 | 336 | build: Boolean controlling whether or not the model should be |
337 | 337 | built when constructor is called. If False, the constructor |
338 | 338 | simply loads the model without compiling. |
@@ -367,10 +367,10 @@ def __init__( |
367 | 367 | self._linearized_outputs: list[str] = [] # linearization output list |
368 | 368 | self._linearized_states: list[str] = [] # linearization states list |
369 | 369 |
|
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) |
374 | 374 | else: |
375 | 375 | self._getconn = OMCSessionZMQ(omhome=omhome) |
376 | 376 |
|
|
0 commit comments