@@ -65,8 +65,8 @@ def test_setSimulationOptions():
6565 mod = OMPython .ModelicaSystem (fileName = model_path + "BouncingBall.mo" , modelName = "BouncingBall" )
6666
6767 # method 1
68- mod .setSimulationOptions (simOptions = { " stopTime" : 1.234 } )
69- mod .setSimulationOptions (simOptions = { " tolerance" : 1.1e-08 } )
68+ mod .setSimulationOptions (stopTime = 1.234 )
69+ mod .setSimulationOptions (tolerance = 1.1e-08 )
7070 assert mod .getSimulationOptions ("stopTime" ) == ["1.234" ]
7171 assert mod .getSimulationOptions ("tolerance" ) == ["1.1e-08" ]
7272 assert mod .getSimulationOptions (["tolerance" , "stopTime" ]) == ["1.1e-08" , "1.234" ]
@@ -78,7 +78,7 @@ def test_setSimulationOptions():
7878 mod .getSimulationOptions ("thisOptionDoesNotExist" )
7979
8080 # method 2
81- mod .setSimulationOptions (simOptions = { " stopTime" : 2.1 , " tolerance" : " 1.2e-08" } )
81+ mod .setSimulationOptions (stopTime = 2.1 , tolerance = 1.2e-08 )
8282 d = mod .getSimulationOptions ()
8383 assert d ["stopTime" ] == "2.1"
8484 assert d ["tolerance" ] == "1.2e-08"
@@ -120,7 +120,9 @@ def test_getSolutions(model_firstorder):
120120 a = - 1
121121 tau = - 1 / a
122122 stopTime = 5 * tau
123- mod .setSimulationOptions (simOptions = {"stopTime" : stopTime , "stepSize" : 0.1 , "tolerance" : 1e-8 })
123+
124+ simOptions = {"stopTime" : stopTime , "stepSize" : 0.1 , "tolerance" : 1e-8 }
125+ mod .setSimulationOptions (** simOptions )
124126 mod .simulate ()
125127
126128 x = mod .getSolutions ("x" )
@@ -299,7 +301,7 @@ def test_getters(tmp_path):
299301 x0 = 1.0
300302 x_analytical = - b / a + (x0 + b / a ) * np .exp (a * stopTime )
301303 dx_analytical = (x0 + b / a ) * a * np .exp (a * stopTime )
302- mod .setSimulationOptions (simOptions = { " stopTime" : stopTime } )
304+ mod .setSimulationOptions (stopTime = stopTime )
303305 mod .simulate ()
304306
305307 # getOutputs after simulate()
@@ -328,7 +330,7 @@ def test_getters(tmp_path):
328330 mod .getContinuous ("a" ) # a is a parameter
329331
330332 with pytest .raises (OMPython .ModelicaSystemError ):
331- mod .setSimulationOptions (simOptions = { " thisOptionDoesNotExist" : 3 } )
333+ mod .setSimulationOptions (thisOptionDoesNotExist = 3 )
332334
333335
334336def test_simulate_inputs (tmp_path ):
@@ -346,7 +348,8 @@ def test_simulate_inputs(tmp_path):
346348""" )
347349 mod = OMPython .ModelicaSystem (fileName = model_file .as_posix (), modelName = "M_input" )
348350
349- mod .setSimulationOptions (simOptions = {"stopTime" : 1.0 })
351+ simOptions = {"stopTime" : 1.0 }
352+ mod .setSimulationOptions (** simOptions )
350353
351354 # integrate zero (no setInputs call) - it should default to None -> 0
352355 assert mod .getInputs () == {
@@ -358,7 +361,7 @@ def test_simulate_inputs(tmp_path):
358361 assert np .isclose (y [- 1 ], 0.0 )
359362
360363 # integrate a constant
361- mod .setInputs (name = { "u1" : 2.5 } )
364+ mod .setInputs (u1 = 2.5 )
362365 assert mod .getInputs () == {
363366 "u1" : [
364367 (0.0 , 2.5 ),
@@ -375,7 +378,8 @@ def test_simulate_inputs(tmp_path):
375378 assert np .isclose (y [- 1 ], 2.5 )
376379
377380 # now let's integrate the sum of two ramps
378- mod .setInputs (name = {"u1" : [(0.0 , 0.0 ), (0.5 , 2 ), (1.0 , 0 )]})
381+ inputs = {"u1" : [(0.0 , 0.0 ), (0.5 , 2 ), (1.0 , 0 )]}
382+ mod .setInputs (** inputs )
379383 assert mod .getInputs ("u1" ) == [[
380384 (0.0 , 0.0 ),
381385 (0.5 , 2.0 ),
@@ -388,17 +392,20 @@ def test_simulate_inputs(tmp_path):
388392 # let's try some edge cases
389393 # unmatched startTime
390394 with pytest .raises (OMPython .ModelicaSystemError ):
391- mod .setInputs (name = { "u1" : [(- 0.5 , 0.0 ), (1.0 , 1 )]} )
395+ mod .setInputs (u1 = [(- 0.5 , 0.0 ), (1.0 , 1 )])
392396 mod .simulate ()
393397 # unmatched stopTime
394398 with pytest .raises (OMPython .ModelicaSystemError ):
395- mod .setInputs (name = { "u1" : [(0.0 , 0.0 ), (0.5 , 1 )]} )
399+ mod .setInputs (u1 = [(0.0 , 0.0 ), (0.5 , 1 )])
396400 mod .simulate ()
397401
398402 # Let's use both inputs, but each one with different number of
399403 # samples. This has an effect when generating the csv file.
400- mod .setInputs (name = {"u1" : [(0.0 , 0 ), (1.0 , 1 )],
401- "u2" : [(0.0 , 0 ), (0.25 , 0.5 ), (0.5 , 1.0 ), (1.0 , 0 )]})
404+ inputs = {
405+ "u1" : [(0.0 , 0 ), (1.0 , 1 )],
406+ "u2" : [(0.0 , 0 ), (0.25 , 0.5 ), (0.5 , 1.0 ), (1.0 , 0 )],
407+ }
408+ mod .setInputs (** inputs )
402409 csv_file = mod ._createCSVData ()
403410 assert pathlib .Path (csv_file ).read_text () == """time,u1,u2,end
4044110.0,0.0,0.0,0
0 commit comments