@@ -362,9 +362,9 @@ def __init__(
362362 self ._linearized_states : list [str ] = [] # linearization states list
363363
364364 if omc_process is not None :
365- self ._getconn = OMCSessionZMQ (omc_process = omc_process )
365+ self ._session = OMCSessionZMQ (omc_process = omc_process )
366366 else :
367- self ._getconn = OMCSessionZMQ (omhome = omhome )
367+ self ._session = OMCSessionZMQ (omhome = omhome )
368368
369369 # set commandLineOptions using default values or the user defined list
370370 if commandLineOptions is None :
@@ -449,13 +449,13 @@ def model(
449449 if file is not None :
450450 file_path = pathlib .Path (file )
451451 # special handling for OMCProcessLocal - consider a relative path
452- if isinstance (self ._getconn .omc_process , OMCProcessLocal ) and not file_path .is_absolute ():
452+ if isinstance (self ._session .omc_process , OMCProcessLocal ) and not file_path .is_absolute ():
453453 file_path = pathlib .Path .cwd () / file_path
454454 if not file_path .is_file ():
455455 raise IOError (f"Model file { file_path } does not exist!" )
456456
457457 self ._file_name = self .getWorkDirectory () / file_path .name
458- if (isinstance (self ._getconn .omc_process , OMCProcessLocal )
458+ if (isinstance (self ._session .omc_process , OMCProcessLocal )
459459 and file_path .as_posix () == self ._file_name .as_posix ()):
460460 pass
461461 elif self ._file_name .is_file ():
@@ -474,7 +474,7 @@ def session(self) -> OMCSessionZMQ:
474474 """
475475 Return the OMC session used for this class.
476476 """
477- return self ._getconn
477+ return self ._session
478478
479479 def setCommandLineOptions (self , commandLineOptions : str ):
480480 """
@@ -517,11 +517,11 @@ def setWorkDirectory(self, customBuildDirectory: Optional[str | os.PathLike] = N
517517 directory. If no directory is defined a unique temporary directory is created.
518518 """
519519 if customBuildDirectory is not None :
520- workdir = self ._getconn .omcpath (customBuildDirectory ).absolute ()
520+ workdir = self ._session .omcpath (customBuildDirectory ).absolute ()
521521 if not workdir .is_dir ():
522522 raise IOError (f"Provided work directory does not exists: { customBuildDirectory } !" )
523523 else :
524- workdir = self ._getconn .omcpath_tempdir ().absolute ()
524+ workdir = self ._session .omcpath_tempdir ().absolute ()
525525 if not workdir .is_dir ():
526526 raise IOError (f"{ workdir } could not be created" )
527527
@@ -557,24 +557,24 @@ def buildModel(self, variableFilter: Optional[str] = None):
557557
558558 # check if the executable exists ...
559559 om_cmd = ModelicaSystemCmd (
560- session = self ._getconn ,
560+ session = self ._session ,
561561 runpath = self .getWorkDirectory (),
562562 modelname = self ._model_name ,
563563 timeout = 5.0 ,
564564 )
565565 # ... by running it - output help for command help
566566 om_cmd .arg_set (key = "help" , val = "help" )
567567 cmd_definition = om_cmd .definition ()
568- returncode = self ._getconn .run_model_executable (cmd_run_data = cmd_definition )
568+ returncode = self ._session .run_model_executable (cmd_run_data = cmd_definition )
569569 if returncode != 0 :
570570 raise ModelicaSystemError ("Model executable not working!" )
571571
572- xml_file = self ._getconn .omcpath (buildModelResult [0 ]).parent / buildModelResult [1 ]
572+ xml_file = self ._session .omcpath (buildModelResult [0 ]).parent / buildModelResult [1 ]
573573 self ._xmlparse (xml_file = xml_file )
574574
575575 def sendExpression (self , expr : str , parsed : bool = True ) -> Any :
576576 try :
577- retval = self ._getconn .sendExpression (expr , parsed )
577+ retval = self ._session .sendExpression (expr , parsed )
578578 except OMCSessionException as ex :
579579 raise ModelicaSystemError (f"Error executing { repr (expr )} : { ex } " ) from ex
580580
@@ -1047,7 +1047,7 @@ def simulate_cmd(
10471047 """
10481048
10491049 om_cmd = ModelicaSystemCmd (
1050- session = self ._getconn ,
1050+ session = self ._session ,
10511051 runpath = self .getWorkDirectory (),
10521052 modelname = self ._model_name ,
10531053 timeout = timeout ,
@@ -1128,7 +1128,7 @@ def simulate(
11281128 elif isinstance (resultfile , OMCPath ):
11291129 self ._result_file = resultfile
11301130 else :
1131- self ._result_file = self ._getconn .omcpath (resultfile )
1131+ self ._result_file = self ._session .omcpath (resultfile )
11321132 if not self ._result_file .is_absolute ():
11331133 self ._result_file = self .getWorkDirectory () / resultfile
11341134
@@ -1147,7 +1147,7 @@ def simulate(
11471147 self ._result_file .unlink ()
11481148 # ... run simulation ...
11491149 cmd_definition = om_cmd .definition ()
1150- returncode = self ._getconn .run_model_executable (cmd_run_data = cmd_definition )
1150+ returncode = self ._session .run_model_executable (cmd_run_data = cmd_definition )
11511151 # and check returncode *AND* resultfile
11521152 if returncode != 0 and self ._result_file .is_file ():
11531153 # check for an empty (=> 0B) result file which indicates a crash of the model executable
@@ -1171,12 +1171,12 @@ def plot(
11711171 plot is created by OMC which needs access to the local display. This is not the case for docker and WSL.
11721172 """
11731173
1174- if not isinstance (self ._getconn .omc_process , OMCProcessLocal ):
1174+ if not isinstance (self ._session .omc_process , OMCProcessLocal ):
11751175 raise ModelicaSystemError ("Plot is using the OMC plot functionality; "
11761176 "thus, it is only working if OMC is running locally!" )
11771177
11781178 if resultfile is not None :
1179- plot_result_file = self ._getconn .omcpath (resultfile )
1179+ plot_result_file = self ._session .omcpath (resultfile )
11801180 elif self ._result_file is not None :
11811181 plot_result_file = self ._result_file
11821182 else :
@@ -1230,7 +1230,7 @@ def getSolutions(
12301230 raise ModelicaSystemError ("No result file found. Run simulate() first." )
12311231 result_file = self ._result_file
12321232 else :
1233- result_file = self ._getconn .omcpath (resultfile )
1233+ result_file = self ._session .omcpath (resultfile )
12341234
12351235 # check if the result file exits
12361236 if not result_file .is_file ():
@@ -1642,7 +1642,7 @@ def convertMo2Fmu(
16421642 properties = (f'version="{ version } ", fmuType="{ fmuType } ", '
16431643 f'fileNamePrefix="{ fileNamePrefix } ", includeResources={ includeResourcesStr } ' )
16441644 fmu = self ._requestApi (apiName = 'buildModelFMU' , entity = self ._model_name , properties = properties )
1645- fmu_path = self ._getconn .omcpath (fmu )
1645+ fmu_path = self ._session .omcpath (fmu )
16461646
16471647 # report proper error message
16481648 if not fmu_path .is_file ():
@@ -1663,7 +1663,7 @@ def convertFmu2Mo(
16631663 >>> convertFmu2Mo("c:/BouncingBall.Fmu")
16641664 """
16651665
1666- fmu_path = self ._getconn .omcpath (fmu )
1666+ fmu_path = self ._session .omcpath (fmu )
16671667
16681668 if not fmu_path .is_file ():
16691669 raise ModelicaSystemError (f"Missing FMU file: { fmu_path .as_posix ()} " )
@@ -1751,7 +1751,7 @@ def linearize(
17511751 )
17521752
17531753 om_cmd = ModelicaSystemCmd (
1754- session = self ._getconn ,
1754+ session = self ._session ,
17551755 runpath = self .getWorkDirectory (),
17561756 modelname = self ._model_name ,
17571757 timeout = timeout ,
@@ -1790,7 +1790,7 @@ def linearize(
17901790 linear_file .unlink (missing_ok = True )
17911791
17921792 cmd_definition = om_cmd .definition ()
1793- returncode = self ._getconn .run_model_executable (cmd_run_data = cmd_definition )
1793+ returncode = self ._session .run_model_executable (cmd_run_data = cmd_definition )
17941794 if returncode != 0 :
17951795 raise ModelicaSystemError (f"Linearize failed with return code: { returncode } " )
17961796 if not linear_file .is_file ():
@@ -2146,7 +2146,7 @@ def worker(worker_id, task_queue):
21462146 logger .info (f"[Worker { worker_id } ] Performing task: { resultpath .name } " )
21472147
21482148 try :
2149- returncode = self ._mod . _getconn .run_model_executable (cmd_run_data = cmd_definition )
2149+ returncode = self .session () .run_model_executable (cmd_run_data = cmd_definition )
21502150 logger .info (f"[Worker { worker_id } ] Simulation { resultpath .name } "
21512151 f"finished with return code: { returncode } " )
21522152 except ModelicaSystemError as ex :
0 commit comments