Scicos tests: relieving compilation
[scilab.git] / scilab / modules / scicos / tests / unit_tests / DDaskrN_Bouncing.dia.ref
1 // =============================================================================
2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) 2013 - Scilab Enterprises - Paul Bignier
4 //
5 //  This file is distributed under the same license as the Scilab package.
6 // =============================================================================
7 // <-- ENGLISH IMPOSED -->
8 // <-- XCOS TEST -->
9 // Import diagram
10 assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/DDaskr_Bouncing_test.zcos"));
11 // Redefining messagebox() to avoid popup
12 prot = funcprot();
13 funcprot(0);
14 function messagebox(msg, msg_title)
15  disp(msg);
16 endfunction
17 funcprot(prot);
18 Info = scicos_simulate(scs_m, list(), 'nw');
19  
20  CMSCOPE('set'): Wrong size for block parameter 'Refresh period': 2 exp 
21       ected, getting 50 50 50 50                                        
22 --------------------------------------------\
23  Main Modelica : TMPDIR/DDaskr_test2_im.mo
24
25  Flat Modelica : TMPDIR/DDaskr_test2_imf.mo
26  Simulation C code :TMPDIR/DDaskr_test2_im.c
27  
28 !Modelica blocks are reduced to a block with:             !
29 !                                                         !
30 !Number of differential states: 2                         !
31 !                                                         !
32 !Number of algebraic states: 0                            !
33 !                                                         !
34 !Number of discrete time states  : 0                      !
35 !                                                         !
36 !Number of zero-crossing surfaces: 1                      !
37 !                                                         !
38 !Number of modes  : 0                                     !
39 !                                                         !
40 !Number of inputs : 0                                     !
41 !                                                         !
42 !Number of outputs: 3                                     !
43 !                                                         !
44 !Input/output dependency:[T]                              !
45 !                                                         !
46 !Analytical Jacobian: enabled  (%Jacobian=%t)             !
47 !                                                         !
48 !Parameter embedding mode: enabled (%Modelica_ParEmb=%t)  !
49 !                                                         !
50 !                                                         !
51 !                                                         !
52 !Generated files path: TMPDIR/         !
53 !                                                         !
54 !                                                         !
55    Generate a loader file
56    Generate a Makefile
57    ilib_gen_Make: Copy compilation files (Makefile*, libtool...) to TMPDIR
58    ilib_gen_Make: Copy DDaskr_test2_im.c to TMPDIR
59    ilib_gen_Make: configure : Generate Makefile.
60    ilib_gen_Make: Modification of the Makefile in TMPDIR.
61    Running the Makefile
62    Generate a cleaner file
63 Shared archive loaded.
64 Link done.
65 // looking for the CLOCK_f/EVTDLY_f to update period
66 for path_1=1:length(scs_m.objs)
67     if typeof(scs_m.objs(path_1))=="Block" & scs_m.objs(path_1).gui=="CLOCK_f" then
68         CLOCK_f_scs_m = scs_m.objs(path_1).model.rpar;
69         break;
70     end
71 end
72 for path_2=1:length(CLOCK_f_scs_m)
73     if typeof(CLOCK_f_scs_m.objs(path_2))=="Block" & CLOCK_f_scs_m.objs(path_2).gui=="EVTDLY_f" then
74         EVTDLY_f_blk = CLOCK_f_scs_m.objs(path_2);
75         break;
76     end
77 end
78 // Start by updating the clock block period (sampling)
79 scs_m.objs(path_1).model.rpar.objs(path_2).graphics.exprs = [string(5*(10^-3));"0"];
80 // Modify solver + run DDaskr + save results
81 scs_m.props.tol(6) = 101;      // Solver
82 //scs_m.props.tol(1) = 1.0e-10; // abstol
83 //scs_m.props.tol(2) = 1.0e-10; // reltol
84 scicos_simulate(scs_m, Info, 'nw');  // DDaskr
85  
86  CMSCOPE('set'): Wrong size for block parameter 'Refresh period': 2 exp 
87       ected, getting 50 50 50 50                                        
88 Warning : redefining function: dst                     . Use funcprot(0) to avoid this message
89
90 ddaskrval = res.values;         // Results
91 time = res.time;                // Time
92 // Modify solver + run IDA + save results
93 scs_m.props.tol(6) = 100;     // Solver
94 scicos_simulate(scs_m, Info, 'nw'); // IDA
95  
96  CMSCOPE('set'): Wrong size for block parameter 'Refresh period': 2 exp 
97       ected, getting 50 50 50 50                                        
98 Warning : redefining function: dst                     . Use funcprot(0) to avoid this message
99
100 idaval = res.values;          // Results
101 // Compare results
102 compa = abs(ddaskrval-idaval);
103 // Extract mean, standard deviation, maximum
104 mea = mean(compa);
105 [maxi, indexMaxi] = max(compa);
106 stdeviation = st_deviation(compa);
107 // Verifying closeness of the results
108 assert_checktrue(maxi <= 10^-(12));
109 assert_checktrue(mea <= 10^-(12));
110 assert_checktrue(stdeviation <= 10^-(12));