@@ -336,7 +336,7 @@ def __init__(
336336 command_line_options : Optional [list [str ]] = None ,
337337 work_directory : Optional [str | os .PathLike ] = None ,
338338 omhome : Optional [str ] = None ,
339- omc_process : Optional [OMCSession ] = None ,
339+ session : Optional [OMCSession ] = None ,
340340 ) -> None :
341341 """Create a ModelicaSystem instance. To define the model use model() or convertFmu2Mo().
342342
@@ -348,7 +348,7 @@ def __init__(
348348 files like the model executable. If left unspecified, a tmp
349349 directory will be created.
350350 omhome: path to OMC to be used when creating the OMC session (see OMCSessionZMQ).
351- omc_process : definition of a (local) OMC process to be used. If
351+ session : definition of a (local) OMC session to be used. If
352352 unspecified, a new local session will be created.
353353 """
354354
@@ -376,8 +376,8 @@ def __init__(
376376 self ._linearized_outputs : list [str ] = [] # linearization output list
377377 self ._linearized_states : list [str ] = [] # linearization states list
378378
379- if omc_process is not None :
380- self ._session = OMCSessionZMQ (omc_process = omc_process )
379+ if session is not None :
380+ self ._session = OMCSessionZMQ (omc_process = session )
381381 else :
382382 self ._session = OMCSessionZMQ (omhome = omhome )
383383
@@ -485,7 +485,7 @@ def model(
485485 if build :
486486 self .buildModel (variable_filter )
487487
488- def session (self ) -> OMCSessionZMQ :
488+ def get_session (self ) -> OMCSessionZMQ :
489489 """
490490 Return the OMC session used for this class.
491491 """
@@ -1967,7 +1967,7 @@ def __init__(
19671967 variable_filter : Optional [str ] = None ,
19681968 work_directory : Optional [str | os .PathLike ] = None ,
19691969 omhome : Optional [str ] = None ,
1970- omc_process : Optional [OMCSession ] = None ,
1970+ session : Optional [OMCSession ] = None ,
19711971 # simulation specific input
19721972 # TODO: add more settings (simulation options, input options, ...)
19731973 simargs : Optional [dict [str , Optional [str | dict [str , str ] | numbers .Number ]]] = None ,
@@ -1988,7 +1988,7 @@ def __init__(
19881988 command_line_options = command_line_options ,
19891989 work_directory = work_directory ,
19901990 omhome = omhome ,
1991- omc_process = omc_process ,
1991+ session = session ,
19921992 )
19931993 self ._mod .model (
19941994 model_file = model_file ,
@@ -2003,9 +2003,9 @@ def __init__(
20032003 self ._timeout = timeout
20042004
20052005 if resultpath is None :
2006- self ._resultpath = self .session ().omcpath_tempdir ()
2006+ self ._resultpath = self .get_session ().omcpath_tempdir ()
20072007 else :
2008- self ._resultpath = self .session ().omcpath (resultpath )
2008+ self ._resultpath = self .get_session ().omcpath (resultpath )
20092009 if not self ._resultpath .is_dir ():
20102010 raise ModelicaSystemError ("Argument resultpath must be set to a valid path within the environment used "
20112011 f"for the OpenModelica session: { resultpath } !" )
@@ -2018,11 +2018,11 @@ def __init__(
20182018 self ._doe_def : Optional [dict [str , dict [str , Any ]]] = None
20192019 self ._doe_cmd : Optional [dict [str , OMCSessionRunData ]] = None
20202020
2021- def session (self ) -> OMCSessionZMQ :
2021+ def get_session (self ) -> OMCSessionZMQ :
20222022 """
20232023 Return the OMC session used for this class.
20242024 """
2025- return self ._mod .session ()
2025+ return self ._mod .get_session ()
20262026
20272027 def prepare (self ) -> int :
20282028 """
@@ -2061,7 +2061,7 @@ def prepare(self) -> int:
20612061
20622062 pk_value = pc_structure [idx_structure ]
20632063 if isinstance (pk_value , str ):
2064- pk_value_str = self .session ().escape_str (pk_value )
2064+ pk_value_str = self .get_session ().escape_str (pk_value )
20652065 expression = f"setParameterValue({ self ._model_name } , { pk_structure } , \" { pk_value_str } \" )"
20662066 elif isinstance (pk_value , bool ):
20672067 pk_value_bool_str = "true" if pk_value else "false"
@@ -2183,12 +2183,12 @@ def worker(worker_id, task_queue):
21832183 raise ModelicaSystemError ("Missing simulation definition!" )
21842184
21852185 resultfile = cmd_definition .cmd_result_path
2186- resultpath = self .session ().omcpath (resultfile )
2186+ resultpath = self .get_session ().omcpath (resultfile )
21872187
21882188 logger .info (f"[Worker { worker_id } ] Performing task: { resultpath .name } " )
21892189
21902190 try :
2191- returncode = self .session ().run_model_executable (cmd_run_data = cmd_definition )
2191+ returncode = self .get_session ().run_model_executable (cmd_run_data = cmd_definition )
21922192 logger .info (f"[Worker { worker_id } ] Simulation { resultpath .name } "
21932193 f"finished with return code: { returncode } " )
21942194 except ModelicaSystemError as ex :
0 commit comments