LEE Kar Heng, Ph.D Chief, TBSS Group SCILAB CHALLENGE@NTU Project Briefing
May 27, 2015
LEE Kar Heng, Ph.DChief, TBSS Group
SCILAB CHALLENGE@NTUProject 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
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
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
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
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
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
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
PROJECT DESCRIPTION
• An illustration:
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)
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
• ScilabPowerful Computation Engine
• XcosDynamic Systems Modeling and Simulation
• ATOMS (AuTomatic mOdules Management for Scilab)Module Management
SCILAB DISTRIBUTION
• 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
• 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
• 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
• 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
Variable Browser
File Browser
Command History
Console
PROGRAMMING ENVIRONMENT
2-D/3-D VisualizationEditor
Embedded Help
External Modules Manager
Variable Editor
PROGRAMMING ENVIRONMENT
• 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
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
• 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
About 100,000 monthly downloads from 150 countries on www.scilab.org
LINKS WITH OTHER LANGUAGES
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
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
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
• 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
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
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
First plot Second plot
Plotting is instantaneous:
SCILAB AS A PLOTTING TOOL
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
• 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
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
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
Scilabis
The Professional Free Software for Numerical
Computation
Industry, Education and Research