Skip to content

Commit 78d155b

Browse files
committed
Improve docstring for getSimulationOptions()
1 parent 72f8033 commit 78d155b

1 file changed

Lines changed: 23 additions & 8 deletions

File tree

OMPython/ModelicaSystem.py

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -803,14 +803,29 @@ def getOutputs(self, names: Optional[str | list[str]] = None): # 7
803803

804804
raise ModelicaSystemError("Unhandled input for getOutputs()")
805805

806-
def getSimulationOptions(self, names=None): # 8
807-
"""
808-
This method returns dict. The key is simulation option names and value is corresponding simulation option value.
809-
If name is None then the function will return dict which contain all simulation option names as key and value as corresponding values. eg., getSimulationOptions()
810-
usage:
811-
>>> getSimulationOptions()
812-
>>> getSimulationOptions("Name1")
813-
>>> getSimulationOptions(["Name1","Name2"])
806+
def getSimulationOptions(self, names: Optional[str | list[str]] = None) -> dict[str, str] | list[str]:
807+
"""Get simulation options such as stopTime and tolerance.
808+
809+
Args:
810+
names: Either None (default), a string with the simulation option
811+
name, or a list of option name strings.
812+
813+
Returns:
814+
If `names` is None, a dict in the format
815+
{option_name: option_value} is returned.
816+
If `names` is a string, a single element list [option_value] is
817+
returned.
818+
If `names` is a list, a list with one value for each option name
819+
in names is returned: [option1_value, option2_value, ...].
820+
Option values are always returned as strings.
821+
822+
Examples:
823+
>>> mod.getSimulationOptions()
824+
{'startTime': '0', 'stopTime': '1.234', 'stepSize': '0.002', 'tolerance': '1.1e-08', 'solver': 'dassl', 'outputFormat': 'mat'}
825+
>>> mod.getSimulationOptions("stopTime")
826+
['1.234']
827+
>>> mod.getSimulationOptions(["tolerance", "stopTime"])
828+
['1.1e-08', '1.234']
814829
"""
815830
if names is None:
816831
return self._simulateOptions

0 commit comments

Comments
 (0)