user-defined blocks in xcos
TRANSCRIPT
![Page 1: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/1.jpg)
User-defined blocks in Xcos
June 29th 2011
Clément DAVID & Bruno JOFRETScilab Consortium
![Page 2: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/2.jpg)
The free and open source software for numerical computation
Scilab/Xcos: Modeling dynamical systems
● Configurable subsystems use
● Conditionally executed
subsystems creation
● Signals and blocks parameters
adaptation
● Scilab algorithms and hand-
written code integration
![Page 3: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/3.jpg)
The free and open source software for numerical computation
Outline
● Model Building and Edition:
– User-defined palettes,– Configurable subsystems use.
● Xcos toolbox skeleton
● Future external modules:
– User defined blocks enabling Scilab and Modelica algorithms calls.
![Page 4: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/4.jpg)
The free and open source software for numerical computation
Model Building and Edition
![Page 5: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/5.jpg)
The free and open source software for numerical computation
Example to mimic a Simulink® block
● Emulate an integrator which triggers a state reset on an input signal
Simulink is a registered trademark of The Mathworks, Inc.
Scilab / Xcos Matlab / Simulink
1s
x o
I n t e g r a t o r
![Page 6: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/6.jpg)
The free and open source software for numerical computation
The Simulink® diagram
S c o p eP u l s e
G e n e r a t o r
1s
x o
I n t e g r a t o r
0
C o n s t a n t 1
1
C o n s t a n t
![Page 7: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/7.jpg)
The free and open source software for numerical computation
The Simulink® diagram results
![Page 8: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/8.jpg)
The free and open source software for numerical computation
The Xcos diagram
![Page 9: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/9.jpg)
The free and open source software for numerical computation
The Xcos diagram results
![Page 10: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/10.jpg)
The free and open source software for numerical computation
With a SuperBlock
![Page 11: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/11.jpg)
The free and open source software for numerical computation
Customize it
![Page 12: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/12.jpg)
The free and open source software for numerical computation
With exact input mapping
![Page 13: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/13.jpg)
The free and open source software for numerical computation
With exact input mapping (2)
![Page 14: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/14.jpg)
The free and open source software for numerical computation
Adding to the palettes
![Page 15: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/15.jpg)
The free and open source software for numerical computation
Using masked SuperBlocks
● Define variables in the parent context
● Use context on the blocks
● Create and customize the mask
● Remove variable in the parent context
![Page 16: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/16.jpg)
The free and open source software for numerical computation
The masked SuperBlock
![Page 17: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/17.jpg)
The free and open source software for numerical computation
Xcos toolbox skeleton
![Page 18: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/18.jpg)
The free and open source software for numerical computation
Xcos toolbox skeleton
● Included into the Scilab distribution (Development tools) with:
– Documentation (how to write your own help pages),
– Examples,
– Demos.
● Quick start to deploy an Xcos module through ATOMS.
● Interface your own libraries:
– Native ones (C, C++, Fortran, …),
– Interpreted (Scilab, Modelica).
![Page 19: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/19.jpg)
The free and open source software for numerical computation
External modules distribution
● ATOMS – http://atoms.scilab.org
– Package your business logic
● Scilab File Exchange – http://fileexchange.scilab.org
– Upload sample files
● Forge – http://forge.scilab.org
– Public or private collaboration platform
![Page 20: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/20.jpg)
The free and open source software for numerical computation
Future External Modules
![Page 21: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/21.jpg)
The free and open source software for numerical computation
UDP Blocks
● Implement blocks to handle remote data access using the UDP protocol:
– http://forge.scilab.org/index.php/p/udp-blocks/– not yet packaged in ATOMS.
![Page 22: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/22.jpg)
The free and open source software for numerical computation
UDP Blocks
● UDP Send:
– C function to send UDP packet● UDP Receive:
– C function to receive UDP packet
![Page 23: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/23.jpg)
The free and open source software for numerical computation
Network
UDP Blocks
● Example: Scilab ↔ Scilab
![Page 24: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/24.jpg)
The free and open source software for numerical computation
Network
UDP Blocks
● Example: Scilab ↔ ???
![Page 25: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/25.jpg)
The free and open source software for numerical computation
Network
UDP Blocks
● Example: ??? ↔ Scilab
![Page 26: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/26.jpg)
The free and open source software for numerical computation
UDP Blocks
● UDP Blocks:
– Based on ToolBox Skeleton,– C Simulations function,– Available through ATOMS (coming soon),– Encode/Decode your own UDP packet,– Easy communication with hardware devices.
![Page 27: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/27.jpg)
The free and open source software for numerical computation
COSELICA
● COSELICA (Modelica)
Standard Modelica Library in Xcos
– Use more Modelica features:● Electrical,● Thermal,● Mechanics.
– Advanced Xcos UI features (port colors, SVG blocks, etc... )
![Page 28: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/28.jpg)
The free and open source software for numerical computation
COSELICA
![Page 29: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/29.jpg)
The free and open source software for numerical computation
COSELICA
![Page 30: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/30.jpg)
The free and open source software for numerical computation
COSELICA
![Page 31: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/31.jpg)
The free and open source software for numerical computation
COSELICA
![Page 32: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/32.jpg)
The free and open source software for numerical computation
COSELICA
● COSELICA (Modelica):
– Based on ToolBox Skeleton,– Modelica Equations,– Generated C Simulation functions,– Available through ATOMS (coming soon),– Extends Xcos on other scientific domains.
![Page 33: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/33.jpg)
The free and open source software for numerical computation
Future FunctionalityAvailable with Scilab 5.4.0
![Page 34: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/34.jpg)
The free and open source software for numerical computation
Block wizard● Common UI for user blocks generation
● Ease new blocks integration
![Page 35: User-defined blocks in Xcos](https://reader031.vdocuments.site/reader031/viewer/2022012304/586e10771a28ab95168b72c6/html5/thumbnails/35.jpg)
Thanks for your attention
www.scilab.org