Scicos: 'nw' option fix for BPLATFORM block
[scilab.git] / scilab / modules / scicos / tests / unit_tests / DDaskrK_Platform.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_Platform_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  Main Modelica : TMPDIR/DDaskr_Platform_test_im.mo
21
22  Flat Modelica : TMPDIR/DDaskr_Platform_test_imf.mo
23  Simulation C code :TMPDIR/DDaskr_Platform_test_im.c
24  
25 !Modelica blocks are reduced to a block with:             !
26 !                                                         !
27 !Number of differential states: 4                         !
28 !                                                         !
29 !Number of algebraic states: 0                            !
30 !                                                         !
31 !Number of discrete time states  : 2                      !
32 !                                                         !
33 !Number of zero-crossing surfaces: 1                      !
34 !                                                         !
35 !Number of modes  : 0                                     !
36 !                                                         !
37 !Number of inputs : 0                                     !
38 !                                                         !
39 !Number of outputs: 3                                     !
40 !                                                         !
41 !Input/output dependency:[T]                              !
42 !                                                         !
43 !Analytical Jacobian: enabled  (%Jacobian=%t)             !
44 !                                                         !
45 !Parameter embedding mode: enabled (%Modelica_ParEmb=%t)  !
46 !                                                         !
47 !                                                         !
48 !                                                         !
49 !Generated files path: TMPDIR/         !
50 !                                                         !
51 !                                                         !
52    Generate a loader file
53    Generate a Makefile
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.
58    Running the Makefile
59    Generate a cleaner file
60 Shared archive loaded.
61 Link done.
62 // looking for the CLOCK_f/EVTDLY_f to update period
63 for path_1=1:length(scs_m.objs)
64     if typeof(scs_m.objs(path_1))=="Block" & scs_m.objs(path_1).gui=="CLOCK_c" then
65         CLOCK_f_scs_m = scs_m.objs(path_1).model.rpar;
66         break;
67     end
68 end
69 for path_2=1:length(CLOCK_f_scs_m)
70     if typeof(CLOCK_f_scs_m.objs(path_2))=="Block" & CLOCK_f_scs_m.objs(path_2).gui=="EVTDLY_c" then
71         EVTDLY_f_blk = CLOCK_f_scs_m.objs(path_2);
72         break;
73     end
74 end
75 for i=1:2  // 'max step size' = 10^-i, precision
76     // Start by updating the clock block period (sampling)
77     scs_m.objs(path_1).model.rpar.objs(path_2).graphics.exprs = [string(5*(10^-i));"0"];
78     // Modify solver + run DDaskr + save results
79     scs_m.props.tol(6) = 102;     // Solver
80     scicos_simulate(scs_m, Info, 'nw'); // DDaskr
81     ddaskrval = res.values;       // Results
82     time = res.time;              // Time
83     // Modify solver + run IDA + save results
84     scs_m.props.tol(6) = 100;     // Solver
85     scicos_simulate(scs_m, Info, 'nw'); // IDA
86     idaval = res.values;          // Results
87     // Compare results
88     compa = abs(ddaskrval-idaval);
89     // Extract mean, standard deviation, maximum
90     mea = mean(compa);
91     [maxi, indexMaxi] = max(compa);
92     stdeviation = st_deviation(compa);
93     // Verifying closeness of the results
94     assert_checktrue(maxi <= 10^-(i+1));
95     assert_checktrue(mea <= 10^-(i+1));
96     assert_checktrue(stdeviation <= 10^-(i+1));
97 end
98 Warning : redefining function: dst                     . Use funcprot(0) to avoid this message
99
100 Warning : redefining function: dst                     . Use funcprot(0) to avoid this message
101
102 Warning : redefining function: dst                     . Use funcprot(0) to avoid this message
103
104 Warning : redefining function: dst                     . Use funcprot(0) to avoid this message
105