Changeset 9162


Ignore:
Timestamp:
Aug 31, 2016 4:26:54 PM (3 years ago)
Author:
Christian Andersson
Message:

Added test for immediate solution when starting enhanced event iteration. Related to ticket:4411

Location:
trunk/Python/src/tests_jmodelica
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Python/src/tests_jmodelica/files/Modelica/EventIter.mo

    r8679 r9162  
    118118end EnhancedEventIteration2;
    119119
     120model EnhancedEventIteration3
     121    Real x(start = 4);
     122    parameter Real magnitude = 1e-6;
     123equation
     124    if x > 2 then
     125       x = 0.5*magnitude;
     126    elseif x <= 0.5*magnitude then
     127       x^2 = 1.0*magnitude^2;
     128    else
     129       x = -0.4*magnitude;
     130    end if;
     131end EnhancedEventIteration3;
     132
    120133model SingularSystem1
    121134  Real sa(start=0);
  • trunk/Python/src/tests_jmodelica/simulation/test_assimulo_interface_fmi.py

    r8990 r9162  
    285285        compile_fmu("EventIter.EnhancedEventIteration1", file_name)
    286286        compile_fmu("EventIter.EnhancedEventIteration2", file_name)
     287        compile_fmu("EventIter.EnhancedEventIteration3", file_name)
    287288        compile_fmu("EventIter.SingularSystem1", file_name)
    288289        compile_fmu("EventIter.InitialPhasing1", file_name)
     
    338339        nose.tools.assert_almost_equal(res["z"][-1], 0.0)
    339340        nose.tools.assert_almost_equal(res["w"][-1], 1.0)
     341       
     342    @testattr(stddist = True)
     343    def test_enhanced_event_iteration_3(self):
     344        model = load_fmu("EventIter_EnhancedEventIteration3.fmu")
     345        model.initialize(relativeTolerance=1e-1)
     346       
     347        nose.tools.assert_almost_equal(model.get("x"), -1e-6)
    340348   
    341349    @testattr(stddist = True)
Note: See TracChangeset for help on using the changeset viewer.