Changeset 13801
 Timestamp:
 Oct 22, 2019 1:42:46 PM (4 weeks ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

branches/dev5819/Python/src/tests_jmodelica/simulation/test_assimulo_interface_fmi.py
r13800 r13801 749 749 res = model.simulate(final_time=3.5, input=input_object,options=opts) 750 750 751 N.testing.assert_almost_equal(N.interp(0.75,res["time"],res["y"]),0.5, places=2)752 N.testing.assert_almost_equal(N.interp(2.25,res["time"],res["y"]),0.5, places=2)753 nose.tools.assert_not_almost_equal(N.interp(0.25,res["time"],res["y"]),0.5, places=2)754 nose.tools.assert_not_almost_equal(N.interp(2.75,res["time"],res["y"]),0.5, places=2)755 nose.tools.assert_not_almost_equal(N.interp(0.75,res["time"],res["x"]),0.5, places=2)756 nose.tools.assert_not_almost_equal(N.interp(2.25,res["time"],res["x"]),0.5, places=2)757 N.testing.assert_almost_equal(N.interp(1.5,res["time"],res["y"]),0.5, places=2)751 N.testing.assert_almost_equal(N.interp(0.75,res["time"],res["y"]),0.5,2) 752 N.testing.assert_almost_equal(N.interp(2.25,res["time"],res["y"]),0.5,2) 753 nose.tools.assert_not_almost_equal(N.interp(0.25,res["time"],res["y"]),0.5,2) 754 nose.tools.assert_not_almost_equal(N.interp(2.75,res["time"],res["y"]),0.5,2) 755 nose.tools.assert_not_almost_equal(N.interp(0.75,res["time"],res["x"]),0.5,2) 756 nose.tools.assert_not_almost_equal(N.interp(2.25,res["time"],res["x"]),0.5,2) 757 N.testing.assert_almost_equal(N.interp(1.5,res["time"],res["y"]),0.5,2) 758 758 759 759 @testattr(stddist_full = True) … … 764 764 res = model.simulate(final_time=3.5, input=input_object,options=opts) 765 765 766 N.testing.assert_almost_equal(N.interp(0.75,res["time"],res["y"]),0.5, places=2)767 N.testing.assert_almost_equal(N.interp(2.25,res["time"],res["y"]),0.5, places=2)768 nose.tools.assert_not_almost_equal(N.interp(0.25,res["time"],res["y"]),0.5, places=2)769 nose.tools.assert_not_almost_equal(N.interp(2.75,res["time"],res["y"]),0.5, places=2)770 nose.tools.assert_not_almost_equal(N.interp(0.75,res["time"],res["x"]),0.5, places=2)771 nose.tools.assert_not_almost_equal(N.interp(2.25,res["time"],res["x"]),0.5, places=2)772 N.testing.assert_almost_equal(N.interp(1.5,res["time"],res["y"]),0.5, places=2)766 N.testing.assert_almost_equal(N.interp(0.75,res["time"],res["y"]),0.5,2) 767 N.testing.assert_almost_equal(N.interp(2.25,res["time"],res["y"]),0.5,2) 768 nose.tools.assert_not_almost_equal(N.interp(0.25,res["time"],res["y"]),0.5,2) 769 nose.tools.assert_not_almost_equal(N.interp(2.75,res["time"],res["y"]),0.5,2) 770 nose.tools.assert_not_almost_equal(N.interp(0.75,res["time"],res["x"]),0.5,2) 771 nose.tools.assert_not_almost_equal(N.interp(2.25,res["time"],res["x"]),0.5,2) 772 N.testing.assert_almost_equal(N.interp(1.5,res["time"],res["y"]),0.5,2) 773 773 774 774 @testattr(stddist_full = True) … … 779 779 res = model.simulate(final_time=3.5, input=input_object,options=opts) 780 780 781 N.testing.assert_almost_equal(N.interp(0.75,res["time"],res["y"]),0.5, places=2)782 N.testing.assert_almost_equal(N.interp(2.25,res["time"],res["y"]),0.5, places=2)783 nose.tools.assert_not_almost_equal(N.interp(0.25,res["time"],res["y"]),0.5, places=2)784 nose.tools.assert_not_almost_equal(N.interp(2.75,res["time"],res["y"]),0.5, places=2)785 nose.tools.assert_not_almost_equal(N.interp(0.75,res["time"],res["x"]),0.5, places=2)786 nose.tools.assert_not_almost_equal(N.interp(2.25,res["time"],res["x"]),0.5, places=2)787 N.testing.assert_almost_equal(N.interp(1.5,res["time"],res["y"]),0.5, places=2)781 N.testing.assert_almost_equal(N.interp(0.75,res["time"],res["y"]),0.5,2) 782 N.testing.assert_almost_equal(N.interp(2.25,res["time"],res["y"]),0.5,2) 783 nose.tools.assert_not_almost_equal(N.interp(0.25,res["time"],res["y"]),0.5,2) 784 nose.tools.assert_not_almost_equal(N.interp(2.75,res["time"],res["y"]),0.5,2) 785 nose.tools.assert_not_almost_equal(N.interp(0.75,res["time"],res["x"]),0.5,2) 786 nose.tools.assert_not_almost_equal(N.interp(2.25,res["time"],res["x"]),0.5,2) 787 N.testing.assert_almost_equal(N.interp(1.5,res["time"],res["y"]),0.5,2) 788 788 789 789 @testattr(stddist_full = True) … … 794 794 res = model.simulate(final_time=3.5, input=input_object,options=opts) 795 795 796 N.testing.assert_almost_equal(N.interp(0.75,res["time"],res["y"]),0.5, places=2)797 N.testing.assert_almost_equal(N.interp(2.25,res["time"],res["y"]),0.5, places=2)798 nose.tools.assert_not_almost_equal(N.interp(0.25,res["time"],res["y"]),0.5, places=2)799 nose.tools.assert_not_almost_equal(N.interp(2.75,res["time"],res["y"]),0.5, places=2)800 nose.tools.assert_not_almost_equal(N.interp(0.75,res["time"],res["x"]),0.5, places=2)801 nose.tools.assert_not_almost_equal(N.interp(2.25,res["time"],res["x"]),0.5, places=2)802 N.testing.assert_almost_equal(N.interp(1.5,res["time"],res["y"]),0.5, places=2)796 N.testing.assert_almost_equal(N.interp(0.75,res["time"],res["y"]),0.5,2) 797 N.testing.assert_almost_equal(N.interp(2.25,res["time"],res["y"]),0.5,2) 798 nose.tools.assert_not_almost_equal(N.interp(0.25,res["time"],res["y"]),0.5,2) 799 nose.tools.assert_not_almost_equal(N.interp(2.75,res["time"],res["y"]),0.5,2) 800 nose.tools.assert_not_almost_equal(N.interp(0.75,res["time"],res["x"]),0.5,2) 801 nose.tools.assert_not_almost_equal(N.interp(2.25,res["time"],res["x"]),0.5,2) 802 N.testing.assert_almost_equal(N.interp(1.5,res["time"],res["y"]),0.5,2) 803 803 804 804 @testattr(stddist_full = True) … … 808 808 res = model.simulate(final_time=0.1) 809 809 810 N.testing.assert_almost_equal(res.initial("x"),1.0, places=3)811 N.testing.assert_almost_equal(res.initial("y"),0.0, places=3)810 N.testing.assert_almost_equal(res.initial("x"),1.0,3) 811 N.testing.assert_almost_equal(res.initial("y"),0.0,3) 812 812 813 813 @testattr(stddist_full = True) … … 817 817 res = model.simulate(final_time=0.1) 818 818 819 N.testing.assert_almost_equal(res.initial("x"),0.0, places=3)820 N.testing.assert_almost_equal(res.initial("y"),1.0, places=3)819 N.testing.assert_almost_equal(res.initial("x"),0.0,3) 820 N.testing.assert_almost_equal(res.initial("y"),1.0,3) 821 821 822 822 @testattr(stddist_full = True) … … 826 826 res = model.simulate(final_time=10) 827 827 828 N.testing.assert_almost_equal(N.interp(3.00,res["time"],res["der(v1)"]),1.0, places=3)829 N.testing.assert_almost_equal(N.interp(3.40,res["time"],res["der(v1)"]),0.0, places=3)830 N.testing.assert_almost_equal(N.interp(8.00,res["time"],res["der(v1)"]),0.0, places=3)831 N.testing.assert_almost_equal(N.interp(8.25,res["time"],res["der(v1)"]),1.0, places=3)832 N.testing.assert_almost_equal(N.interp(4.00,res["time"],res["der(v2)"]),1.0, places=3)833 N.testing.assert_almost_equal(N.interp(4.20,res["time"],res["der(v2)"]),0.0, places=3)834 N.testing.assert_almost_equal(N.interp(7.00,res["time"],res["der(v2)"]),0.0, places=3)835 N.testing.assert_almost_equal(N.interp(7.20,res["time"],res["der(v2)"]),1.0, places=3)828 N.testing.assert_almost_equal(N.interp(3.00,res["time"],res["der(v1)"]),1.0,3) 829 N.testing.assert_almost_equal(N.interp(3.40,res["time"],res["der(v1)"]),0.0,3) 830 N.testing.assert_almost_equal(N.interp(8.00,res["time"],res["der(v1)"]),0.0,3) 831 N.testing.assert_almost_equal(N.interp(8.25,res["time"],res["der(v1)"]),1.0,3) 832 N.testing.assert_almost_equal(N.interp(4.00,res["time"],res["der(v2)"]),1.0,3) 833 N.testing.assert_almost_equal(N.interp(4.20,res["time"],res["der(v2)"]),0.0,3) 834 N.testing.assert_almost_equal(N.interp(7.00,res["time"],res["der(v2)"]),0.0,3) 835 N.testing.assert_almost_equal(N.interp(7.20,res["time"],res["der(v2)"]),1.0,3) 836 836 837 837 class Test_NonLinear_Systems: … … 916 916 917 917 for i,iv in enumerate(ivs): 918 N.testing.assert_almost_equal(fprime(iv) ,df[i], places=12)918 N.testing.assert_almost_equal(fprime(iv) ,df[i], 12) 919 919 920 920 @testattr(stddist_base = True) … … 1939 1939 solver = res.solver 1940 1940 1941 N.testing.assert_almost_equal(solver.t, 1.856045, places=3)1941 N.testing.assert_almost_equal(solver.t, 1.856045, 3) 1942 1942 1943 1943 @testattr(windows_full = True) … … 1951 1951 solver = res.solver 1952 1952 1953 N.testing.assert_almost_equal(solver.t, 1.856045, places=3)1953 N.testing.assert_almost_equal(solver.t, 1.856045, 3) 1954 1954 1955 1955 @testattr(noncompliantfmi = True)
Note: See TracChangeset
for help on using the changeset viewer.