@@ -79,6 +79,77 @@ def test_ModelicaSystemRunner(model_firstorder, param):
7979 _check_result (mod = mod , resultfile = resultfile_modr , param = param )
8080
8181
82+ def test_ModelicaSystemRunner_local (model_firstorder , param ):
83+ # create a model using ModelicaSystem
84+ mod = OMPython .ModelicaSystemOMC ()
85+ mod .model (
86+ model_file = model_firstorder ,
87+ model_name = "M" ,
88+ )
89+
90+ resultfile_mod = mod .getWorkDirectory () / f"{ mod .get_model_name ()} _res_mod.mat"
91+ _run_simulation (mod = mod , resultfile = resultfile_mod , param = param )
92+
93+ # run the model using only the runner class
94+ omcs = OMPython .OMSessionRunner (
95+ version = mod .get_session ().get_version (),
96+ ompath_runner = OMPython .OMPathRunnerLocal ,
97+ )
98+ modr = OMPython .ModelicaSystemRunner (
99+ session = omcs ,
100+ work_directory = mod .getWorkDirectory (),
101+ )
102+ modr .setup (
103+ model_name = "M" ,
104+ )
105+
106+ resultfile_modr = mod .getWorkDirectory () / f"{ mod .get_model_name ()} _res_modr.mat"
107+ _run_simulation (mod = modr , resultfile = resultfile_modr , param = param )
108+
109+ # cannot check the content as runner does not have the capability to open a result file
110+ assert resultfile_mod .size () == resultfile_modr .size ()
111+
112+ # check results
113+ _check_result (mod = mod , resultfile = resultfile_mod , param = param )
114+ _check_result (mod = mod , resultfile = resultfile_modr , param = param )
115+
116+
117+ @skip_on_windows
118+ def test_ModelicaSystemRunner_bash (model_firstorder , param ):
119+ # create a model using ModelicaSystem
120+ mod = OMPython .ModelicaSystemOMC ()
121+ mod .model (
122+ model_file = model_firstorder ,
123+ model_name = "M" ,
124+ )
125+
126+ resultfile_mod = mod .getWorkDirectory () / f"{ mod .get_model_name ()} _res_mod.mat"
127+ _run_simulation (mod = mod , resultfile = resultfile_mod , param = param )
128+
129+ # run the model using only the runner class
130+ omcs = OMPython .OMSessionRunner (
131+ version = mod .get_session ().get_version (),
132+ ompath_runner = OMPython .OMPathRunnerBash ,
133+ )
134+ modr = OMPython .ModelicaSystemRunner (
135+ session = omcs ,
136+ work_directory = mod .getWorkDirectory (),
137+ )
138+ modr .setup (
139+ model_name = "M" ,
140+ )
141+
142+ resultfile_modr = mod .getWorkDirectory () / f"{ mod .get_model_name ()} _res_modr.mat"
143+ _run_simulation (mod = modr , resultfile = resultfile_modr , param = param )
144+
145+ # cannot check the content as runner does not have the capability to open a result file
146+ assert resultfile_mod .size () == resultfile_modr .size ()
147+
148+ # check results
149+ _check_result (mod = mod , resultfile = resultfile_mod , param = param )
150+ _check_result (mod = mod , resultfile = resultfile_modr , param = param )
151+
152+
82153@skip_on_windows
83154def test_ModelicaSystemRunner_bash_docker (model_firstorder , param ):
84155 omcp = OMPython .OMCSessionDocker (docker = "openmodelica/openmodelica:v1.25.0-minimal" )
0 commit comments