Changeset 13735


Ignore:
Timestamp:
Oct 12, 2019 9:36:58 AM (5 weeks ago)
Author:
Christian Andersson
Message:

Updated tests. Related to ticket:5854

Location:
branches/dev-cw-pyfmi/Python/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/dev-cw-pyfmi/Python/src/pyjmi/examples/cstr_mpc_casadi.py

    r8187 r13735  
    8686    sim_model.set('_start_T', T_0_A)
    8787    sim_model.set('Tc', 280)
    88     init_res = sim_model.simulate(start_time=0., final_time=150)
     88   
     89    opts = sim_model.simulate_options()
     90    opts["CVode_options"]["maxh"] = 0.0
     91    opts["ncp"] = 0
     92   
     93    init_res = sim_model.simulate(start_time=0., final_time=150, options=opts)
    8994
    9095    ### 2. Define the optimal control problem and solve it using the MPC class
     
    159164        sim_res = sim_model.simulate(start_time=k*sample_period,
    160165                                     final_time=(k+1)*sample_period,
    161                                      input=u_k)
     166                                     input=u_k, options=opts)
    162167
    163168        # Extract state at end of sample_period from sim_res and add Gaussian
  • branches/dev-cw-pyfmi/Python/src/pyjmi/ukf.py

    r10171 r13735  
    368368                opt['CVode_options']['atol'] = 1e-8
    369369                opt['CVode_options']['rtol'] = 1e-6
     370                opt['CVode_options']['maxh'] = 0.0
     371                opt['ncp'] = 0
    370372                print 'Simulating sigma-point '+str(i+1)+' out of '+str(sigma.shape[1])+' :'
    371373                try:
  • branches/dev-cw-pyfmi/Python/src/tests_jmodelica/general/base_simul.py

    r10446 r13735  
    286286       
    287287        if not cvode_options:
    288             cvode_options = {'atol':self.abs_tol,'rtol':self.rel_tol}
     288            cvode_options = {'atol':self.abs_tol,'rtol':self.rel_tol, 'maxh':0.0}
     289        else:
     290            if not 'maxh' in cvode_options:
     291                cvode_options['maxh'] = 0.0
    289292       
    290293        if isinstance(self.model, FMUModelME1) or isinstance(self.model, FMUModelME2):
  • branches/dev-cw-pyfmi/Python/src/tests_jmodelica/test_fmi_coupled.py

    r13338 r13735  
    8282        nose.tools.assert_almost_equal(res.final("time"),1.5)
    8383        nose.tools.assert_almost_equal(res.final("First.J1.w"),res.final("Second.J1.w"))
    84         nose.tools.assert_almost_equal(res.final("First.J1.w"), 3.2501079, places=3)
     84        nose.tools.assert_almost_equal(res.final("First.J1.w"), 3.2501079, places=2)
    8585       
    8686        coupled.reset()
     
    9090        nose.tools.assert_almost_equal(res.final("time"),1.5)
    9191        nose.tools.assert_almost_equal(res.final("First.J1.w"),res.final("Second.J1.w"))
    92         nose.tools.assert_almost_equal(res.final("First.J1.w"), 3.2501079, places=3)
     92        nose.tools.assert_almost_equal(res.final("First.J1.w"), 3.2501079, places=2)
    9393
    9494    @testattr(stddist_full = True)
Note: See TracChangeset for help on using the changeset viewer.