diff options
Diffstat (limited to 'modules/scicos/tests')
96 files changed, 3858 insertions, 0 deletions
diff --git a/modules/scicos/tests/unit_tests/PENDULUM_ANIM.sci b/modules/scicos/tests/unit_tests/PENDULUM_ANIM.sci new file mode 100755 index 000000000..bdbf9f76f --- /dev/null +++ b/modules/scicos/tests/unit_tests/PENDULUM_ANIM.sci @@ -0,0 +1,73 @@ +///withoutPrompt +function [x,y,typ]=PENDULUM_ANIM(job,arg1,arg2) + // Animation of the cart-pendulum problem + x=[];y=[];typ=[] + select job + case "plot" then + standard_draw(arg1) + case "getinputs" then + [x,y,typ]=standard_inputs(o) + case "getoutputs" then + x=[];y=[];typ=[]; + case "getorigin" then + [x,y]=standard_origin(arg1) + case "set" then + x=arg1; + graphics=arg1.graphics;exprs=graphics.exprs + model=arg1.model;dstate=model.dstate + while %t do + [ok,plen,csiz,phi,xmin,xmax,ymin,ymax,exprs]=scicos_getvalue(.. + "Set Scope parameters",.. + ["pendulum length";"cart size (square side)";"slope"; + "Xmin";"Xmax"; "Ymin"; "Ymax"; ],.. + list("vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs) + if ~ok then break,end + mess=[] + if plen<=0|csiz<=0 then + mess=[mess;"Pendulum length and cart size must be positive.";" "] + ok=%f + end + if ymin>=ymax then + mess=[mess;"Ymax must be greater than Ymin";" "] + ok=%f + end + if xmin>=xmax then + mess=[mess;"Xmax must be greater than Xmin";" "] + ok=%f + end + if ~ok then + messagebox(mess,"modal") + else + rpar=[plen;csiz;phi;xmin;xmax;ymin;ymax] + model.rpar=rpar; + graphics.exprs=exprs; + x.graphics=graphics;x.model=model + break + end + end + case "define" then + plen=2; csiz=2; phi=0; + xmin=-5;xmax=5;ymin=-5;ymax=5 + + model=scicos_model() + model.sim=list("anim_pen",5) + model.in=[1;1] + model.evtin=1 + model.dstate=0 + model.rpar=[plen;csiz;phi;xmin;xmax;ymin;ymax] + model.blocktype="d" + model.dep_ut=[%f %f] + + exprs=string(model.rpar) + gr_i=["thick=xget(''thickness'');xset(''thickness'',2);"; + "xx=orig(1)+sz(1)*[.4 .6 .6 .4 .4]" + "yy=orig(2)+sz(2)*[.2 .2 .4 .4 .2]" + "xpoly(xx,yy,''lines'')" + "xx=orig(1)+sz(1)*[.5 .6]" + "yy=orig(2)+sz(2)*[.4 .8]" + "xpoly(xx,yy)" + "xset(''thickness'',thick);"] + x=standard_define([3 3],model,exprs,gr_i) + end +endfunction + diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_Bouncing.tst b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_Bouncing.tst new file mode 100755 index 000000000..37bad2c9c --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_Bouncing.tst @@ -0,0 +1,47 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// + +ilib_verbose(0); //to remove ilib_* traces + +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/Bouncing.zcos")); + +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +funcprot(prot); +Info = scicos_simulate(scs_m, list()); + +// Modify solver + run DDaskr + save results +scs_m.props.tol(6) = 102; // Solver +scicos_simulate(scs_m, Info); // DDaskr +ddaskrval = res.values; // Results + +// 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 = stdev(compa); + +// Verifying closeness of the results +assert_checktrue(maxi <= 5d-5); +assert_checktrue(mea <= 5d-5); +assert_checktrue(stdeviation <= 5d-5); diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_Bouncing.unix.dia.ref b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_Bouncing.unix.dia.ref new file mode 100755 index 000000000..6c44dcddb --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_Bouncing.unix.dia.ref @@ -0,0 +1,48 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// +ilib_verbose(0); //to remove ilib_* traces +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/Bouncing.zcos")); +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +funcprot(prot); +Info = scicos_simulate(scs_m, list()); +--------------------------------------------\ + Main Modelica : TMPDIR/Bouncing_im.mo + + Flat Modelica : TMPDIR/Bouncing_imf.mo + Simulation C code :TMPDIR/Bouncing_im.c +// Modify solver + run DDaskr + save results +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 +// Modify solver + run IDA + save results +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 +// Compare results +compa = abs(ddaskrval-idaval); +// Extract mean, standard deviation, maximum +mea = mean(compa); +[maxi, indexMaxi] = max(compa); +stdeviation = stdev(compa); +// Verifying closeness of the results +assert_checktrue(maxi <= 5d-5); +assert_checktrue(mea <= 5d-5); +assert_checktrue(stdeviation <= 5d-5); diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_Bouncing.win.dia.ref b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_Bouncing.win.dia.ref new file mode 100755 index 000000000..b91941916 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_Bouncing.win.dia.ref @@ -0,0 +1,48 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// +ilib_verbose(0); //to remove ilib_* traces +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/Bouncing.zcos")); +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +funcprot(prot); +Info = scicos_simulate(scs_m, list()); +--------------------------------------------\ + Main Modelica : TMPDIR\Bouncing_im.mo + + Flat Modelica : TMPDIR\Bouncing_imf.mo + Simulation C code :TMPDIR\Bouncing_im.c +// Modify solver + run DDaskr + save results +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 +// Modify solver + run IDA + save results +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 +// Compare results +compa = abs(ddaskrval-idaval); +// Extract mean, standard deviation, maximum +mea = mean(compa); +[maxi, indexMaxi] = max(compa); +stdeviation = stdev(compa); +// Verifying closeness of the results +assert_checktrue(maxi <= 5d-5); +assert_checktrue(mea <= 5d-5); +assert_checktrue(stdeviation <= 5d-5); diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_Hydraulics.tst b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_Hydraulics.tst new file mode 100755 index 000000000..87d58291f --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_Hydraulics.tst @@ -0,0 +1,46 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// + +ilib_verbose(0); //to remove ilib_* traces + +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/Hydraulics.zcos")); + +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +funcprot(prot); + +// Modify solver + run DDaskr + save results +scs_m.props.tol(6) = 102; // Solver +scicos_simulate(scs_m); // DDaskr +ddaskrval = res.values; // Results + +// Modify solver + run IDA + save results +scs_m.props.tol(6) = 100; // Solver +scicos_simulate(scs_m); // IDA +idaval = res.values; // Results + +// Compare results +compa = abs(ddaskrval-idaval); + +// Extract mean, standard deviation, maximum +mea = mean(compa); +[maxi, indexMaxi] = max(compa); +stdeviation = stdev(compa); + +// Verifying closeness of the results +assert_checktrue(maxi <= 2d-6); +assert_checktrue(mea <= 2d-6); +assert_checktrue(stdeviation <= 2d-6); diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_Hydraulics.unix.dia.ref b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_Hydraulics.unix.dia.ref new file mode 100755 index 000000000..db407daf8 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_Hydraulics.unix.dia.ref @@ -0,0 +1,48 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// +ilib_verbose(0); //to remove ilib_* traces +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/Hydraulics.zcos")); +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +funcprot(prot); +// Modify solver + run DDaskr + save results +scs_m.props.tol(6) = 102; // Solver +scicos_simulate(scs_m); // DDaskr +--------------------------------------------\ + Main Modelica : TMPDIR/Hydraulics_im.mo + + Flat Modelica : TMPDIR/Hydraulics_imf.mo + Simulation C code :TMPDIR/Hydraulics_im.c +ddaskrval = res.values; // Results +// Modify solver + run IDA + save results +scs_m.props.tol(6) = 100; // Solver +scicos_simulate(scs_m); // IDA +--------------------------------------------\ + Main Modelica : TMPDIR/Hydraulics_im.mo + + Flat Modelica : TMPDIR/Hydraulics_imf.mo + Simulation C code :TMPDIR/Hydraulics_im.c +idaval = res.values; // Results +// Compare results +compa = abs(ddaskrval-idaval); +// Extract mean, standard deviation, maximum +mea = mean(compa); +[maxi, indexMaxi] = max(compa); +stdeviation = stdev(compa); +// Verifying closeness of the results +assert_checktrue(maxi <= 2d-6); +assert_checktrue(mea <= 2d-6); +assert_checktrue(stdeviation <= 2d-6); diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_Hydraulics.win.dia.ref b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_Hydraulics.win.dia.ref new file mode 100755 index 000000000..aab41a540 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_Hydraulics.win.dia.ref @@ -0,0 +1,48 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// +ilib_verbose(0); //to remove ilib_* traces +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/Hydraulics.zcos")); +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +funcprot(prot); +// Modify solver + run DDaskr + save results +scs_m.props.tol(6) = 102; // Solver +scicos_simulate(scs_m); // DDaskr +--------------------------------------------\ + Main Modelica : TMPDIR\Hydraulics_im.mo + + Flat Modelica : TMPDIR\Hydraulics_imf.mo + Simulation C code :TMPDIR\Hydraulics_im.c +ddaskrval = res.values; // Results +// Modify solver + run IDA + save results +scs_m.props.tol(6) = 100; // Solver +scicos_simulate(scs_m); // IDA +--------------------------------------------\ + Main Modelica : TMPDIR\Hydraulics_im.mo + + Flat Modelica : TMPDIR\Hydraulics_imf.mo + Simulation C code :TMPDIR\Hydraulics_im.c +idaval = res.values; // Results +// Compare results +compa = abs(ddaskrval-idaval); +// Extract mean, standard deviation, maximum +mea = mean(compa); +[maxi, indexMaxi] = max(compa); +stdeviation = stdev(compa); +// Verifying closeness of the results +assert_checktrue(maxi <= 2d-6); +assert_checktrue(mea <= 2d-6); +assert_checktrue(stdeviation <= 2d-6); diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_Platform.tst b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_Platform.tst new file mode 100755 index 000000000..f33617292 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_Platform.tst @@ -0,0 +1,53 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// + +ilib_verbose(0); //to remove ilib_* traces + +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/Platform.zcos")); + +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction + +for i=1:2 // 'max step size' = 10^-i, precision + + // Start by updating the clock block period (sampling) + Context.per = 5*10^-i; + + // Modify solver + run DDaskr + save results + scs_m.props.tol(6) = 102; // Solver + scicos_simulate(scs_m, Context); // DDaskr + ddaskrval = res.values; // Results + + // Modify solver + run IDA + save results + scs_m.props.tol(6) = 100; // Solver + scicos_simulate(scs_m, Context); // IDA + idaval = res.values; // Results + + // Compare results + compa = abs(ddaskrval-idaval); + + // Extract mean, standard deviation, maximum + mea = mean(compa); + [maxi, indexMaxi] = max(compa); + stdeviation = stdev(compa); + + // Verifying closeness of the results + assert_checktrue(maxi <= 5*10^-(i+2)); + assert_checktrue(mea <= 5*10^-(i+2)); + assert_checktrue(stdeviation <= 5*10^-(i+2)); + +end +funcprot(prot); diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_Platform.unix.dia.ref b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_Platform.unix.dia.ref new file mode 100755 index 000000000..bf74b28e3 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_Platform.unix.dia.ref @@ -0,0 +1,62 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// +ilib_verbose(0); //to remove ilib_* traces +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/Platform.zcos")); +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +for i=1:2 // 'max step size' = 10^-i, precision + // Start by updating the clock block period (sampling) + Context.per = 5*10^-i; + // Modify solver + run DDaskr + save results + scs_m.props.tol(6) = 102; // Solver + scicos_simulate(scs_m, Context); // DDaskr + ddaskrval = res.values; // Results + // Modify solver + run IDA + save results + scs_m.props.tol(6) = 100; // Solver + scicos_simulate(scs_m, Context); // IDA + idaval = res.values; // Results + // Compare results + compa = abs(ddaskrval-idaval); + // Extract mean, standard deviation, maximum + mea = mean(compa); + [maxi, indexMaxi] = max(compa); + stdeviation = stdev(compa); + // Verifying closeness of the results + assert_checktrue(maxi <= 5*10^-(i+2)); + assert_checktrue(mea <= 5*10^-(i+2)); + assert_checktrue(stdeviation <= 5*10^-(i+2)); +end +--------------------------------------------\ + Main Modelica : TMPDIR/Platform_im.mo + + Flat Modelica : TMPDIR/Platform_imf.mo + Simulation C code :TMPDIR/Platform_im.c +--------------------------------------------\ + Main Modelica : TMPDIR/Platform_im.mo + + Flat Modelica : TMPDIR/Platform_imf.mo + Simulation C code :TMPDIR/Platform_im.c +--------------------------------------------\ + Main Modelica : TMPDIR/Platform_im.mo + + Flat Modelica : TMPDIR/Platform_imf.mo + Simulation C code :TMPDIR/Platform_im.c +--------------------------------------------\ + Main Modelica : TMPDIR/Platform_im.mo + + Flat Modelica : TMPDIR/Platform_imf.mo + Simulation C code :TMPDIR/Platform_im.c +funcprot(prot); diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_Platform.win.dia.ref b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_Platform.win.dia.ref new file mode 100755 index 000000000..2c760e602 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_Platform.win.dia.ref @@ -0,0 +1,62 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// +ilib_verbose(0); //to remove ilib_* traces +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/Platform.zcos")); +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +for i=1:2 // 'max step size' = 10^-i, precision + // Start by updating the clock block period (sampling) + Context.per = 5*10^-i; + // Modify solver + run DDaskr + save results + scs_m.props.tol(6) = 102; // Solver + scicos_simulate(scs_m, Context); // DDaskr + ddaskrval = res.values; // Results + // Modify solver + run IDA + save results + scs_m.props.tol(6) = 100; // Solver + scicos_simulate(scs_m, Context); // IDA + idaval = res.values; // Results + // Compare results + compa = abs(ddaskrval-idaval); + // Extract mean, standard deviation, maximum + mea = mean(compa); + [maxi, indexMaxi] = max(compa); + stdeviation = stdev(compa); + // Verifying closeness of the results + assert_checktrue(maxi <= 5*10^-(i+2)); + assert_checktrue(mea <= 5*10^-(i+2)); + assert_checktrue(stdeviation <= 5*10^-(i+2)); +end +--------------------------------------------\ + Main Modelica : TMPDIR\Platform_im.mo + + Flat Modelica : TMPDIR\Platform_imf.mo + Simulation C code :TMPDIR\Platform_im.c +--------------------------------------------\ + Main Modelica : TMPDIR\Platform_im.mo + + Flat Modelica : TMPDIR\Platform_imf.mo + Simulation C code :TMPDIR\Platform_im.c +--------------------------------------------\ + Main Modelica : TMPDIR\Platform_im.mo + + Flat Modelica : TMPDIR\Platform_imf.mo + Simulation C code :TMPDIR\Platform_im.c +--------------------------------------------\ + Main Modelica : TMPDIR\Platform_im.mo + + Flat Modelica : TMPDIR\Platform_imf.mo + Simulation C code :TMPDIR\Platform_im.c +funcprot(prot); diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_RLC.tst b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_RLC.tst new file mode 100755 index 000000000..b02586503 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_RLC.tst @@ -0,0 +1,52 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> + +ilib_verbose(0); //to remove ilib_* traces + +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/RLC.zcos")); + +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +funcprot(prot); + +for i=2:3 + + // Start by updating the clock block period (sampling) + scs_m.props.context = "per = 5*10^-"+string(i); + + // Modify solver + run DDaskr + save results + scs_m.props.tol(6) = 102; // Solver + scicos_simulate(scs_m); // DDaskr + ddaskrval = res.values; // Results + + // Modify solver + run IDA + save results + scs_m.props.tol(6) = 100; // Solver + scicos_simulate(scs_m); // IDA + idaval = res.values; // Results + + // Compare results + compa = abs(ddaskrval-idaval); + + // Extract mean, standard deviation, maximum + mea = mean(compa); + [maxi, indexMaxi] = max(compa); + stdeviation = stdev(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 diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_RLC.unix.dia.ref b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_RLC.unix.dia.ref new file mode 100755 index 000000000..0dbd54512 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_RLC.unix.dia.ref @@ -0,0 +1,61 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +ilib_verbose(0); //to remove ilib_* traces +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/RLC.zcos")); +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +funcprot(prot); +for i=2:3 + // Start by updating the clock block period (sampling) + scs_m.props.context = "per = 5*10^-"+string(i); + // Modify solver + run DDaskr + save results + scs_m.props.tol(6) = 102; // Solver + scicos_simulate(scs_m); // DDaskr + ddaskrval = res.values; // Results + // Modify solver + run IDA + save results + scs_m.props.tol(6) = 100; // Solver + scicos_simulate(scs_m); // IDA + idaval = res.values; // Results + // Compare results + compa = abs(ddaskrval-idaval); + // Extract mean, standard deviation, maximum + mea = mean(compa); + [maxi, indexMaxi] = max(compa); + stdeviation = stdev(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/RLC_im.mo + + Flat Modelica : TMPDIR/RLC_imf.mo + Simulation C code :TMPDIR/RLC_im.c +--------------------------------------------\ + Main Modelica : TMPDIR/RLC_im.mo + + Flat Modelica : TMPDIR/RLC_imf.mo + Simulation C code :TMPDIR/RLC_im.c +--------------------------------------------\ + Main Modelica : TMPDIR/RLC_im.mo + + Flat Modelica : TMPDIR/RLC_imf.mo + Simulation C code :TMPDIR/RLC_im.c +--------------------------------------------\ + Main Modelica : TMPDIR/RLC_im.mo + + Flat Modelica : TMPDIR/RLC_imf.mo + Simulation C code :TMPDIR/RLC_im.c diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_RLC.win.dia.ref b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_RLC.win.dia.ref new file mode 100755 index 000000000..f5b9861ce --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrK_RLC.win.dia.ref @@ -0,0 +1,61 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +ilib_verbose(0); //to remove ilib_* traces +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/RLC.zcos")); +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +funcprot(prot); +for i=2:3 + // Start by updating the clock block period (sampling) + scs_m.props.context = "per = 5*10^-"+string(i); + // Modify solver + run DDaskr + save results + scs_m.props.tol(6) = 102; // Solver + scicos_simulate(scs_m); // DDaskr + ddaskrval = res.values; // Results + // Modify solver + run IDA + save results + scs_m.props.tol(6) = 100; // Solver + scicos_simulate(scs_m); // IDA + idaval = res.values; // Results + // Compare results + compa = abs(ddaskrval-idaval); + // Extract mean, standard deviation, maximum + mea = mean(compa); + [maxi, indexMaxi] = max(compa); + stdeviation = stdev(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\RLC_im.mo + + Flat Modelica : TMPDIR\RLC_imf.mo + Simulation C code :TMPDIR\RLC_im.c +--------------------------------------------\ + Main Modelica : TMPDIR\RLC_im.mo + + Flat Modelica : TMPDIR\RLC_imf.mo + Simulation C code :TMPDIR\RLC_im.c +--------------------------------------------\ + Main Modelica : TMPDIR\RLC_im.mo + + Flat Modelica : TMPDIR\RLC_imf.mo + Simulation C code :TMPDIR\RLC_im.c +--------------------------------------------\ + Main Modelica : TMPDIR\RLC_im.mo + + Flat Modelica : TMPDIR\RLC_imf.mo + Simulation C code :TMPDIR\RLC_im.c diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_Bouncing.tst b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_Bouncing.tst new file mode 100755 index 000000000..575d6fa5a --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_Bouncing.tst @@ -0,0 +1,47 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// + +ilib_verbose(0); //to remove ilib_* traces + +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/Bouncing.zcos")); + +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +funcprot(prot); +Info = scicos_simulate(scs_m, list()); + +// Modify solver + run DDaskr + save results +scs_m.props.tol(6) = 101; // Solver +scicos_simulate(scs_m, Info); // DDaskr +ddaskrval = res.values; // Results + +// 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 = stdev(compa); + +// Verifying closeness of the results +assert_checktrue(maxi <= 2d-12); +assert_checktrue(mea <= 1d-12); +assert_checktrue(stdeviation <= 1d-12); diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_Bouncing.unix.dia.ref b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_Bouncing.unix.dia.ref new file mode 100755 index 000000000..bbe47ef58 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_Bouncing.unix.dia.ref @@ -0,0 +1,48 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// +ilib_verbose(0); //to remove ilib_* traces +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/Bouncing.zcos")); +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +funcprot(prot); +Info = scicos_simulate(scs_m, list()); +--------------------------------------------\ + Main Modelica : TMPDIR/Bouncing_im.mo + + Flat Modelica : TMPDIR/Bouncing_imf.mo + Simulation C code :TMPDIR/Bouncing_im.c +// Modify solver + run DDaskr + save results +scs_m.props.tol(6) = 101; // Solver +scicos_simulate(scs_m, Info); // DDaskr +Warning : redefining function: dst . Use funcprot(0) to avoid this message + +ddaskrval = res.values; // Results +// Modify solver + run IDA + save results +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 +// Compare results +compa = abs(ddaskrval-idaval); +// Extract mean, standard deviation, maximum +mea = mean(compa); +[maxi, indexMaxi] = max(compa); +stdeviation = stdev(compa); +// Verifying closeness of the results +assert_checktrue(maxi <= 2d-12); +assert_checktrue(mea <= 1d-12); +assert_checktrue(stdeviation <= 1d-12); diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_Bouncing.win.dia.ref b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_Bouncing.win.dia.ref new file mode 100755 index 000000000..869bcfb89 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_Bouncing.win.dia.ref @@ -0,0 +1,48 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// +ilib_verbose(0); //to remove ilib_* traces +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/Bouncing.zcos")); +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +funcprot(prot); +Info = scicos_simulate(scs_m, list()); +--------------------------------------------\ + Main Modelica : TMPDIR\Bouncing_im.mo + + Flat Modelica : TMPDIR\Bouncing_imf.mo + Simulation C code :TMPDIR\Bouncing_im.c +// Modify solver + run DDaskr + save results +scs_m.props.tol(6) = 101; // Solver +scicos_simulate(scs_m, Info); // DDaskr +Warning : redefining function: dst . Use funcprot(0) to avoid this message + +ddaskrval = res.values; // Results +// Modify solver + run IDA + save results +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 +// Compare results +compa = abs(ddaskrval-idaval); +// Extract mean, standard deviation, maximum +mea = mean(compa); +[maxi, indexMaxi] = max(compa); +stdeviation = stdev(compa); +// Verifying closeness of the results +assert_checktrue(maxi <= 2d-12); +assert_checktrue(mea <= 1d-12); +assert_checktrue(stdeviation <= 1d-12); diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_Hydraulics.tst b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_Hydraulics.tst new file mode 100755 index 000000000..8edf01d8d --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_Hydraulics.tst @@ -0,0 +1,46 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// + +ilib_verbose(0); //to remove ilib_* traces + +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/Hydraulics.zcos")); + +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +funcprot(prot); + +// Modify solver + run DDaskr + save results +scs_m.props.tol(6) = 101; // Solver +scicos_simulate(scs_m); // DDaskr +ddaskrval = res.values; // Results + +// Modify solver + run IDA + save results +scs_m.props.tol(6) = 100; // Solver +scicos_simulate(scs_m); // IDA +idaval = res.values; // Results + +// Compare results +compa = abs(ddaskrval-idaval); + +// Extract mean, standard deviation, maximum +mea = mean(compa); +[maxi, indexMaxi] = max(compa); +stdeviation = stdev(compa); + +// Verifying closeness of the results +assert_checktrue(maxi <= 2d-7); +assert_checktrue(mea <= 2d-7); +assert_checktrue(stdeviation <= 2d-7); diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_Hydraulics.unix.dia.ref b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_Hydraulics.unix.dia.ref new file mode 100755 index 000000000..d0280bd63 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_Hydraulics.unix.dia.ref @@ -0,0 +1,48 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// +ilib_verbose(0); //to remove ilib_* traces +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/Hydraulics.zcos")); +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +funcprot(prot); +// Modify solver + run DDaskr + save results +scs_m.props.tol(6) = 101; // Solver +scicos_simulate(scs_m); // DDaskr +--------------------------------------------\ + Main Modelica : TMPDIR/Hydraulics_im.mo + + Flat Modelica : TMPDIR/Hydraulics_imf.mo + Simulation C code :TMPDIR/Hydraulics_im.c +ddaskrval = res.values; // Results +// Modify solver + run IDA + save results +scs_m.props.tol(6) = 100; // Solver +scicos_simulate(scs_m); // IDA +--------------------------------------------\ + Main Modelica : TMPDIR/Hydraulics_im.mo + + Flat Modelica : TMPDIR/Hydraulics_imf.mo + Simulation C code :TMPDIR/Hydraulics_im.c +idaval = res.values; // Results +// Compare results +compa = abs(ddaskrval-idaval); +// Extract mean, standard deviation, maximum +mea = mean(compa); +[maxi, indexMaxi] = max(compa); +stdeviation = stdev(compa); +// Verifying closeness of the results +assert_checktrue(maxi <= 2d-7); +assert_checktrue(mea <= 2d-7); +assert_checktrue(stdeviation <= 2d-7); diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_Hydraulics.win.dia.ref b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_Hydraulics.win.dia.ref new file mode 100755 index 000000000..5dbcfead7 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_Hydraulics.win.dia.ref @@ -0,0 +1,48 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// +ilib_verbose(0); //to remove ilib_* traces +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/Hydraulics.zcos")); +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +funcprot(prot); +// Modify solver + run DDaskr + save results +scs_m.props.tol(6) = 101; // Solver +scicos_simulate(scs_m); // DDaskr +--------------------------------------------\ + Main Modelica : TMPDIR\Hydraulics_im.mo + + Flat Modelica : TMPDIR\Hydraulics_imf.mo + Simulation C code :TMPDIR\Hydraulics_im.c +ddaskrval = res.values; // Results +// Modify solver + run IDA + save results +scs_m.props.tol(6) = 100; // Solver +scicos_simulate(scs_m); // IDA +--------------------------------------------\ + Main Modelica : TMPDIR\Hydraulics_im.mo + + Flat Modelica : TMPDIR\Hydraulics_imf.mo + Simulation C code :TMPDIR\Hydraulics_im.c +idaval = res.values; // Results +// Compare results +compa = abs(ddaskrval-idaval); +// Extract mean, standard deviation, maximum +mea = mean(compa); +[maxi, indexMaxi] = max(compa); +stdeviation = stdev(compa); +// Verifying closeness of the results +assert_checktrue(maxi <= 2d-7); +assert_checktrue(mea <= 2d-7); +assert_checktrue(stdeviation <= 2d-7); diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_Platform.tst b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_Platform.tst new file mode 100755 index 000000000..ef82e64ac --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_Platform.tst @@ -0,0 +1,53 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// + +ilib_verbose(0); //to remove ilib_* traces + +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/Platform.zcos")); + +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction + +for i=1:3 // 'max step size' = 10^-i, precision + + // Start by updating the clock block period (sampling) + Context.per = 5*10^-i; + + // Modify solver + run DDaskr + save results + scs_m.props.tol(6) = 101; // Solver + scicos_simulate(scs_m, Context); // DDaskr + ddaskrval = res.values; // Results + + // Modify solver + run IDA + save results + scs_m.props.tol(6) = 100; // Solver + scicos_simulate(scs_m, Context); // IDA + idaval = res.values; // Results + + // Compare results + compa = abs(ddaskrval-idaval); + + // Extract mean, standard deviation, maximum + mea = mean(compa); + [maxi, indexMaxi] = max(compa); + stdeviation = stdev(compa); + + // Verifying closeness of the results + assert_checktrue(maxi <= 5*10^-(i+3)); + assert_checktrue(mea <= 5*10^-(i+3)); + assert_checktrue(stdeviation <= 5*10^-(i+3)); + +end +funcprot(prot); diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_Platform.unix.dia.ref b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_Platform.unix.dia.ref new file mode 100755 index 000000000..0ac675ba9 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_Platform.unix.dia.ref @@ -0,0 +1,72 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// +ilib_verbose(0); //to remove ilib_* traces +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/Platform.zcos")); +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +for i=1:3 // 'max step size' = 10^-i, precision + // Start by updating the clock block period (sampling) + Context.per = 5*10^-i; + // Modify solver + run DDaskr + save results + scs_m.props.tol(6) = 101; // Solver + scicos_simulate(scs_m, Context); // DDaskr + ddaskrval = res.values; // Results + // Modify solver + run IDA + save results + scs_m.props.tol(6) = 100; // Solver + scicos_simulate(scs_m, Context); // IDA + idaval = res.values; // Results + // Compare results + compa = abs(ddaskrval-idaval); + // Extract mean, standard deviation, maximum + mea = mean(compa); + [maxi, indexMaxi] = max(compa); + stdeviation = stdev(compa); + // Verifying closeness of the results + assert_checktrue(maxi <= 5*10^-(i+3)); + assert_checktrue(mea <= 5*10^-(i+3)); + assert_checktrue(stdeviation <= 5*10^-(i+3)); +end +--------------------------------------------\ + Main Modelica : TMPDIR/Platform_im.mo + + Flat Modelica : TMPDIR/Platform_imf.mo + Simulation C code :TMPDIR/Platform_im.c +--------------------------------------------\ + Main Modelica : TMPDIR/Platform_im.mo + + Flat Modelica : TMPDIR/Platform_imf.mo + Simulation C code :TMPDIR/Platform_im.c +--------------------------------------------\ + Main Modelica : TMPDIR/Platform_im.mo + + Flat Modelica : TMPDIR/Platform_imf.mo + Simulation C code :TMPDIR/Platform_im.c +--------------------------------------------\ + Main Modelica : TMPDIR/Platform_im.mo + + Flat Modelica : TMPDIR/Platform_imf.mo + Simulation C code :TMPDIR/Platform_im.c +--------------------------------------------\ + Main Modelica : TMPDIR/Platform_im.mo + + Flat Modelica : TMPDIR/Platform_imf.mo + Simulation C code :TMPDIR/Platform_im.c +--------------------------------------------\ + Main Modelica : TMPDIR/Platform_im.mo + + Flat Modelica : TMPDIR/Platform_imf.mo + Simulation C code :TMPDIR/Platform_im.c +funcprot(prot); diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_Platform.win.dia.ref b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_Platform.win.dia.ref new file mode 100755 index 000000000..704edb847 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_Platform.win.dia.ref @@ -0,0 +1,72 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// +ilib_verbose(0); //to remove ilib_* traces +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/Platform.zcos")); +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +for i=1:3 // 'max step size' = 10^-i, precision + // Start by updating the clock block period (sampling) + Context.per = 5*10^-i; + // Modify solver + run DDaskr + save results + scs_m.props.tol(6) = 101; // Solver + scicos_simulate(scs_m, Context); // DDaskr + ddaskrval = res.values; // Results + // Modify solver + run IDA + save results + scs_m.props.tol(6) = 100; // Solver + scicos_simulate(scs_m, Context); // IDA + idaval = res.values; // Results + // Compare results + compa = abs(ddaskrval-idaval); + // Extract mean, standard deviation, maximum + mea = mean(compa); + [maxi, indexMaxi] = max(compa); + stdeviation = stdev(compa); + // Verifying closeness of the results + assert_checktrue(maxi <= 5*10^-(i+3)); + assert_checktrue(mea <= 5*10^-(i+3)); + assert_checktrue(stdeviation <= 5*10^-(i+3)); +end +--------------------------------------------\ + Main Modelica : TMPDIR\Platform_im.mo + + Flat Modelica : TMPDIR\Platform_imf.mo + Simulation C code :TMPDIR\Platform_im.c +--------------------------------------------\ + Main Modelica : TMPDIR\Platform_im.mo + + Flat Modelica : TMPDIR\Platform_imf.mo + Simulation C code :TMPDIR\Platform_im.c +--------------------------------------------\ + Main Modelica : TMPDIR\Platform_im.mo + + Flat Modelica : TMPDIR\Platform_imf.mo + Simulation C code :TMPDIR\Platform_im.c +--------------------------------------------\ + Main Modelica : TMPDIR\Platform_im.mo + + Flat Modelica : TMPDIR\Platform_imf.mo + Simulation C code :TMPDIR\Platform_im.c +--------------------------------------------\ + Main Modelica : TMPDIR\Platform_im.mo + + Flat Modelica : TMPDIR\Platform_imf.mo + Simulation C code :TMPDIR\Platform_im.c +--------------------------------------------\ + Main Modelica : TMPDIR\Platform_im.mo + + Flat Modelica : TMPDIR\Platform_imf.mo + Simulation C code :TMPDIR\Platform_im.c +funcprot(prot); diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_RLC.tst b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_RLC.tst new file mode 100755 index 000000000..33b44db76 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_RLC.tst @@ -0,0 +1,52 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> + +ilib_verbose(0); //to remove ilib_* traces + +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/RLC.zcos")); + +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +funcprot(prot); + +for i=2:3 + + // Start by updating the clock block period (sampling) + scs_m.props.context = "per = 5*10^-"+string(i); + + // Modify solver + run DDaskr + save results + scs_m.props.tol(6) = 101; // Solver + scicos_simulate(scs_m); // DDaskr + ddaskrval = res.values; // Results + + // Modify solver + run IDA + save results + scs_m.props.tol(6) = 100; // Solver + scicos_simulate(scs_m); // IDA + idaval = res.values; // Results + + // Compare results + compa = abs(ddaskrval-idaval); + + // Extract mean, standard deviation, maximum + mea = mean(compa); + [maxi, indexMaxi] = max(compa); + stdeviation = stdev(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 diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_RLC.unix.dia.ref b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_RLC.unix.dia.ref new file mode 100755 index 000000000..f53a19935 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_RLC.unix.dia.ref @@ -0,0 +1,61 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +ilib_verbose(0); //to remove ilib_* traces +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/RLC.zcos")); +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +funcprot(prot); +for i=2:3 + // Start by updating the clock block period (sampling) + scs_m.props.context = "per = 5*10^-"+string(i); + // Modify solver + run DDaskr + save results + scs_m.props.tol(6) = 101; // Solver + scicos_simulate(scs_m); // DDaskr + ddaskrval = res.values; // Results + // Modify solver + run IDA + save results + scs_m.props.tol(6) = 100; // Solver + scicos_simulate(scs_m); // IDA + idaval = res.values; // Results + // Compare results + compa = abs(ddaskrval-idaval); + // Extract mean, standard deviation, maximum + mea = mean(compa); + [maxi, indexMaxi] = max(compa); + stdeviation = stdev(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/RLC_im.mo + + Flat Modelica : TMPDIR/RLC_imf.mo + Simulation C code :TMPDIR/RLC_im.c +--------------------------------------------\ + Main Modelica : TMPDIR/RLC_im.mo + + Flat Modelica : TMPDIR/RLC_imf.mo + Simulation C code :TMPDIR/RLC_im.c +--------------------------------------------\ + Main Modelica : TMPDIR/RLC_im.mo + + Flat Modelica : TMPDIR/RLC_imf.mo + Simulation C code :TMPDIR/RLC_im.c +--------------------------------------------\ + Main Modelica : TMPDIR/RLC_im.mo + + Flat Modelica : TMPDIR/RLC_imf.mo + Simulation C code :TMPDIR/RLC_im.c diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_RLC.win.dia.ref b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_RLC.win.dia.ref new file mode 100755 index 000000000..e9b9fe707 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/DDaskrN_RLC.win.dia.ref @@ -0,0 +1,61 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +ilib_verbose(0); //to remove ilib_* traces +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/RLC.zcos")); +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +funcprot(prot); +for i=2:3 + // Start by updating the clock block period (sampling) + scs_m.props.context = "per = 5*10^-"+string(i); + // Modify solver + run DDaskr + save results + scs_m.props.tol(6) = 101; // Solver + scicos_simulate(scs_m); // DDaskr + ddaskrval = res.values; // Results + // Modify solver + run IDA + save results + scs_m.props.tol(6) = 100; // Solver + scicos_simulate(scs_m); // IDA + idaval = res.values; // Results + // Compare results + compa = abs(ddaskrval-idaval); + // Extract mean, standard deviation, maximum + mea = mean(compa); + [maxi, indexMaxi] = max(compa); + stdeviation = stdev(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\RLC_im.mo + + Flat Modelica : TMPDIR\RLC_imf.mo + Simulation C code :TMPDIR\RLC_im.c +--------------------------------------------\ + Main Modelica : TMPDIR\RLC_im.mo + + Flat Modelica : TMPDIR\RLC_imf.mo + Simulation C code :TMPDIR\RLC_im.c +--------------------------------------------\ + Main Modelica : TMPDIR\RLC_im.mo + + Flat Modelica : TMPDIR\RLC_imf.mo + Simulation C code :TMPDIR\RLC_im.c +--------------------------------------------\ + Main Modelica : TMPDIR\RLC_im.mo + + Flat Modelica : TMPDIR\RLC_imf.mo + Simulation C code :TMPDIR\RLC_im.c diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_Bouncing.tst b/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_Bouncing.tst new file mode 100755 index 000000000..d34d98533 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_Bouncing.tst @@ -0,0 +1,58 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// + +ilib_verbose(0); //to remove ilib_* traces + +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/Bouncing.zcos")); + +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +funcprot(prot); + +IDA_val_ref = [ 10. + 11.3875 + 12.55 + 13.4875 + 14.2 + 14.6875 + 14.95 + 14.9875 + 14.8 + 14.3875 + 13.75 + 12.8875 + 11.8 + 10.4875 + 8.95 + 7.1875 + 5.2 + 2.9875 + 0.55 + 1.5647919 + 3.3538291 + 4.9178663 + 6.2569034 + 7.3709406 + 8.2599778 + 8.924015 ]; +IDA_time_ref = (0:.5:49.5)'; + +scs_m.props.tol(6) = 100; // Solver +scs_m.props.context = "per = 0.5"; // Period, to get more varied results +scicos_simulate(scs_m); // IDA + +assert_checkalmostequal(res.values(1:26), IDA_val_ref, [], 1d-7); +assert_checkalmostequal(res.time, IDA_time_ref); diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_Bouncing.unix.dia.ref b/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_Bouncing.unix.dia.ref new file mode 100755 index 000000000..1e44ae8ef --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_Bouncing.unix.dia.ref @@ -0,0 +1,57 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// +ilib_verbose(0); //to remove ilib_* traces +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/Bouncing.zcos")); +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +funcprot(prot); +IDA_val_ref = [ 10. + 11.3875 + 12.55 + 13.4875 + 14.2 + 14.6875 + 14.95 + 14.9875 + 14.8 + 14.3875 + 13.75 + 12.8875 + 11.8 + 10.4875 + 8.95 + 7.1875 + 5.2 + 2.9875 + 0.55 + 1.5647919 + 3.3538291 + 4.9178663 + 6.2569034 + 7.3709406 + 8.2599778 + 8.924015 ]; +IDA_time_ref = (0:.5:49.5)'; +scs_m.props.tol(6) = 100; // Solver +scs_m.props.context = "per = 0.5"; // Period, to get more varied results +scicos_simulate(scs_m); // IDA +--------------------------------------------\ + Main Modelica : TMPDIR/Bouncing_im.mo + + Flat Modelica : TMPDIR/Bouncing_imf.mo + Simulation C code :TMPDIR/Bouncing_im.c +assert_checkalmostequal(res.values(1:26), IDA_val_ref, [], 1d-7); +assert_checkalmostequal(res.time, IDA_time_ref); diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_Bouncing.win.dia.ref b/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_Bouncing.win.dia.ref new file mode 100755 index 000000000..fa6fa7c99 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_Bouncing.win.dia.ref @@ -0,0 +1,57 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// +ilib_verbose(0); //to remove ilib_* traces +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/Bouncing.zcos")); +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +funcprot(prot); +IDA_val_ref = [ 10. + 11.3875 + 12.55 + 13.4875 + 14.2 + 14.6875 + 14.95 + 14.9875 + 14.8 + 14.3875 + 13.75 + 12.8875 + 11.8 + 10.4875 + 8.95 + 7.1875 + 5.2 + 2.9875 + 0.55 + 1.5647919 + 3.3538291 + 4.9178663 + 6.2569034 + 7.3709406 + 8.2599778 + 8.924015 ]; +IDA_time_ref = (0:.5:49.5)'; +scs_m.props.tol(6) = 100; // Solver +scs_m.props.context = "per = 0.5"; // Period, to get more varied results +scicos_simulate(scs_m); // IDA +--------------------------------------------\ + Main Modelica : TMPDIR\Bouncing_im.mo + + Flat Modelica : TMPDIR\Bouncing_imf.mo + Simulation C code :TMPDIR\Bouncing_im.c +assert_checkalmostequal(res.values(1:26), IDA_val_ref, [], 1d-7); +assert_checkalmostequal(res.time, IDA_time_ref); diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_Hydraulics.tst b/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_Hydraulics.tst new file mode 100755 index 000000000..4b7ae90b3 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_Hydraulics.tst @@ -0,0 +1,100 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// + +ilib_verbose(0); //to remove ilib_* traces + +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/Hydraulics.zcos")); + +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +funcprot(prot); + +IDA_val_ref = [ 0.2014730 + 0.2014678 + 0.2014630 + 0.2014586 + 0.2014545 + 0.2014507 + 0.2014472 + 0.2014440 + 0.201441 + 0.2014383 + 0.2014358 + 0.2014336 + 0.2014315 + 0.2014297 + 0.201428 + 0.2014265 + 0.2014252 + 0.2014240 + 0.2014229 + 0.2014220 + 0.2014211 + 0.2014204 + 0.2014198 + 0.2014192 + 0.2014188 + 0.2014184 + 0.2014181 + 0.2014178 + 0.2014176 + 0.2014174 + 0.2014173 + 0.2014172 + 0.2014172 + 0.2014172 + 0.2014172 + 0.2014172 + 0.2014173 + 0.2014174 + 0.2014174 + 0.2014175 + 0.2014176 + 0.2014178 + 0.2014179 + 0.201418 + 0.2014181 + 0.2014183 + 0.2014184 + 0.2014185 + 0.2014186 + 0.2014188 + 0.2014189 + 0.2014190 + 0.2014191 + 0.2014193 + 0.2014194 + 0.2014195 + 0.2014196 + 0.2014197 + 0.2014198 + 0.2014199 + 0.2014200 + 0.2014200 + 0.2014201 + 0.2014202 + 0.2014203 + 0.2014203 + 0.2014204 + 0.2014204 ]; +IDA_time_ref = (25.05:.05:50)'; + +scs_m.props.tol(6) = 100; // Solver +scs_m.props.context = "per = 0.05"; // Period, to get more varied results +scicos_simulate(scs_m); // IDA + +assert_checkalmostequal(res.values($-67:$, :), IDA_val_ref, [], 1d-7); +assert_checkalmostequal(res.time, IDA_time_ref); diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_Hydraulics.unix.dia.ref b/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_Hydraulics.unix.dia.ref new file mode 100755 index 000000000..36870ca85 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_Hydraulics.unix.dia.ref @@ -0,0 +1,99 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// +ilib_verbose(0); //to remove ilib_* traces +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/Hydraulics.zcos")); +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +funcprot(prot); +IDA_val_ref = [ 0.2014730 + 0.2014678 + 0.2014630 + 0.2014586 + 0.2014545 + 0.2014507 + 0.2014472 + 0.2014440 + 0.201441 + 0.2014383 + 0.2014358 + 0.2014336 + 0.2014315 + 0.2014297 + 0.201428 + 0.2014265 + 0.2014252 + 0.2014240 + 0.2014229 + 0.2014220 + 0.2014211 + 0.2014204 + 0.2014198 + 0.2014192 + 0.2014188 + 0.2014184 + 0.2014181 + 0.2014178 + 0.2014176 + 0.2014174 + 0.2014173 + 0.2014172 + 0.2014172 + 0.2014172 + 0.2014172 + 0.2014172 + 0.2014173 + 0.2014174 + 0.2014174 + 0.2014175 + 0.2014176 + 0.2014178 + 0.2014179 + 0.201418 + 0.2014181 + 0.2014183 + 0.2014184 + 0.2014185 + 0.2014186 + 0.2014188 + 0.2014189 + 0.2014190 + 0.2014191 + 0.2014193 + 0.2014194 + 0.2014195 + 0.2014196 + 0.2014197 + 0.2014198 + 0.2014199 + 0.2014200 + 0.2014200 + 0.2014201 + 0.2014202 + 0.2014203 + 0.2014203 + 0.2014204 + 0.2014204 ]; +IDA_time_ref = (25.05:.05:50)'; +scs_m.props.tol(6) = 100; // Solver +scs_m.props.context = "per = 0.05"; // Period, to get more varied results +scicos_simulate(scs_m); // IDA +--------------------------------------------\ + Main Modelica : TMPDIR/Hydraulics_im.mo + + Flat Modelica : TMPDIR/Hydraulics_imf.mo + Simulation C code :TMPDIR/Hydraulics_im.c +assert_checkalmostequal(res.values($-67:$, :), IDA_val_ref, [], 1d-7); +assert_checkalmostequal(res.time, IDA_time_ref); diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_Hydraulics.win.dia.ref b/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_Hydraulics.win.dia.ref new file mode 100755 index 000000000..b045b47fb --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_Hydraulics.win.dia.ref @@ -0,0 +1,99 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// +ilib_verbose(0); //to remove ilib_* traces +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/Hydraulics.zcos")); +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +funcprot(prot); +IDA_val_ref = [ 0.2014730 + 0.2014678 + 0.2014630 + 0.2014586 + 0.2014545 + 0.2014507 + 0.2014472 + 0.2014440 + 0.201441 + 0.2014383 + 0.2014358 + 0.2014336 + 0.2014315 + 0.2014297 + 0.201428 + 0.2014265 + 0.2014252 + 0.2014240 + 0.2014229 + 0.2014220 + 0.2014211 + 0.2014204 + 0.2014198 + 0.2014192 + 0.2014188 + 0.2014184 + 0.2014181 + 0.2014178 + 0.2014176 + 0.2014174 + 0.2014173 + 0.2014172 + 0.2014172 + 0.2014172 + 0.2014172 + 0.2014172 + 0.2014173 + 0.2014174 + 0.2014174 + 0.2014175 + 0.2014176 + 0.2014178 + 0.2014179 + 0.201418 + 0.2014181 + 0.2014183 + 0.2014184 + 0.2014185 + 0.2014186 + 0.2014188 + 0.2014189 + 0.2014190 + 0.2014191 + 0.2014193 + 0.2014194 + 0.2014195 + 0.2014196 + 0.2014197 + 0.2014198 + 0.2014199 + 0.2014200 + 0.2014200 + 0.2014201 + 0.2014202 + 0.2014203 + 0.2014203 + 0.2014204 + 0.2014204 ]; +IDA_time_ref = (25.05:.05:50)'; +scs_m.props.tol(6) = 100; // Solver +scs_m.props.context = "per = 0.05"; // Period, to get more varied results +scicos_simulate(scs_m); // IDA +--------------------------------------------\ + Main Modelica : TMPDIR\Hydraulics_im.mo + + Flat Modelica : TMPDIR\Hydraulics_imf.mo + Simulation C code :TMPDIR\Hydraulics_im.c +assert_checkalmostequal(res.values($-67:$, :), IDA_val_ref, [], 1d-7); +assert_checkalmostequal(res.time, IDA_time_ref); diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_Platform.tst b/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_Platform.tst new file mode 100755 index 000000000..1b0a230e0 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_Platform.tst @@ -0,0 +1,72 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// + +ilib_verbose(0); //to remove ilib_* traces + +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/Platform.zcos")); + +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +funcprot(prot); + +IDA_val_ref = [ 11. +11. +11. +7.1057377 +4.2276434 +3.7837192 +2.9538128 +5.8771057 +6.3928885 +7.7794415 +8.7234525 +8.1656745 +5.4692996 +4.119467 +3.98566 +4.5880334 +6.2619705 +7.460788 +8.0411235 +7.0316339 +5.9103864 +5.0870516 +4.8350387 +5.2736793 +6.0991627 +6.8411039 +7.22751 +6.791484 +6.0262625 +5.4580017 +5.3754978 +5.5876889 +6.078075 +6.5118764 +6.6403792 +6.4498018 +6.0902532 +5.7053277 +5.6308887 +5.8353956 ]; +IDA_time_ref = (0:.5:19.5)'; + +scs_m.props.tol(6) = 100; // Solver +scs_m.props.context = "per = 0.5"; // Period, to get more varied results +scicos_simulate(scs_m); // IDA + +assert_checkalmostequal(res.values, IDA_val_ref, [], 1d-6); +assert_checkalmostequal(res.time, IDA_time_ref); diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_Platform.unix.dia.ref b/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_Platform.unix.dia.ref new file mode 100755 index 000000000..c3ef03ec4 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_Platform.unix.dia.ref @@ -0,0 +1,71 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// +ilib_verbose(0); //to remove ilib_* traces +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/Platform.zcos")); +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +funcprot(prot); +IDA_val_ref = [ 11. + 11. + 11. + 7.1057377 + 4.2276434 + 3.7837192 + 2.9538128 + 5.8771057 + 6.3928885 + 7.7794415 + 8.7234525 + 8.1656745 + 5.4692996 + 4.119467 + 3.98566 + 4.5880334 + 6.2619705 + 7.460788 + 8.0411235 + 7.0316339 + 5.9103864 + 5.0870516 + 4.8350387 + 5.2736793 + 6.0991627 + 6.8411039 + 7.22751 + 6.791484 + 6.0262625 + 5.4580017 + 5.3754978 + 5.5876889 + 6.078075 + 6.5118764 + 6.6403792 + 6.4498018 + 6.0902532 + 5.7053277 + 5.6308887 + 5.8353956 ]; +IDA_time_ref = (0:.5:19.5)'; +scs_m.props.tol(6) = 100; // Solver +scs_m.props.context = "per = 0.5"; // Period, to get more varied results +scicos_simulate(scs_m); // IDA +--------------------------------------------\ + Main Modelica : TMPDIR/Platform_im.mo + + Flat Modelica : TMPDIR/Platform_imf.mo + Simulation C code :TMPDIR/Platform_im.c +assert_checkalmostequal(res.values, IDA_val_ref, [], 1d-6); +assert_checkalmostequal(res.time, IDA_time_ref); diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_Platform.win.dia.ref b/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_Platform.win.dia.ref new file mode 100755 index 000000000..77dbf176f --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_Platform.win.dia.ref @@ -0,0 +1,71 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// +ilib_verbose(0); //to remove ilib_* traces +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/Platform.zcos")); +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +funcprot(prot); +IDA_val_ref = [ 11. + 11. + 11. + 7.1057377 + 4.2276434 + 3.7837192 + 2.9538128 + 5.8771057 + 6.3928885 + 7.7794415 + 8.7234525 + 8.1656745 + 5.4692996 + 4.119467 + 3.98566 + 4.5880334 + 6.2619705 + 7.460788 + 8.0411235 + 7.0316339 + 5.9103864 + 5.0870516 + 4.8350387 + 5.2736793 + 6.0991627 + 6.8411039 + 7.22751 + 6.791484 + 6.0262625 + 5.4580017 + 5.3754978 + 5.5876889 + 6.078075 + 6.5118764 + 6.6403792 + 6.4498018 + 6.0902532 + 5.7053277 + 5.6308887 + 5.8353956 ]; +IDA_time_ref = (0:.5:19.5)'; +scs_m.props.tol(6) = 100; // Solver +scs_m.props.context = "per = 0.5"; // Period, to get more varied results +scicos_simulate(scs_m); // IDA +--------------------------------------------\ + Main Modelica : TMPDIR\Platform_im.mo + + Flat Modelica : TMPDIR\Platform_imf.mo + Simulation C code :TMPDIR\Platform_im.c +assert_checkalmostequal(res.values, IDA_val_ref, [], 1d-6); +assert_checkalmostequal(res.time, IDA_time_ref); diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_RLC.tst b/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_RLC.tst new file mode 100755 index 000000000..25a59b7bb --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_RLC.tst @@ -0,0 +1,63 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// + +ilib_verbose(0); //to remove ilib_* traces + +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/RLC.zcos")); + +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +funcprot(prot); + +IDA_val_ref = [ +-0.0019611 +-0.0015823 +-0.0011972 +-0.0008074 +-0.0004144 +-0.0000198 +0.0003750 +0.0007682 +0.0011584 +0.0015440 +0.0019236 +0.0022955 +0.0026584 +0.0030108 +0.0033513 +0.0036786 +0.0039914 +0.0042884 +0.0045685 +0.0048305 +0.0050736 +0.0052965 +0.0054986 +0.0056790 +0.0058369 +0.0059719 +0.0060832 +0.0061706 +0.0062336 +0.0062720 ]; +IDA_time_ref = (1.7:.01:1.99)'; + +scs_m.props.tol(6) = 101; // Solver +scs_m.props.context = "L = .0001; per = 0.01;"; // Period, to get more varied results +scicos_simulate(scs_m); // IDA + +assert_checkalmostequal(res.values, IDA_val_ref, [], 1d-7); +assert_checkalmostequal(res.time, IDA_time_ref); diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_RLC.unix.dia.ref b/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_RLC.unix.dia.ref new file mode 100755 index 000000000..1a821452e --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_RLC.unix.dia.ref @@ -0,0 +1,62 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// +ilib_verbose(0); //to remove ilib_* traces +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/RLC.zcos")); +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +funcprot(prot); +IDA_val_ref = [ + -0.0019611 + -0.0015823 + -0.0011972 + -0.0008074 + -0.0004144 + -0.0000198 + 0.0003750 + 0.0007682 + 0.0011584 + 0.0015440 + 0.0019236 + 0.0022955 + 0.0026584 + 0.0030108 + 0.0033513 + 0.0036786 + 0.0039914 + 0.0042884 + 0.0045685 + 0.0048305 + 0.0050736 + 0.0052965 + 0.0054986 + 0.0056790 + 0.0058369 + 0.0059719 + 0.0060832 + 0.0061706 + 0.0062336 + 0.0062720 ]; +IDA_time_ref = (1.7:.01:1.99)'; +scs_m.props.tol(6) = 101; // Solver +scs_m.props.context = "L = .0001; per = 0.01;"; // Period, to get more varied results +scicos_simulate(scs_m); // IDA +--------------------------------------------\ + Main Modelica : TMPDIR/RLC_im.mo + + Flat Modelica : TMPDIR/RLC_imf.mo + Simulation C code :TMPDIR/RLC_im.c +assert_checkalmostequal(res.values, IDA_val_ref, [], 1d-7); +assert_checkalmostequal(res.time, IDA_time_ref); diff --git a/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_RLC.win.dia.ref b/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_RLC.win.dia.ref new file mode 100755 index 000000000..8c48e28c6 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/DAE/IDA_RLC.win.dia.ref @@ -0,0 +1,62 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// +ilib_verbose(0); //to remove ilib_* traces +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/DAE/RLC.zcos")); +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function messagebox(msg, msg_title) +endfunction +funcprot(prot); +IDA_val_ref = [ + -0.0019611 + -0.0015823 + -0.0011972 + -0.0008074 + -0.0004144 + -0.0000198 + 0.0003750 + 0.0007682 + 0.0011584 + 0.0015440 + 0.0019236 + 0.0022955 + 0.0026584 + 0.0030108 + 0.0033513 + 0.0036786 + 0.0039914 + 0.0042884 + 0.0045685 + 0.0048305 + 0.0050736 + 0.0052965 + 0.0054986 + 0.0056790 + 0.0058369 + 0.0059719 + 0.0060832 + 0.0061706 + 0.0062336 + 0.0062720 ]; +IDA_time_ref = (1.7:.01:1.99)'; +scs_m.props.tol(6) = 101; // Solver +scs_m.props.context = "L = .0001; per = 0.01;"; // Period, to get more varied results +scicos_simulate(scs_m); // IDA +--------------------------------------------\ + Main Modelica : TMPDIR\RLC_im.mo + + Flat Modelica : TMPDIR\RLC_imf.mo + Simulation C code :TMPDIR\RLC_im.c +assert_checkalmostequal(res.values, IDA_val_ref, [], 1d-7); +assert_checkalmostequal(res.time, IDA_time_ref); diff --git a/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_Cont-Disc.dia.ref b/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_Cont-Disc.dia.ref new file mode 100755 index 000000000..9a1bfb5e5 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_Cont-Disc.dia.ref @@ -0,0 +1,40 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/ODE/Cont-Disc.zcos")); +CVode_val_ref = [ + 0.0526307 0.0281557 -0.0448704 + 0.0532495 0.0310114 -0.0395186 + 0.0515776 0.0292653 -0.0411181 + 0.0541249 0.0359859 -0.0302313 + 0.0557393 0.0408484 -0.0222704 + 0.0553117 0.0416374 -0.0205659 + 0.0532631 0.0391278 -0.0237235 + 0.0527059 0.0395825 -0.0224774 + 0.0484859 0.0326594 -0.0322248 + 0.0478463 0.0328263 -0.0311995 + 0.0480311 0.0346173 -0.0277562 + 0.0482951 0.0365765 -0.0241936 + 0.0499827 0.0413830 -0.0164582 + 0.0482402 0.0393498 -0.0191464 + 0.0449862 0.0341952 -0.0262754 + 0.0456246 0.0367935 -0.0217585 + 0.0442013 0.0352645 -0.0235108 + 0.0418061 0.0317424 -0.0281739 + 0.0423243 0.0340336 -0.0241589 + 0.0416363 0.0338569 -0.0237435 ]; +CVode_time_ref = (17.2:.1:29.9)'; +for i=1:4 + scs_m.props.tol(6) = i; // Solver + try scicos_simulate(scs_m); catch disp(lasterror()); end; // CVode + assert_checkalmostequal(res.values($-19:$, :), CVode_val_ref, 1d-4); + assert_checkalmostequal(res.time, CVode_time_ref); +end diff --git a/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_Cont-Disc.tst b/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_Cont-Disc.tst new file mode 100755 index 000000000..92ac6103b --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_Cont-Disc.tst @@ -0,0 +1,46 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// + +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/ODE/Cont-Disc.zcos")); + +CVode_val_ref = [ + 0.0526307 0.0281557 -0.0448704 + 0.0532495 0.0310114 -0.0395186 + 0.0515776 0.0292653 -0.0411181 + 0.0541249 0.0359859 -0.0302313 + 0.0557393 0.0408484 -0.0222704 + 0.0553117 0.0416374 -0.0205659 + 0.0532631 0.0391278 -0.0237235 + 0.0527059 0.0395825 -0.0224774 + 0.0484859 0.0326594 -0.0322248 + 0.0478463 0.0328263 -0.0311995 + 0.0480311 0.0346173 -0.0277562 + 0.0482951 0.0365765 -0.0241936 + 0.0499827 0.0413830 -0.0164582 + 0.0482402 0.0393498 -0.0191464 + 0.0449862 0.0341952 -0.0262754 + 0.0456246 0.0367935 -0.0217585 + 0.0442013 0.0352645 -0.0235108 + 0.0418061 0.0317424 -0.0281739 + 0.0423243 0.0340336 -0.0241589 + 0.0416363 0.0338569 -0.0237435 ]; +CVode_time_ref = (17.2:.1:29.9)'; + +for i=1:4 + + scs_m.props.tol(6) = i; // Solver + try scicos_simulate(scs_m); catch disp(lasterror()); end; // CVode + + assert_checkalmostequal(res.values($-19:$, :), CVode_val_ref, 1d-4); + assert_checkalmostequal(res.time, CVode_time_ref); + +end diff --git a/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_Controller.dia.ref b/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_Controller.dia.ref new file mode 100755 index 000000000..9bb194885 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_Controller.dia.ref @@ -0,0 +1,40 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/ODE/Controller.zcos")); +CVode_val_ref = [ + -0.3044468 -0.0529063 -0.1556339 + -0.3152667 -0.0434950 -0.1412728 + -0.3178104 -0.0331244 -0.1275205 + -0.3071042 -0.0127201 -0.0885981 + -0.3140531 -0.0293549 -0.1124763 + -0.3227156 -0.0419506 -0.1226843 + -0.3353218 -0.0411101 -0.1285499 + -0.3202700 -0.0083677 -0.0802106 + -0.2992298 0.0202297 -0.0450890 + -0.2463811 0.0683297 0.0322714 + -0.1970797 0.0886041 0.0663326 + -0.1349323 0.1199161 0.1213726 + -0.0965228 0.1049137 0.0971713 + -0.0428198 0.1142629 0.1258705 + 0.0334498 0.1465127 0.1855820 + 0.0940592 0.1375793 0.1859050 + 0.1280733 0.1031344 0.1476760 + 0.1468555 0.0715547 0.1117624 + 0.1678585 0.0609110 0.1017769 + 0.1779129 0.0480921 0.0894899 ]; +CVode_time_ref = (0:.1:29.9)'; +for i=1:4 + scs_m.props.tol(6) = i; // Solver + try scicos_simulate(scs_m); catch disp(lasterror()); end; // CVode + assert_checkalmostequal(res.values($-19:$, :), CVode_val_ref, [], 1d-4); + assert_checkalmostequal(res.time, CVode_time_ref); +end diff --git a/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_Controller.tst b/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_Controller.tst new file mode 100755 index 000000000..052ee5a5e --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_Controller.tst @@ -0,0 +1,46 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// + +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/ODE/Controller.zcos")); + +CVode_val_ref = [ + -0.3044468 -0.0529063 -0.1556339 + -0.3152667 -0.0434950 -0.1412728 + -0.3178104 -0.0331244 -0.1275205 + -0.3071042 -0.0127201 -0.0885981 + -0.3140531 -0.0293549 -0.1124763 + -0.3227156 -0.0419506 -0.1226843 + -0.3353218 -0.0411101 -0.1285499 + -0.3202700 -0.0083677 -0.0802106 + -0.2992298 0.0202297 -0.0450890 + -0.2463811 0.0683297 0.0322714 + -0.1970797 0.0886041 0.0663326 + -0.1349323 0.1199161 0.1213726 + -0.0965228 0.1049137 0.0971713 + -0.0428198 0.1142629 0.1258705 + 0.0334498 0.1465127 0.1855820 + 0.0940592 0.1375793 0.1859050 + 0.1280733 0.1031344 0.1476760 + 0.1468555 0.0715547 0.1117624 + 0.1678585 0.0609110 0.1017769 + 0.1779129 0.0480921 0.0894899 ]; +CVode_time_ref = (0:.1:29.9)'; + +for i=1:4 + + scs_m.props.tol(6) = i; // Solver + try scicos_simulate(scs_m); catch disp(lasterror()); end; // CVode + + assert_checkalmostequal(res.values($-19:$, :), CVode_val_ref, [], 1d-4); + assert_checkalmostequal(res.time, CVode_time_ref); + +end diff --git a/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_IPendulum.dia.ref b/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_IPendulum.dia.ref new file mode 100755 index 000000000..e33b2bd26 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_IPendulum.dia.ref @@ -0,0 +1,40 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2014 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- XCOS TEST --> +// +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/ODE/IPendulum.zcos")); +// Importing a function used by the diagram +exec("SCI/modules/xcos/demos/setw.sci", -1); +CVode_val_ref = [ +-0.0227915 0.0307594 -0.9543050 0.0201381 -1.0730676 -1. +-0.0197164 0.0312202 -0.9533119 -0.0000256 -1.0777036 -1. +-0.0165213 0.0325962 -0.9542269 -0.0177130 -1.0823414 -1. +-0.0132332 0.0329347 -0.9567362 -0.0318341 -1.0868049 -1. +-0.0099822 0.0318753 -0.9604665 -0.0421799 -1.0909528 -1. +-0.0068999 0.0295920 -0.9650512 -0.0489345 -1.0946824 -1. +-0.0040504 0.0269587 -0.9702015 -0.0533494 -1.0979233 -1. +-0.0015593 0.0227394 -0.9756016 -0.0541501 -1.1006336 -1. +0.0004864 0.0181779 -0.9809467 -0.0523918 -1.1028044 -1. +0.0020816 0.0137832 -0.9860190 -0.0488045 -1.1044527 -1. +0.0032551 0.0097721 -0.9906651 -0.0439566 -1.1056138 -1. +0.0045380 0.0135493 -0.9950621 -0.0426360 -1.1063262 -1. +0.0057121 0.0093744 -0.9990293 -0.0362660 -1.1066162 -1. +0.0063728 0.0038864 -1.0022687 -0.0284691 -1.1065444 -1. +0.0065159 -0.0008130 -1.0047241 -0.0207391 -1.1061879 -1. +0.0062518 -0.0042459 -1.0064382 -0.0137017 -1.1056237 -1. +0.0051706 -0.014412 -1.007129 -0.0018149 -1.1049356 -1. +0.0037090 -0.0139594 -1.0070254 0.0031673 -1.1042238 -1. +0.0024626 -0.0108371 -1.0065914 0.0051986 -1.1035413 -1. +0.0015416 -0.0076733 -1.0060276 0.0059356 -1.1029098 -1. ]; +CVode_time_ref = (0:.1:29.9)'; +for i=1:4 + scs_m.props.tol(6) = i; // Solver + try scicos_simulate(scs_m); catch disp(lasterror()); end; // CVode + assert_checkalmostequal(res.values($-19:$, :), CVode_val_ref, [], 1d-4); + assert_checkalmostequal(res.time, CVode_time_ref); +end diff --git a/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_IPendulum.tst b/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_IPendulum.tst new file mode 100755 index 000000000..36d2d41ac --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_IPendulum.tst @@ -0,0 +1,47 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2014 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- XCOS TEST --> +// + +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/ODE/IPendulum.zcos")); + +// Importing a function used by the diagram +exec("SCI/modules/xcos/demos/setw.sci", -1); + +CVode_val_ref = [ +-0.0227915 0.0307594 -0.9543050 0.0201381 -1.0730676 -1. +-0.0197164 0.0312202 -0.9533119 -0.0000256 -1.0777036 -1. +-0.0165213 0.0325962 -0.9542269 -0.0177130 -1.0823414 -1. +-0.0132332 0.0329347 -0.9567362 -0.0318341 -1.0868049 -1. +-0.0099822 0.0318753 -0.9604665 -0.0421799 -1.0909528 -1. +-0.0068999 0.0295920 -0.9650512 -0.0489345 -1.0946824 -1. +-0.0040504 0.0269587 -0.9702015 -0.0533494 -1.0979233 -1. +-0.0015593 0.0227394 -0.9756016 -0.0541501 -1.1006336 -1. +0.0004864 0.0181779 -0.9809467 -0.0523918 -1.1028044 -1. +0.0020816 0.0137832 -0.9860190 -0.0488045 -1.1044527 -1. +0.0032551 0.0097721 -0.9906651 -0.0439566 -1.1056138 -1. +0.0045380 0.0135493 -0.9950621 -0.0426360 -1.1063262 -1. +0.0057121 0.0093744 -0.9990293 -0.0362660 -1.1066162 -1. +0.0063728 0.0038864 -1.0022687 -0.0284691 -1.1065444 -1. +0.0065159 -0.0008130 -1.0047241 -0.0207391 -1.1061879 -1. +0.0062518 -0.0042459 -1.0064382 -0.0137017 -1.1056237 -1. +0.0051706 -0.014412 -1.007129 -0.0018149 -1.1049356 -1. +0.0037090 -0.0139594 -1.0070254 0.0031673 -1.1042238 -1. +0.0024626 -0.0108371 -1.0065914 0.0051986 -1.1035413 -1. +0.0015416 -0.0076733 -1.0060276 0.0059356 -1.1029098 -1. ]; +CVode_time_ref = (0:.1:29.9)'; + +for i=1:4 + + scs_m.props.tol(6) = i; // Solver + try scicos_simulate(scs_m); catch disp(lasterror()); end; // CVode + + assert_checkalmostequal(res.values($-19:$, :), CVode_val_ref, [], 1d-4); + assert_checkalmostequal(res.time, CVode_time_ref); + +end diff --git a/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_Kalman.dia.ref b/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_Kalman.dia.ref new file mode 100755 index 000000000..84cfdb6ae --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_Kalman.dia.ref @@ -0,0 +1,39 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/ODE/Kalman.zcos")); +CVode_val_ref = [ -0.0124518 0.0057263 0.0202561 + -0.0056589 0.0003643 0.0040543 + 0.0139675 0.0010424 -0.0068178 + 0.0342362 0.0025550 -0.0150659 + 0.0349585 0.0022871 -0.0139099 + 0.0457677 0.0095449 -0.0057510 + 0.0438374 0.0179447 0.0110369 + 0.0399226 0.0159906 0.0084871 + 0.0466923 0.0087662 -0.0088076 + 0.0431542 0.0060647 -0.0101178 + 0.0586618 0.0186971 0.0051877 + 0.0629366 0.0288542 0.0211484 + 0.0579398 0.0109636 -0.0105544 + 0.0624743 0.0102438 -0.0139593 + 0.0654326 0.0065228 -0.0207958 + 0.0531896 -0.0026032 -0.0283963 + 0.0353228 -0.0132950 -0.0343691 + 0.0381893 -0.0053057 -0.0183788 + 0.0563168 0.0083184 -0.0028685 + 0.0363338 0.0053192 0.0038699 ]; +CVode_time_ref = (0:.03:14.97)'; +for i=1:4 + scs_m.props.tol(6) = i; // Solver + try scicos_simulate(scs_m); catch disp(lasterror()); end; // CVode + assert_checkalmostequal(res.values($-19:$, :), CVode_val_ref, [], 1d-7); + assert_checkalmostequal(res.time, CVode_time_ref); +end diff --git a/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_Kalman.tst b/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_Kalman.tst new file mode 100755 index 000000000..bd9842732 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_Kalman.tst @@ -0,0 +1,45 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// + +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/ODE/Kalman.zcos")); + +CVode_val_ref = [ -0.0124518 0.0057263 0.0202561 + -0.0056589 0.0003643 0.0040543 + 0.0139675 0.0010424 -0.0068178 + 0.0342362 0.0025550 -0.0150659 + 0.0349585 0.0022871 -0.0139099 + 0.0457677 0.0095449 -0.0057510 + 0.0438374 0.0179447 0.0110369 + 0.0399226 0.0159906 0.0084871 + 0.0466923 0.0087662 -0.0088076 + 0.0431542 0.0060647 -0.0101178 + 0.0586618 0.0186971 0.0051877 + 0.0629366 0.0288542 0.0211484 + 0.0579398 0.0109636 -0.0105544 + 0.0624743 0.0102438 -0.0139593 + 0.0654326 0.0065228 -0.0207958 + 0.0531896 -0.0026032 -0.0283963 + 0.0353228 -0.0132950 -0.0343691 + 0.0381893 -0.0053057 -0.0183788 + 0.0563168 0.0083184 -0.0028685 + 0.0363338 0.0053192 0.0038699 ]; +CVode_time_ref = (0:.03:14.97)'; + +for i=1:4 + + scs_m.props.tol(6) = i; // Solver + try scicos_simulate(scs_m); catch disp(lasterror()); end; // CVode + + assert_checkalmostequal(res.values($-19:$, :), CVode_val_ref, [], 1d-7); + assert_checkalmostequal(res.time, CVode_time_ref); + +end diff --git a/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_Temperature_Controller.dia.ref b/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_Temperature_Controller.dia.ref new file mode 100755 index 000000000..d0758193b --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_Temperature_Controller.dia.ref @@ -0,0 +1,40 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/ODE/Temperature_Controller.zcos")); +CVode_val_ref = [ + -3.6548088 0.0000044 16.066667 19.721476 + -3.6499578 0.0000040 16.066667 19.716625 + -3.6451087 0.0000036 16.066667 19.711776 + -3.6402617 0.0000033 16.066667 19.706929 + -3.6354167 0.0000030 16.066667 19.702084 + -3.6305738 0.0000027 16.066667 19.697241 + -3.6257328 0.0000025 16.066667 19.6924 + -3.6208938 0.0000023 16.066667 19.687561 + -3.6160569 0.0000021 16.066667 19.682724 + -3.611222 0.0000019 16.066667 19.677889 + -3.6063891 0.0000017 16.066667 19.673056 + -3.6015582 0.0000015 16.066667 19.668225 + -3.5967293 0.0000014 16.066667 19.663396 + -3.5919024 0.0000013 16.066667 19.658569 + -3.5870775 0.0000012 16.066667 19.653745 + -3.5822547 0.0000011 16.066667 19.648922 + -3.5774338 0.0000010 16.066667 19.644101 + -3.572615 0.0000009 16.066667 19.639282 + -3.5677982 0.0000008 16.066667 19.634465 + -3.5629834 0.0000007 16.066667 19.62965 ]; +CVode_time_ref = (28720.1:10:29990.1)'; +for i=1:4 + scs_m.props.tol(6) = i; // Solver + try scicos_simulate(scs_m); catch disp(lasterror()); end; // CVode + assert_checkalmostequal(res.values($-19:$, :), CVode_val_ref, [], 1d-4); + assert_checkalmostequal(res.time, CVode_time_ref); +end diff --git a/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_Temperature_Controller.tst b/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_Temperature_Controller.tst new file mode 100755 index 000000000..f15d17d27 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_Temperature_Controller.tst @@ -0,0 +1,46 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// + +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/ODE/Temperature_Controller.zcos")); + +CVode_val_ref = [ + -3.6548088 0.0000044 16.066667 19.721476 + -3.6499578 0.0000040 16.066667 19.716625 + -3.6451087 0.0000036 16.066667 19.711776 + -3.6402617 0.0000033 16.066667 19.706929 + -3.6354167 0.0000030 16.066667 19.702084 + -3.6305738 0.0000027 16.066667 19.697241 + -3.6257328 0.0000025 16.066667 19.6924 + -3.6208938 0.0000023 16.066667 19.687561 + -3.6160569 0.0000021 16.066667 19.682724 + -3.611222 0.0000019 16.066667 19.677889 + -3.6063891 0.0000017 16.066667 19.673056 + -3.6015582 0.0000015 16.066667 19.668225 + -3.5967293 0.0000014 16.066667 19.663396 + -3.5919024 0.0000013 16.066667 19.658569 + -3.5870775 0.0000012 16.066667 19.653745 + -3.5822547 0.0000011 16.066667 19.648922 + -3.5774338 0.0000010 16.066667 19.644101 + -3.572615 0.0000009 16.066667 19.639282 + -3.5677982 0.0000008 16.066667 19.634465 + -3.5629834 0.0000007 16.066667 19.62965 ]; +CVode_time_ref = (28720.1:10:29990.1)'; + +for i=1:4 + + scs_m.props.tol(6) = i; // Solver + try scicos_simulate(scs_m); catch disp(lasterror()); end; // CVode + + assert_checkalmostequal(res.values($-19:$, :), CVode_val_ref, [], 1d-4); + assert_checkalmostequal(res.time, CVode_time_ref); + +end diff --git a/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_Watertank.dia.ref b/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_Watertank.dia.ref new file mode 100755 index 000000000..9c2d56101 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_Watertank.dia.ref @@ -0,0 +1,40 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/ODE/Watertank.zcos")); +CVode_val_ref = [ + 7.8198758 9.6795397 + 7.8460626 9.6628927 + 7.8715566 9.6488678 + 7.8963773 9.6375731 + 7.9205414 9.6287258 + 7.9440674 9.6219139 + 7.9669711 9.6174424 + 7.9892697 9.6150375 + 8.0109781 9.6146991 + 8.0321113 9.6160474 + 8.052689 9.619105 + 8.0727243 9.6238066 + 8.0922301 9.6298068 + 8.1112209 9.6370943 + 8.1297115 9.6456041 + 8.1477135 9.6551443 + 8.1652409 9.6656234 + 8.1823051 9.6768902 + 8.198919 9.6888469 + 8.2150942 9.7013865 ]; +CVode_time_ref = (0.1:.1:10)'; +for i=1:4 + scs_m.props.tol(6) = i; // Solver + try scicos_simulate(scs_m); catch disp(lasterror()); end; // CVode + assert_checkalmostequal(res.values($-19:$, :), CVode_val_ref, 1d-3); + assert_checkalmostequal(res.time, CVode_time_ref); +end diff --git a/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_Watertank.tst b/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_Watertank.tst new file mode 100755 index 000000000..aa97942d7 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/ODE/CVode_Watertank.tst @@ -0,0 +1,46 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// + +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/ODE/Watertank.zcos")); + +CVode_val_ref = [ + 7.8198758 9.6795397 + 7.8460626 9.6628927 + 7.8715566 9.6488678 + 7.8963773 9.6375731 + 7.9205414 9.6287258 + 7.9440674 9.6219139 + 7.9669711 9.6174424 + 7.9892697 9.6150375 + 8.0109781 9.6146991 + 8.0321113 9.6160474 + 8.052689 9.619105 + 8.0727243 9.6238066 + 8.0922301 9.6298068 + 8.1112209 9.6370943 + 8.1297115 9.6456041 + 8.1477135 9.6551443 + 8.1652409 9.6656234 + 8.1823051 9.6768902 + 8.198919 9.6888469 + 8.2150942 9.7013865 ]; +CVode_time_ref = (0.1:.1:10)'; + +for i=1:4 + + scs_m.props.tol(6) = i; // Solver + try scicos_simulate(scs_m); catch disp(lasterror()); end; // CVode + + assert_checkalmostequal(res.values($-19:$, :), CVode_val_ref, 1d-3); + assert_checkalmostequal(res.time, CVode_time_ref); + +end diff --git a/modules/scicos/tests/unit_tests/Solvers/ODE/DAE_ODE.dia.ref b/modules/scicos/tests/unit_tests/Solvers/ODE/DAE_ODE.dia.ref new file mode 100755 index 000000000..ad23cc52f --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/ODE/DAE_ODE.dia.ref @@ -0,0 +1,37 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/ODE/Kalman.zcos")); +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function message(msg) +endfunction +funcprot(prot); +// Modify solver + run IDA +scs_m.props.tol(6) = 100; // Solver +ier = execstr('xcos_simulate(scs_m, 4);', 'errcatch'); // Run simulation (LSodar will actually take over) +assert_checkequal(ier, 0); +ier = execstr('scicos_simulate(scs_m);', 'errcatch'); +assert_checkequal(ier, 0); +// Modify solver + run DDaskr Newton +scs_m.props.tol(6) = 101; // Solver +ier = execstr('xcos_simulate(scs_m, 4);', 'errcatch'); // Run simulation (LSodar will actually take over) +assert_checkequal(ier, 0); +ier = execstr('scicos_simulate(scs_m);', 'errcatch'); +assert_checkequal(ier, 0); +// Modify solver + run DDaskr GMRes +scs_m.props.tol(6) = 102; // Solver +ier = execstr('xcos_simulate(scs_m, 4);', 'errcatch'); // Run simulation (LSodar will actually take over) +assert_checkequal(ier, 0); +ier = execstr('scicos_simulate(scs_m);', 'errcatch'); +assert_checkequal(ier, 0); diff --git a/modules/scicos/tests/unit_tests/Solvers/ODE/DAE_ODE.tst b/modules/scicos/tests/unit_tests/Solvers/ODE/DAE_ODE.tst new file mode 100755 index 000000000..caf59cde8 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/ODE/DAE_ODE.tst @@ -0,0 +1,42 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// + +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/ODE/Kalman.zcos")); + +// Redefining messagebox() to avoid popup +prot = funcprot(); +funcprot(0); +function message(msg) +endfunction +funcprot(prot); + +// Modify solver + run IDA +scs_m.props.tol(6) = 100; // Solver +ier = execstr('xcos_simulate(scs_m, 4);', 'errcatch'); // Run simulation (LSodar will actually take over) +assert_checkequal(ier, 0); +ier = execstr('scicos_simulate(scs_m);', 'errcatch'); +assert_checkequal(ier, 0); + +// Modify solver + run DDaskr Newton +scs_m.props.tol(6) = 101; // Solver +ier = execstr('xcos_simulate(scs_m, 4);', 'errcatch'); // Run simulation (LSodar will actually take over) +assert_checkequal(ier, 0); +ier = execstr('scicos_simulate(scs_m);', 'errcatch'); +assert_checkequal(ier, 0); + +// Modify solver + run DDaskr GMRes +scs_m.props.tol(6) = 102; // Solver +ier = execstr('xcos_simulate(scs_m, 4);', 'errcatch'); // Run simulation (LSodar will actually take over) +assert_checkequal(ier, 0); +ier = execstr('scicos_simulate(scs_m);', 'errcatch'); +assert_checkequal(ier, 0); diff --git a/modules/scicos/tests/unit_tests/Solvers/ODE/DoPri.dia.ref b/modules/scicos/tests/unit_tests/Solvers/ODE/DoPri.dia.ref new file mode 100755 index 000000000..f83ca19b4 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/ODE/DoPri.dia.ref @@ -0,0 +1,37 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/ODE/Kalman.zcos")); +Info = scicos_simulate(scs_m, list()); +for i=2:4 // 'max step size' = 5*10^-i, precision + // Start by updating the clock block period (sampling) + scs_m.objs(8).model.rpar(1) = 5*10^-i; + scs_m.objs(9).model.rpar(1) = 5*10^-i; + // Modify solver and 'max step size' + run DoPri + save results + scs_m.props.tol(7) = 5*10^-i; scs_m.props.tol(6) = 5; // 'max step size' + solver + try scicos_simulate(scs_m, Info); catch disp(lasterror()); end; // DoPri + doprival = res.values; // Results + // Modify solver and 'max step size' + run CVode + save results + scs_m.props.tol(7) = 0; scs_m.props.tol(6) = 1; + try scicos_simulate(scs_m, Info); catch disp(lasterror()); end; + cvval = res.values; + // Compare results + compa = abs(doprival-cvval); + // Extract mean, standard deviation, maximum + mea = mean(compa); + [maxi, indexMaxi] = max(compa); + stdeviation = stdev(compa); + // Verifying closeness of the results + assert_checktrue(maxi <= 10^-(i+2)); + assert_checktrue(mea <= 10^-(i+2)); + assert_checktrue(stdeviation <= 10^-(i+2)); +end diff --git a/modules/scicos/tests/unit_tests/Solvers/ODE/DoPri.tst b/modules/scicos/tests/unit_tests/Solvers/ODE/DoPri.tst new file mode 100755 index 000000000..46fe76c36 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/ODE/DoPri.tst @@ -0,0 +1,46 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// + +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/ODE/Kalman.zcos")); +Info = scicos_simulate(scs_m, list()); + +for i=2:4 // 'max step size' = 5*10^-i, precision + + // Start by updating the clock block period (sampling) + scs_m.objs(8).model.rpar(1) = 5*10^-i; + scs_m.objs(9).model.rpar(1) = 5*10^-i; + + // Modify solver and 'max step size' + run DoPri + save results + scs_m.props.tol(7) = 5*10^-i; scs_m.props.tol(6) = 5; // 'max step size' + solver + try scicos_simulate(scs_m, Info); catch disp(lasterror()); end; // DoPri + doprival = res.values; // Results + + // Modify solver and 'max step size' + run CVode + save results + scs_m.props.tol(7) = 0; scs_m.props.tol(6) = 1; + try scicos_simulate(scs_m, Info); catch disp(lasterror()); end; + cvval = res.values; + + // Compare results + compa = abs(doprival-cvval); + + // Extract mean, standard deviation, maximum + mea = mean(compa); + [maxi, indexMaxi] = max(compa); + stdeviation = stdev(compa); + + // Verifying closeness of the results + assert_checktrue(maxi <= 10^-(i+2)); + assert_checktrue(mea <= 10^-(i+2)); + assert_checktrue(stdeviation <= 10^-(i+2)); + +end diff --git a/modules/scicos/tests/unit_tests/Solvers/ODE/ExpRK.dia.ref b/modules/scicos/tests/unit_tests/Solvers/ODE/ExpRK.dia.ref new file mode 100755 index 000000000..1c9204480 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/ODE/ExpRK.dia.ref @@ -0,0 +1,37 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/ODE/Kalman.zcos")); +Info = scicos_simulate(scs_m, list()); +for i=2:4 // 'max step size' = 5*10^-i, precision + // Start by updating the clock block period (sampling) + scs_m.objs(7).model.rpar(1) = 5*10^-i; + scs_m.objs(8).model.rpar(1) = 5*10^-i; + // Modify solver and 'max step size' + run ExpRK + save results + scs_m.props.tol(7) = 5*10^-i; scs_m.props.tol(6) = 6; // 'max step size' + solver + try scicos_simulate(scs_m, Info); catch disp(lasterror()); end; // ExpRK + rkval = res.values; // Results + // Modify solver and 'max step size' + run CVode + save results + scs_m.props.tol(7) = 0; scs_m.props.tol(6) = 1; + try scicos_simulate(scs_m, Info); catch disp(lasterror()); end; + cvval = res.values; + // Compare results + compa = abs(rkval-cvval); + // Extract mean, standard deviation, maximum + mea = mean(compa); + [maxi, indexMaxi] = max(compa); + stdeviation = stdev(compa); + // Verifying closeness of the results + assert_checktrue(maxi <= 10^-(i+1)); + assert_checktrue(mea <= 10^-(i+1)); + assert_checktrue(stdeviation <= 10^-(i+2)); +end diff --git a/modules/scicos/tests/unit_tests/Solvers/ODE/ExpRK.tst b/modules/scicos/tests/unit_tests/Solvers/ODE/ExpRK.tst new file mode 100755 index 000000000..0ac6939f4 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/ODE/ExpRK.tst @@ -0,0 +1,46 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// + +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/ODE/Kalman.zcos")); +Info = scicos_simulate(scs_m, list()); + +for i=2:4 // 'max step size' = 5*10^-i, precision + + // Start by updating the clock block period (sampling) + scs_m.objs(7).model.rpar(1) = 5*10^-i; + scs_m.objs(8).model.rpar(1) = 5*10^-i; + + // Modify solver and 'max step size' + run ExpRK + save results + scs_m.props.tol(7) = 5*10^-i; scs_m.props.tol(6) = 6; // 'max step size' + solver + try scicos_simulate(scs_m, Info); catch disp(lasterror()); end; // ExpRK + rkval = res.values; // Results + + // Modify solver and 'max step size' + run CVode + save results + scs_m.props.tol(7) = 0; scs_m.props.tol(6) = 1; + try scicos_simulate(scs_m, Info); catch disp(lasterror()); end; + cvval = res.values; + + // Compare results + compa = abs(rkval-cvval); + + // Extract mean, standard deviation, maximum + mea = mean(compa); + [maxi, indexMaxi] = max(compa); + stdeviation = stdev(compa); + + // Verifying closeness of the results + assert_checktrue(maxi <= 10^-(i+1)); + assert_checktrue(mea <= 10^-(i+1)); + assert_checktrue(stdeviation <= 10^-(i+2)); + +end diff --git a/modules/scicos/tests/unit_tests/Solvers/ODE/ImpRK.dia.ref b/modules/scicos/tests/unit_tests/Solvers/ODE/ImpRK.dia.ref new file mode 100755 index 000000000..f62dd42d2 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/ODE/ImpRK.dia.ref @@ -0,0 +1,38 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/ODE/Kalman.zcos")); +Info = scicos_simulate(scs_m, list()); +for i=2:4 // 'max step size' = 10^-i, precision + // Start by updating the clock block period (sampling) + scs_m.objs(7).model.rpar(1) = 5*10^-i; + scs_m.objs(8).model.rpar(1) = 5*10^-i; + // Modify solver and 'max step size' + run ImpRK + save results + scs_m.props.tol(7) = 5*10^-i; scs_m.props.tol(6) = 7; // 'max step size' + solver + scs_m.props.tol(2) = 1d-12; // reltol + try scicos_simulate(scs_m, Info); catch disp(lasterror()); end // ImpRK + rkval = res.values; // Results + // Modify solver and reltol + run CVode + save results + scs_m.props.tol(6) = 4; scs_m.props.tol(2) = 1d-15; + try scicos_simulate(scs_m, Info); catch disp(lasterror()); end + cvval = res.values; + // Compare results + compa = abs(rkval-cvval); + // Extract mean, standard deviation, maximum + mea = mean(compa); + [maxi, indexMaxi] = max(compa); + stdeviation = stdev(compa); + // Verifying closeness of the results + assert_checktrue(maxi <= 10^-i); + assert_checktrue(mea <= 10^-i); + assert_checktrue(stdeviation <= 10^-i); +end diff --git a/modules/scicos/tests/unit_tests/Solvers/ODE/ImpRK.tst b/modules/scicos/tests/unit_tests/Solvers/ODE/ImpRK.tst new file mode 100755 index 000000000..7393f899e --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/ODE/ImpRK.tst @@ -0,0 +1,47 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// + +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/ODE/Kalman.zcos")); +Info = scicos_simulate(scs_m, list()); + +for i=2:4 // 'max step size' = 10^-i, precision + + // Start by updating the clock block period (sampling) + scs_m.objs(7).model.rpar(1) = 5*10^-i; + scs_m.objs(8).model.rpar(1) = 5*10^-i; + + // Modify solver and 'max step size' + run ImpRK + save results + scs_m.props.tol(7) = 5*10^-i; scs_m.props.tol(6) = 7; // 'max step size' + solver + scs_m.props.tol(2) = 1d-12; // reltol + try scicos_simulate(scs_m, Info); catch disp(lasterror()); end // ImpRK + rkval = res.values; // Results + + // Modify solver and reltol + run CVode + save results + scs_m.props.tol(6) = 4; scs_m.props.tol(2) = 1d-15; + try scicos_simulate(scs_m, Info); catch disp(lasterror()); end + cvval = res.values; + + // Compare results + compa = abs(rkval-cvval); + + // Extract mean, standard deviation, maximum + mea = mean(compa); + [maxi, indexMaxi] = max(compa); + stdeviation = stdev(compa); + + // Verifying closeness of the results + assert_checktrue(maxi <= 10^-i); + assert_checktrue(mea <= 10^-i); + assert_checktrue(stdeviation <= 10^-i); + +end diff --git a/modules/scicos/tests/unit_tests/Solvers/ODE/LSodar.dia.ref b/modules/scicos/tests/unit_tests/Solvers/ODE/LSodar.dia.ref new file mode 100755 index 000000000..d000e6b32 --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/ODE/LSodar.dia.ref @@ -0,0 +1,51 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/ODE/Kalman.zcos")); +// Set solver to LSodar + run LSodar + save results +scs_m.props.tol(6) = 0; // Set solver to LSodar +try scicos_simulate(scs_m); catch disp(lasterror()); end; // Run LSodar +lsodarval = res.values; // Results +// Set solver to CVode BDF/Newton + run + save results +scs_m.props.tol(6) = 1; +try scicos_simulate(scs_m); catch disp(lasterror()); end; +cvval = res.values; +// Compare results +compa = abs(lsodarval-cvval); +// Extract mean, standard deviation, maximum +mea = mean(compa); +[maxi, indexMaxi] = max(compa); +stdeviation = stdev(compa); +// Verifying closeness of the results +assert_checktrue(maxi <= 1d-8); +assert_checktrue(mea <= 1d-8); +assert_checktrue(stdeviation <= 1d-8); +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/ODE/Controller.zcos")); +// Set solver to LSodar + run LSodar + save results +scs_m.props.tol(6) = 0; // Set solver to LSodar +try scicos_simulate(scs_m); catch disp(lasterror()); end; // Run LSodar +lsodarval = res.values; // Results +// Set solver to CVode BDF/Newton + run + save results +scs_m.props.tol(6) = 1; +try scicos_simulate(scs_m); catch disp(lasterror()); end; +cvval = res.values; +// Compare results +compa = abs(lsodarval-cvval); +// Extract mean, standard deviation, maximum +mea = mean(compa); +[maxi, indexMaxi] = max(compa); +stdeviation = stdev(compa); +// Verifying closeness of the results +assert_checktrue(maxi <= 10^-4); +assert_checktrue(mea <= 10^-4); +assert_checktrue(stdeviation <= 10^-4); diff --git a/modules/scicos/tests/unit_tests/Solvers/ODE/LSodar.tst b/modules/scicos/tests/unit_tests/Solvers/ODE/LSodar.tst new file mode 100755 index 000000000..d91da004d --- /dev/null +++ b/modules/scicos/tests/unit_tests/Solvers/ODE/LSodar.tst @@ -0,0 +1,64 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - Scilab Enterprises - Paul Bignier +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- ENGLISH IMPOSED --> +// +// <-- XCOS TEST --> +// + +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/ODE/Kalman.zcos")); + +// Set solver to LSodar + run LSodar + save results +scs_m.props.tol(6) = 0; // Set solver to LSodar +try scicos_simulate(scs_m); catch disp(lasterror()); end; // Run LSodar +lsodarval = res.values; // Results + +// Set solver to CVode BDF/Newton + run + save results +scs_m.props.tol(6) = 1; +try scicos_simulate(scs_m); catch disp(lasterror()); end; +cvval = res.values; + +// Compare results +compa = abs(lsodarval-cvval); + +// Extract mean, standard deviation, maximum +mea = mean(compa); +[maxi, indexMaxi] = max(compa); +stdeviation = stdev(compa); + +// Verifying closeness of the results +assert_checktrue(maxi <= 1d-8); +assert_checktrue(mea <= 1d-8); +assert_checktrue(stdeviation <= 1d-8); + + +// Import diagram +assert_checktrue(importXcosDiagram("SCI/modules/xcos/tests/unit_tests/Solvers/ODE/Controller.zcos")); + +// Set solver to LSodar + run LSodar + save results +scs_m.props.tol(6) = 0; // Set solver to LSodar +try scicos_simulate(scs_m); catch disp(lasterror()); end; // Run LSodar +lsodarval = res.values; // Results + +// Set solver to CVode BDF/Newton + run + save results +scs_m.props.tol(6) = 1; +try scicos_simulate(scs_m); catch disp(lasterror()); end; +cvval = res.values; + +// Compare results +compa = abs(lsodarval-cvval); + +// Extract mean, standard deviation, maximum +mea = mean(compa); +[maxi, indexMaxi] = max(compa); +stdeviation = stdev(compa); + +// Verifying closeness of the results +assert_checktrue(maxi <= 10^-4); +assert_checktrue(mea <= 10^-4); +assert_checktrue(stdeviation <= 10^-4); diff --git a/modules/scicos/tests/unit_tests/buildouttb.dia.ref b/modules/scicos/tests/unit_tests/buildouttb.dia.ref new file mode 100755 index 000000000..6ed6d0bb6 --- /dev/null +++ b/modules/scicos/tests/unit_tests/buildouttb.dia.ref @@ -0,0 +1,2 @@ +ierr=execstr("buildouttb()","errcatch"); +if ierr <> 77 then bugmes();quit;end diff --git a/modules/scicos/tests/unit_tests/buildouttb.tst b/modules/scicos/tests/unit_tests/buildouttb.tst new file mode 100755 index 000000000..71f971d07 --- /dev/null +++ b/modules/scicos/tests/unit_tests/buildouttb.tst @@ -0,0 +1,9 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ????-2008 - INRIA +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +ierr=execstr("buildouttb()","errcatch"); +if ierr <> 77 then pause,end
\ No newline at end of file diff --git a/modules/scicos/tests/unit_tests/end_scicosim.dia.ref b/modules/scicos/tests/unit_tests/end_scicosim.dia.ref new file mode 100755 index 000000000..28c908027 --- /dev/null +++ b/modules/scicos/tests/unit_tests/end_scicosim.dia.ref @@ -0,0 +1,2 @@ +ierr=execstr("end_scicosim ()","errcatch"); +if ierr <> 999 then bugmes();quit;end diff --git a/modules/scicos/tests/unit_tests/end_scicosim.tst b/modules/scicos/tests/unit_tests/end_scicosim.tst new file mode 100755 index 000000000..6771c705a --- /dev/null +++ b/modules/scicos/tests/unit_tests/end_scicosim.tst @@ -0,0 +1,9 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ????-2008 - INRIA +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +ierr=execstr("end_scicosim ()","errcatch"); +if ierr <> 999 then pause,end
\ No newline at end of file diff --git a/modules/scicos/tests/unit_tests/getscicosvars.dia.ref b/modules/scicos/tests/unit_tests/getscicosvars.dia.ref new file mode 100755 index 000000000..701faddc4 --- /dev/null +++ b/modules/scicos/tests/unit_tests/getscicosvars.dia.ref @@ -0,0 +1,2 @@ +ierr=execstr("[myvar]=getscicosvars(''blocks'')","errcatch"); +if ierr <> 999 then bugmes();quit;end diff --git a/modules/scicos/tests/unit_tests/getscicosvars.tst b/modules/scicos/tests/unit_tests/getscicosvars.tst new file mode 100755 index 000000000..32126e5ae --- /dev/null +++ b/modules/scicos/tests/unit_tests/getscicosvars.tst @@ -0,0 +1,9 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ????-2008 - INRIA +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +ierr=execstr("[myvar]=getscicosvars(''blocks'')","errcatch"); +if ierr <> 999 then pause,end
\ No newline at end of file diff --git a/modules/scicos/tests/unit_tests/lincos.dia.ref b/modules/scicos/tests/unit_tests/lincos.dia.ref new file mode 100755 index 000000000..ba3b41998 --- /dev/null +++ b/modules/scicos/tests/unit_tests/lincos.dia.ref @@ -0,0 +1,27 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - INRIA +// Copyright (C) 2009 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- ENGLISH IMPOSED --> +// <-- XCOS TEST --> +ilib_verbose(0); +prot=funcprot(); +funcprot(0); +exec("SCI/modules/xcos/demos/PENDULUM_ANIM.sci"); +exec("SCI/modules/xcos/demos/anim_pen.sci"); +funcprot(prot); +load("SCI/modules/scicos/tests/unit_tests/pendulum_anim45.cos"); +// CBLOCK parameters +M=10; +m=3; +l=3; +ph=0.1; +// INTEGRALs parameters +z0=-4; +th0=0.02; +scs_m = scs_m.objs(5).model.rpar; +[X,U,Y,XP] = steadycos(scs_m,[],[],[],[],1,1:$); +sys = lincos(scs_m,X,U); diff --git a/modules/scicos/tests/unit_tests/lincos.tst b/modules/scicos/tests/unit_tests/lincos.tst new file mode 100755 index 000000000..62386be03 --- /dev/null +++ b/modules/scicos/tests/unit_tests/lincos.tst @@ -0,0 +1,33 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - INRIA +// Copyright (C) 2009 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- ENGLISH IMPOSED --> +// <-- XCOS TEST --> +ilib_verbose(0); + +prot=funcprot(); +funcprot(0); +exec("SCI/modules/xcos/demos/PENDULUM_ANIM.sci"); +exec("SCI/modules/xcos/demos/anim_pen.sci"); +funcprot(prot); +load("SCI/modules/scicos/tests/unit_tests/pendulum_anim45.cos"); + +// CBLOCK parameters +M=10; +m=3; +l=3; +ph=0.1; + +// INTEGRALs parameters +z0=-4; +th0=0.02; + +scs_m = scs_m.objs(5).model.rpar; +[X,U,Y,XP] = steadycos(scs_m,[],[],[],[],1,1:$); +sys = lincos(scs_m,X,U); + diff --git a/modules/scicos/tests/unit_tests/pendulum_anim45.cos b/modules/scicos/tests/unit_tests/pendulum_anim45.cos Binary files differnew file mode 100755 index 000000000..37a219074 --- /dev/null +++ b/modules/scicos/tests/unit_tests/pendulum_anim45.cos diff --git a/modules/scicos/tests/unit_tests/phase_simulation.dia.ref b/modules/scicos/tests/unit_tests/phase_simulation.dia.ref new file mode 100755 index 000000000..be3634b4f --- /dev/null +++ b/modules/scicos/tests/unit_tests/phase_simulation.dia.ref @@ -0,0 +1,2 @@ +ierr=execstr("[psim]=phase_simulation()","errcatch"); +if ierr <> 999 then bugmes();quit;end diff --git a/modules/scicos/tests/unit_tests/phase_simulation.tst b/modules/scicos/tests/unit_tests/phase_simulation.tst new file mode 100755 index 000000000..b02cc17e1 --- /dev/null +++ b/modules/scicos/tests/unit_tests/phase_simulation.tst @@ -0,0 +1,9 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ????-2008 - INRIA +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +ierr=execstr("[psim]=phase_simulation()","errcatch"); +if ierr <> 999 then pause,end
\ No newline at end of file diff --git a/modules/scicos/tests/unit_tests/pointer_xproperty.dia.ref b/modules/scicos/tests/unit_tests/pointer_xproperty.dia.ref new file mode 100755 index 000000000..f248519d9 --- /dev/null +++ b/modules/scicos/tests/unit_tests/pointer_xproperty.dia.ref @@ -0,0 +1,2 @@ +ierr=execstr("[xprop]=pointer_xproperty()","errcatch") ; +if ierr <> 999 then bugmes();quit;end diff --git a/modules/scicos/tests/unit_tests/pointer_xproperty.tst b/modules/scicos/tests/unit_tests/pointer_xproperty.tst new file mode 100755 index 000000000..fb3327d98 --- /dev/null +++ b/modules/scicos/tests/unit_tests/pointer_xproperty.tst @@ -0,0 +1,9 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ????-2008 - INRIA +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +ierr=execstr("[xprop]=pointer_xproperty()","errcatch") ; +if ierr <> 999 then pause,end
\ No newline at end of file diff --git a/modules/scicos/tests/unit_tests/scicos.dia.ref b/modules/scicos/tests/unit_tests/scicos.dia.ref new file mode 100755 index 000000000..3f28b2517 --- /dev/null +++ b/modules/scicos/tests/unit_tests/scicos.dia.ref @@ -0,0 +1,63 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ????-2008 - INRIA +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +load('SCI/modules/scicos/macros/scicos_scicos/lib'); +load('SCI/modules/scicos/macros/scicos_utils/lib'); +if ( ~isdef("modelica_libs") | .. + ~isdef("scicos_pal_libs") ) then + [modelica_libs, scicos_pal_libs, %scicos_with_grid, %scs_wgrid]=initial_scicos_tables() + %scs_wgrid = + + 10. + 10. + 12. + %scicos_with_grid = + + F + scicos_pal_libs = + + + column 1 to 7 + +!Branching Events Misc Sinks Threshold Linear MatrixOp ! + + column 8 to 13 + +!NonLinear Sources Electrical Hydraulics PDE IntegerOp ! + modelica_libs = + + + column 1 + +!SCI/modules/scicos_blocks/macros/Electrical ! + + column 2 + +!SCI/modules/scicos_blocks/macros/Hydraulics ! +end +exec(loadpallibs,-1) +exec('SCI/modules/scicos/tests/unit_tests/scicos_tests.sci'); +options=default_options(); +//build the block set +blockslib='scs'+['Branching','Events','Misc','Sinks','Threshold','Linear', ... + 'NonLinear','Sources','Electrical','Hydraulics']+'lib'; +Blocs=[] + Blocs = + + [] +for blocklib=blockslib + B=string(blocklib);Blocs=[Blocs;B(2:$)]; +end +Blocs(Blocs=="m_sin")=[]; +nb=size(Blocs,1); +if checkdefine() then bugmes();quit;end +if checkinputs() then bugmes();quit;end +if checkoutputs() then bugmes();quit;end +if checkorigin() then bugmes();quit;end +if checkdeput() then bugmes();quit;end +if checkfiring() then bugmes();quit;end +if check_define_ports() then bugmes();quit;end +if check_set_ports() then bugmes();quit;end diff --git a/modules/scicos/tests/unit_tests/scicos.tst b/modules/scicos/tests/unit_tests/scicos.tst new file mode 100755 index 000000000..572ca6f2f --- /dev/null +++ b/modules/scicos/tests/unit_tests/scicos.tst @@ -0,0 +1,38 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ????-2008 - INRIA +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +load('SCI/modules/scicos/macros/scicos_scicos/lib'); +load('SCI/modules/scicos/macros/scicos_utils/lib'); +if ( ~isdef("modelica_libs") | .. + ~isdef("scicos_pal_libs") ) then + + [modelica_libs, scicos_pal_libs, %scicos_with_grid, %scs_wgrid]=initial_scicos_tables() +end + +exec(loadpallibs,-1) + +exec('SCI/modules/scicos/tests/unit_tests/scicos_tests.sci'); + +options=default_options(); +//build the block set +blockslib='scs'+['Branching','Events','Misc','Sinks','Threshold','Linear', ... + 'NonLinear','Sources','Electrical','Hydraulics']+'lib'; +Blocs=[] +for blocklib=blockslib + B=string(blocklib);Blocs=[Blocs;B(2:$)]; +end +Blocs(Blocs=="m_sin")=[]; + +nb=size(Blocs,1); +if checkdefine() then pause,end +if checkinputs() then pause,end +if checkoutputs() then pause,end +if checkorigin() then pause,end +if checkdeput() then pause,end +if checkfiring() then pause,end +if check_define_ports() then pause,end +if check_set_ports() then pause,end diff --git a/modules/scicos/tests/unit_tests/scicos_debug.dia.ref b/modules/scicos/tests/unit_tests/scicos_debug.dia.ref new file mode 100755 index 000000000..73c4a26a4 --- /dev/null +++ b/modules/scicos/tests/unit_tests/scicos_debug.dia.ref @@ -0,0 +1,4 @@ +level = 2; +scicos_debug(level); +res = scicos_debug(); +if res <> level then bugmes();quit;end diff --git a/modules/scicos/tests/unit_tests/scicos_debug.tst b/modules/scicos/tests/unit_tests/scicos_debug.tst new file mode 100755 index 000000000..feab314ce --- /dev/null +++ b/modules/scicos/tests/unit_tests/scicos_debug.tst @@ -0,0 +1,11 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ????-2008 - INRIA +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +level = 2; +scicos_debug(level); +res = scicos_debug(); +if res <> level then pause,end
\ No newline at end of file diff --git a/modules/scicos/tests/unit_tests/scicos_filesassociation.tst b/modules/scicos/tests/unit_tests/scicos_filesassociation.tst new file mode 100755 index 000000000..17aae5764 --- /dev/null +++ b/modules/scicos/tests/unit_tests/scicos_filesassociation.tst @@ -0,0 +1,16 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2005-2008 - INRIA - Allan CORNET <allan.cornet@inria.fr> +// Copyright (C) 2005-2008 - INRIA - Pierre MARECHAL <pierre.marechal@inria.fr> +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +if getos() == 'Windows' then + + ierr = execstr('res = winqueryreg(''HKEY_CLASSES_ROOT'',''Scilab5.cos'')','errcatch'); + if ierr <> 0 then pause,end + + ierr = execstr('res = winqueryreg(''HKEY_CLASSES_ROOT'',''Scilab5.cosf'')','errcatch'); + if ierr <> 0 then pause,end + +end
\ No newline at end of file diff --git a/modules/scicos/tests/unit_tests/scicos_filesassociation.unix.dia.ref b/modules/scicos/tests/unit_tests/scicos_filesassociation.unix.dia.ref new file mode 100755 index 000000000..04bff1a84 --- /dev/null +++ b/modules/scicos/tests/unit_tests/scicos_filesassociation.unix.dia.ref @@ -0,0 +1,13 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2005-2008 - INRIA - Allan CORNET <allan.cornet@inria.fr> +// Copyright (C) 2005-2008 - INRIA - Pierre MARECHAL <pierre.marechal@inria.fr> +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +if getos() == 'Windows' then + ierr = execstr('res = winqueryreg(''HKEY_CLASSES_ROOT'',''Scilab5.cos'')','errcatch'); + if ierr <> 0 then bugmes();quit;end + ierr = execstr('res = winqueryreg(''HKEY_CLASSES_ROOT'',''Scilab5.cosf'')','errcatch'); + if ierr <> 0 then bugmes();quit;end +end diff --git a/modules/scicos/tests/unit_tests/scicos_filesassociation.win.dia.ref b/modules/scicos/tests/unit_tests/scicos_filesassociation.win.dia.ref new file mode 100755 index 000000000..04bff1a84 --- /dev/null +++ b/modules/scicos/tests/unit_tests/scicos_filesassociation.win.dia.ref @@ -0,0 +1,13 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2005-2008 - INRIA - Allan CORNET <allan.cornet@inria.fr> +// Copyright (C) 2005-2008 - INRIA - Pierre MARECHAL <pierre.marechal@inria.fr> +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +if getos() == 'Windows' then + ierr = execstr('res = winqueryreg(''HKEY_CLASSES_ROOT'',''Scilab5.cos'')','errcatch'); + if ierr <> 0 then bugmes();quit;end + ierr = execstr('res = winqueryreg(''HKEY_CLASSES_ROOT'',''Scilab5.cosf'')','errcatch'); + if ierr <> 0 then bugmes();quit;end +end diff --git a/modules/scicos/tests/unit_tests/scicos_tests.sci b/modules/scicos/tests/unit_tests/scicos_tests.sci new file mode 100755 index 000000000..5fb571af8 --- /dev/null +++ b/modules/scicos/tests/unit_tests/scicos_tests.sci @@ -0,0 +1,180 @@ + +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +//Test du cas 'define' des fonctions gui des blocs +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function r=checkdefine() + r=%f + for i=1:nb + execstr("gui="+Blocs(i)) + ierr=execstr("x=gui(''define'')","errcatch") + if ierr<>0 then + mprintf("define failed for block "+Blocs(i)); + r=%t + return; + end + clear gui + end +endfunction +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +//Test du cas 'inputs' des fonctions gui des blocs +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function r=checkinputs() + r=%f + for i=1:nb + execstr("gui="+Blocs(i)) + o=gui("define") + ierr=execstr("[x,y,typ]=gui(''getinputs'',o)","errcatch") + if ierr<>0 then + mprintf("getinputs failed for block "+Blocs(i)); + r=%t + return; + end + clear gui + end +endfunction + +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +//Test du cas 'outputs' des fonctions gui des blocs +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function r=checkoutputs() + r=%f + for i=1:nb + execstr("gui="+Blocs(i)) + o=gui("define") + ierr=execstr("[x,y,typ]=gui(''getoutputs'',o)","errcatch") + if ierr<>0 then + mprintf("getoutputs failed for block "+Blocs(i)); + r=%t + return; + end + clear gui + end +endfunction +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +//Test du cas 'origin' des fonctions gui des blocs +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function r=checkorigin() + r=%f + for i=1:nb + execstr("gui="+Blocs(i)) + o=gui("define") + ierr=execstr("[x,y,typ]=gui(''getorigin'',o)","errcatch") + if ierr<>0 then + mprintf("getorigin failed for block "+Blocs(i)); + r=%t + return; + elseif x<>0|y<>0 then + mprintf("getorigin failed for block "+Blocs(i)); + r=%t + return; + end + clear gui + end +endfunction +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +//Test de la taille du vecteur dep_ut +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function r=checkdeput() + r=%f + for i=1:nb + execstr("gui="+Blocs(i)) + o=gui("define"); + dpt=o.model.dep_ut; + if length(o.model.dep_ut)~=2 then + mprintf("check dep_ut failed for block "+Blocs(i)); + r=%t + return; + end + clear gui + end +endfunction + +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +//Test de la taille du vecteur firing +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function r=checkfiring() + r=%f + for i=1:nb + execstr("gui="+Blocs(i)) + o=gui("define"); + dpt=o.model.firing; + if length(o.model.firing)==[] then + mprintf("check firing failed for block "+Blocs(i)); + r=%t + return; + end + clear gui + end +endfunction + +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +//Test de coherence des ports entre model et graphic cas define +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function r=check_define_ports() + r=%f + for i=1:nb + execstr("gui="+Blocs(i)) + o=gui("define"); + opim=o.model.in; + opom=o.model.out; + opeim=o.model.evtin; + opeom=o.model.evtout; + opig=o.graphics.pin; + opog=o.graphics.pout; + opeig=o.graphics.pein; + opeog=o.graphics.peout; + + if size(opim,1)<>size(opig,1) | .. + size(opom,1)<>size(opog,1) | .. + size(opeim,1)<>size(opeig,1) | .. + size(opeom,1)<>size(opeog,1) then + mprintf("check define_ports failed for block "+Blocs(i)); + r=%t + return; + end + clear gui + end +endfunction + +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +//Test de coherence des ports entre model et graphic : cas set +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function r=check_set_ports() + r=%f + prot=funcprot(); + funcprot(0); + scicos_getvalue=setvalue; + funcprot(prot); + alreadyran=%f; %scicos_prob=%f + for i=1:nb + if and(Blocs(i)~=["SUPER_f" "func_block" "scifunc_block" "GENERAL_f" "SOM_f" "CURV_f" "LOOKUP_f"]) then + if Blocs(i)=="fortran_block"|Blocs(i)=="c_block" then + exec("SCI/modules/scicos_blocks/macros/"+Blocs(i)+".sci") + else + exec("SCI/modules/scicos_blocks/macros/"+Blocs(i)+".sci") + end + execstr("gui="+Blocs(i)) + o=gui("define"); + o_n=gui("set",o); + o_npim=o_n.model.in; + o_npom=o_n.model.out; + o_npeim=o_n.model.evtin; + o_npeom=o_n.model.evtout; + o_npig=o_n.graphics.pin; + o_npog=o_n.graphics.pout; + o_npeig=o_n.graphics.pein; + o_npeog=o_n.graphics.peout; + if size(o_npim,1)<>size(o_npig,1) | .. + size(o_npom,1)<>size(o_npog,1) | .. + size(o_npeim,1)<>size(o_npeig,1)| .. + size(o_npeom,1)<>size(o_npeog,1) then + mprintf("check set_ports failed for block "+Blocs(i)); + r=%t + return; + end + clear gui + end + end +endfunction diff --git a/modules/scicos/tests/unit_tests/scicos_time.dia.ref b/modules/scicos/tests/unit_tests/scicos_time.dia.ref new file mode 100755 index 000000000..df93e9e8e --- /dev/null +++ b/modules/scicos/tests/unit_tests/scicos_time.dia.ref @@ -0,0 +1,2 @@ +t=scicos_time(); +if t <> 0 then bugmes();quit;end diff --git a/modules/scicos/tests/unit_tests/scicos_time.tst b/modules/scicos/tests/unit_tests/scicos_time.tst new file mode 100755 index 000000000..2aa9fc8ed --- /dev/null +++ b/modules/scicos/tests/unit_tests/scicos_time.tst @@ -0,0 +1,9 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ????-2008 - INRIA +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +t=scicos_time(); +if t <> 0 then pause,end
\ No newline at end of file diff --git a/modules/scicos/tests/unit_tests/scicosim.dia.ref b/modules/scicos/tests/unit_tests/scicosim.dia.ref new file mode 100755 index 000000000..733e09452 --- /dev/null +++ b/modules/scicos/tests/unit_tests/scicosim.dia.ref @@ -0,0 +1,2 @@ +ierr=execstr("scicosim()","errcatch"); +if ierr <> 77 then bugmes();quit;end diff --git a/modules/scicos/tests/unit_tests/scicosim.tst b/modules/scicos/tests/unit_tests/scicosim.tst new file mode 100755 index 000000000..24a57bff8 --- /dev/null +++ b/modules/scicos/tests/unit_tests/scicosim.tst @@ -0,0 +1,9 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ????-2008 - INRIA +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +ierr=execstr("scicosim()","errcatch"); +if ierr <> 77 then pause,end
\ No newline at end of file diff --git a/modules/scicos/tests/unit_tests/script2var.dia.ref b/modules/scicos/tests/unit_tests/script2var.dia.ref new file mode 100755 index 000000000..b69c3fa46 --- /dev/null +++ b/modules/scicos/tests/unit_tests/script2var.dia.ref @@ -0,0 +1,36 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +loadXcosLibs(); +%txt=["a=1"; +"function r=foo(v)"; +" r=v;"; +"endfunction"; +"b=2"; +"c=foo(3)"; +"d=ones(1,1);"; +""]; +%ll=struct(); +[%ll,%ierr] = script2var(%txt, %ll) + %ierr = + + 0. + %ll = + + d: 1 + c: 3 + b: 2 + a: 1 +[%ll,%ierr] = script2var(%txt, %ll) + %ierr = + + 0. + %ll = + + d: 1 + c: 3 + b: 2 + a: 1 diff --git a/modules/scicos/tests/unit_tests/script2var.tst b/modules/scicos/tests/unit_tests/script2var.tst new file mode 100755 index 000000000..46ddeec70 --- /dev/null +++ b/modules/scicos/tests/unit_tests/script2var.tst @@ -0,0 +1,23 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2013 - Scilab Enterprises +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +loadXcosLibs(); + +%txt=["a=1"; +"function r=foo(v)"; +" r=v;"; +"endfunction"; +"b=2"; +"c=foo(3)"; +"d=ones(1,1);"; +""]; + +%ll=struct(); +[%ll,%ierr] = script2var(%txt, %ll) + +[%ll,%ierr] = script2var(%txt, %ll) + diff --git a/modules/scicos/tests/unit_tests/set_blockerror.dia.ref b/modules/scicos/tests/unit_tests/set_blockerror.dia.ref new file mode 100755 index 000000000..d08fb7460 --- /dev/null +++ b/modules/scicos/tests/unit_tests/set_blockerror.dia.ref @@ -0,0 +1,8 @@ +ierr=execstr("set_blockerror(-1)","errcatch"); +if ierr <> 999 then bugmes();quit;end +ierr=execstr("set_blockerror(-2)","errcatch"); +if ierr <> 999 then bugmes();quit;end +ierr=execstr("set_blockerror(-3)","errcatch"); +if ierr <> 999 then bugmes();quit;end +ierr=execstr("set_blockerror(-16)","errcatch"); +if ierr <> 999 then bugmes();quit;end diff --git a/modules/scicos/tests/unit_tests/set_blockerror.tst b/modules/scicos/tests/unit_tests/set_blockerror.tst new file mode 100755 index 000000000..497f05a37 --- /dev/null +++ b/modules/scicos/tests/unit_tests/set_blockerror.tst @@ -0,0 +1,15 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ????-2008 - INRIA +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +ierr=execstr("set_blockerror(-1)","errcatch"); +if ierr <> 999 then pause,end +ierr=execstr("set_blockerror(-2)","errcatch"); +if ierr <> 999 then pause,end +ierr=execstr("set_blockerror(-3)","errcatch"); +if ierr <> 999 then pause,end +ierr=execstr("set_blockerror(-16)","errcatch"); +if ierr <> 999 then pause,end diff --git a/modules/scicos/tests/unit_tests/set_xproperty.dia.ref b/modules/scicos/tests/unit_tests/set_xproperty.dia.ref new file mode 100755 index 000000000..7a97ac68f --- /dev/null +++ b/modules/scicos/tests/unit_tests/set_xproperty.dia.ref @@ -0,0 +1,4 @@ +ierr=execstr("set_xproperty(1)","errcatch"); +if ierr <> 999 then bugmes();quit;end +ierr=execstr("set_xproperty(-1)","errcatch"); +if ierr <> 999 then bugmes();quit;end diff --git a/modules/scicos/tests/unit_tests/set_xproperty.tst b/modules/scicos/tests/unit_tests/set_xproperty.tst new file mode 100755 index 000000000..9b36e3116 --- /dev/null +++ b/modules/scicos/tests/unit_tests/set_xproperty.tst @@ -0,0 +1,11 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ????-2008 - INRIA +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +ierr=execstr("set_xproperty(1)","errcatch"); +if ierr <> 999 then pause,end +ierr=execstr("set_xproperty(-1)","errcatch"); +if ierr <> 999 then pause,end
\ No newline at end of file diff --git a/modules/scicos/tests/unit_tests/steadycos.dia.ref b/modules/scicos/tests/unit_tests/steadycos.dia.ref new file mode 100755 index 000000000..aebb64bd3 --- /dev/null +++ b/modules/scicos/tests/unit_tests/steadycos.dia.ref @@ -0,0 +1,26 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - INRIA +// Copyright (C) 2009 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- ENGLISH IMPOSED --> +// <-- XCOS TEST --> +ilib_verbose(0); +prot=funcprot(); +funcprot(0); +exec("SCI/modules/xcos/demos/PENDULUM_ANIM.sci"); +exec("SCI/modules/xcos/demos/anim_pen.sci"); +funcprot(prot); +load("SCI/modules/scicos/tests/unit_tests/pendulum_anim45.cos"); +// CBLOCK parameters +M=10; +m=3; +l=3; +ph=0.1; +// INTEGRALs parameters +z0=-4; +th0=0.02; +scs_m = scs_m.objs(5).model.rpar; +[X,U,Y,XP] = steadycos(scs_m,[],[],[],[],1,1:$); diff --git a/modules/scicos/tests/unit_tests/steadycos.tst b/modules/scicos/tests/unit_tests/steadycos.tst new file mode 100755 index 000000000..400d6731c --- /dev/null +++ b/modules/scicos/tests/unit_tests/steadycos.tst @@ -0,0 +1,32 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2008 - INRIA +// Copyright (C) 2009 - DIGITEO +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- ENGLISH IMPOSED --> +// <-- XCOS TEST --> +ilib_verbose(0); + +prot=funcprot(); +funcprot(0); +exec("SCI/modules/xcos/demos/PENDULUM_ANIM.sci"); +exec("SCI/modules/xcos/demos/anim_pen.sci"); +funcprot(prot); +load("SCI/modules/scicos/tests/unit_tests/pendulum_anim45.cos"); + +// CBLOCK parameters +M=10; +m=3; +l=3; +ph=0.1; + +// INTEGRALs parameters +z0=-4; +th0=0.02; + +scs_m = scs_m.objs(5).model.rpar; +[X,U,Y,XP] = steadycos(scs_m,[],[],[],[],1,1:$); + diff --git a/modules/scicos/tests/unit_tests/var2vec.dia.ref b/modules/scicos/tests/unit_tests/var2vec.dia.ref new file mode 100755 index 000000000..a5de265aa --- /dev/null +++ b/modules/scicos/tests/unit_tests/var2vec.dia.ref @@ -0,0 +1,4 @@ +a=list("cos",[1.1,2]); +b=var2vec(a); +if type(b) <> 1 then bugmes();quit;end +if size(b) <> [12 1] then bugmes();quit;end diff --git a/modules/scicos/tests/unit_tests/var2vec.tst b/modules/scicos/tests/unit_tests/var2vec.tst new file mode 100755 index 000000000..5bcf63bf2 --- /dev/null +++ b/modules/scicos/tests/unit_tests/var2vec.tst @@ -0,0 +1,11 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ????-2008 - INRIA +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +a=list("cos",[1.1,2]); +b=var2vec(a); +if type(b) <> 1 then pause,end +if size(b) <> [12 1] then pause,end
\ No newline at end of file diff --git a/modules/scicos/tests/unit_tests/vec2var.dia.ref b/modules/scicos/tests/unit_tests/vec2var.dia.ref new file mode 100755 index 000000000..5c26e363c --- /dev/null +++ b/modules/scicos/tests/unit_tests/vec2var.dia.ref @@ -0,0 +1,5 @@ +a=list("cos",[1.1,2]); +b=var2vec(a); +c=vec2var(b); +if type(c) <> 15 then bugmes();quit;end +if c(1) <> 'cos' then bugmes();quit;end diff --git a/modules/scicos/tests/unit_tests/vec2var.tst b/modules/scicos/tests/unit_tests/vec2var.tst new file mode 100755 index 000000000..ab75a29a7 --- /dev/null +++ b/modules/scicos/tests/unit_tests/vec2var.tst @@ -0,0 +1,12 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) ????-2008 - INRIA +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +a=list("cos",[1.1,2]); +b=var2vec(a); +c=vec2var(b); +if type(c) <> 15 then pause,end +if c(1) <> 'cos' then pause,end
\ No newline at end of file |