|
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__)
|
@@ -332,7 +332,7 @@ def __init__(
|
332 | 332 | variableFilter: Optional[str] = None,
|
333 | 333 | customBuildDirectory: Optional[str | os.PathLike | pathlib.Path] = None,
|
334 | 334 | omhome: Optional[str] = None,
|
335 |
| - session: Optional[OMCSessionZMQ] = None, |
| 335 | + omc_process: Optional[OMCProcessLocal] = None, |
336 | 336 | build: bool = True,
|
337 | 337 | ) -> None:
|
338 | 338 | """Initialize, load and build a model.
|
@@ -360,8 +360,8 @@ def __init__(
|
360 | 360 | directory will be created.
|
361 | 361 | omhome: OPENMODELICAHOME value to be used when creating the OMC
|
362 | 362 | session.
|
363 |
| - session: OMC session to be used. If unspecified, a new session |
364 |
| - will be created. |
| 363 | + omc_process: definition of a (local) OMC process to be used. If |
| 364 | + unspecified, a new local session will be created. |
365 | 365 | build: Boolean controlling whether or not the model should be
|
366 | 366 | built when constructor is called. If False, the constructor
|
367 | 367 | simply loads the model without compiling.
|
@@ -396,10 +396,10 @@ def __init__(
|
396 | 396 | self.linearoutputs: list[str] = [] # linearization output list
|
397 | 397 | self.linearstates: list[str] = [] # linearization states list
|
398 | 398 |
|
399 |
| - if session is not None: |
400 |
| - if not isinstance(session, OMCSessionZMQ): |
401 |
| - raise ModelicaSystemError("Invalid session data provided!") |
402 |
| - self.getconn = session |
| 399 | + if omc_process is not None: |
| 400 | + if not isinstance(omc_process, OMCProcessLocal): |
| 401 | + raise ModelicaSystemError("Invalid (local) omc process definition provided!") |
| 402 | + self.getconn = OMCSessionZMQ(omc_process=omc_process) |
403 | 403 | else:
|
404 | 404 | self.getconn = OMCSessionZMQ(omhome=omhome)
|
405 | 405 |
|
|
0 commit comments