@@ -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 timeout : float = 10.0 ,
341341 ) -> None :
342342 """Create a ModelicaSystem instance. To define the model use model() or convertFmu2Mo().
@@ -349,7 +349,7 @@ def __init__(
349349 files like the model executable. If left unspecified, a tmp
350350 directory will be created.
351351 omhome: path to OMC to be used when creating the OMC session (see OMCSessionZMQ).
352- omc_process : definition of a (local) OMC process to be used. If
352+ session : definition of a (local) OMC session to be used. If
353353 unspecified, a new local session will be created.
354354 timeout: float value to define the timeout; if nothing is defined, a default value of 10s is used
355355 """
@@ -378,8 +378,8 @@ def __init__(
378378 self ._linearized_outputs : list [str ] = [] # linearization output list
379379 self ._linearized_states : list [str ] = [] # linearization states list
380380
381- if omc_process is not None :
382- self ._session = OMCSessionZMQ (omc_process = omc_process )
381+ if session is not None :
382+ self ._session = OMCSessionZMQ (omc_process = session )
383383 else :
384384 self ._session = OMCSessionZMQ (omhome = omhome , timeout = timeout )
385385
@@ -487,7 +487,7 @@ def model(
487487 if build :
488488 self .buildModel (variable_filter )
489489
490- def session (self ) -> OMCSessionZMQ :
490+ def get_session (self ) -> OMCSessionZMQ :
491491 """
492492 Return the OMC session used for this class.
493493 """
@@ -1969,7 +1969,7 @@ def __init__(
19691969 variable_filter : Optional [str ] = None ,
19701970 work_directory : Optional [str | os .PathLike ] = None ,
19711971 omhome : Optional [str ] = None ,
1972- omc_process : Optional [OMCSession ] = None ,
1972+ session : Optional [OMCSession ] = None ,
19731973 timeout : float = 10.0 ,
19741974 # simulation specific input
19751975 # TODO: add more settings (simulation options, input options, ...)
@@ -1990,7 +1990,7 @@ def __init__(
19901990 command_line_options = command_line_options ,
19911991 work_directory = work_directory ,
19921992 omhome = omhome ,
1993- omc_process = omc_process ,
1993+ session = session ,
19941994 timeout = timeout ,
19951995 )
19961996 self ._mod .model (
@@ -2006,9 +2006,9 @@ def __init__(
20062006 self ._timeout = timeout
20072007
20082008 if resultpath is None :
2009- self ._resultpath = self .session ().omcpath_tempdir ()
2009+ self ._resultpath = self .get_session ().omcpath_tempdir ()
20102010 else :
2011- self ._resultpath = self .session ().omcpath (resultpath )
2011+ self ._resultpath = self .get_session ().omcpath (resultpath )
20122012 if not self ._resultpath .is_dir ():
20132013 raise ModelicaSystemError ("Argument resultpath must be set to a valid path within the environment used "
20142014 f"for the OpenModelica session: { resultpath } !" )
@@ -2021,11 +2021,11 @@ def __init__(
20212021 self ._doe_def : Optional [dict [str , dict [str , Any ]]] = None
20222022 self ._doe_cmd : Optional [dict [str , OMCSessionRunData ]] = None
20232023
2024- def session (self ) -> OMCSessionZMQ :
2024+ def get_session (self ) -> OMCSessionZMQ :
20252025 """
20262026 Return the OMC session used for this class.
20272027 """
2028- return self ._mod .session ()
2028+ return self ._mod .get_session ()
20292029
20302030 def prepare (self ) -> int :
20312031 """
@@ -2064,7 +2064,7 @@ def prepare(self) -> int:
20642064
20652065 pk_value = pc_structure [idx_structure ]
20662066 if isinstance (pk_value , str ):
2067- pk_value_str = self .session ().escape_str (pk_value )
2067+ pk_value_str = self .get_session ().escape_str (pk_value )
20682068 expression = f"setParameterValue({ self ._model_name } , { pk_structure } , \" { pk_value_str } \" )"
20692069 elif isinstance (pk_value , bool ):
20702070 pk_value_bool_str = "true" if pk_value else "false"
@@ -2186,12 +2186,12 @@ def worker(worker_id, task_queue):
21862186 raise ModelicaSystemError ("Missing simulation definition!" )
21872187
21882188 resultfile = cmd_definition .cmd_result_path
2189- resultpath = self .session ().omcpath (resultfile )
2189+ resultpath = self .get_session ().omcpath (resultfile )
21902190
21912191 logger .info (f"[Worker { worker_id } ] Performing task: { resultpath .name } " )
21922192
21932193 try :
2194- returncode = self .session ().run_model_executable (cmd_run_data = cmd_definition )
2194+ returncode = self .get_session ().run_model_executable (cmd_run_data = cmd_definition )
21952195 logger .info (f"[Worker { worker_id } ] Simulation { resultpath .name } "
21962196 f"finished with return code: { returncode } " )
21972197 except ModelicaSystemError as ex :
0 commit comments