@@ -43,7 +43,7 @@ def param_doe() -> dict[str, list]:
4343 return param
4444
4545
46- def test_ModelicaDoEOMC_local (tmp_path , model_doe , param_doe ):
46+ def test_ModelicaDoERunner_OMC (tmp_path , model_doe , param_doe ):
4747 tmpdir = tmp_path / 'DoE'
4848 tmpdir .mkdir (exist_ok = True )
4949
@@ -67,6 +67,38 @@ def test_ModelicaDoEOMC_local(tmp_path, model_doe, param_doe):
6767 _check_runner_result (mod = mod , doe_mod = doe_mod )
6868
6969
70+ def test_ModelicaDoERunner_Runner (tmp_path , model_doe , param_doe ):
71+ tmpdir = tmp_path / 'DoE'
72+ tmpdir .mkdir (exist_ok = True )
73+
74+ mod = OMPython .ModelicaSystemOMC ()
75+ mod .model (
76+ model_file = model_doe ,
77+ model_name = "M" ,
78+ )
79+
80+ resultfile_mod = mod .getWorkDirectory () / f"{ mod .get_model_name ()} _res_mod.mat"
81+ _run_simulation (mod = mod , resultfile = resultfile_mod , param = param_doe )
82+
83+ # run the model using only the runner class
84+ omcs = OMPython .OMSessionRunner (
85+ version = mod .get_session ().get_version (),
86+ )
87+ modr = OMPython .ModelicaSystemRunner (
88+ session = omcs ,
89+ work_directory = mod .getWorkDirectory (),
90+ )
91+ doe_mod = OMPython .ModelicaDoERunner (
92+ mod = modr ,
93+ parameters = param_doe ,
94+ resultpath = tmpdir ,
95+ )
96+
97+ _run_ModelicaDoERunner (doe_mod = doe_mod )
98+
99+ _check_runner_result (mod = mod , doe_mod = doe_mod )
100+
101+
70102def _run_simulation (mod , resultfile , param ):
71103 simOptions = {"stopTime" : 1.0 , "stepSize" : 0.1 , "tolerance" : 1e-8 }
72104 mod .setSimulationOptions (** simOptions )
0 commit comments