2828 OMCSessionException ,
2929 OMCSession ,
3030 OMCSessionLocal ,
31- OMCPath ,
31+
32+ OMPathABC ,
3233)
3334
3435# define logger using the current module name as ID
@@ -387,13 +388,13 @@ def __init__(
387388 self ._version = self ._parse_om_version (version = version_str )
388389
389390 self ._simulated = False # True if the model has already been simulated
390- self ._result_file : Optional [OMCPath ] = None # for storing result file
391+ self ._result_file : Optional [OMPathABC ] = None # for storing result file
391392
392- self ._work_dir : OMCPath = self .setWorkDirectory (work_directory )
393+ self ._work_dir : OMPathABC = self .setWorkDirectory (work_directory )
393394
394395 self ._model_name : Optional [str ] = None
395396 self ._libraries : Optional [list [str | tuple [str , str ]]] = None
396- self ._file_name : Optional [OMCPath ] = None
397+ self ._file_name : Optional [OMPathABC ] = None
397398 self ._variable_filter : Optional [str ] = None
398399
399400 def get_session (self ) -> OMCSession :
@@ -411,7 +412,7 @@ def get_model_name(self) -> str:
411412
412413 return self ._model_name
413414
414- def setWorkDirectory (self , work_directory : Optional [str | os .PathLike ] = None ) -> OMCPath :
415+ def setWorkDirectory (self , work_directory : Optional [str | os .PathLike ] = None ) -> OMPathABC :
415416 """
416417 Define the work directory for the ModelicaSystem / OpenModelica session. The model is build within this
417418 directory. If no directory is defined a unique temporary directory is created.
@@ -433,7 +434,7 @@ def setWorkDirectory(self, work_directory: Optional[str | os.PathLike] = None) -
433434 # ... and also return the defined path
434435 return workdir
435436
436- def getWorkDirectory (self ) -> OMCPath :
437+ def getWorkDirectory (self ) -> OMPathABC :
437438 """
438439 Return the defined working directory for this ModelicaSystem / OpenModelica session.
439440 """
@@ -458,7 +459,7 @@ def check_model_executable(self):
458459 if returncode != 0 :
459460 raise ModelicaSystemError ("Model executable not working!" )
460461
461- def _xmlparse (self , xml_file : OMCPath ):
462+ def _xmlparse (self , xml_file : OMPathABC ):
462463 if not xml_file .is_file ():
463464 raise ModelicaSystemError (f"XML file not generated: { xml_file } " )
464465
@@ -832,7 +833,7 @@ def _parse_om_version(version: str) -> tuple[int, int, int]:
832833 def _process_override_data (
833834 self ,
834835 om_cmd : ModelExecutionCmd ,
835- override_file : OMCPath ,
836+ override_file : OMPathABC ,
836837 override_var : dict [str , str ],
837838 override_sim : dict [str , str ],
838839 ) -> None :
@@ -864,7 +865,7 @@ def _process_override_data(
864865
865866 def simulate_cmd (
866867 self ,
867- result_file : OMCPath ,
868+ result_file : OMPathABC ,
868869 simflags : Optional [str ] = None ,
869870 simargs : Optional [dict [str , Optional [str | dict [str , Any ] | numbers .Number ]]] = None ,
870871 ) -> ModelExecutionCmd :
@@ -962,14 +963,14 @@ def simulate(
962963 if resultfile is None :
963964 # default result file generated by OM
964965 self ._result_file = self .getWorkDirectory () / f"{ self ._model_name } _res.mat"
965- elif isinstance (resultfile , OMCPath ):
966+ elif isinstance (resultfile , OMPathABC ):
966967 self ._result_file = resultfile
967968 else :
968969 self ._result_file = self ._session .omcpath (resultfile )
969970 if not self ._result_file .is_absolute ():
970971 self ._result_file = self .getWorkDirectory () / resultfile
971972
972- if not isinstance (self ._result_file , OMCPath ):
973+ if not isinstance (self ._result_file , OMPathABC ):
973974 raise ModelicaSystemError (f"Invalid result file path: { self ._result_file } - must be an OMCPath object!" )
974975
975976 om_cmd = self .simulate_cmd (
@@ -1294,7 +1295,7 @@ def setInputs(
12941295
12951296 return True
12961297
1297- def _createCSVData (self , csvfile : Optional [OMCPath ] = None ) -> OMCPath :
1298+ def _createCSVData (self , csvfile : Optional [OMPathABC ] = None ) -> OMPathABC :
12981299 """
12991300 Create a csv file with inputs for the simulation/optimization of the model. If csvfile is provided as argument,
13001301 this file is used; else a generic file name is created.
@@ -1622,7 +1623,7 @@ def set_command_line_options(self, command_line_option: str):
16221623 expr = f'setCommandLineOptions("{ command_line_option } ")'
16231624 self .sendExpression (expr = expr )
16241625
1625- def _loadFile (self , fileName : OMCPath ):
1626+ def _loadFile (self , fileName : OMPathABC ):
16261627 # load file
16271628 self .sendExpression (expr = f'loadFile("{ fileName .as_posix ()} ")' )
16281629
@@ -2003,7 +2004,7 @@ def convertMo2Fmu(
20032004 fmuType : str = "me_cs" ,
20042005 fileNamePrefix : Optional [str ] = None ,
20052006 includeResources : bool = True ,
2006- ) -> OMCPath :
2007+ ) -> OMPathABC :
20072008 """Translate the model into a Functional Mockup Unit.
20082009
20092010 Args:
@@ -2042,7 +2043,7 @@ def convertMo2Fmu(
20422043 def convertFmu2Mo (
20432044 self ,
20442045 fmu : os .PathLike ,
2045- ) -> OMCPath :
2046+ ) -> OMPathABC :
20462047 """
20472048 In order to load FMU, at first it needs to be translated into Modelica model. This method is used to generate
20482049 Modelica model from the given FMU. It generates "fmuName_me_FMU.mo".
@@ -2509,7 +2510,7 @@ def get_doe_solutions(
25092510
25102511def doe_get_solutions (
25112512 msomc : ModelicaSystemOMC ,
2512- resultpath : OMCPath ,
2513+ resultpath : OMPathABC ,
25132514 doe_def : Optional [dict ] = None ,
25142515 var_list : Optional [list ] = None ,
25152516) -> Optional [tuple [str ] | dict [str , dict [str , np .ndarray ]]]:
0 commit comments