User-defined blocks in Xcos - Scilab
User-defined blocks in Xcos - Scilab
User-defined blocks in Xcos - Scilab
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>User</strong>-<strong>def<strong>in</strong>ed</strong> <strong>blocks</strong> <strong>in</strong> <strong>Xcos</strong><br />
Clément DAVID & Bruno JOFRET<br />
<strong>Scilab</strong> Consortium<br />
June 29 th 2011
<strong>Scilab</strong>/<strong>Xcos</strong>: Model<strong>in</strong>g dynamical systems<br />
● Configurable subsystems use<br />
● Conditionally executed<br />
subsystems creation<br />
● Signals and <strong>blocks</strong> parameters<br />
adaptation<br />
● <strong>Scilab</strong> algorithms and hand-<br />
written code <strong>in</strong>tegration<br />
The free and open source software for numerical computation
Outl<strong>in</strong>e<br />
● Model Build<strong>in</strong>g and Edition:<br />
– <strong>User</strong>-<strong>def<strong>in</strong>ed</strong> palettes,<br />
– Configurable subsystems use.<br />
● <strong>Xcos</strong> toolbox skeleton<br />
● Future external modules:<br />
– <strong>User</strong> <strong>def<strong>in</strong>ed</strong> <strong>blocks</strong> enabl<strong>in</strong>g <strong>Scilab</strong> and Modelica algorithms<br />
calls.<br />
The free and open source software for numerical computation
The free and open source software for numerical computation<br />
Model Build<strong>in</strong>g and Edition
Example to mimic a Simul<strong>in</strong>k® block<br />
● Emulate an <strong>in</strong>tegrator which triggers a state reset on an <strong>in</strong>put signal<br />
<strong>Scilab</strong> / <strong>Xcos</strong> Matlab / Simul<strong>in</strong>k<br />
The free and open source software for numerical computation<br />
Simul<strong>in</strong>k is a registered trademark of The Mathworks, Inc.<br />
x o<br />
1<br />
s<br />
I n t e g r a t o r
The Simul<strong>in</strong>k® diagram<br />
1<br />
C o n s t a n t<br />
0<br />
C o n s t a n t 1<br />
P u l s e<br />
G e n e r a t o r<br />
The free and open source software for numerical computation<br />
x o<br />
1<br />
s<br />
I n t e g r a t o r<br />
S c o p e
The Simul<strong>in</strong>k® diagram results<br />
The free and open source software for numerical computation
The <strong>Xcos</strong> diagram<br />
The free and open source software for numerical computation
The <strong>Xcos</strong> diagram results<br />
The free and open source software for numerical computation
With a SuperBlock<br />
The free and open source software for numerical computation
Customize it<br />
The free and open source software for numerical computation
With exact <strong>in</strong>put mapp<strong>in</strong>g<br />
The free and open source software for numerical computation
With exact <strong>in</strong>put mapp<strong>in</strong>g (2)<br />
The free and open source software for numerical computation
Add<strong>in</strong>g to the palettes<br />
The free and open source software for numerical computation
Us<strong>in</strong>g masked SuperBlocks<br />
● Def<strong>in</strong>e variables <strong>in</strong> the parent context<br />
● Use context on the <strong>blocks</strong><br />
● Create and customize the mask<br />
● Remove variable <strong>in</strong> the parent context<br />
The free and open source software for numerical computation
The masked SuperBlock<br />
The free and open source software for numerical computation
The free and open source software for numerical computation<br />
<strong>Xcos</strong> toolbox skeleton
<strong>Xcos</strong> toolbox skeleton<br />
● Included <strong>in</strong>to the <strong>Scilab</strong> distribution (Development tools) with:<br />
– Documentation (how to write your own help pages),<br />
– Examples,<br />
– Demos.<br />
● Quick start to deploy an <strong>Xcos</strong> module through ATOMS.<br />
● Interface your own libraries:<br />
– Native ones (C, C++, Fortran, …),<br />
– Interpreted (<strong>Scilab</strong>, Modelica).<br />
The free and open source software for numerical computation
External modules distribution<br />
● ATOMS – http://atoms.scilab.org<br />
– Package your bus<strong>in</strong>ess logic<br />
● <strong>Scilab</strong> File Exchange – http://fileexchange.scilab.org<br />
– Upload sample files<br />
● Forge – http://forge.scilab.org<br />
– Public or private collaboration platform<br />
The free and open source software for numerical computation
The free and open source software for numerical computation<br />
Future External Modules
UDP Blocks<br />
● Implement <strong>blocks</strong> to handle remote data access us<strong>in</strong>g the UDP<br />
protocol:<br />
– http://forge.scilab.org/<strong>in</strong>dex.php/p/udp-<strong>blocks</strong>/<br />
– not yet packaged <strong>in</strong> ATOMS.<br />
The free and open source software for numerical computation
UDP Blocks<br />
● UDP Send:<br />
– C function to send UDP packet<br />
● UDP Receive:<br />
– C function to receive UDP packet<br />
The free and open source software for numerical computation
UDP Blocks<br />
● Example: <strong>Scilab</strong> ↔ <strong>Scilab</strong><br />
Network<br />
The free and open source software for numerical computation
UDP Blocks<br />
● Example: <strong>Scilab</strong> ↔ ???<br />
Network<br />
The free and open source software for numerical computation
UDP Blocks<br />
● Example: ??? ↔ <strong>Scilab</strong><br />
Network<br />
The free and open source software for numerical computation
UDP Blocks<br />
● UDP Blocks:<br />
– Based on ToolBox Skeleton,<br />
– C Simulations function,<br />
– Available through ATOMS (com<strong>in</strong>g soon),<br />
– Encode/Decode your own UDP packet,<br />
– Easy communication with hardware devices.<br />
The free and open source software for numerical computation
COSELICA<br />
● COSELICA (Modelica)<br />
Standard Modelica Library <strong>in</strong> <strong>Xcos</strong><br />
– Use more Modelica features:<br />
● Electrical,<br />
● Thermal,<br />
● Mechanics.<br />
– Advanced <strong>Xcos</strong> UI features (port colors, SVG <strong>blocks</strong>, etc... )<br />
The free and open source software for numerical computation
COSELICA<br />
The free and open source software for numerical computation
COSELICA<br />
The free and open source software for numerical computation
COSELICA<br />
The free and open source software for numerical computation
COSELICA<br />
The free and open source software for numerical computation
COSELICA<br />
● COSELICA (Modelica):<br />
– Based on ToolBox Skeleton,<br />
– Modelica Equations,<br />
– Generated C Simulation functions,<br />
– Available through ATOMS (com<strong>in</strong>g soon),<br />
– Extends <strong>Xcos</strong> on other scientific doma<strong>in</strong>s.<br />
The free and open source software for numerical computation
The free and open source software for numerical computation<br />
Future Functionality<br />
Available with <strong>Scilab</strong> 5.4.0
Block wizard<br />
● Common UI for user <strong>blocks</strong> generation<br />
● Ease new <strong>blocks</strong> <strong>in</strong>tegration<br />
The free and open source software for numerical computation
Thanks for your attention<br />
www.scilab.org