@@ -350,6 +350,8 @@ def __init__(
350350 else :
351351 self ._session = OMCSessionLocal (omhome = omhome )
352352
353+ # get OpenModelica version
354+ self ._version = self ._session .sendExpression ("getVersion()" , parsed = True )
353355 # set commandLineOptions using default values or the user defined list
354356 if command_line_options is None :
355357 # set default command line options to improve the performance of linearization and to avoid recompilation if
@@ -1074,12 +1076,11 @@ def simulate_cmd(
10741076 if self ._override_variables or self ._simulate_options_override :
10751077 override_file = result_file .parent / f"{ result_file .stem } _override.txt"
10761078
1077- # simulation options are not read from override file from version > 1.25 .0,
1079+ # simulation options are not read from override file from version >= 1.26 .0,
10781080 # pass them to simulation executable directly as individual arguments
10791081 # see https://github.com/OpenModelica/OpenModelica/pull/14813
1080- version = self ._session .sendExpression ("getVersion()" , parsed = True )
1081- major , minor , patch = self .parse_om_version (version )
1082- if (major , minor , patch ) > (1 , 25 , 0 ):
1082+ major , minor , patch = self .parse_om_version (self ._version )
1083+ if (major , minor , patch ) >= (1 , 26 , 0 ):
10831084 for key , opt_value in self ._simulate_options_override .items ():
10841085 om_cmd .arg_set (key = key , val = str (opt_value ))
10851086 override_content = (
@@ -1774,9 +1775,9 @@ def linearize(
17741775 modelname = self ._model_name ,
17751776 )
17761777
1777- version = self . _session . sendExpression ( "getVersion()" , parsed = True )
1778- major , minor , patch = self .parse_om_version (version )
1779- if (major , minor , patch ) > (1 , 25 , 0 ):
1778+ # See comment in simulate_cmd regarding override file and OM version
1779+ major , minor , patch = self .parse_om_version (self . _version )
1780+ if (major , minor , patch ) >= (1 , 26 , 0 ):
17801781 for key , opt_value in self ._linearization_options .items ():
17811782 om_cmd .arg_set (key = key , val = str (opt_value ))
17821783 override_content = (
0 commit comments