Scilab Challenge@NTU 2014/2015 Project Briefing

34
LEE Kar Heng, Ph.D Chief, TBSS Group SCILAB CHALLENGE@NTU Project Briefing

description

Project Briefing 10 October 2014 2.30 pm to 4.30 pm NTU

Transcript of Scilab Challenge@NTU 2014/2015 Project Briefing

Page 1: Scilab Challenge@NTU 2014/2015 Project Briefing

LEE Kar Heng, Ph.DChief, TBSS Group

SCILAB CHALLENGE@NTUProject Briefing

Page 2: Scilab Challenge@NTU 2014/2015 Project Briefing

2

THE TBSS-SCILAB PARTNERSHIP

• Singapore (TBSS-Scilab Singapore Center)• Vietnam (TBSS Khai Kinh Co. Ltd.)• Oversees and Manages Scilab activities in

– Training and Education– Project and Consultancy – Migration and Deployment– Specialized Developments– Scilab User Group Management, Operations and Support

• Manages, administers and funds the Singapore and Vietnam Scilab User Groups

• Manages Scilab projects in Singapore and Vietnam

Page 3: Scilab Challenge@NTU 2014/2015 Project Briefing

3

PROJECT OBJECTIVES

• To promote use of Scilab in academic institutions, currently NTU and TP

• To facilitate the use of Scilab to solve a specific problem

• To enable the students appreciate Scilab• To provide a channel for students to present

findings in the ScilabTec2015 conference, Paris• To reward capable students accordingly

Page 4: Scilab Challenge@NTU 2014/2015 Project Briefing

4

THE SCILAB CHALLENGE PROJECT

• Scilab Challenge 2014/2015 requires students to work on a project that uses Scilab as the main scientific tool in the simulation and computation of the solution to the problem they are investigating

• Top 5 projects will be presented with cash prize of SGD300.00, certificate and medal

• All participants will be presented certificate and medal• Identified projects will be required to submit a technical

paper to the ScilabTEC2015 Committee• The selected project team will be sponsored to present the

findings at the ScilabTEC2015 Conference in Paris

Page 5: Scilab Challenge@NTU 2014/2015 Project Briefing

BENEFITS

• Gain skillset in use of Scilab• Participation in project gives advantage in

seeking employment• Participation in international conference is

widely accepted as a professional recognition• Possibility to work for Scilab Enterprise, TBSS-

Scilab or other Scilab partners

5

Page 6: Scilab Challenge@NTU 2014/2015 Project Briefing

6

SCILAB CHALLENGE@NTU

• The problem is “A Radar Design Toolbox for Scilab and XCos”

• Important dates:15/10/14 – registration closed15/12/14 – submit a one-page report22/12/14 – announce selected projects30/04/15 – submit a 6-page final report11/05/15 – prize presentation 21/05/15 – ScilabTEC2015

Page 7: Scilab Challenge@NTU 2014/2015 Project Briefing

PROJECT DESCRIPTION

• The problem is “A Radar Design Toolbox for Scilab and XCos”• The objectives of this project include investigations, design,

simulation and development of a set of development tools using Scilab and XCos

• The development tool shall allow users to configure a radar system with different antennas, transmitter, receiver, and other subsystems

• The project also aims to simulate a typical entire radar system into model through the use of the developed tool and predict the behavior of system’s output

• A series of plots shall be presented for user to analyze the performance of the system design

Page 8: Scilab Challenge@NTU 2014/2015 Project Briefing

PROJECT DESCRIPTION

• To achieve this main objective, it is necessary to analyse, and research and carry out simulations of radar equations, algorithm related on to the radar

• Conduct a detailed survey study of radar signal processing • Develop the XCos models and write Scilab programs for

various radar system components. • These components can be connected to give a complete radar

system. • The development tool will then simulate the entire radar

system and present plots for users to performance analyse and evaluation

Page 9: Scilab Challenge@NTU 2014/2015 Project Briefing

PROJECT DESCRIPTION

• An illustration:

Page 10: Scilab Challenge@NTU 2014/2015 Project Briefing

PROJECT SUPPORT

• Community support– TBSS-Scilab User Group at Facebook (General enquiries on Scilab)– Scilab Challenge@NTU 2014/2015 (Project related matters,

announcement, …)

• Contact – Lee Kar Heng ([email protected]) (project matters)– Tan Thiam Huat ([email protected]) (Scilab matters)

Page 11: Scilab Challenge@NTU 2014/2015 Project Briefing

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

HISTORY

Page 12: Scilab Challenge@NTU 2014/2015 Project Briefing

• ScilabPowerful Computation Engine

• XcosDynamic Systems Modeling and Simulation

• ATOMS (AuTomatic mOdules Management for Scilab)Module Management

SCILAB DISTRIBUTION

Page 13: Scilab Challenge@NTU 2014/2015 Project Briefing

• 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

SCILAB: FREE AND OPEN SOURCE

Page 14: Scilab Challenge@NTU 2014/2015 Project Briefing

• 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:

KEY SCIENTIFIC FEATURES

Page 15: Scilab Challenge@NTU 2014/2015 Project Briefing

• Dynamic System Modeling and 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

XCOS

Page 16: Scilab Challenge@NTU 2014/2015 Project Briefing

• 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

XCOS MAIN FEATURES

Page 17: Scilab Challenge@NTU 2014/2015 Project Briefing

Variable Browser

File Browser

Command History

Console

PROGRAMMING ENVIRONMENT

Page 18: Scilab Challenge@NTU 2014/2015 Project Briefing

2-D/3-D VisualizationEditor

Embedded Help

External Modules Manager

Variable Editor

PROGRAMMING ENVIRONMENT

Page 19: Scilab Challenge@NTU 2014/2015 Project Briefing

• Great number of functionalities to create Graphical User Interfaces

• Accessible from Scilab

• Interaction between GUI and plots

• Fully integrated in OS environment

GRAPHICAL USER INTERFACES

Page 20: Scilab Challenge@NTU 2014/2015 Project Briefing

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

• Mathematics and linear algebra

• Simulation

• Visualization

• Control

• Optimization

• Probabilities, statistics

• Signal processing

LATEST RELEASE SCILAB 5.5.0

Page 21: Scilab Challenge@NTU 2014/2015 Project Briefing

• 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.

LINKS WITH OTHER LANGUAGES

Page 22: Scilab Challenge@NTU 2014/2015 Project Briefing

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

LINKS WITH OTHER LANGUAGES

Page 23: Scilab Challenge@NTU 2014/2015 Project Briefing

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 (French high

schools) Engineering schools (TP, …) Universities (HCMUT, NUT,

SUTD, …)

In red: Scilab Enterprises customers

USERS

Page 24: Scilab Challenge@NTU 2014/2015 Project Briefing

Scilab is free software

– Easy to install everywhere

– Large community of users

But freedom is not enoughA 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

CHANGING TO SCILAB

Page 25: Scilab Challenge@NTU 2014/2015 Project Briefing

Scilab is not a clone of Matlab• Very similar languages• Same simple graphics functions: plot, bar, mesh, pie,

surf

• But different syntax and semantics for many functions:- Syntax example: “eigen” vs. “spec”- Semantics example: “max” function- Different management of source files

Matlab / Scilab dictionary available in the Scilab help

SCILAB … MATLAB

Page 26: Scilab Challenge@NTU 2014/2015 Project Briefing

• 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);

SCILAB AS A CALCULATOR

Page 27: Scilab Challenge@NTU 2014/2015 Project Briefing

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));endfunctionx=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 surfacee=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";

SCILAB AS A CALCULATOR

Page 28: Scilab Challenge@NTU 2014/2015 Project Briefing

To plot data in 2D with color according to the value of the points, modify data and then 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);

SCILAB AS A PLOTTING TOOL

Page 29: Scilab Challenge@NTU 2014/2015 Project Briefing

First plot Second plot

Plotting is instantaneous:

SCILAB AS A PLOTTING TOOL

Page 30: Scilab Challenge@NTU 2014/2015 Project Briefing

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

SCILAB FILE HANDLING

Page 31: Scilab Challenge@NTU 2014/2015 Project Briefing

• 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 endendfunction

About 1,300 Scilab functions are written in Scilab

SCILAB PROGRAMMING

Page 32: Scilab Challenge@NTU 2014/2015 Project Briefing

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

Gaussian elimination with partial pivoting:

Scilab vectorized syntax

SCILAB PROGRAMMING

// 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); endendfunction

Page 33: Scilab Challenge@NTU 2014/2015 Project Briefing

Save and load GUI as XML files :• Save GUI with:

saveGui(f,"mygui.xml");

• Load GUI with:f=loadGui("mygui.xml");

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

GUI WITH SCILAB 5.5.0

Page 34: Scilab Challenge@NTU 2014/2015 Project Briefing

Scilabis

The Professional Free Software for Numerical

Computation

Industry, Education and Research