1 // =============================================================================
2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) 2013 - Scilab Enterprises - Paul Bignier
5 // This file is distributed under the same license as the Scilab package.
6 // =============================================================================
7 // <-- ENGLISH IMPOSED -->
10 assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/DDaskr_RLC_test.zcos"));
11 // Redefining messagebox() to avoid popup
14 function messagebox(msg, msg_title)
19 // Start by updating the clock block period (sampling)
20 Context.per = 5*10^-i;
21 Info = scicos_simulate(scs_m, list(), Context);
22 // Modify solver + run DDaskr + save results
23 scs_m.props.tol(6) = 101; // Solver
24 scicos_simulate(scs_m, Info); // DDaskr
25 ddaskrval = res.values; // Results
26 time = res.time; // Time
27 // Modify solver + run IDA + save results
28 scs_m.props.tol(6) = 100; // Solver
29 scicos_simulate(scs_m, Info); // IDA
30 idaval = res.values; // Results
32 compa = abs(ddaskrval-idaval);
33 // Extract mean, standard deviation, maximum
35 [maxi, indexMaxi] = max(compa);
36 stdeviation = st_deviation(compa);
37 // Verifying closeness of the results
38 assert_checktrue(maxi <= 10^-(i+4));
39 assert_checktrue(mea <= 10^-(i+4));
40 assert_checktrue(stdeviation <= 10^-(i+4));
42 --------------------------------------------\
43 Main Modelica : TMPDIR/DDaskr_RLC_test_im.mo
45 Flat Modelica : TMPDIR/DDaskr_RLC_test_imf.mo
46 Simulation C code :TMPDIR/DDaskr_RLC_test_im.c
48 !Modelica blocks are reduced to a block with: !
50 !Number of differential states: 2 !
52 !Number of algebraic states: 1 !
54 !Number of discrete time states : 0 !
56 !Number of zero-crossing surfaces: 0 !
58 !Number of modes : 0 !
60 !Number of inputs : 0 !
62 !Number of outputs: 1 !
64 !Input/output dependency:[T] !
66 !Analytical Jacobian: enabled (%Jacobian=%t) !
68 !Parameter embedding mode: enabled (%Modelica_ParEmb=%t) !
72 !Generated files path: TMPDIR/ !
75 Generate a loader file
77 ilib_gen_Make: Copy compilation files (Makefile*, libtool...) to TMPDIR
78 ilib_gen_Make: Copy DDaskr_RLC_test_im.c to TMPDIR
79 ilib_gen_Make: configure : Generate Makefile.
80 ilib_gen_Make: Modification of the Makefile in TMPDIR.
82 Generate a cleaner file
83 Shared archive loaded.
85 Warning : redefining function: dst . Use funcprot(0) to avoid this message
87 Warning : redefining function: dst . Use funcprot(0) to avoid this message
89 --------------------------------------------\
90 Main Modelica : TMPDIR/DDaskr_RLC_test_im.mo
92 Flat Modelica : TMPDIR/DDaskr_RLC_test_imf.mo
93 Simulation C code :TMPDIR/DDaskr_RLC_test_im.c
95 !Modelica blocks are reduced to a block with: !
97 !Number of differential states: 2 !
99 !Number of algebraic states: 1 !
101 !Number of discrete time states : 0 !
103 !Number of zero-crossing surfaces: 0 !
105 !Number of modes : 0 !
107 !Number of inputs : 0 !
109 !Number of outputs: 1 !
111 !Input/output dependency:[T] !
113 !Analytical Jacobian: enabled (%Jacobian=%t) !
115 !Parameter embedding mode: enabled (%Modelica_ParEmb=%t) !
119 !Generated files path: TMPDIR/ !
122 Generate a loader file
124 ilib_gen_Make: Copy compilation files (Makefile*, libtool...) to TMPDIR
125 ilib_gen_Make: Copy DDaskr_RLC_test_im.c to TMPDIR
126 ilib_gen_Make: configure : Generate Makefile.
127 ilib_gen_Make: Modification of the Makefile in TMPDIR.
129 Generate a cleaner file
130 Shared archive loaded.
132 Warning : redefining function: dst . Use funcprot(0) to avoid this message
134 Warning : redefining function: dst . Use funcprot(0) to avoid this message