@@ -131,7 +131,7 @@ def __init__(
131131 variableFilter : Optional [str ] = None ,
132132 customBuildDirectory : Optional [str | os .PathLike ] = None ,
133133 omhome : Optional [str ] = None ,
134- session : Optional [OMCSessionBase ] = None
134+ session : Optional [OMCSessionZMQ ] = None
135135 ):
136136 """Initialize, load and build a model.
137137
@@ -237,7 +237,7 @@ def setCommandLineOptions(self, commandLineOptions: str):
237237 exp = f'setCommandLineOptions("{ commandLineOptions } ")'
238238 self .sendExpression (exp )
239239
240- def loadFile (self , fileName : Path ):
240+ def loadFile (self , fileName : pathlib . Path ):
241241 # load file
242242 self .sendExpression (f'loadFile("{ fileName .as_posix ()} ")' )
243243
@@ -460,7 +460,7 @@ def getContinuous(self, names=None): # 4
460460 raise ModelicaSystemError (f"{ i } is not continuous" )
461461 return valuelist
462462
463- raise ModelicaSystemError (f "Unhandled input for getContinous()" )
463+ raise ModelicaSystemError ("Unhandled input for getContinous()" )
464464
465465 def getParameters (self , names : Optional [str | list [str ]] = None ) -> dict [str , str ] | list [str ]: # 5
466466 """Get parameter values.
@@ -491,7 +491,7 @@ def getParameters(self, names: Optional[str | list[str]] = None) -> dict[str, st
491491 elif isinstance (names , list ):
492492 return [self .paramlist .get (x , "NotExist" ) for x in names ]
493493
494- raise ModelicaSystemError (f "Unhandled input for getParameters()" )
494+ raise ModelicaSystemError ("Unhandled input for getParameters()" )
495495
496496 def getInputs (self , names : Optional [str | list [str ]] = None ) -> dict | list : # 6
497497 """Get input values.
@@ -527,7 +527,7 @@ def getInputs(self, names: Optional[str | list[str]] = None) -> dict | list: #
527527 elif isinstance (names , list ):
528528 return [self .inputlist .get (x , "NotExist" ) for x in names ]
529529
530- raise ModelicaSystemError (f "Unhandled input for getInputs()" )
530+ raise ModelicaSystemError ("Unhandled input for getInputs()" )
531531
532532 def getOutputs (self , names : Optional [str | list [str ]] = None ): # 7
533533 """Get output values.
@@ -707,7 +707,7 @@ def simulate(self, resultfile=None, simflags=None, timeout: Optional[int] = None
707707 if float (self .simulateOptions ["stopTime" ]) != val [- 1 ][0 ]:
708708 raise ModelicaSystemError (f"stopTime not matched for Input { i } !" )
709709 self .csvFile = self .createCSVData () # create csv file
710- csvinput = " -csvInput=" + self .csvFile .as_posx ()
710+ csvinput = " -csvInput=" + self .csvFile .as_posix ()
711711 else :
712712 csvinput = ""
713713
@@ -925,7 +925,7 @@ def checkValidInputs(self, name):
925925 else :
926926 ModelicaSystemError ('Error!!! Value must be in tuple format' )
927927
928- def createCSVData (self ) -> Path :
928+ def createCSVData (self ) -> pathlib . Path :
929929 start_time : float = float (self .simulateOptions ["startTime" ])
930930 stop_time : float = float (self .simulateOptions ["stopTime" ])
931931
@@ -972,7 +972,7 @@ def createCSVData(self) -> Path:
972972 writer = csv .writer (f )
973973 writer .writerows (csv_rows )
974974
975- return csvfile
975+ return csvFile
976976
977977 # to convert Modelica model to FMU
978978 def convertMo2Fmu (self , version = "2.0" , fmuType = "me_cs" , fileNamePrefix = "<default>" , includeResources = True ): # 19
@@ -1012,10 +1012,10 @@ def convertFmu2Mo(self, fmuName): # 20
10121012 fmuFileName = self .requestApi ('importFMU' , fmuName )
10131013
10141014 # report proper error message
1015- if not os .path .exists (fileName ):
1015+ if not os .path .exists (fmuFileName ):
10161016 raise ModelicaSystemError (f"Missing FMU file { fmuFileName } " )
10171017
1018- return fileName
1018+ return fmuFileName
10191019
10201020 # to optimize model
10211021 def optimize (self ): # 21
@@ -1105,7 +1105,7 @@ def linearize(self, lintime: Optional[float] = None, simflags: Optional[str] = N
11051105 linearFile = pathlib .Path (f'linear_{ self .modelName } .py' )
11061106
11071107 if not linearFile .exists ():
1108- raise ModelicaSystemError (f"Linearization failed: { linearFile } not found: { errormsg } " )
1108+ raise ModelicaSystemError (f"Linearization failed: { linearFile } not found! " )
11091109
11101110 # this function is called from the generated python code linearized_model.py at runtime,
11111111 # to improve the performance by directly reading the matrices A, B, C and D from the julia code and avoid building the linearized modelica model
0 commit comments