@@ -333,7 +333,7 @@ def __init__(
333333 command_line_options : Optional [list [str ]] = None ,
334334 work_directory : Optional [str | os .PathLike ] = None ,
335335 omhome : Optional [str ] = None ,
336- omc_process : Optional [OMCSession ] = None ,
336+ session : Optional [OMCSession ] = None ,
337337 ) -> None :
338338 """Create a ModelicaSystem instance. To define the model use model() or convertFmu2Mo().
339339
@@ -345,7 +345,7 @@ def __init__(
345345 files like the model executable. If left unspecified, a tmp
346346 directory will be created.
347347 omhome: path to OMC to be used when creating the OMC session (see OMCSessionZMQ).
348- omc_process : definition of a (local) OMC process to be used. If
348+ session : definition of a (local) OMC session to be used. If
349349 unspecified, a new local session will be created.
350350 """
351351
@@ -373,8 +373,8 @@ def __init__(
373373 self ._linearized_outputs : list [str ] = [] # linearization output list
374374 self ._linearized_states : list [str ] = [] # linearization states list
375375
376- if omc_process is not None :
377- self ._session = OMCSessionZMQ (omc_process = omc_process )
376+ if session is not None :
377+ self ._session = OMCSessionZMQ (omc_process = session )
378378 else :
379379 self ._session = OMCSessionZMQ (omhome = omhome )
380380
@@ -482,7 +482,7 @@ def model(
482482 if build :
483483 self .buildModel (variable_filter )
484484
485- def session (self ) -> OMCSessionZMQ :
485+ def get_session (self ) -> OMCSessionZMQ :
486486 """
487487 Return the OMC session used for this class.
488488 """
@@ -1954,7 +1954,7 @@ def __init__(
19541954 variable_filter : Optional [str ] = None ,
19551955 work_directory : Optional [str | os .PathLike ] = None ,
19561956 omhome : Optional [str ] = None ,
1957- omc_process : Optional [OMCSession ] = None ,
1957+ session : Optional [OMCSession ] = None ,
19581958 # simulation specific input
19591959 # TODO: add more settings (simulation options, input options, ...)
19601960 simargs : Optional [dict [str , Optional [str | dict [str , str ] | numbers .Number ]]] = None ,
@@ -1974,7 +1974,7 @@ def __init__(
19741974 command_line_options = command_line_options ,
19751975 work_directory = work_directory ,
19761976 omhome = omhome ,
1977- omc_process = omc_process ,
1977+ session = session ,
19781978 )
19791979 self ._mod .model (
19801980 model_file = model_file ,
@@ -1988,9 +1988,9 @@ def __init__(
19881988 self ._simargs = simargs
19891989
19901990 if resultpath is None :
1991- self ._resultpath = self .session ().omcpath_tempdir ()
1991+ self ._resultpath = self .get_session ().omcpath_tempdir ()
19921992 else :
1993- self ._resultpath = self .session ().omcpath (resultpath )
1993+ self ._resultpath = self .get_session ().omcpath (resultpath )
19941994 if not self ._resultpath .is_dir ():
19951995 raise ModelicaSystemError ("Argument resultpath must be set to a valid path within the environment used "
19961996 f"for the OpenModelica session: { resultpath } !" )
@@ -2003,11 +2003,11 @@ def __init__(
20032003 self ._doe_def : Optional [dict [str , dict [str , Any ]]] = None
20042004 self ._doe_cmd : Optional [dict [str , OMCSessionRunData ]] = None
20052005
2006- def session (self ) -> OMCSessionZMQ :
2006+ def get_session (self ) -> OMCSessionZMQ :
20072007 """
20082008 Return the OMC session used for this class.
20092009 """
2010- return self ._mod .session ()
2010+ return self ._mod .get_session ()
20112011
20122012 def prepare (self ) -> int :
20132013 """
@@ -2046,7 +2046,7 @@ def prepare(self) -> int:
20462046
20472047 pk_value = pc_structure [idx_structure ]
20482048 if isinstance (pk_value , str ):
2049- pk_value_str = self .session ().escape_str (pk_value )
2049+ pk_value_str = self .get_session ().escape_str (pk_value )
20502050 expression = f"setParameterValue({ self ._model_name } , { pk_structure } , \" { pk_value_str } \" )"
20512051 elif isinstance (pk_value , bool ):
20522052 pk_value_bool_str = "true" if pk_value else "false"
@@ -2167,12 +2167,12 @@ def worker(worker_id, task_queue):
21672167 raise ModelicaSystemError ("Missing simulation definition!" )
21682168
21692169 resultfile = cmd_definition .cmd_result_path
2170- resultpath = self .session ().omcpath (resultfile )
2170+ resultpath = self .get_session ().omcpath (resultfile )
21712171
21722172 logger .info (f"[Worker { worker_id } ] Performing task: { resultpath .name } " )
21732173
21742174 try :
2175- returncode = self .session ().run_model_executable (cmd_run_data = cmd_definition )
2175+ returncode = self .get_session ().run_model_executable (cmd_run_data = cmd_definition )
21762176 logger .info (f"[Worker { worker_id } ] Simulation { resultpath .name } "
21772177 f"finished with return code: { returncode } " )
21782178 except ModelicaSystemError as ex :
0 commit comments