3232 OMPathABC ,
3333)
3434
35- OMCPath = OMPathABC
36-
3735# define logger using the current module name as ID
3836logger = logging .getLogger (__name__ )
3937
@@ -390,13 +388,13 @@ def __init__(
390388 self ._version = self ._parse_om_version (version = version_str )
391389
392390 self ._simulated = False # True if the model has already been simulated
393- self ._result_file : Optional [OMCPath ] = None # for storing result file
391+ self ._result_file : Optional [OMPathABC ] = None # for storing result file
394392
395- self ._work_dir : OMCPath = self .setWorkDirectory (work_directory )
393+ self ._work_dir : OMPathABC = self .setWorkDirectory (work_directory )
396394
397395 self ._model_name : Optional [str ] = None
398396 self ._libraries : Optional [list [str | tuple [str , str ]]] = None
399- self ._file_name : Optional [OMCPath ] = None
397+ self ._file_name : Optional [OMPathABC ] = None
400398 self ._variable_filter : Optional [str ] = None
401399
402400 def get_session (self ) -> OMCSession :
@@ -414,7 +412,7 @@ def get_model_name(self) -> str:
414412
415413 return self ._model_name
416414
417- def setWorkDirectory (self , work_directory : Optional [str | os .PathLike ] = None ) -> OMCPath :
415+ def setWorkDirectory (self , work_directory : Optional [str | os .PathLike ] = None ) -> OMPathABC :
418416 """
419417 Define the work directory for the ModelicaSystem / OpenModelica session. The model is build within this
420418 directory. If no directory is defined a unique temporary directory is created.
@@ -436,7 +434,7 @@ def setWorkDirectory(self, work_directory: Optional[str | os.PathLike] = None) -
436434 # ... and also return the defined path
437435 return workdir
438436
439- def getWorkDirectory (self ) -> OMCPath :
437+ def getWorkDirectory (self ) -> OMPathABC :
440438 """
441439 Return the defined working directory for this ModelicaSystem / OpenModelica session.
442440 """
@@ -461,7 +459,7 @@ def check_model_executable(self):
461459 if returncode != 0 :
462460 raise ModelicaSystemError ("Model executable not working!" )
463461
464- def _xmlparse (self , xml_file : OMCPath ):
462+ def _xmlparse (self , xml_file : OMPathABC ):
465463 if not xml_file .is_file ():
466464 raise ModelicaSystemError (f"XML file not generated: { xml_file } " )
467465
@@ -835,7 +833,7 @@ def _parse_om_version(version: str) -> tuple[int, int, int]:
835833 def _process_override_data (
836834 self ,
837835 om_cmd : ModelExecutionCmd ,
838- override_file : OMCPath ,
836+ override_file : OMPathABC ,
839837 override_var : dict [str , str ],
840838 override_sim : dict [str , str ],
841839 ) -> None :
@@ -867,7 +865,7 @@ def _process_override_data(
867865
868866 def simulate_cmd (
869867 self ,
870- result_file : OMCPath ,
868+ result_file : OMPathABC ,
871869 simflags : Optional [str ] = None ,
872870 simargs : Optional [dict [str , Optional [str | dict [str , Any ] | numbers .Number ]]] = None ,
873871 ) -> ModelExecutionCmd :
@@ -965,14 +963,14 @@ def simulate(
965963 if resultfile is None :
966964 # default result file generated by OM
967965 self ._result_file = self .getWorkDirectory () / f"{ self ._model_name } _res.mat"
968- elif isinstance (resultfile , OMCPath ):
966+ elif isinstance (resultfile , OMPathABC ):
969967 self ._result_file = resultfile
970968 else :
971969 self ._result_file = self ._session .omcpath (resultfile )
972970 if not self ._result_file .is_absolute ():
973971 self ._result_file = self .getWorkDirectory () / resultfile
974972
975- if not isinstance (self ._result_file , OMCPath ):
973+ if not isinstance (self ._result_file , OMPathABC ):
976974 raise ModelicaSystemError (f"Invalid result file path: { self ._result_file } - must be an OMCPath object!" )
977975
978976 om_cmd = self .simulate_cmd (
@@ -1297,7 +1295,7 @@ def setInputs(
12971295
12981296 return True
12991297
1300- def _createCSVData (self , csvfile : Optional [OMCPath ] = None ) -> OMCPath :
1298+ def _createCSVData (self , csvfile : Optional [OMPathABC ] = None ) -> OMPathABC :
13011299 """
13021300 Create a csv file with inputs for the simulation/optimization of the model. If csvfile is provided as argument,
13031301 this file is used; else a generic file name is created.
@@ -1625,7 +1623,7 @@ def set_command_line_options(self, command_line_option: str):
16251623 expr = f'setCommandLineOptions("{ command_line_option } ")'
16261624 self .sendExpression (expr = expr )
16271625
1628- def _loadFile (self , fileName : OMCPath ):
1626+ def _loadFile (self , fileName : OMPathABC ):
16291627 # load file
16301628 self .sendExpression (expr = f'loadFile("{ fileName .as_posix ()} ")' )
16311629
@@ -2006,7 +2004,7 @@ def convertMo2Fmu(
20062004 fmuType : str = "me_cs" ,
20072005 fileNamePrefix : Optional [str ] = None ,
20082006 includeResources : bool = True ,
2009- ) -> OMCPath :
2007+ ) -> OMPathABC :
20102008 """Translate the model into a Functional Mockup Unit.
20112009
20122010 Args:
@@ -2045,7 +2043,7 @@ def convertMo2Fmu(
20452043 def convertFmu2Mo (
20462044 self ,
20472045 fmu : os .PathLike ,
2048- ) -> OMCPath :
2046+ ) -> OMPathABC :
20492047 """
20502048 In order to load FMU, at first it needs to be translated into Modelica model. This method is used to generate
20512049 Modelica model from the given FMU. It generates "fmuName_me_FMU.mo".
@@ -2512,7 +2510,7 @@ def get_doe_solutions(
25122510
25132511def doe_get_solutions (
25142512 msomc : ModelicaSystemOMC ,
2515- resultpath : OMCPath ,
2513+ resultpath : OMPathABC ,
25162514 doe_def : Optional [dict ] = None ,
25172515 var_list : Optional [list ] = None ,
25182516) -> Optional [tuple [str ] | dict [str , dict [str , np .ndarray ]]]:
0 commit comments