scilab-by-dr-gomez-june2014

61
Scilab The Free Numerical Computation Software Dr. Claude Gomez Scilab Enterprises CEO Scilab Week, MMU, Melaka, 9 June 2014 Malaysia Scilab Users Seminar, UPM, 10 June 2014

Upload: ahmad-rbadlishah

Post on 14-Dec-2014

276 views

Category:

Engineering


0 download

DESCRIPTION

It is all abaout Scilab.

TRANSCRIPT

Page 1: Scilab-by-dr-gomez-june2014

Scilab

The Free Numerical Computation

Software

Dr. Claude GomezScilab Enterprises CEO

Scilab Week, MMU, Melaka, 9 June 2014Malaysia Scilab Users Seminar, UPM, 10 June 2014

Page 2: Scilab-by-dr-gomez-june2014

History

Page 3: Scilab-by-dr-gomez-june2014

1 - Scilab made by Inria

2003 – 2007: Scilab Consortium phase 1 (Inria)2008 – 2012: Scilab Consortium phase 2 (DIGITEO Foundation)

2008: Free Scilab (GPL compatible)2009: Xcos industrialization

1980: first MATLAB1980 – 1990: BASILE software at Inria / Simulog

2010: Transfer to Scilab Enterprises Company2012: Exclusivity of trademark, development and publishing of Scilab

1990 – 2003: Open Source Scilab (Research)Scilab freely distributed on the Net in 1994

2 - Scilab industrialization

3 – Scilab Enterprises

Page 4: Scilab-by-dr-gomez-june2014

Scilab Software

Page 5: Scilab-by-dr-gomez-june2014

Scilab Distribution

ScilabPowerful Computation Engine

XcosDynamic Systems Modeling and Simulation

ATOMS

(AuTomatic mOdules Management for Scilab)

Modules Management

Page 6: Scilab-by-dr-gomez-june2014

Scilab: the Free and Open Source Numerical Software

High level programming language

Hundreds of mathematical functions

Advanced data structures & user-defined data types

Computation engine easy to embed into applications

Open System: extended capabilities with professional & specialized modules

Page 7: Scilab-by-dr-gomez-june2014

Scilab: Key Scientific Features

Mathematical functions

Matrix computation, sparse matrices

Polynomials and rational functions

Simulation: ODE and DAE

Classic and robust control, LMI optimization

Differentiable and non differentiable optimization

• Interpolation, approximation

• Signal processing

• Statistics

• Xcos: hybrid dynamical systems modeler and simulator

More than 2,000 functions:

Page 8: Scilab-by-dr-gomez-june2014

XcosDynamic Systems Modeling & Simulation

A user-friendly GUI-based editor for modeling and simulating hybrid dynamical systems as block diagrams: model construction, edition and customization

Integrated Modelica Compiler

Freely Available and distributed with Scilab

Page 9: Scilab-by-dr-gomez-june2014

Xcos main features

• Graphically model, compile, and simulate dynamical systems• Combine continuous and discrete-time behaviors in the same model• Select model elements from Palettes of standard blocks• Program new blocks in C, Fortran, or Scilab language

• HDF5 standard which has been chosen to guarantee data exchanges between Scilab and Xcos Editor

• Free Modelica compiler which enables the simulation of implicit diagrams• Graphical user interface based on JGraphX

Page 10: Scilab-by-dr-gomez-june2014

Coselica external module for multiphysics simulation

200 acausal blocks (in Modelica language):

• Analogical electrical systems.

• Mechanical systems: 1-D (translations, rotations) and 2-D planar.

• Thermic exchanges 0-D/1-D.

Page 11: Scilab-by-dr-gomez-june2014

User-friendly Environment: easy to program

Variable BrowserFile Browser

Command History

Console

Page 12: Scilab-by-dr-gomez-june2014

2-D/3-D VisualizationEditor

Embedded Help

External Modules Manager

Variable Editor

Page 13: Scilab-by-dr-gomez-june2014

Graphical User Interfaces

Great number of functionalities to create Graphical User Interfaces

Accessible from Scilab

Interaction between GUI and plots

Fully integrated in OS environment

Page 14: Scilab-by-dr-gomez-june2014

Latest release: Scilab 5.5.0 (April 2014)

What’s new?

Graphics: speed (Matplot),

datatips, interactions, 3-D

lightning

Graphical User Interface: new UI

Controls

Remote file Access (sciCurl)

Scilab/MPI (Message Passing

Interface)

Java Integration (JIMS)

HDF5 management

Localization of external modules

Works under Windows XP/Vista/7/8, GNU/Linux

and Mac OS X, 32 bits and 64 bits

Page 15: Scilab-by-dr-gomez-june2014

Links with other language and software

Management of C, C++, Fortran, Java, Python, .net... from Scilab: JIMS module for Java

Available as a computing engine with C, C++, Java, Python, .net API...

Links with:

– Excel®, COM/DCOM® (Microsoft),

– Labview® (National Instruments),

– Isight® (Dassault Systèmes),

– Alternova® (Eurodecision),

– modeFRONTIER® (ESTECO),

– etc.

Page 16: Scilab-by-dr-gomez-june2014

Scilab Future

Page 17: Scilab-by-dr-gomez-june2014

Scilab: Main Development Axis

Covering strategic fields

From HPC to multicore:Scilab 6 with new kernel

Embedded systems:C code generation with Xcos

Extending Scilab & Xcos

Interface with main simulation software

Dedicated sectorial modules

Page 18: Scilab-by-dr-gomez-june2014

New kernel ready for:

• HPC: multithreading, parallelism

detection,…

• Code generation

• Debugging

Scilab for the Future: Scilab 6

Language: ascendant compatibility ensured

Memory:

• Scilab memory is only limited by hardware

• Dynamic memory allocation

New parser:

• Native multi dimensional types and lists

• Error management

Page 19: Scilab-by-dr-gomez-june2014

Scilab Community

Page 20: Scilab-by-dr-gomez-june2014

Scilab in the World

About 100,000 monthly downloads from 150 countries on www.scilab.org

Page 21: Scilab-by-dr-gomez-june2014

Main French Scilab Users

Main industrial sectors

Aerospace: Airbus Group, CNES, Safran, Dassault Aviation

Transportation: Renault, LEONI, Siemens, Alstom, Faurecia

Mechanical: ArcelorMittal, Aperam

Energy: EDF, RTE, CEA, Total, IFP

Defence: DGA, THALES

Health: SANOFI

Telecom: Orange

Earth Science: BRGM, Eramet

Academics, education

High schools

Engineering schools

Universities

In red: Scilab Enterprises customers

Page 22: Scilab-by-dr-gomez-june2014

Organization

Page 23: Scilab-by-dr-gomez-june2014

Company created in June 2010 from Inria

The official structure resulting of the Scilab Consortium which had developed Scilab since 2003

Jacques DhellemmesPresident

Claude GomezCEO

Christian SaguezVice President

Denis RanqueBoard Administrator

A high level team who has extensive knowledge of Scilab software and its environment and benefits directly from the Scilab developers expertise.

Scilab Enterprises relies on the historical and technical knowledge of the Scilab Consortium which develops Scilab software since 2003.

Scilab Enterprises

Page 24: Scilab-by-dr-gomez-june2014

Activities

Scilab = Free software

funding

Scilab Enterprises

• Services:

– Consulting

– Migrations to Scilab

– Specific in-house versions

– Development and optimization of

applications

• Products:

– Training and support

– Scilab LTS (« Long Term Support »)

– External commercial modules

development

publishing

Page 25: Scilab-by-dr-gomez-june2014

International Partnership Committee

President: Gérard Poirier (Dassault Aviation)

The International Scilab User’s Group

Role

• Management of Scilab users and developers

• Promotion of Scilab

• Roadmap and external modules proposals

• All kinds of exchanges around Scilab

Creation of regional groups

Page 26: Scilab-by-dr-gomez-june2014

Extending Scilab

Page 27: Scilab-by-dr-gomez-june2014

What does “free” means

Scilab Enterprises Commitment

Mission given by InriaThe Scilab distribution is and will

remain Free and Open Source

The Scilab distribution = what isdownloaded from “www.scilab.org”

• Mathematical functions• Language• Graphics, GUI• Xcos• ATOMS

Scilab license: CeCILL, GPL compatible

Scilab includes GPL code

=

Page 28: Scilab-by-dr-gomez-june2014

External modules: Open Source or not Free or commercial

EM

EM

Scilab: Free and Open Source

...

Page 29: Scilab-by-dr-gomez-june2014

Graphics

GUIFortran and C code

(800,000 lines)

Scilab code

(150,000 lines)

Computation libraries

Parser

Interpreter

API

Docu

menta

tion

Scilab internals

User

External Module

External Module

External

Module

700 functions

1300 functions

XML

JAVA

External

Module

Page 30: Scilab-by-dr-gomez-june2014

Make a complete application using the good language

Fortran, C, C++

Scilab Code (including UI

Control)

Java

Scilab API:create a C gateway

JIMS = Java Interaction Mechanism in Scilab

You can use your own existing code without modifying it

Page 31: Scilab-by-dr-gomez-june2014

External modules

EM

EM

Scilab

ATOMSsystem

ATOMS: the external module manager

Advantages of ATOMS modules:

Independent of Scilab releases issues:

easy update

Works on all architectures (Fortran, C or

C++ code compiled on Windows, Mac OS X,

Linux)

Handling of dependencies between

modules

...

Page 32: Scilab-by-dr-gomez-june2014

User implementation

Organize the Scilab module according to instructions:

http://atoms.scilab.org

The module can include:

Scilab, Fortran, C, C++, Fortran code, XML help files

Upload source of Scilab module to ATOMS Scilab

site Module available from Scilab

“ATOMIZATION” by Scilab Enterprises

For Companies: an internal ATOMS server can be installed

Fast deployment and easy maintenance

Page 33: Scilab-by-dr-gomez-june2014

ATOMS modules are loaded and installed interactively from Scilab from the

“Applications” menu

Page 34: Scilab-by-dr-gomez-june2014

Why Using Scilab?

Page 35: Scilab-by-dr-gomez-june2014

Scilab Advantages

Scilab is free software

– Easy to install everywhere

– Large community of users

But freedom is not enough

A friendly software with a lot of functionalities

– Included toolboxes for most of applied mathematics

– Own dedicated OpenGL graphics

– Xcos comparable to Simulink

– Easy to add interactively external module

A comprehensive organization takes care of Scilab

– Scilab developed professionally by Scilab Enterprises

– Supports and services

– IPC Scilab Users Group with important Companies

Page 36: Scilab-by-dr-gomez-june2014

How Using Scilab?

Page 37: Scilab-by-dr-gomez-june2014

Scilab as a Powerful Graphical Calculator

Matrix computations:A=rand(1000,1000); b=rand(1000,1);

x=A\b; norm(A*x-b)

vp=spec(A);

2D plots:plot(real(vp),imag(vp),"*r");

x=linspace(-%pi,%pi,1000);

clf; plot(x,sin(x),"r",x,cos(x),"g");

3D curve:k=tan(%pi/27);t=linspace(-40,40,1000);

x=cos(t)./cosh(k*t); y=sin(t)./cosh(k*t); z=tanh(k*t);

clf; param3d(x,y,z);

Page 38: Scilab-by-dr-gomez-june2014

3D beautiful surface: 90,000 pointsfunction z=f(x,y) // function defining the surface

z=exp(exp(-x^2-y^2)*(exp(cos(x^2+y^2)^20)+..

8*sin(x^2+y^2)^20+2*sin(2*(x^2+y^2))^8));

endfunction

x=linspace(-1.5,1.5,300); y=linspace(-1.5,1.5,300); z=feval(x,y,f);

f=scf(0); f.color_map=rainbowcolormap(32);

surf(x,y,z); // plot the surface

e=gce(); e.color_mode=-1;

a=gca(); a.box="off";

a.axes_visible=["off","off","off"];

a.x_label.visible="off";

a.y_label.visible="off";

a.z_label.visible="off";

Page 39: Scilab-by-dr-gomez-june2014

Example: we want to plot data in 2D with color according to the value of the points, modify data and plot again

Data are given in text file mandel.txt (2 million points, 19 Mb).

1. Put data into Scilab matrix M:

M=fscanfMat("mandel.txt");

2. Open graphics window, choose beautiful colormap and plot points according to its value:

f=scf(1); f.color_map = rainbowcolormap(256);

Matplot(M);

3. Discard points with value between 50 and 210 and plot in another window:

M(find(50<M & M<210))=1;

f=scf(2); f.color_map = rainbowcolormap(256);

Matplot(M);

A very usual use: 1. Get data. 2. Plot Data. 3. Modify data and plot again.

Page 40: Scilab-by-dr-gomez-june2014

First plot Second plot

Plotting is instantaneous:

Page 41: Scilab-by-dr-gomez-june2014

To read text file takes time:

M=fscanfMat("mandel.txt"); // 5 seconds

1. Save matrix into binary SOD (Scilab Open Data) based on HDF5 standard:

save("mandel.sod","M"); // 0.04 second

2. Loading into Scilab is now very fast:

load("mandel.sod"); // 0.1 second

Page 42: Scilab-by-dr-gomez-june2014

Programming in Scilab

Friendly editor, powerful mathematical language close to natural language:

function u=Newton(f,fprim,u0,eps)

u=u0;

while abs(f(u))>eps then

fp=fprim(u);

if abs(fp)<=%eps then

error("singularity")

end

u=u-f(u)/fp

end

endfunction

About 1,300 Scilab functions are written in Scilab

Page 43: Scilab-by-dr-gomez-june2014

function x=Gauss(A,b,eps)

n=size(b,"*"); x=b;

for k=1:n-1

// when the diagonal term is close to 0

// searching for a non zero element in the column

if abs(A(k,k))<eps then

kk=find(abs(A(k:n,k))>eps);

if kk==[] then

disp(“Non invertible Matrix");

return;

end

// exchanging lines k and kk in A and in b

kk=kk(1);

lignek=A(k,:); A(k,:)=A(kk,:); A(kk,:)=lignek;

lignek=b(k); b(k)=b(kk); b(kk)=lignek;

end

// Gauss algorithm

for l=k+1:n

p=A(l,k)/A(k,k);

for m=k:n

A(l,m)=A(l,m)-A(k,m)*p;

end

x(l)=x(l)-x(k)*p;

end

end

if abs(A(n,n))<eps then

disp("Non invertible Matrix ");

return;

end

// compute x

x(n)=x(n)/A(n,n);

for i=n-1:-1:1

s=0;

for j=i+1:n

s=s+A(i,j)*x(j);

end

x(i)=(x(i)-s)/A(i,i);

end

endfunction

Gaussian elimination with partial pivoting:

Scilab vectorized syntax

Page 44: Scilab-by-dr-gomez-june2014

Save and load GUI as XML files :

Save GUI with:

saveGui(f,"mygui.xml");

Load GUI with:

f=loadGui("mygui.xml");

Making easy Scilab GUI with Scilab 5.5.0

New components, speed, default look and feel of the OS

Page 45: Scilab-by-dr-gomez-june2014

Migration from Matlab to Scilab: fast ROI

Migration from Excel to Scilab: GUI, faster computations, easy deployment and maintenance, easy evolution

BRGM Example 1

Scilab as a computation engine for other software: LabVIEW, iSight, ModFRONTIER,…

Make complete application as Scilab modules:– Used on site for production: ARCELORMITTAL, SANOFI, SNECMA,…

– For internal use: AIRBUS GROUP, BRGM, CNES, DASSAULT AVIATION, EDF…

– For scientific domains:• Space mechanics: CelestLab by CNES Example 2

• Optimization platform: SOP with DASSAULT AVIATION Example 3

For Industry

Page 46: Scilab-by-dr-gomez-june2014

Example 1: from Excel to Scilab, BRGM

Page 47: Scilab-by-dr-gomez-june2014

Example 2: CelestLab

ATOMS module for space mechanics and

flight dynamics made by CNES

Freely available and Open Source

Used by CNES and ESA for mission analysis

Library of Scilab code: functions easily re-used for

making new programs

Page 48: Scilab-by-dr-gomez-june2014

CelestLab: A free and open source Scilab library for flight dynamics

CelestLab topics

Topics Contents

Coordinates and Frames - Change of coordinates

- Dates manipulation

- Change of reference frames

- Orbital element transformations

- Rotations and quaternions

Geometry and Events - Orbital events computation

- Orbital geometry

Interplanetary - Interplanetary transfer

- Three body analysis

Models Earth motion, density models

Orbit properties - Keplerian formulas

- Orbit characteristics (sun synchronism, repeat orbits, frozen orbits)

Relative motion Chlohessy-Wiltshire formalism

Trajectory and manoeuvres - Orbit propagation (analytical)

- Manoeuvre computation

- Dispersion analysis

Utilities - Various support functions including graphics

Page 49: Scilab-by-dr-gomez-june2014

CelestLab: A free and open source Scilab library for flight dynamics 49

CelestLab and mission analysis practices

■Coding Scilab scripts using CelestLab is easy. This

encourages people to develop their own scripts.

■CelestLab is developed by people in charge of mission

analysis. It is a shared product.

■When an analysis is completed, there is an assessment on

whether a part can be incorporated in CelestLab.

■CelestLab demos are a efficient solution for answering

recurrent questions and can easily modified if needed.

■CelestLab is well documented and is more and more used as a

source of information on a laptop.

Page 50: Scilab-by-dr-gomez-june2014

CelestLab: A free and open source Scilab library for flight dynamics 50

Examples of computation made with CelestLab:

1 - Sun elevation from any location on Earth

Page 51: Scilab-by-dr-gomez-june2014

CelestLab: A free and open source Scilab library for flight dynamics 51

2 - Sun reflection point (glint)

Page 52: Scilab-by-dr-gomez-june2014

CelestLab: A free and open source Scilab library for flight dynamics 52

3 - Ground stations visibility

Page 53: Scilab-by-dr-gomez-june2014

Example 3: SOP

Optimization platform made with DASSAULT AVIATION

OMD2 and CSDL French funded R & D projects

Open Source and freely available: ATOMS module in the future

Comprehensive application with GUI

Library of C and Scilab code

Typical example of a complete Scilab industrial application:

– Friendly interactive user interface masking the complexity to the final user

– Possibility to try various algorithms, to make comparisons

– Possibility to add its own functions and algorithms

– Visualization and interaction with graphics

Page 54: Scilab-by-dr-gomez-june2014

Interactive Graphics User Interface

Three modules:

Data management

Modeling

Optimization

Project management:

Saving and loading

Visualization and graphical interaction at each level

Page 55: Scilab-by-dr-gomez-june2014

Data management

Load and generate existing DOE (iSight,…) : possibility to add its own DOE generator

Response simulation using external tools (openFOAM, CATIA, CCM+,…) or Scilab functions

2D visualization of factors

and responses

Page 56: Scilab-by-dr-gomez-june2014

Modeling

Selection among various modelers: DACE,

LOLIMOT,…

Parameter configuration

Multiple model management with best model

selection

Possibility to select points:– Learning point

– Validation or points

– Bad points (simulation issues,…)

Page 57: Scilab-by-dr-gomez-june2014

Modeling: execution and 2D visualization

Response: all factors, two factors

Correlation

Page 58: Scilab-by-dr-gomez-june2014

Optimization

Responses coefficients setting

Optimizer:

– Selection between various algorithms: optim,

fmincon, genetic,…

– Possibility to add its own algorithm

– Interactive configuration

Visualization:

– Optimal point

– Pareto frontier

– Robustness

Page 59: Scilab-by-dr-gomez-june2014

Conclusion

Page 60: Scilab-by-dr-gomez-june2014

Scilab

is

The Professional Free

Software for Numerical Computation

Industry, Education and Research

Page 61: Scilab-by-dr-gomez-june2014