diff --git a/OMPython/ModelicaSystem.py b/OMPython/ModelicaSystem.py index 01269875..23424e16 100644 --- a/OMPython/ModelicaSystem.py +++ b/OMPython/ModelicaSystem.py @@ -49,7 +49,7 @@ import warnings import xml.etree.ElementTree as ET -from OMPython.OMCSession import OMCSessionException, OMCSessionZMQ +from OMPython.OMCSession import OMCSessionException, OMCSessionZMQ, OMCProcessLocal # define logger using the current module name as ID logger = logging.getLogger(__name__) @@ -332,7 +332,7 @@ def __init__( variableFilter: Optional[str] = None, customBuildDirectory: Optional[str | os.PathLike | pathlib.Path] = None, omhome: Optional[str] = None, - session: Optional[OMCSessionZMQ] = None, + omc_process: Optional[OMCProcessLocal] = None, build: bool = True, ) -> None: """Initialize, load and build a model. @@ -360,8 +360,8 @@ def __init__( directory will be created. omhome: OPENMODELICAHOME value to be used when creating the OMC session. - session: OMC session to be used. If unspecified, a new session - will be created. + omc_process: definition of a (local) OMC process to be used. If + unspecified, a new local session will be created. build: Boolean controlling whether or not the model should be built when constructor is called. If False, the constructor simply loads the model without compiling. @@ -396,10 +396,10 @@ def __init__( self.linearoutputs: list[str] = [] # linearization output list self.linearstates: list[str] = [] # linearization states list - if session is not None: - if not isinstance(session, OMCSessionZMQ): - raise ModelicaSystemError("Invalid session data provided!") - self.getconn = session + if omc_process is not None: + if not isinstance(omc_process, OMCProcessLocal): + raise ModelicaSystemError("Invalid (local) omc process definition provided!") + self.getconn = OMCSessionZMQ(omc_process=omc_process) else: self.getconn = OMCSessionZMQ(omhome=omhome)