Xcos tests: recompilation at every call and context use 32/12132/5
Paul BIGNIER [Thu, 25 Jul 2013 14:16:24 +0000 (16:16 +0200)]
Modifiying the scs_m (Clock block period) requires recompilation of the cpr (Info),
so it was not safe to use the same Info variable.
Also, used the context to update that value,
instead of looking for it in the scs_m through loops.

In the diagrams, removed the unnecessary Scope blocks and recalibrated the buffer sizes
to match the minimal number of steps (final time / highest clock period).
Also, cleaned the contexts from unused variable L.

Change-Id: Ieeadd9f9c00f2e42273a3b12fb99e2e67e93e133

20 files changed:
scilab/modules/scicos/tests/unit_tests/DDaskrK_Bouncing.dia.ref
scilab/modules/scicos/tests/unit_tests/DDaskrK_Bouncing.tst
scilab/modules/scicos/tests/unit_tests/DDaskrK_Hydraulics.dia.ref
scilab/modules/scicos/tests/unit_tests/DDaskrK_Hydraulics.tst
scilab/modules/scicos/tests/unit_tests/DDaskrK_Platform.dia.ref
scilab/modules/scicos/tests/unit_tests/DDaskrK_Platform.tst
scilab/modules/scicos/tests/unit_tests/DDaskrK_RLC.dia.ref
scilab/modules/scicos/tests/unit_tests/DDaskrK_RLC.tst
scilab/modules/scicos/tests/unit_tests/DDaskrN_Bouncing.dia.ref
scilab/modules/scicos/tests/unit_tests/DDaskrN_Bouncing.tst
scilab/modules/scicos/tests/unit_tests/DDaskrN_Hydraulics.dia.ref
scilab/modules/scicos/tests/unit_tests/DDaskrN_Hydraulics.tst
scilab/modules/scicos/tests/unit_tests/DDaskrN_Platform.dia.ref
scilab/modules/scicos/tests/unit_tests/DDaskrN_Platform.tst
scilab/modules/scicos/tests/unit_tests/DDaskrN_RLC.dia.ref
scilab/modules/scicos/tests/unit_tests/DDaskrN_RLC.tst
scilab/modules/xcos/tests/unit_tests/DDaskr_Bouncing_test.zcos
scilab/modules/xcos/tests/unit_tests/DDaskr_Hydraulics_test.zcos
scilab/modules/xcos/tests/unit_tests/DDaskr_Platform_test.zcos
scilab/modules/xcos/tests/unit_tests/DDaskr_RLC_test.zcos

index 5a102de..ef323ec 100644 (file)
@@ -15,15 +15,12 @@ function messagebox(msg, msg_title)
  disp(msg);
 endfunction
 funcprot(prot);
-Info = scicos_simulate(scs_m, list(), 'nw');
- CMSCOPE('set'): Wrong size for block parameter 'Refresh period': 2 exp 
-      ected, getting 50 50 50 50                                        
+Info = scicos_simulate(scs_m, list());
 --------------------------------------------\
- Main Modelica : TMPDIR/DDaskr_test2_im.mo
+ Main Modelica : TMPDIR/DDaskr_Bouncing_test_im.mo
 
- Flat Modelica : TMPDIR/DDaskr_test2_imf.mo
- Simulation C code :TMPDIR/DDaskr_test2_im.c
+ Flat Modelica : TMPDIR/DDaskr_Bouncing_test_imf.mo
+ Simulation C code :TMPDIR/DDaskr_Bouncing_test_im.c
  
 !Modelica blocks are reduced to a block with:             !
 !                                                         !
@@ -39,7 +36,7 @@ Info = scicos_simulate(scs_m, list(), 'nw');
 !                                                         !
 !Number of inputs : 0                                     !
 !                                                         !
-!Number of outputs: 3                                     !
+!Number of outputs: 1                                     !
 !                                                         !
 !Input/output dependency:[T]                              !
 !                                                         !
@@ -55,49 +52,26 @@ Info = scicos_simulate(scs_m, list(), 'nw');
    Generate a loader file
    Generate a Makefile
    ilib_gen_Make: Copy compilation files (Makefile*, libtool...) to TMPDIR
-   ilib_gen_Make: Copy DDaskr_test2_im.c to TMPDIR
+   ilib_gen_Make: Copy DDaskr_Bouncing_test_im.c to TMPDIR
    ilib_gen_Make: configure : Generate Makefile.
    ilib_gen_Make: Modification of the Makefile in TMPDIR.
    Running the Makefile
    Generate a cleaner file
 Shared archive loaded.
 Link done.
-// looking for the CLOCK_f/EVTDLY_f to update period
-for path_1=1:length(scs_m.objs)
-    if typeof(scs_m.objs(path_1))=="Block" & scs_m.objs(path_1).gui=="CLOCK_f" then
-        CLOCK_f_scs_m = scs_m.objs(path_1).model.rpar;
-        break;
-    end
-end
-for path_2=1:length(CLOCK_f_scs_m)
-    if typeof(CLOCK_f_scs_m.objs(path_2))=="Block" & CLOCK_f_scs_m.objs(path_2).gui=="EVTDLY_f" then
-        EVTDLY_f_blk = CLOCK_f_scs_m.objs(path_2);
-        break;
-    end
-end
-// Start by updating the clock block period (sampling)
-scs_m.objs(path_1).model.rpar.objs(path_2).graphics.exprs = [string(5*(10^-3));"0"];
 // Modify solver + run DDaskr + save results
-scs_m.props.tol(6) = 102;      // Solver
-//scs_m.props.tol(1) = 1.0e-10; // abstol
-//scs_m.props.tol(2) = 1.0e-10; // reltol
-scicos_simulate(scs_m, Info, 'nw');  // DDaskr
- CMSCOPE('set'): Wrong size for block parameter 'Refresh period': 2 exp 
-      ected, getting 50 50 50 50                                        
+scs_m.props.tol(6) = 102;       // Solver
+scicos_simulate(scs_m, Info);   // DDaskr
 Warning : redefining function: dst                     . Use funcprot(0) to avoid this message
 
 ddaskrval = res.values;         // Results
 time = res.time;                // Time
 // Modify solver + run IDA + save results
-scs_m.props.tol(6) = 100;     // Solver
-scicos_simulate(scs_m, Info, 'nw'); // IDA
- CMSCOPE('set'): Wrong size for block parameter 'Refresh period': 2 exp 
-      ected, getting 50 50 50 50                                        
+scs_m.props.tol(6) = 100;      // Solver
+scicos_simulate(scs_m, Info);  // IDA
 Warning : redefining function: dst                     . Use funcprot(0) to avoid this message
 
-idaval = res.values;          // Results
+idaval = res.values;           // Results
 // Compare results
 compa = abs(ddaskrval-idaval);
 // Extract mean, standard deviation, maximum
@@ -105,6 +79,6 @@ mea = mean(compa);
 [maxi, indexMaxi] = max(compa);
 stdeviation = st_deviation(compa);
 // Verifying closeness of the results
-assert_checktrue(maxi <= 10^-(4));
-assert_checktrue(mea <= 10^-(4));
-assert_checktrue(stdeviation <= 10^-(4));
+assert_checktrue(maxi <= 5*10^-(5));
+assert_checktrue(mea <= 5*10^-(5));
+assert_checktrue(stdeviation <= 5*10^-(5));
index 2379d43..9403b68 100644 (file)
@@ -18,37 +18,18 @@ function messagebox(msg, msg_title)
  disp(msg);
 endfunction
 funcprot(prot);
-Info = scicos_simulate(scs_m, list(), 'nw');
-
-// looking for the CLOCK_f/EVTDLY_f to update period
-for path_1=1:length(scs_m.objs)
-    if typeof(scs_m.objs(path_1))=="Block" & scs_m.objs(path_1).gui=="CLOCK_f" then
-        CLOCK_f_scs_m = scs_m.objs(path_1).model.rpar;
-        break;
-    end
-end
-for path_2=1:length(CLOCK_f_scs_m)
-    if typeof(CLOCK_f_scs_m.objs(path_2))=="Block" & CLOCK_f_scs_m.objs(path_2).gui=="EVTDLY_f" then
-        EVTDLY_f_blk = CLOCK_f_scs_m.objs(path_2);
-        break;
-    end
-end
-
-// Start by updating the clock block period (sampling)
-scs_m.objs(path_1).model.rpar.objs(path_2).graphics.exprs = [string(5*(10^-3));"0"];
+Info = scicos_simulate(scs_m, list());
 
 // Modify solver + run DDaskr + save results
-scs_m.props.tol(6) = 102;      // Solver
-//scs_m.props.tol(1) = 1.0e-10; // abstol
-//scs_m.props.tol(2) = 1.0e-10; // reltol
-scicos_simulate(scs_m, Info, 'nw');  // DDaskr
+scs_m.props.tol(6) = 102;       // Solver
+scicos_simulate(scs_m, Info);   // DDaskr
 ddaskrval = res.values;         // Results
 time = res.time;                // Time
 
 // Modify solver + run IDA + save results
-scs_m.props.tol(6) = 100;     // Solver
-scicos_simulate(scs_m, Info, 'nw'); // IDA
-idaval = res.values;          // Results
+scs_m.props.tol(6) = 100;      // Solver
+scicos_simulate(scs_m, Info);  // IDA
+idaval = res.values;           // Results
 
 // Compare results
 compa = abs(ddaskrval-idaval);
@@ -59,6 +40,6 @@ mea = mean(compa);
 stdeviation = st_deviation(compa);
 
 // Verifying closeness of the results
-assert_checktrue(maxi <= 10^-(4));
-assert_checktrue(mea <= 10^-(4));
-assert_checktrue(stdeviation <= 10^-(4));
+assert_checktrue(maxi <= 5*10^-(5));
+assert_checktrue(mea <= 5*10^-(5));
+assert_checktrue(stdeviation <= 5*10^-(5));
index 6753566..c9bd184 100644 (file)
@@ -15,10 +15,9 @@ function messagebox(msg, msg_title)
  disp(msg);
 endfunction
 funcprot(prot);
-Info = scicos_simulate(scs_m, list(), 'nw');
- CMSCOPE('set'): Wrong size for block parameter 'Refresh period': 2 exp 
-      ected, getting 50 50 50 50                                        
+// Modify solver + run DDaskr + save results
+scs_m.props.tol(6) = 102;       // Solver
+scicos_simulate(scs_m);   // DDaskr
 --------------------------------------------\
  Main Modelica : TMPDIR/DDaskr_Hydraulics_test_im.mo
 
@@ -39,7 +38,7 @@ Info = scicos_simulate(scs_m, list(), 'nw');
 !                                                         !
 !Number of inputs : 1                                     !
 !                                                         !
-!Number of outputs: 2                                     !
+!Number of outputs: 1                                     !
 !                                                         !
 !Input/output dependency:[F]                              !
 !                                                         !
@@ -62,42 +61,55 @@ Info = scicos_simulate(scs_m, list(), 'nw');
    Generate a cleaner file
 Shared archive loaded.
 Link done.
-// looking for the CLOCK_f/EVTDLY_f to update period
-for path_1=1:length(scs_m.objs)
-    if typeof(scs_m.objs(path_1))=="Block" & scs_m.objs(path_1).gui=="CLOCK_f" then
-        CLOCK_f_scs_m = scs_m.objs(path_1).model.rpar;
-        break;
-    end
-end
-for path_2=1:length(CLOCK_f_scs_m)
-    if typeof(CLOCK_f_scs_m.objs(path_2))=="Block" & CLOCK_f_scs_m.objs(path_2).gui=="EVTDLY_f" then
-        EVTDLY_f_blk = CLOCK_f_scs_m.objs(path_2);
-        break;
-    end
-end
-// Start by updating the clock block period (sampling)
-scs_m.objs(path_1).model.rpar.objs(path_2).graphics.exprs = [string(5*(10^-3));"0"];
-// Modify solver + run DDaskr + save results
-scs_m.props.tol(6) = 102;       // Solver
-//scs_m.props.tol(1) = 1.0e-10; // abstol
-//scs_m.props.tol(2) = 1.0e-10; // reltol
-scicos_simulate(scs_m, Info, 'nw');   // DDaskr
- CMSCOPE('set'): Wrong size for block parameter 'Refresh period': 2 exp 
-      ected, getting 50 50 50 50                                        
-Warning : redefining function: dst                     . Use funcprot(0) to avoid this message
-
 ddaskrval = res.values;         // Results
 time = res.time;                // Time
 // Modify solver + run IDA + save results
-scs_m.props.tol(6) = 100;       // Solver
-scicos_simulate(scs_m, Info, 'nw');   // IDA
- CMSCOPE('set'): Wrong size for block parameter 'Refresh period': 2 exp 
-      ected, getting 50 50 50 50                                        
-Warning : redefining function: dst                     . Use funcprot(0) to avoid this message
+scs_m.props.tol(6) = 100;      // Solver
+scicos_simulate(scs_m);  // IDA
+--------------------------------------------\
+ Main Modelica : TMPDIR/DDaskr_Hydraulics_test_im.mo
 
-idaval = res.values;            // Results
+ Flat Modelica : TMPDIR/DDaskr_Hydraulics_test_imf.mo
+ Simulation C code :TMPDIR/DDaskr_Hydraulics_test_im.c
+!Modelica blocks are reduced to a block with:             !
+!                                                         !
+!Number of differential states: 2                         !
+!                                                         !
+!Number of algebraic states: 5                            !
+!                                                         !
+!Number of discrete time states  : 0                      !
+!                                                         !
+!Number of zero-crossing surfaces: 19                     !
+!                                                         !
+!Number of modes  : 19                                    !
+!                                                         !
+!Number of inputs : 1                                     !
+!                                                         !
+!Number of outputs: 1                                     !
+!                                                         !
+!Input/output dependency:[F]                              !
+!                                                         !
+!Analytical Jacobian: enabled  (%Jacobian=%t)             !
+!                                                         !
+!Parameter embedding mode: enabled (%Modelica_ParEmb=%t)  !
+!                                                         !
+!                                                         !
+!                                                         !
+!Generated files path: TMPDIR/         !
+!                                                         !
+!                                                         !
+   Generate a loader file
+   Generate a Makefile
+   ilib_gen_Make: Copy compilation files (Makefile*, libtool...) to TMPDIR
+   ilib_gen_Make: Copy DDaskr_Hydraulics_test_im.c to TMPDIR
+   ilib_gen_Make: configure : Generate Makefile.
+   ilib_gen_Make: Modification of the Makefile in TMPDIR.
+   Running the Makefile
+   Generate a cleaner file
+Shared archive loaded.
+Link done.
+idaval = res.values;           // Results
 // Compare results
 compa = abs(ddaskrval-idaval);
 // Extract mean, standard deviation, maximum
@@ -105,6 +117,6 @@ mea = mean(compa);
 [maxi, indexMaxi] = max(compa);
 stdeviation = st_deviation(compa);
 // Verifying closeness of the results
-assert_checktrue(maxi <= 10^-(7));
-assert_checktrue(mea <= 10^-(7));
-assert_checktrue(stdeviation <= 10^-(7));
+assert_checktrue(maxi <= 2*10^-(6));
+assert_checktrue(mea <= 2*10^-(6));
+assert_checktrue(stdeviation <= 2*10^-(6));
index 411ca1a..7c08f9d 100644 (file)
@@ -18,37 +18,17 @@ function messagebox(msg, msg_title)
  disp(msg);
 endfunction
 funcprot(prot);
-Info = scicos_simulate(scs_m, list(), 'nw');
-
-// looking for the CLOCK_f/EVTDLY_f to update period
-for path_1=1:length(scs_m.objs)
-    if typeof(scs_m.objs(path_1))=="Block" & scs_m.objs(path_1).gui=="CLOCK_f" then
-        CLOCK_f_scs_m = scs_m.objs(path_1).model.rpar;
-        break;
-    end
-end
-for path_2=1:length(CLOCK_f_scs_m)
-    if typeof(CLOCK_f_scs_m.objs(path_2))=="Block" & CLOCK_f_scs_m.objs(path_2).gui=="EVTDLY_f" then
-        EVTDLY_f_blk = CLOCK_f_scs_m.objs(path_2);
-        break;
-    end
-end
-
-// Start by updating the clock block period (sampling)
-scs_m.objs(path_1).model.rpar.objs(path_2).graphics.exprs = [string(5*(10^-3));"0"];
 
 // Modify solver + run DDaskr + save results
 scs_m.props.tol(6) = 102;       // Solver
-//scs_m.props.tol(1) = 1.0e-10; // abstol
-//scs_m.props.tol(2) = 1.0e-10; // reltol
-scicos_simulate(scs_m, Info, 'nw');   // DDaskr
+scicos_simulate(scs_m);   // DDaskr
 ddaskrval = res.values;         // Results
 time = res.time;                // Time
 
 // Modify solver + run IDA + save results
-scs_m.props.tol(6) = 100;       // Solver
-scicos_simulate(scs_m, Info, 'nw');   // IDA
-idaval = res.values;            // Results
+scs_m.props.tol(6) = 100;      // Solver
+scicos_simulate(scs_m);  // IDA
+idaval = res.values;           // Results
 
 // Compare results
 compa = abs(ddaskrval-idaval);
@@ -59,7 +39,7 @@ mea = mean(compa);
 stdeviation = st_deviation(compa);
 
 // Verifying closeness of the results
-assert_checktrue(maxi <= 10^-(7));
-assert_checktrue(mea <= 10^-(7));
-assert_checktrue(stdeviation <= 10^-(7));
+assert_checktrue(maxi <= 2*10^-(6));
+assert_checktrue(mea <= 2*10^-(6));
+assert_checktrue(stdeviation <= 2*10^-(6));
 
index 9447865..35ceebc 100644 (file)
@@ -15,7 +15,7 @@ function messagebox(msg, msg_title)
  disp(msg);
 endfunction
 funcprot(prot);
-Info = scicos_simulate(scs_m, list(),'nw');
+Info = scicos_simulate(scs_m, list());
 --------------------------------------------\
  Main Modelica : TMPDIR/DDaskr_Platform_test_im.mo
 
@@ -36,7 +36,7 @@ Info = scicos_simulate(scs_m, list(),'nw');
 !                                                         !
 !Number of inputs : 0                                     !
 !                                                         !
-!Number of outputs: 3                                     !
+!Number of outputs: 1                                     !
 !                                                         !
 !Input/output dependency:[T]                              !
 !                                                         !
@@ -46,7 +46,7 @@ Info = scicos_simulate(scs_m, list(),'nw');
 !                                                         !
 !                                                         !
 !                                                         !
-!Generated files path: TMPDIR/          !
+!Generated files path: TMPDIR/         !
 !                                                         !
 !                                                         !
    Generate a loader file
@@ -59,47 +59,47 @@ Info = scicos_simulate(scs_m, list(),'nw');
    Generate a cleaner file
 Shared archive loaded.
 Link done.
-// looking for the CLOCK_f/EVTDLY_f to update period
-for path_1=1:length(scs_m.objs)
-    if typeof(scs_m.objs(path_1))=="Block" & scs_m.objs(path_1).gui=="CLOCK_c" then
-        CLOCK_f_scs_m = scs_m.objs(path_1).model.rpar;
-        break;
-    end
-end
-for path_2=1:length(CLOCK_f_scs_m)
-    if typeof(CLOCK_f_scs_m.objs(path_2))=="Block" & CLOCK_f_scs_m.objs(path_2).gui=="EVTDLY_c" then
-        EVTDLY_f_blk = CLOCK_f_scs_m.objs(path_2);
-        break;
-    end
-end
 for i=1:2  // 'max step size' = 10^-i, precision
     // Start by updating the clock block period (sampling)
-    scs_m.objs(path_1).model.rpar.objs(path_2).graphics.exprs = [string(5*(10^-i));"0"];
+    Context.per = 5*10^-i;
     // Modify solver + run DDaskr + save results
     scs_m.props.tol(6) = 102;     // Solver
-    scicos_simulate(scs_m, Info, 'nw'); // DDaskr
+    scicos_simulate(scs_m, Info, Context); // DDaskr
     ddaskrval = res.values;       // Results
     time = res.time;              // Time
     // Modify solver + run IDA + save results
     scs_m.props.tol(6) = 100;     // Solver
-    scicos_simulate(scs_m, Info, 'nw'); // IDA
+    scicos_simulate(scs_m, Info, Context); // IDA
     idaval = res.values;          // Results
     // Compare results
     compa = abs(ddaskrval-idaval);
     // Extract mean, standard deviation, maximum
     mea = mean(compa);
     [maxi, indexMaxi] = max(compa);
+    maxi, mea
     stdeviation = st_deviation(compa);
     // Verifying closeness of the results
-    assert_checktrue(maxi <= 10^-(i+1));
-    assert_checktrue(mea <= 10^-(i+1));
-    assert_checktrue(stdeviation <= 10^-(i+1));
+    assert_checktrue(maxi <= 5*10^-(i+2));
+    assert_checktrue(mea <= 5*10^-(i+2));
+    assert_checktrue(stdeviation <= 5*10^-(i+2));
 end
 Warning : redefining function: dst                     . Use funcprot(0) to avoid this message
 
 Warning : redefining function: dst                     . Use funcprot(0) to avoid this message
 
+ maxi  =
+    0.0000197  
+ mea  =
+    0.0000043  
 Warning : redefining function: dst                     . Use funcprot(0) to avoid this message
 
 Warning : redefining function: dst                     . Use funcprot(0) to avoid this message
 
+ maxi  =
+    0.0002730  
+ mea  =
+    0.0000455  
index 141f2ec..8637060 100644 (file)
@@ -18,36 +18,22 @@ function messagebox(msg, msg_title)
  disp(msg);
 endfunction
 funcprot(prot);
-Info = scicos_simulate(scs_m, list(),'nw');
-
-// looking for the CLOCK_f/EVTDLY_f to update period
-for path_1=1:length(scs_m.objs)
-    if typeof(scs_m.objs(path_1))=="Block" & scs_m.objs(path_1).gui=="CLOCK_c" then
-        CLOCK_f_scs_m = scs_m.objs(path_1).model.rpar;
-        break;
-    end
-end
-for path_2=1:length(CLOCK_f_scs_m)
-    if typeof(CLOCK_f_scs_m.objs(path_2))=="Block" & CLOCK_f_scs_m.objs(path_2).gui=="EVTDLY_c" then
-        EVTDLY_f_blk = CLOCK_f_scs_m.objs(path_2);
-        break;
-    end
-end
+Info = scicos_simulate(scs_m, list());
 
 for i=1:2  // 'max step size' = 10^-i, precision
 
     // Start by updating the clock block period (sampling)
-    scs_m.objs(path_1).model.rpar.objs(path_2).graphics.exprs = [string(5*(10^-i));"0"];
+    Context.per = 5*10^-i;
 
     // Modify solver + run DDaskr + save results
     scs_m.props.tol(6) = 102;     // Solver
-    scicos_simulate(scs_m, Info, 'nw'); // DDaskr
+    scicos_simulate(scs_m, Info, Context); // DDaskr
     ddaskrval = res.values;       // Results
     time = res.time;              // Time
 
     // Modify solver + run IDA + save results
     scs_m.props.tol(6) = 100;     // Solver
-    scicos_simulate(scs_m, Info, 'nw'); // IDA
+    scicos_simulate(scs_m, Info, Context); // IDA
     idaval = res.values;          // Results
 
     // Compare results
@@ -56,11 +42,12 @@ for i=1:2  // 'max step size' = 10^-i, precision
     // Extract mean, standard deviation, maximum
     mea = mean(compa);
     [maxi, indexMaxi] = max(compa);
+    maxi, mea
     stdeviation = st_deviation(compa);
 
     // Verifying closeness of the results
-    assert_checktrue(maxi <= 10^-(i+1));
-    assert_checktrue(mea <= 10^-(i+1));
-    assert_checktrue(stdeviation <= 10^-(i+1));
+    assert_checktrue(maxi <= 5*10^-(i+2));
+    assert_checktrue(mea <= 5*10^-(i+2));
+    assert_checktrue(stdeviation <= 5*10^-(i+2));
 
 end
index 3f2da12..2a699eb 100644 (file)
@@ -15,10 +15,30 @@ function messagebox(msg, msg_title)
  disp(msg);
 endfunction
 funcprot(prot);
-Info = scicos_simulate(scs_m, list(), 'nw');
- CMSCOPE('set'): Wrong size for block parameter 'Refresh period': 2 exp 
-      ected, getting 2 2 2 2                                            
+for i=2:3
+    // Start by updating the clock block period (sampling)
+    Context.per = 5*10^-i;
+    Info = scicos_simulate(scs_m, list(), Context);
+    // Modify solver + run DDaskr + save results
+    scs_m.props.tol(6) = 102;     // Solver
+    scicos_simulate(scs_m, Info); // DDaskr
+    ddaskrval = res.values;       // Results
+    time = res.time;              // Time
+    // Modify solver + run IDA + save results
+    scs_m.props.tol(6) = 100;     // Solver
+    scicos_simulate(scs_m, Info); // IDA
+    idaval = res.values;          // Results
+    // Compare results
+    compa = abs(ddaskrval-idaval);
+    // Extract mean, standard deviation, maximum
+    mea = mean(compa);
+    [maxi, indexMaxi] = max(compa);
+    stdeviation = st_deviation(compa);
+    // Verifying closeness of the results
+    assert_checktrue(maxi <= 10^-(i+4));
+    assert_checktrue(mea <= 10^-(i+4));
+    assert_checktrue(stdeviation <= 10^-(i+4));
+end
 --------------------------------------------\
  Main Modelica : TMPDIR/DDaskr_RLC_test_im.mo
 
@@ -39,7 +59,7 @@ Info = scicos_simulate(scs_m, list(), 'nw');
 !                                                         !
 !Number of inputs : 0                                     !
 !                                                         !
-!Number of outputs: 3                                     !
+!Number of outputs: 1                                     !
 !                                                         !
 !Input/output dependency:[T]                              !
 !                                                         !
@@ -62,59 +82,54 @@ Info = scicos_simulate(scs_m, list(), 'nw');
    Generate a cleaner file
 Shared archive loaded.
 Link done.
-// looking for the CLOCK_f/EVTDLY_f to update period
-for path_1=1:length(scs_m.objs)
-    if typeof(scs_m.objs(path_1))=="Block" & scs_m.objs(path_1).gui=="CLOCK_f" then
-        CLOCK_f_scs_m = scs_m.objs(path_1).model.rpar;
-        break;
-    end
-end
-for path_2=1:length(CLOCK_f_scs_m)
-    if typeof(CLOCK_f_scs_m.objs(path_2))=="Block" & CLOCK_f_scs_m.objs(path_2).gui=="EVTDLY_f" then
-        EVTDLY_f_blk = CLOCK_f_scs_m.objs(path_2);
-        break;
-    end
-end
-for i=2:3
-    // Start by updating the clock block period (sampling)
-    scs_m.objs(path_1).model.rpar.objs(path_2).graphics.exprs = [string(5*(10^-i));"0"];
-    // Modify solver + run DDaskr + save results
-    scs_m.props.tol(6) = 102;     // Solver
-    scicos_simulate(scs_m, Info, 'nw'); // DDaskr
-    ddaskrval = res.values;        // Results
-    time = res.time;               // Time
-    // Modify solver + run IDA + save results
-    scs_m.props.tol(6) = 100;     // Solver
-    scicos_simulate(scs_m, Info, 'nw'); // IDA
-    idaval = res.values;          // Results
-    // Compare results
-    compa = abs(ddaskrval-idaval);
-    // Extract mean, standard deviation, maximum
-    mea = mean(compa);
-    [maxi, indexMaxi] = max(compa);
-    stdeviation = st_deviation(compa);
-    // Verifying closeness of the results
-    assert_checktrue(maxi <= 10^-(i+3));
-    assert_checktrue(mea <= 10^-(i+3));
-    assert_checktrue(stdeviation <= 10^-(i+3));
-end
- CMSCOPE('set'): Wrong size for block parameter 'Refresh period': 2 exp 
-      ected, getting 2 2 2 2                                            
 Warning : redefining function: dst                     . Use funcprot(0) to avoid this message
 
- CMSCOPE('set'): Wrong size for block parameter 'Refresh period': 2 exp 
-      ected, getting 2 2 2 2                                            
 Warning : redefining function: dst                     . Use funcprot(0) to avoid this message
 
+--------------------------------------------\
+ Main Modelica : TMPDIR/DDaskr_RLC_test_im.mo
+
+ Flat Modelica : TMPDIR/DDaskr_RLC_test_imf.mo
+ Simulation C code :TMPDIR/DDaskr_RLC_test_im.c
  
- CMSCOPE('set'): Wrong size for block parameter 'Refresh period': 2 exp 
-      ected, getting 2 2 2 2                                            
+!Modelica blocks are reduced to a block with:             !
+!                                                         !
+!Number of differential states: 2                         !
+!                                                         !
+!Number of algebraic states: 1                            !
+!                                                         !
+!Number of discrete time states  : 0                      !
+!                                                         !
+!Number of zero-crossing surfaces: 0                      !
+!                                                         !
+!Number of modes  : 0                                     !
+!                                                         !
+!Number of inputs : 0                                     !
+!                                                         !
+!Number of outputs: 1                                     !
+!                                                         !
+!Input/output dependency:[T]                              !
+!                                                         !
+!Analytical Jacobian: enabled  (%Jacobian=%t)             !
+!                                                         !
+!Parameter embedding mode: enabled (%Modelica_ParEmb=%t)  !
+!                                                         !
+!                                                         !
+!                                                         !
+!Generated files path: TMPDIR/         !
+!                                                         !
+!                                                         !
+   Generate a loader file
+   Generate a Makefile
+   ilib_gen_Make: Copy compilation files (Makefile*, libtool...) to TMPDIR
+   ilib_gen_Make: Copy DDaskr_RLC_test_im.c to TMPDIR
+   ilib_gen_Make: configure : Generate Makefile.
+   ilib_gen_Make: Modification of the Makefile in TMPDIR.
+   Running the Makefile
+   Generate a cleaner file
+Shared archive loaded.
+Link done.
 Warning : redefining function: dst                     . Use funcprot(0) to avoid this message
 
- CMSCOPE('set'): Wrong size for block parameter 'Refresh period': 2 exp 
-      ected, getting 2 2 2 2                                            
 Warning : redefining function: dst                     . Use funcprot(0) to avoid this message
 
index 2336b99..4f345bb 100644 (file)
@@ -18,38 +18,22 @@ function messagebox(msg, msg_title)
  disp(msg);
 endfunction
 funcprot(prot);
-Info = scicos_simulate(scs_m, list(), 'nw');
-
-// looking for the CLOCK_f/EVTDLY_f to update period
-for path_1=1:length(scs_m.objs)
-    if typeof(scs_m.objs(path_1))=="Block" & scs_m.objs(path_1).gui=="CLOCK_f" then
-        CLOCK_f_scs_m = scs_m.objs(path_1).model.rpar;
-        break;
-    end
-end
-for path_2=1:length(CLOCK_f_scs_m)
-    if typeof(CLOCK_f_scs_m.objs(path_2))=="Block" & CLOCK_f_scs_m.objs(path_2).gui=="EVTDLY_f" then
-        EVTDLY_f_blk = CLOCK_f_scs_m.objs(path_2);
-        break;
-    end
-end
-
-
 
 for i=2:3
 
     // Start by updating the clock block period (sampling)
-    scs_m.objs(path_1).model.rpar.objs(path_2).graphics.exprs = [string(5*(10^-i));"0"];
+    Context.per = 5*10^-i;
+    Info = scicos_simulate(scs_m, list(), Context);
 
     // Modify solver + run DDaskr + save results
     scs_m.props.tol(6) = 102;     // Solver
-    scicos_simulate(scs_m, Info, 'nw'); // DDaskr
-    ddaskrval = res.values;        // Results
-    time = res.time;               // Time
+    scicos_simulate(scs_m, Info); // DDaskr
+    ddaskrval = res.values;       // Results
+    time = res.time;              // Time
 
     // Modify solver + run IDA + save results
     scs_m.props.tol(6) = 100;     // Solver
-    scicos_simulate(scs_m, Info, 'nw'); // IDA
+    scicos_simulate(scs_m, Info); // IDA
     idaval = res.values;          // Results
 
     // Compare results
@@ -61,7 +45,8 @@ for i=2:3
     stdeviation = st_deviation(compa);
 
     // Verifying closeness of the results
-    assert_checktrue(maxi <= 10^-(i+3));
-    assert_checktrue(mea <= 10^-(i+3));
-    assert_checktrue(stdeviation <= 10^-(i+3));
+    assert_checktrue(maxi <= 10^-(i+4));
+    assert_checktrue(mea <= 10^-(i+4));
+    assert_checktrue(stdeviation <= 10^-(i+4));
+
 end
index 59bf9c7..7172156 100644 (file)
@@ -15,15 +15,12 @@ function messagebox(msg, msg_title)
  disp(msg);
 endfunction
 funcprot(prot);
-Info = scicos_simulate(scs_m, list(), 'nw');
- CMSCOPE('set'): Wrong size for block parameter 'Refresh period': 2 exp 
-      ected, getting 50 50 50 50                                        
+Info = scicos_simulate(scs_m, list());
 --------------------------------------------\
- Main Modelica : TMPDIR/DDaskr_test2_im.mo
+ Main Modelica : TMPDIR/DDaskr_Bouncing_test_im.mo
 
- Flat Modelica : TMPDIR/DDaskr_test2_imf.mo
- Simulation C code :TMPDIR/DDaskr_test2_im.c
+ Flat Modelica : TMPDIR/DDaskr_Bouncing_test_imf.mo
+ Simulation C code :TMPDIR/DDaskr_Bouncing_test_im.c
  
 !Modelica blocks are reduced to a block with:             !
 !                                                         !
@@ -39,7 +36,7 @@ Info = scicos_simulate(scs_m, list(), 'nw');
 !                                                         !
 !Number of inputs : 0                                     !
 !                                                         !
-!Number of outputs: 3                                     !
+!Number of outputs: 1                                     !
 !                                                         !
 !Input/output dependency:[T]                              !
 !                                                         !
@@ -49,52 +46,29 @@ Info = scicos_simulate(scs_m, list(), 'nw');
 !                                                         !
 !                                                         !
 !                                                         !
-!Generated files path: TMPDIR/         !
+!Generated files path: TMPDIR/          !
 !                                                         !
 !                                                         !
    Generate a loader file
    Generate a Makefile
    ilib_gen_Make: Copy compilation files (Makefile*, libtool...) to TMPDIR
-   ilib_gen_Make: Copy DDaskr_test2_im.c to TMPDIR
+   ilib_gen_Make: Copy DDaskr_Bouncing_test_im.c to TMPDIR
    ilib_gen_Make: configure : Generate Makefile.
    ilib_gen_Make: Modification of the Makefile in TMPDIR.
    Running the Makefile
    Generate a cleaner file
 Shared archive loaded.
 Link done.
-// looking for the CLOCK_f/EVTDLY_f to update period
-for path_1=1:length(scs_m.objs)
-    if typeof(scs_m.objs(path_1))=="Block" & scs_m.objs(path_1).gui=="CLOCK_f" then
-        CLOCK_f_scs_m = scs_m.objs(path_1).model.rpar;
-        break;
-    end
-end
-for path_2=1:length(CLOCK_f_scs_m)
-    if typeof(CLOCK_f_scs_m.objs(path_2))=="Block" & CLOCK_f_scs_m.objs(path_2).gui=="EVTDLY_f" then
-        EVTDLY_f_blk = CLOCK_f_scs_m.objs(path_2);
-        break;
-    end
-end
-// Start by updating the clock block period (sampling)
-scs_m.objs(path_1).model.rpar.objs(path_2).graphics.exprs = [string(5*(10^-3));"0"];
 // Modify solver + run DDaskr + save results
 scs_m.props.tol(6) = 101;      // Solver
-//scs_m.props.tol(1) = 1.0e-10; // abstol
-//scs_m.props.tol(2) = 1.0e-10; // reltol
-scicos_simulate(scs_m, Info, 'nw');  // DDaskr
- CMSCOPE('set'): Wrong size for block parameter 'Refresh period': 2 exp 
-      ected, getting 50 50 50 50                                        
+scicos_simulate(scs_m, Info);  // DDaskr
 Warning : redefining function: dst                     . Use funcprot(0) to avoid this message
 
 ddaskrval = res.values;         // Results
 time = res.time;                // Time
 // Modify solver + run IDA + save results
 scs_m.props.tol(6) = 100;     // Solver
-scicos_simulate(scs_m, Info, 'nw'); // IDA
- CMSCOPE('set'): Wrong size for block parameter 'Refresh period': 2 exp 
-      ected, getting 50 50 50 50                                        
+scicos_simulate(scs_m, Info); // IDA
 Warning : redefining function: dst                     . Use funcprot(0) to avoid this message
 
 idaval = res.values;          // Results
index d6956fd..6a4ab82 100644 (file)
@@ -18,36 +18,17 @@ function messagebox(msg, msg_title)
  disp(msg);
 endfunction
 funcprot(prot);
-Info = scicos_simulate(scs_m, list(), 'nw');
-
-// looking for the CLOCK_f/EVTDLY_f to update period
-for path_1=1:length(scs_m.objs)
-    if typeof(scs_m.objs(path_1))=="Block" & scs_m.objs(path_1).gui=="CLOCK_f" then
-        CLOCK_f_scs_m = scs_m.objs(path_1).model.rpar;
-        break;
-    end
-end
-for path_2=1:length(CLOCK_f_scs_m)
-    if typeof(CLOCK_f_scs_m.objs(path_2))=="Block" & CLOCK_f_scs_m.objs(path_2).gui=="EVTDLY_f" then
-        EVTDLY_f_blk = CLOCK_f_scs_m.objs(path_2);
-        break;
-    end
-end
-
-// Start by updating the clock block period (sampling)
-scs_m.objs(path_1).model.rpar.objs(path_2).graphics.exprs = [string(5*(10^-3));"0"];
+Info = scicos_simulate(scs_m, list());
 
 // Modify solver + run DDaskr + save results
 scs_m.props.tol(6) = 101;      // Solver
-//scs_m.props.tol(1) = 1.0e-10; // abstol
-//scs_m.props.tol(2) = 1.0e-10; // reltol
-scicos_simulate(scs_m, Info, 'nw');  // DDaskr
+scicos_simulate(scs_m, Info);  // DDaskr
 ddaskrval = res.values;         // Results
 time = res.time;                // Time
 
 // Modify solver + run IDA + save results
 scs_m.props.tol(6) = 100;     // Solver
-scicos_simulate(scs_m, Info, 'nw'); // IDA
+scicos_simulate(scs_m, Info); // IDA
 idaval = res.values;          // Results
 
 // Compare results
index 0d6a776..5798696 100644 (file)
@@ -15,10 +15,9 @@ function messagebox(msg, msg_title)
  disp(msg);
 endfunction
 funcprot(prot);
-Info = scicos_simulate(scs_m, list(), 'nw');
- CMSCOPE('set'): Wrong size for block parameter 'Refresh period': 2 exp 
-      ected, getting 50 50 50 50                                        
+// Modify solver + run DDaskr + save results
+scs_m.props.tol(6) = 101;       // Solver
+scicos_simulate(scs_m);   // DDaskr
 --------------------------------------------\
  Main Modelica : TMPDIR/DDaskr_Hydraulics_test_im.mo
 
@@ -39,7 +38,7 @@ Info = scicos_simulate(scs_m, list(), 'nw');
 !                                                         !
 !Number of inputs : 1                                     !
 !                                                         !
-!Number of outputs: 2                                     !
+!Number of outputs: 1                                     !
 !                                                         !
 !Input/output dependency:[F]                              !
 !                                                         !
@@ -49,7 +48,7 @@ Info = scicos_simulate(scs_m, list(), 'nw');
 !                                                         !
 !                                                         !
 !                                                         !
-!Generated files path: TMPDIR/         !
+!Generated files path: TMPDIR/          !
 !                                                         !
 !                                                         !
    Generate a loader file
@@ -62,41 +61,54 @@ Info = scicos_simulate(scs_m, list(), 'nw');
    Generate a cleaner file
 Shared archive loaded.
 Link done.
-// looking for the CLOCK_f/EVTDLY_f to update period
-for path_1=1:length(scs_m.objs)
-    if typeof(scs_m.objs(path_1))=="Block" & scs_m.objs(path_1).gui=="CLOCK_f" then
-        CLOCK_f_scs_m = scs_m.objs(path_1).model.rpar;
-        break;
-    end
-end
-for path_2=1:length(CLOCK_f_scs_m)
-    if typeof(CLOCK_f_scs_m.objs(path_2))=="Block" & CLOCK_f_scs_m.objs(path_2).gui=="EVTDLY_f" then
-        EVTDLY_f_blk = CLOCK_f_scs_m.objs(path_2);
-        break;
-    end
-end
-// Start by updating the clock block period (sampling)
-scs_m.objs(path_1).model.rpar.objs(path_2).graphics.exprs = [string(5*(10^-3));"0"];
-// Modify solver + run DDaskr + save results
-scs_m.props.tol(6) = 101;       // Solver
-//scs_m.props.tol(1) = 1.0e-10; // abstol
-//scs_m.props.tol(2) = 1.0e-10; // reltol
-scicos_simulate(scs_m, Info, 'nw');   // DDaskr
- CMSCOPE('set'): Wrong size for block parameter 'Refresh period': 2 exp 
-      ected, getting 50 50 50 50                                        
-Warning : redefining function: dst                     . Use funcprot(0) to avoid this message
-
 ddaskrval = res.values;         // Results
 time = res.time;                // Time
 // Modify solver + run IDA + save results
 scs_m.props.tol(6) = 100;       // Solver
-scicos_simulate(scs_m, Info, 'nw');   // IDA
- CMSCOPE('set'): Wrong size for block parameter 'Refresh period': 2 exp 
-      ected, getting 50 50 50 50                                        
-Warning : redefining function: dst                     . Use funcprot(0) to avoid this message
+scicos_simulate(scs_m);   // IDA
+--------------------------------------------\
+ Main Modelica : TMPDIR/DDaskr_Hydraulics_test_im.mo
 
+ Flat Modelica : TMPDIR/DDaskr_Hydraulics_test_imf.mo
+ Simulation C code :TMPDIR/DDaskr_Hydraulics_test_im.c
+!Modelica blocks are reduced to a block with:             !
+!                                                         !
+!Number of differential states: 2                         !
+!                                                         !
+!Number of algebraic states: 5                            !
+!                                                         !
+!Number of discrete time states  : 0                      !
+!                                                         !
+!Number of zero-crossing surfaces: 19                     !
+!                                                         !
+!Number of modes  : 19                                    !
+!                                                         !
+!Number of inputs : 1                                     !
+!                                                         !
+!Number of outputs: 1                                     !
+!                                                         !
+!Input/output dependency:[F]                              !
+!                                                         !
+!Analytical Jacobian: enabled  (%Jacobian=%t)             !
+!                                                         !
+!Parameter embedding mode: enabled (%Modelica_ParEmb=%t)  !
+!                                                         !
+!                                                         !
+!                                                         !
+!Generated files path: TMPDIR/          !
+!                                                         !
+!                                                         !
+   Generate a loader file
+   Generate a Makefile
+   ilib_gen_Make: Copy compilation files (Makefile*, libtool...) to TMPDIR
+   ilib_gen_Make: Copy DDaskr_Hydraulics_test_im.c to TMPDIR
+   ilib_gen_Make: configure : Generate Makefile.
+   ilib_gen_Make: Modification of the Makefile in TMPDIR.
+   Running the Makefile
+   Generate a cleaner file
+Shared archive loaded.
+Link done.
 idaval = res.values;            // Results
 // Compare results
 compa = abs(ddaskrval-idaval);
@@ -105,6 +117,6 @@ mea = mean(compa);
 [maxi, indexMaxi] = max(compa);
 stdeviation = st_deviation(compa);
 // Verifying closeness of the results
-assert_checktrue(maxi <= 10^-(7));
-assert_checktrue(mea <= 10^-(7));
-assert_checktrue(stdeviation <= 10^-(7));
+assert_checktrue(maxi <= 2*10^-(7));
+assert_checktrue(mea <= 2*10^-(7));
+assert_checktrue(stdeviation <= 2*10^-(7));
index 75f7bd6..f8f572f 100644 (file)
@@ -18,36 +18,16 @@ function messagebox(msg, msg_title)
  disp(msg);
 endfunction
 funcprot(prot);
-Info = scicos_simulate(scs_m, list(), 'nw');
-
-// looking for the CLOCK_f/EVTDLY_f to update period
-for path_1=1:length(scs_m.objs)
-    if typeof(scs_m.objs(path_1))=="Block" & scs_m.objs(path_1).gui=="CLOCK_f" then
-        CLOCK_f_scs_m = scs_m.objs(path_1).model.rpar;
-        break;
-    end
-end
-for path_2=1:length(CLOCK_f_scs_m)
-    if typeof(CLOCK_f_scs_m.objs(path_2))=="Block" & CLOCK_f_scs_m.objs(path_2).gui=="EVTDLY_f" then
-        EVTDLY_f_blk = CLOCK_f_scs_m.objs(path_2);
-        break;
-    end
-end
-
-// Start by updating the clock block period (sampling)
-scs_m.objs(path_1).model.rpar.objs(path_2).graphics.exprs = [string(5*(10^-3));"0"];
 
 // Modify solver + run DDaskr + save results
 scs_m.props.tol(6) = 101;       // Solver
-//scs_m.props.tol(1) = 1.0e-10; // abstol
-//scs_m.props.tol(2) = 1.0e-10; // reltol
-scicos_simulate(scs_m, Info, 'nw');   // DDaskr
+scicos_simulate(scs_m);   // DDaskr
 ddaskrval = res.values;         // Results
 time = res.time;                // Time
 
 // Modify solver + run IDA + save results
 scs_m.props.tol(6) = 100;       // Solver
-scicos_simulate(scs_m, Info, 'nw');   // IDA
+scicos_simulate(scs_m);   // IDA
 idaval = res.values;            // Results
 
 // Compare results
@@ -59,7 +39,7 @@ mea = mean(compa);
 stdeviation = st_deviation(compa);
 
 // Verifying closeness of the results
-assert_checktrue(maxi <= 10^-(7));
-assert_checktrue(mea <= 10^-(7));
-assert_checktrue(stdeviation <= 10^-(7));
+assert_checktrue(maxi <= 2*10^-(7));
+assert_checktrue(mea <= 2*10^-(7));
+assert_checktrue(stdeviation <= 2*10^-(7));
 
index 3d36480..875ac18 100644 (file)
@@ -15,7 +15,7 @@ function messagebox(msg, msg_title)
  disp(msg);
 endfunction
 funcprot(prot);
-Info = scicos_simulate(scs_m, list(), 'nw');
+Info = scicos_simulate(scs_m, list());
 --------------------------------------------\
  Main Modelica : TMPDIR/DDaskr_Platform_test_im.mo
 
@@ -36,7 +36,7 @@ Info = scicos_simulate(scs_m, list(), 'nw');
 !                                                         !
 !Number of inputs : 0                                     !
 !                                                         !
-!Number of outputs: 3                                     !
+!Number of outputs: 1                                     !
 !                                                         !
 !Input/output dependency:[T]                              !
 !                                                         !
@@ -46,7 +46,7 @@ Info = scicos_simulate(scs_m, list(), 'nw');
 !                                                         !
 !                                                         !
 !                                                         !
-!Generated files path: TMPDIR/          !
+!Generated files path: TMPDIR/         !
 !                                                         !
 !                                                         !
    Generate a loader file
@@ -59,30 +59,17 @@ Info = scicos_simulate(scs_m, list(), 'nw');
    Generate a cleaner file
 Shared archive loaded.
 Link done.
-// looking for the CLOCK_f/EVTDLY_f to update period
-for path_1=1:length(scs_m.objs)
-    if typeof(scs_m.objs(path_1))=="Block" & scs_m.objs(path_1).gui=="CLOCK_c" then
-        CLOCK_f_scs_m = scs_m.objs(path_1).model.rpar;
-        break;
-    end
-end
-for path_2=1:length(CLOCK_f_scs_m)
-    if typeof(CLOCK_f_scs_m.objs(path_2))=="Block" & CLOCK_f_scs_m.objs(path_2).gui=="EVTDLY_c" then
-        EVTDLY_f_blk = CLOCK_f_scs_m.objs(path_2);
-        break;
-    end
-end
 for i=1:3  // 'max step size' = 10^-i, precision
     // Start by updating the clock block period (sampling)
-    scs_m.objs(path_1).model.rpar.objs(path_2).graphics.exprs = [string(5*(10^-i));"0"];
+    Context.per = 5*10^-i;
     // Modify solver + run DDaskr + save results
     scs_m.props.tol(6) = 101;     // Solver
-    scicos_simulate(scs_m, Info, 'nw'); // DDaskr
+    scicos_simulate(scs_m, Info, Context); // DDaskr
     ddaskrval = res.values;       // Results
     time = res.time;              // Time
     // Modify solver + run IDA + save results
     scs_m.props.tol(6) = 100;     // Solver
-    scicos_simulate(scs_m, Info, 'nw'); // IDA
+    scicos_simulate(scs_m, Info, Context); // IDA
     idaval = res.values;          // Results
     // Compare results
     compa = abs(ddaskrval-idaval);
index 596ce2e..36a4a1a 100644 (file)
@@ -18,36 +18,22 @@ function messagebox(msg, msg_title)
  disp(msg);
 endfunction
 funcprot(prot);
-Info = scicos_simulate(scs_m, list(), 'nw');
-
-// looking for the CLOCK_f/EVTDLY_f to update period
-for path_1=1:length(scs_m.objs)
-    if typeof(scs_m.objs(path_1))=="Block" & scs_m.objs(path_1).gui=="CLOCK_c" then
-        CLOCK_f_scs_m = scs_m.objs(path_1).model.rpar;
-        break;
-    end
-end
-for path_2=1:length(CLOCK_f_scs_m)
-    if typeof(CLOCK_f_scs_m.objs(path_2))=="Block" & CLOCK_f_scs_m.objs(path_2).gui=="EVTDLY_c" then
-        EVTDLY_f_blk = CLOCK_f_scs_m.objs(path_2);
-        break;
-    end
-end
+Info = scicos_simulate(scs_m, list());
 
 for i=1:3  // 'max step size' = 10^-i, precision
 
     // Start by updating the clock block period (sampling)
-    scs_m.objs(path_1).model.rpar.objs(path_2).graphics.exprs = [string(5*(10^-i));"0"];
+    Context.per = 5*10^-i;
 
     // Modify solver + run DDaskr + save results
     scs_m.props.tol(6) = 101;     // Solver
-    scicos_simulate(scs_m, Info, 'nw'); // DDaskr
+    scicos_simulate(scs_m, Info, Context); // DDaskr
     ddaskrval = res.values;       // Results
     time = res.time;              // Time
 
     // Modify solver + run IDA + save results
     scs_m.props.tol(6) = 100;     // Solver
-    scicos_simulate(scs_m, Info, 'nw'); // IDA
+    scicos_simulate(scs_m, Info, Context); // IDA
     idaval = res.values;          // Results
 
     // Compare results
index 9a049e5..f18c7a5 100644 (file)
@@ -15,10 +15,30 @@ function messagebox(msg, msg_title)
  disp(msg);
 endfunction
 funcprot(prot);
-Info = scicos_simulate(scs_m, list(), 'nw');
- CMSCOPE('set'): Wrong size for block parameter 'Refresh period': 2 exp 
-      ected, getting 2 2 2 2                                            
+for i=2:3
+    // Start by updating the clock block period (sampling)
+    Context.per = 5*10^-i;
+    Info = scicos_simulate(scs_m, list(), Context);
+    // Modify solver + run DDaskr + save results
+    scs_m.props.tol(6) = 101;     // Solver
+    scicos_simulate(scs_m, Info); // DDaskr
+    ddaskrval = res.values;       // Results
+    time = res.time;              // Time
+    // Modify solver + run IDA + save results
+    scs_m.props.tol(6) = 100;     // Solver
+    scicos_simulate(scs_m, Info); // IDA
+    idaval = res.values;          // Results
+    // Compare results
+    compa = abs(ddaskrval-idaval);
+    // Extract mean, standard deviation, maximum
+    mea = mean(compa);
+    [maxi, indexMaxi] = max(compa);
+    stdeviation = st_deviation(compa);
+    // Verifying closeness of the results
+    assert_checktrue(maxi <= 10^-(i+4));
+    assert_checktrue(mea <= 10^-(i+4));
+    assert_checktrue(stdeviation <= 10^-(i+4));
+end
 --------------------------------------------\
  Main Modelica : TMPDIR/DDaskr_RLC_test_im.mo
 
@@ -39,7 +59,7 @@ Info = scicos_simulate(scs_m, list(), 'nw');
 !                                                         !
 !Number of inputs : 0                                     !
 !                                                         !
-!Number of outputs: 3                                     !
+!Number of outputs: 1                                     !
 !                                                         !
 !Input/output dependency:[T]                              !
 !                                                         !
@@ -62,59 +82,54 @@ Info = scicos_simulate(scs_m, list(), 'nw');
    Generate a cleaner file
 Shared archive loaded.
 Link done.
-// looking for the CLOCK_f/EVTDLY_f to update period
-for path_1=1:length(scs_m.objs)
-    if typeof(scs_m.objs(path_1))=="Block" & scs_m.objs(path_1).gui=="CLOCK_f" then
-        CLOCK_f_scs_m = scs_m.objs(path_1).model.rpar;
-        break;
-    end
-end
-for path_2=1:length(CLOCK_f_scs_m)
-    if typeof(CLOCK_f_scs_m.objs(path_2))=="Block" & CLOCK_f_scs_m.objs(path_2).gui=="EVTDLY_f" then
-        EVTDLY_f_blk = CLOCK_f_scs_m.objs(path_2);
-        break;
-    end
-end
-for i=2:3
-    // Start by updating the clock block period (sampling)
-    scs_m.objs(path_1).model.rpar.objs(path_2).graphics.exprs = [string(5*(10^-i));"0"];
-    // Modify solver + run DDaskr + save results
-    scs_m.props.tol(6) = 101;     // Solver
-    scicos_simulate(scs_m, Info, 'nw'); // DDaskr
-    ddaskrval = res.values;        // Results
-    time = res.time;               // Time
-    // Modify solver + run IDA + save results
-    scs_m.props.tol(6) = 100;     // Solver
-    scicos_simulate(scs_m, Info, 'nw'); // IDA
-    idaval = res.values;          // Results
-    // Compare results
-    compa = abs(ddaskrval-idaval);
-    // Extract mean, standard deviation, maximum
-    mea = mean(compa);
-    [maxi, indexMaxi] = max(compa);
-    stdeviation = st_deviation(compa);
-    // Verifying closeness of the results
-    assert_checktrue(maxi <= 10^-(i+4));
-    assert_checktrue(mea <= 10^-(i+4));
-    assert_checktrue(stdeviation <= 10^-(i+4));
-end
- CMSCOPE('set'): Wrong size for block parameter 'Refresh period': 2 exp 
-      ected, getting 2 2 2 2                                            
 Warning : redefining function: dst                     . Use funcprot(0) to avoid this message
 
- CMSCOPE('set'): Wrong size for block parameter 'Refresh period': 2 exp 
-      ected, getting 2 2 2 2                                            
 Warning : redefining function: dst                     . Use funcprot(0) to avoid this message
 
+--------------------------------------------\
+ Main Modelica : TMPDIR/DDaskr_RLC_test_im.mo
+
+ Flat Modelica : TMPDIR/DDaskr_RLC_test_imf.mo
+ Simulation C code :TMPDIR/DDaskr_RLC_test_im.c
  
- CMSCOPE('set'): Wrong size for block parameter 'Refresh period': 2 exp 
-      ected, getting 2 2 2 2                                            
+!Modelica blocks are reduced to a block with:             !
+!                                                         !
+!Number of differential states: 2                         !
+!                                                         !
+!Number of algebraic states: 1                            !
+!                                                         !
+!Number of discrete time states  : 0                      !
+!                                                         !
+!Number of zero-crossing surfaces: 0                      !
+!                                                         !
+!Number of modes  : 0                                     !
+!                                                         !
+!Number of inputs : 0                                     !
+!                                                         !
+!Number of outputs: 1                                     !
+!                                                         !
+!Input/output dependency:[T]                              !
+!                                                         !
+!Analytical Jacobian: enabled  (%Jacobian=%t)             !
+!                                                         !
+!Parameter embedding mode: enabled (%Modelica_ParEmb=%t)  !
+!                                                         !
+!                                                         !
+!                                                         !
+!Generated files path: TMPDIR/         !
+!                                                         !
+!                                                         !
+   Generate a loader file
+   Generate a Makefile
+   ilib_gen_Make: Copy compilation files (Makefile*, libtool...) to TMPDIR
+   ilib_gen_Make: Copy DDaskr_RLC_test_im.c to TMPDIR
+   ilib_gen_Make: configure : Generate Makefile.
+   ilib_gen_Make: Modification of the Makefile in TMPDIR.
+   Running the Makefile
+   Generate a cleaner file
+Shared archive loaded.
+Link done.
 Warning : redefining function: dst                     . Use funcprot(0) to avoid this message
 
- CMSCOPE('set'): Wrong size for block parameter 'Refresh period': 2 exp 
-      ected, getting 2 2 2 2                                            
 Warning : redefining function: dst                     . Use funcprot(0) to avoid this message
 
index 14e47e1..a23a717 100644 (file)
@@ -18,38 +18,22 @@ function messagebox(msg, msg_title)
  disp(msg);
 endfunction
 funcprot(prot);
-Info = scicos_simulate(scs_m, list(), 'nw');
-
-// looking for the CLOCK_f/EVTDLY_f to update period
-for path_1=1:length(scs_m.objs)
-    if typeof(scs_m.objs(path_1))=="Block" & scs_m.objs(path_1).gui=="CLOCK_f" then
-        CLOCK_f_scs_m = scs_m.objs(path_1).model.rpar;
-        break;
-    end
-end
-for path_2=1:length(CLOCK_f_scs_m)
-    if typeof(CLOCK_f_scs_m.objs(path_2))=="Block" & CLOCK_f_scs_m.objs(path_2).gui=="EVTDLY_f" then
-        EVTDLY_f_blk = CLOCK_f_scs_m.objs(path_2);
-        break;
-    end
-end
-
-
 
 for i=2:3
 
     // Start by updating the clock block period (sampling)
-    scs_m.objs(path_1).model.rpar.objs(path_2).graphics.exprs = [string(5*(10^-i));"0"];
+    Context.per = 5*10^-i;
+    Info = scicos_simulate(scs_m, list(), Context);
 
     // Modify solver + run DDaskr + save results
     scs_m.props.tol(6) = 101;     // Solver
-    scicos_simulate(scs_m, Info, 'nw'); // DDaskr
-    ddaskrval = res.values;        // Results
-    time = res.time;               // Time
+    scicos_simulate(scs_m, Info); // DDaskr
+    ddaskrval = res.values;       // Results
+    time = res.time;              // Time
 
     // Modify solver + run IDA + save results
     scs_m.props.tol(6) = 100;     // Solver
-    scicos_simulate(scs_m, Info, 'nw'); // IDA
+    scicos_simulate(scs_m, Info); // IDA
     idaval = res.values;          // Results
 
     // Compare results
@@ -64,4 +48,5 @@ for i=2:3
     assert_checktrue(maxi <= 10^-(i+4));
     assert_checktrue(mea <= 10^-(i+4));
     assert_checktrue(stdeviation <= 10^-(i+4));
+
 end
index 18cc335..dfbef79 100644 (file)
Binary files a/scilab/modules/xcos/tests/unit_tests/DDaskr_Bouncing_test.zcos and b/scilab/modules/xcos/tests/unit_tests/DDaskr_Bouncing_test.zcos differ
index cae1b8a..b4b832d 100644 (file)
Binary files a/scilab/modules/xcos/tests/unit_tests/DDaskr_Hydraulics_test.zcos and b/scilab/modules/xcos/tests/unit_tests/DDaskr_Hydraulics_test.zcos differ
index 2b85b48..d711446 100644 (file)
Binary files a/scilab/modules/xcos/tests/unit_tests/DDaskr_Platform_test.zcos and b/scilab/modules/xcos/tests/unit_tests/DDaskr_Platform_test.zcos differ
index 3f84318..d9b3b9c 100644 (file)
Binary files a/scilab/modules/xcos/tests/unit_tests/DDaskr_RLC_test.zcos and b/scilab/modules/xcos/tests/unit_tests/DDaskr_RLC_test.zcos differ