@@ -331,14 +331,14 @@ def __init__(
331331 self ._simulate_options : dict [str , str ] = {}
332332 self ._override_variables : dict [str , str ] = {}
333333 self ._simulate_options_override : dict [str , str ] = {}
334- self ._linearization_options : dict [str , str | float ] = {
335- 'startTime' : 0.0 ,
336- 'stopTime' : 1.0 ,
337- 'stepSize' : 0.002 ,
338- 'tolerance' : 1e-8 ,
334+ self ._linearization_options : dict [str , str ] = {
335+ 'startTime' : str ( 0.0 ) ,
336+ 'stopTime' : str ( 1.0 ) ,
337+ 'stepSize' : str ( 0.002 ) ,
338+ 'tolerance' : str ( 1e-8 ) ,
339339 }
340340 self ._optimization_options = self ._linearization_options | {
341- 'numberOfIntervals' : 500 ,
341+ 'numberOfIntervals' : str ( 500 ) ,
342342 }
343343 self ._linearized_inputs : list [str ] = [] # linearization input list
344344 self ._linearized_outputs : list [str ] = [] # linearization output list
@@ -950,7 +950,7 @@ def getSimulationOptions(
950950 def getLinearizationOptions (
951951 self ,
952952 names : Optional [str | list [str ]] = None ,
953- ) -> dict [str , str | float ] | list [str | float ]:
953+ ) -> dict [str , str ] | list [str ]:
954954 """Get simulation options used for linearization.
955955
956956 Args:
@@ -964,31 +964,30 @@ def getLinearizationOptions(
964964 returned.
965965 If `names` is a list, a list with one value for each option name
966966 in names is returned: [option1_value, option2_value, ...].
967- Some option values are returned as float when first initialized,
968- but always as strings after setLinearizationOptions is used to
969- change them.
967+
968+ The option values are always returned as strings.
970969
971970 Examples:
972971 >>> mod.getLinearizationOptions()
973- {'startTime': 0.0, 'stopTime': 1.0, 'stepSize': 0.002, 'tolerance': 1e-08}
972+ {'startTime': ' 0.0' , 'stopTime': ' 1.0' , 'stepSize': ' 0.002' , 'tolerance': ' 1e-08' }
974973 >>> mod.getLinearizationOptions("stopTime")
975- [1.0]
974+ [' 1.0' ]
976975 >>> mod.getLinearizationOptions(["tolerance", "stopTime"])
977- [1e-08, 1.0]
976+ [' 1e-08', ' 1.0' ]
978977 """
979978 if names is None :
980- return self ._linearization_options
979+ return { key : str ( val ) for key , val in self ._linearization_options . items ()}
981980 if isinstance (names , str ):
982981 return [self ._linearization_options [names ]]
983982 if isinstance (names , list ):
984- return [self ._linearization_options [x ] for x in names ]
983+ return [str ( self ._linearization_options [x ]) for x in names ]
985984
986985 raise ModelicaSystemError ("Unhandled input for getLinearizationOptions()" )
987986
988987 def getOptimizationOptions (
989988 self ,
990989 names : Optional [str | list [str ]] = None ,
991- ) -> dict [str , str | float ] | list [str | float ]:
990+ ) -> dict [str , str ] | list [str ]:
992991 """Get simulation options used for optimization.
993992
994993 Args:
@@ -1002,9 +1001,8 @@ def getOptimizationOptions(
10021001 returned.
10031002 If `names` is a list, a list with one value for each option name
10041003 in names is returned: [option1_value, option2_value, ...].
1005- Some option values are returned as float when first initialized,
1006- but always as strings after setOptimizationOptions is used to
1007- change them.
1004+
1005+ The option values are always returned as string.
10081006
10091007 Examples:
10101008 >>> mod.getOptimizationOptions()
@@ -1015,11 +1013,11 @@ def getOptimizationOptions(
10151013 [1e-08, 1.0]
10161014 """
10171015 if names is None :
1018- return self ._optimization_options
1016+ return { key : str ( val ) for key , val in self ._optimization_options . items ()}
10191017 if isinstance (names , str ):
1020- return [self ._optimization_options [names ]]
1018+ return [str ( self ._optimization_options [names ]) ]
10211019 if isinstance (names , list ):
1022- return [self ._optimization_options [x ] for x in names ]
1020+ return [str ( self ._optimization_options [x ]) for x in names ]
10231021
10241022 raise ModelicaSystemError ("Unhandled input for getOptimizationOptions()" )
10251023
0 commit comments