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_Platform_test.zcos"));
11 // Redefining messagebox() to avoid popup
14 function messagebox(msg, msg_title)
18 Info = scicos_simulate(scs_m, list());
19 --------------------------------------------\
20 Main Modelica : TMPDIR/DDaskr_Platform_test_im.mo
22 Flat Modelica : TMPDIR/DDaskr_Platform_test_imf.mo
23 Simulation C code :TMPDIR/DDaskr_Platform_test_im.c
25 !Modelica blocks are reduced to a block with: !
27 !Number of differential states: 4 !
29 !Number of algebraic states: 0 !
31 !Number of discrete time states : 2 !
33 !Number of zero-crossing surfaces: 1 !
35 !Number of modes : 0 !
37 !Number of inputs : 0 !
39 !Number of outputs: 1 !
41 !Input/output dependency:[T] !
43 !Analytical Jacobian: enabled (%Jacobian=%t) !
45 !Parameter embedding mode: enabled (%Modelica_ParEmb=%t) !
49 !Generated files path: TMPDIR/ !
52 Generate a loader file
54 ilib_gen_Make: Copy compilation files (Makefile*, libtool...) to TMPDIR
55 ilib_gen_Make: Copy DDaskr_Platform_test_im.c to TMPDIR
56 ilib_gen_Make: configure : Generate Makefile.
57 ilib_gen_Make: Modification of the Makefile in TMPDIR.
59 Generate a cleaner file
60 Shared archive loaded.
62 for i=1:2 // 'max step size' = 10^-i, precision
63 // Start by updating the clock block period (sampling)
64 Context.per = 5*10^-i;
65 // Modify solver + run DDaskr + save results
66 scs_m.props.tol(6) = 102; // Solver
67 scicos_simulate(scs_m, Info, Context); // DDaskr
68 ddaskrval = res.values; // Results
69 time = res.time; // Time
70 // Modify solver + run IDA + save results
71 scs_m.props.tol(6) = 100; // Solver
72 scicos_simulate(scs_m, Info, Context); // IDA
73 idaval = res.values; // Results
75 compa = abs(ddaskrval-idaval);
76 // Extract mean, standard deviation, maximum
78 [maxi, indexMaxi] = max(compa);
80 stdeviation = st_deviation(compa);
81 // Verifying closeness of the results
82 assert_checktrue(maxi <= 5*10^-(i+2));
83 assert_checktrue(mea <= 5*10^-(i+2));
84 assert_checktrue(stdeviation <= 5*10^-(i+2));
86 Warning : redefining function: dst . Use funcprot(0) to avoid this message
88 Warning : redefining function: dst . Use funcprot(0) to avoid this message
96 Warning : redefining function: dst . Use funcprot(0) to avoid this message
98 Warning : redefining function: dst . Use funcprot(0) to avoid this message