5151from OMPython .OMCSession import (
5252 OMCSessionException ,
5353 OMCSessionRunData ,
54- OMCSessionZMQ ,
5554 OMCSession ,
5655 OMCSessionLocal ,
5756 OMCPath ,
@@ -127,7 +126,7 @@ class ModelicaSystemCmd:
127126
128127 def __init__ (
129128 self ,
130- session : OMCSessionZMQ ,
129+ session : OMCSession ,
131130 runpath : OMCPath ,
132131 modelname : Optional [str ] = None ,
133132 timeout : Optional [float ] = None ,
@@ -328,7 +327,7 @@ def parse_simflags(simflags: str) -> dict[str, Optional[str | dict[str, Any] | n
328327
329328class ModelicaSystem :
330329 """
331- Class to simulate a Modelica model using OpenModelica via OMCSessionZMQ .
330+ Class to simulate a Modelica model using OpenModelica via OMCSession .
332331 """
333332
334333 def __init__ (
@@ -348,7 +347,7 @@ def __init__(
348347 work_directory: Path to a directory to be used for temporary
349348 files like the model executable. If left unspecified, a tmp
350349 directory will be created.
351- omhome: path to OMC to be used when creating the OMC session (see OMCSessionZMQ ).
350+ omhome: path to OMC to be used when creating the OMC session (see OMCSession ).
352351 session: definition of a (local) OMC session to be used. If
353352 unspecified, a new local session will be created.
354353 timeout: float value to define the timeout; if nothing is defined, a default value of 10s is used
@@ -379,9 +378,9 @@ def __init__(
379378 self ._linearized_states : list [str ] = [] # linearization states list
380379
381380 if session is not None :
382- self ._session = OMCSessionZMQ ( omc_process = session )
381+ self ._session = session
383382 else :
384- self ._session = OMCSessionZMQ (omhome = omhome , timeout = timeout )
383+ self ._session = OMCSessionLocal (omhome = omhome , timeout = timeout )
385384
386385 # set commandLineOptions using default values or the user defined list
387386 if command_line_options is None :
@@ -466,13 +465,13 @@ def model(
466465 if model_file is not None :
467466 file_path = pathlib .Path (model_file )
468467 # special handling for OMCProcessLocal - consider a relative path
469- if isinstance (self ._session . omc_process , OMCSessionLocal ) and not file_path .is_absolute ():
468+ if isinstance (self ._session , OMCSessionLocal ) and not file_path .is_absolute ():
470469 file_path = pathlib .Path .cwd () / file_path
471470 if not file_path .is_file ():
472471 raise IOError (f"Model file { file_path } does not exist!" )
473472
474473 self ._file_name = self .getWorkDirectory () / file_path .name
475- if (isinstance (self ._session . omc_process , OMCSessionLocal )
474+ if (isinstance (self ._session , OMCSessionLocal )
476475 and file_path .as_posix () == self ._file_name .as_posix ()):
477476 pass
478477 elif self ._file_name .is_file ():
@@ -487,7 +486,7 @@ def model(
487486 if build :
488487 self .buildModel (variable_filter )
489488
490- def get_session (self ) -> OMCSessionZMQ :
489+ def get_session (self ) -> OMCSession :
491490 """
492491 Return the OMC session used for this class.
493492 """
@@ -1209,7 +1208,7 @@ def plot(
12091208 plot is created by OMC which needs access to the local display. This is not the case for docker and WSL.
12101209 """
12111210
1212- if not isinstance (self ._session . omc_process , OMCSessionLocal ):
1211+ if not isinstance (self ._session , OMCSessionLocal ):
12131212 raise ModelicaSystemError ("Plot is using the OMC plot functionality; "
12141213 "thus, it is only working if OMC is running locally!" )
12151214
@@ -2021,7 +2020,7 @@ def __init__(
20212020 self ._doe_def : Optional [dict [str , dict [str , Any ]]] = None
20222021 self ._doe_cmd : Optional [dict [str , OMCSessionRunData ]] = None
20232022
2024- def get_session (self ) -> OMCSessionZMQ :
2023+ def get_session (self ) -> OMCSession :
20252024 """
20262025 Return the OMC session used for this class.
20272026 """
0 commit comments