Scilab Interaction with other software

32
The free and open source software for numerical computation Scilab Interaction with other software June 29 th 2011 Allan CORNET & Sylvestre LEDRU Scilab Consortium

Transcript of Scilab Interaction with other software

Page 1: Scilab Interaction with other software

The free and open source software for numerical computation

Scilab Interaction with other software

June 29th 2011

Allan CORNET & Sylvestre LEDRUScilab Consortium

Page 2: Scilab Interaction with other software

The free and open source software for numerical computation

Interaction to make Scilab the reference in numerical computation

● In interacting with new application fields,

● In acquiring new functionalities,

● In facilitating the communication, exchange and collaboration with other software,

● In integrating the results of the most recent scientific breakthroughs in the field of numerical computation.

Page 3: Scilab Interaction with other software

The free and open source software for numerical computation

Key Advantages

● For Scilab Users:

– No need to learn another software,

– Adapt and use the software according to their needs,

– Develop exchanges and facilitate collaboration among different users communities.

● For Scilab Software:

– Give access to Scilab features from another software and vice versa,

– Add functionalities to Scilab in several areas,

– Enhance the scope of use of Scilab.

Page 4: Scilab Interaction with other software

The free and open source software for numerical computation

Interactiondeveloped by Scilab Consortium

The free and open source software for numerical computation

Page 5: Scilab Interaction with other software

The free and open source software for numerical computation

Scilab and LabVIEW®LabVIEW is a trademark of National Instruments

Page 6: Scilab Interaction with other software

The free and open source software for numerical computation

Scilab and LabVIEW®

● Gateway jointly developed by National Instruments and the Scilab

Consortium

● Allow to access to Scilab from LabVIEW

● Upraising the specter of both software

● Facilitate collaboration between the two communities of users

● Avoid lengthy and expensive code rewriting

Page 7: Scilab Interaction with other software

The free and open source software for numerical computation

Integrate Scilab scripts to LabVIEW®

Page 8: Scilab Interaction with other software

The free and open source software for numerical computation

● Implement equations or textual

algorithms in Scilab node

● Define your inputs/outputs

variables

● Connect inputs/outputs.

Maths with Scilab node

Page 9: Scilab Interaction with other software

The free and open source software for numerical computation

Scilab and Excel® Excel is a trademark of Microsoft Corporation

Page 10: Scilab Interaction with other software

The free and open source software for numerical computation

Control Excel® from Scilab

• xls_link: http://atoms.scilab.org/toolboxes/xls_link

• Take the control of Excel® from Scilab:• // Call a new instance of Excel• r = xls_NewExcel();• // Create a Workbook• xls_AddWorkbook();• // Set Worksheet 1 (visible on)• xls_SetWorksheet(1);• // set visible excel windows• xls_SetVisible(%t);• // send data to excel• xls_SetData("A2", eye(10,10))• // get data from excel• M = xls_GetData(xls_CalculateRange("A2",[10,10]))

Page 11: Scilab Interaction with other software

The free and open source software for numerical computation

Using Scilab as an Add-in in Excel®

● Scilab XLLhttp://atoms.scilab.org/toolboxes/Scilab_XLL

● Scilab XLL connects Excel® spreadsheet software with Scilab workspace. With Scilab XLL, you can exchange data between Scilab and Excel

● SLEvalString: evaluate command in Scilab software

● SLGetMatrix: write contents of Scilab matrix to Excel worksheet

● SLPutMatrix: create or overwrite Scilab matrix with data from Excel worksheet

Page 12: Scilab Interaction with other software

The free and open source software for numerical computation

OLE/COM Client for Scilab (beta)

• Automation module for Scilab:

http://forge.scilab.org/index.php/p/ole

• Provide a Component Object Model Client to call and interoperate with code written in any other language (COM aware)

• COM is one of the main ways to glue applications and components together on Windows platforms.

Page 13: Scilab Interaction with other software

The free and open source software for numerical computation

OLE/COM Client for Scilab (beta)

Example

We call VBScript from Scilab :

• pScript = ole_actxserver('MSScriptControl.ScriptControl')

• ole_set(pScript, 'Language', 'VBScript')

• ole_invoke(pScript,'Eval','MsgBox(""Hello world"")') ;

• ole_invoke(pScript,'Eval','68 + 1')

• ole_delete(pScript)

Page 14: Scilab Interaction with other software

The free and open source software for numerical computation

Interactiondeveloped by our partners

The free and open source software for numerical computation

Page 15: Scilab Interaction with other software

The free and open source software for numerical computation

Scilab and modeFRONTIER® modeFRONTIER is a trademark of Esteco s.r.l.

Page 16: Scilab Interaction with other software

The free and open source software for numerical computation

modeFRONTIER®

● Developed by Esteco

● modeFRONTIER is a multidisciplinary and multi-objective software written to allow easy coupling to almost any computer aided engineering (CAE) tool,

● Mainly used in:

– Integration,

– Optimization,

– Post-processing.

Page 17: Scilab Interaction with other software

The free and open source software for numerical computation

Scilab and modeFRONTIER®

● Gateway developed by Esteco and supported by EnginSoft France

● Scilab node: Edit and execute Scilab scripts from modeFRONTIER

● External Scheduler Bridge:

– Use Scilab as an external solver/optimizer,

– Transparently handle the communications between Scilab and the modeFRONTIER workflow.

Page 18: Scilab Interaction with other software

The free and open source software for numerical computation

Scilab and Isight®Isight is a trademark of Dassault Systèmes

Page 19: Scilab Interaction with other software

The free and open source software for numerical computation

Isight®

● Developed by Dassault Systèmes

● Open desktop solution for simulation process automation and design optimization from SIMULIA, the Dassault Systèmes brand for realistic simulation.

Page 20: Scilab Interaction with other software

The free and open source software for numerical computation

Scilab and Isight®

● Gateway jointly developed by Dassault Systèmes and the Scilab Consortium within CSDL project (Systematic Paris-Région Competitiveness Cluster) on-going development

● Scilab activity: edit and execute Scilab scripts from Isight

● Approximation module: interface Scilab modeling tools to Isight

● Optimization module: interface Scilab optimization algorithms to Isight

Page 21: Scilab Interaction with other software

The free and open source software for numerical computation

Scilab and DAKOTA®DAKOTA is a trademark of Sandia Corporation

Page 22: Scilab Interaction with other software

The free and open source software for numerical computation

DAKOTA®

● Developed by the Sandia National Laboratories

● DAKOTA is a Multilevel Parallel Object-Oriented Framework for design optimization, parameter estimation, uncertainty quantification, and sensitivity analysis.

Page 23: Scilab Interaction with other software

The free and open source software for numerical computation

Scilab and DAKOTA®

● GSOC 2011 project / Partnership with Hutchinson

● Scilab called by DAKOTA for DOE, modeling, optimization…

● External interface: file communication

● Internal interface: memory communication

DAKOTA

SCILAB

params.in

result.out

f.sci – fp.sci – fpp.sci

dakscilabconfig.i

n

config.in

DAKOTA

SCILAB

structure.sci

Page 24: Scilab Interaction with other software

The free and open source software for numerical computation

How to make interaction possible?

The free and open source software for numerical computation

Page 25: Scilab Interaction with other software

The free and open source software for numerical computation

call_scilab: Scilab as a computing engine

• Access to Scilab features from native code (ie thirdparty application)

• C or C++ API. Similar syntax to api_scilab

• Send and retrieve Scilab variables to/from Scilab

ScilabEngine

Call_Scilab Application

Page 26: Scilab Interaction with other software

The free and open source software for numerical computation

call_scilab: Example

0001 /* 0002 * Write a matrix into Scilab0003 * B=[1 4 2 3; 0004 * 3 9 8 2 ]0005 * Note that it is done column by column0006 */ 0007 double B[] = { 1,3,4,9,2,8,3,2} ; /* Declare the matrix */

0008 int rowB = 2, colB = 4; /* Size of the matrix */0009 char variableNameB[] = ”B”;0010 0011 /*0012 * Write it into Scilab’s memory 0013 */0014 createNamedMatrixOfDouble(pvApiCtx,variableNameB,rowB,colB, B);0015 0016 printf(”Display from Scilab of B:\ n”);0017 SendScilabJob(”disp(B);”); /* Display B *

Display from Scilab of B: 1. 4. 2. 3. 3. 9. 8. 2.

C code: Final output:

Page 27: Scilab Interaction with other software

The free and open source software for numerical computation

javasci: Scilab as a computing engine for Java

• Access to Scilab features from Java

• Based on call_scilab

• New version introduced in Scilab 5.3.0

• Provide mapping of Scilab variables in Java

• Send and retrieve Scilab variables to/from Scilab

ScilabEngine

Javasci Application

Page 28: Scilab Interaction with other software

The free and open source software for numerical computation

Javasci v2: Example

Java code:0001 // A simple Java example with javasci v20002 // Filename: DisplayPI.java0003 0004 import org.scilab.modules.javasci.Scilab;0005 import org.scilab.modules.types.ScilabType;0006 import org.scilab.modules.types.ScilabDouble;0007 0008 class Example1 { 0009 0010 public static void main(String[] args) { 0011 0012 try { 0013 Scilab sci = new Scilab();0014 sci.open();0015 sci.exec(”disp(%pi);”);0016 0017 double [][]data={ { 42, Math.PI} } ;0018 ScilabDouble a = new ScilabDouble(data);0019 sci.put(”a”,a);0020 sci.exec(”b=cos(a);”);0021 ScilabType b = sci.get(”b”);0022 System.out.println(”b = ” + b);0023 0024 sci.close();0025 0026 } catch (org.scilab.modules.javasci.JavasciException e) { 0027 System.err.println(”An exception occurred: ” + e.getLocalizedMessage());0028 } 0029 0030 } 0031 }

b = [-0.39998531498835127, -1.0] 3.1415927

Output:

Page 29: Scilab Interaction with other software

The free and open source software for numerical computation

And more to come

The free and open source software for numerical computation

Page 30: Scilab Interaction with other software

The free and open source software for numerical computation

JIMS

● JIMS module provides an easy way to create and manipulate a Java object in Scilab environment.

● Benefits of Scilab Java interface:

– Access java API,

– Access third-party java classes,

– Pass data between Scilab variables and Java objects.

Available through ATOMS: http://atoms.scilab.org/toolboxes/JIMS or atomsInstall('JIMS')

example :jimport java.lang.String

s = String.new('hello')

jimport java.util.Enumeration

jgetmethods(Enumeration)

Page 31: Scilab Interaction with other software

The free and open source software for numerical computation

And

● dNIMS: GSOC 2011

Ability for calling .NET framework or Mono from Scilab.

http://forge.scilab.org/index.php/p/dnims/

Page 32: Scilab Interaction with other software

The free and open source software for numerical computation

Thanks for your attention

www.scilab.org