@@ -131,7 +131,7 @@ def __init__(
131
131
variableFilter : Optional [str ] = None ,
132
132
customBuildDirectory : Optional [str | os .PathLike ] = None ,
133
133
omhome : Optional [str ] = None ,
134
- session : Optional [OMCSessionBase ] = None
134
+ session : Optional [OMCSessionZMQ ] = None
135
135
):
136
136
"""Initialize, load and build a model.
137
137
@@ -237,7 +237,7 @@ def setCommandLineOptions(self, commandLineOptions: str):
237
237
exp = f'setCommandLineOptions("{ commandLineOptions } ")'
238
238
self .sendExpression (exp )
239
239
240
- def loadFile (self , fileName : Path ):
240
+ def loadFile (self , fileName : pathlib . Path ):
241
241
# load file
242
242
self .sendExpression (f'loadFile("{ fileName .as_posix ()} ")' )
243
243
@@ -460,7 +460,7 @@ def getContinuous(self, names=None): # 4
460
460
raise ModelicaSystemError (f"{ i } is not continuous" )
461
461
return valuelist
462
462
463
- raise ModelicaSystemError (f "Unhandled input for getContinous()" )
463
+ raise ModelicaSystemError ("Unhandled input for getContinous()" )
464
464
465
465
def getParameters (self , names : Optional [str | list [str ]] = None ) -> dict [str , str ] | list [str ]: # 5
466
466
"""Get parameter values.
@@ -491,7 +491,7 @@ def getParameters(self, names: Optional[str | list[str]] = None) -> dict[str, st
491
491
elif isinstance (names , list ):
492
492
return [self .paramlist .get (x , "NotExist" ) for x in names ]
493
493
494
- raise ModelicaSystemError (f "Unhandled input for getParameters()" )
494
+ raise ModelicaSystemError ("Unhandled input for getParameters()" )
495
495
496
496
def getInputs (self , names : Optional [str | list [str ]] = None ) -> dict | list : # 6
497
497
"""Get input values.
@@ -527,7 +527,7 @@ def getInputs(self, names: Optional[str | list[str]] = None) -> dict | list: #
527
527
elif isinstance (names , list ):
528
528
return [self .inputlist .get (x , "NotExist" ) for x in names ]
529
529
530
- raise ModelicaSystemError (f "Unhandled input for getInputs()" )
530
+ raise ModelicaSystemError ("Unhandled input for getInputs()" )
531
531
532
532
def getOutputs (self , names : Optional [str | list [str ]] = None ): # 7
533
533
"""Get output values.
@@ -925,7 +925,7 @@ def checkValidInputs(self, name):
925
925
else :
926
926
ModelicaSystemError ('Error!!! Value must be in tuple format' )
927
927
928
- def createCSVData (self ) -> Path :
928
+ def createCSVData (self ) -> pathlib . Path :
929
929
start_time : float = float (self .simulateOptions ["startTime" ])
930
930
stop_time : float = float (self .simulateOptions ["stopTime" ])
931
931
@@ -972,7 +972,7 @@ def createCSVData(self) -> Path:
972
972
writer = csv .writer (f )
973
973
writer .writerows (csv_rows )
974
974
975
- return csvfile
975
+ return csvFile
976
976
977
977
# to convert Modelica model to FMU
978
978
def convertMo2Fmu (self , version = "2.0" , fmuType = "me_cs" , fileNamePrefix = "<default>" , includeResources = True ): # 19
@@ -1012,10 +1012,10 @@ def convertFmu2Mo(self, fmuName): # 20
1012
1012
fmuFileName = self .requestApi ('importFMU' , fmuName )
1013
1013
1014
1014
# report proper error message
1015
- if not os .path .exists (fileName ):
1015
+ if not os .path .exists (fmuFileName ):
1016
1016
raise ModelicaSystemError (f"Missing FMU file { fmuFileName } " )
1017
1017
1018
- return fileName
1018
+ return fmuFileName
1019
1019
1020
1020
# to optimize model
1021
1021
def optimize (self ): # 21
@@ -1105,7 +1105,7 @@ def linearize(self, lintime: Optional[float] = None, simflags: Optional[str] = N
1105
1105
linearFile = pathlib .Path (f'linear_{ self .modelName } .py' )
1106
1106
1107
1107
if not linearFile .exists ():
1108
- raise ModelicaSystemError (f"Linearization failed: { linearFile } not found: { errormsg } " )
1108
+ raise ModelicaSystemError (f"Linearization failed: { linearFile } not found! " )
1109
1109
1110
1110
# this function is called from the generated python code linearized_model.py at runtime,
1111
1111
# 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