@@ -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_ModelicaSystemOMC (tmp_path , model_doe , param_doe ):
4747 tmpdir = tmp_path / 'DoE'
4848 tmpdir .mkdir (exist_ok = True )
4949
@@ -67,6 +67,41 @@ 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_ModelicaSystemRunner (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+ modr .setup (
92+ model_name = "M" ,
93+ )
94+ doe_mod = OMPython .ModelicaDoERunner (
95+ mod = modr ,
96+ parameters = param_doe ,
97+ resultpath = tmpdir ,
98+ )
99+
100+ _run_ModelicaDoERunner (doe_mod = doe_mod )
101+
102+ _check_runner_result (mod = mod , doe_mod = doe_mod )
103+
104+
70105def _run_simulation (mod , resultfile , param ):
71106 simOptions = {"stopTime" : 1.0 , "stepSize" : 0.1 , "tolerance" : 1e-8 }
72107 mod .setSimulationOptions (** simOptions )
@@ -77,7 +112,7 @@ def _run_simulation(mod, resultfile, param):
77112
78113def _run_ModelicaDoERunner (doe_mod ):
79114 doe_count = doe_mod .prepare ()
80- assert doe_count == 16
115+ assert doe_count == 4
81116
82117 doe_def = doe_mod .get_doe_definition ()
83118 assert isinstance (doe_def , dict )
0 commit comments