|
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__) |
@@ -323,7 +323,7 @@ def __init__( |
323 | 323 | variableFilter: Optional[str] = None, |
324 | 324 | customBuildDirectory: Optional[str | os.PathLike | pathlib.Path] = None, |
325 | 325 | omhome: Optional[str] = None, |
326 | | - session: Optional[OMCSessionZMQ] = None, |
| 326 | + omc_process: Optional[OMCProcessLocal] = None, |
327 | 327 | build: bool = True, |
328 | 328 | ) -> None: |
329 | 329 | """Initialize, load and build a model. |
@@ -351,8 +351,8 @@ def __init__( |
351 | 351 | directory will be created. |
352 | 352 | omhome: OPENMODELICAHOME value to be used when creating the OMC |
353 | 353 | 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. |
356 | 356 | build: Boolean controlling whether or not the model should be |
357 | 357 | built when constructor is called. If False, the constructor |
358 | 358 | simply loads the model without compiling. |
@@ -387,10 +387,10 @@ def __init__( |
387 | 387 | self.linearoutputs: list[str] = [] # linearization output list |
388 | 388 | self.linearstates: list[str] = [] # linearization states list |
389 | 389 |
|
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) |
394 | 394 | else: |
395 | 395 | self.getconn = OMCSessionZMQ(omhome=omhome) |
396 | 396 |
|
|
0 commit comments