File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1418,6 +1418,62 @@ def getLinearStates(self):
14181418class ModelicaSystemDoE :
14191419 """
14201420 Class to run DoEs based on a (Open)Modelica model using ModelicaSystem
1421+
1422+ Example
1423+ -------
1424+ ```
1425+ import OMPython
1426+ import pathlib
1427+
1428+
1429+ def run_doe():
1430+ mypath = pathlib.Path('.')
1431+
1432+ model = mypath / "M.mo"
1433+ model.write_text(
1434+ " model M\n "
1435+ " parameter Integer p=1;\n "
1436+ " parameter Integer q=1;\n "
1437+ " parameter Real a = -1;\n "
1438+ " parameter Real b = -1;\n "
1439+ " Real x[p];\n "
1440+ " Real y[q];\n "
1441+ " equation\n "
1442+ " der(x) = a * fill(1.0, p);\n "
1443+ " der(y) = b * fill(1.0, q);\n "
1444+ " end M;\n "
1445+ )
1446+
1447+ param = {
1448+ # structural
1449+ 'p': [1, 2],
1450+ 'q': [3, 4],
1451+ # simple
1452+ 'a': [5, 6],
1453+ 'b': [7, 8],
1454+ }
1455+
1456+ resdir = mypath / 'DoE'
1457+ resdir.mkdir(exist_ok=True)
1458+
1459+ mod_doe = OMPython.ModelicaSystemDoE(
1460+ fileName=model.as_posix(),
1461+ modelName="M",
1462+ parameters=param,
1463+ resultpath=resdir,
1464+ simargs={"override": {'stopTime': 1.0}},
1465+ )
1466+ mod_doe.prepare()
1467+ df_doe = mod_doe.get_doe()
1468+ mod_doe.simulate()
1469+ var_list = mod_doe.get_solutions()
1470+ sol_dict = mod_doe.get_solutions(var_list=var_list)
1471+
1472+
1473+ if __name__ == "__main__":
1474+ run_doe()
1475+ ```
1476+
14211477 """
14221478
14231479 DF_COLUMNS_RESULTFILENAME : str = 'resultfilename'
You can’t perform that action at this time.
0 commit comments