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 // =============================================================================
8 // <-- ENGLISH IMPOSED -->
12 assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/DDaskr_Platform_test.zcos"));
14 // Redefining messagebox() to avoid popup
17 function messagebox(msg, msg_title)
21 Info = scicos_simulate(scs_m, list(), 'nw');
23 // looking for the CLOCK_f/EVTDLY_f to update period
24 for path_1=1:length(scs_m.objs)
25 if typeof(scs_m.objs(path_1))=="Block" & scs_m.objs(path_1).gui=="CLOCK_c" then
26 CLOCK_f_scs_m = scs_m.objs(path_1).model.rpar;
30 for path_2=1:length(CLOCK_f_scs_m)
31 if typeof(CLOCK_f_scs_m.objs(path_2))=="Block" & CLOCK_f_scs_m.objs(path_2).gui=="EVTDLY_c" then
32 EVTDLY_f_blk = CLOCK_f_scs_m.objs(path_2);
37 for i=1:3 // 'max step size' = 10^-i, precision
39 // Start by updating the clock block period (sampling)
40 scs_m.objs(path_1).model.rpar.objs(path_2).graphics.exprs = [string(5*(10^-i));"0"];
42 // Modify solver + run DDaskr + save results
43 scs_m.props.tol(6) = 101; // Solver
44 scicos_simulate(scs_m, Info, 'nw'); // DDaskr
45 ddaskrval = res.values; // Results
46 time = res.time; // Time
48 // Modify solver + run IDA + save results
49 scs_m.props.tol(6) = 100; // Solver
50 scicos_simulate(scs_m, Info, 'nw'); // IDA
51 idaval = res.values; // Results
54 compa = abs(ddaskrval-idaval);
56 // Extract mean, standard deviation, maximum
58 [maxi, indexMaxi] = max(compa);
59 stdeviation = st_deviation(compa);
61 // Verifying closeness of the results
62 assert_checktrue(maxi <= 10^-(i+3));
63 assert_checktrue(mea <= 10^-(i+3));
64 assert_checktrue(stdeviation <= 10^-(i+3));