Upload
sukrit-jaidee
View
8
Download
2
Embed Size (px)
DESCRIPTION
Scilab LabVIEW Gateway
Citation preview
..
1
Introduction SCILAB with LabVIEW GATEWAY
SCILAB MATLAB SCILAB (freeware) MATLAB SCILAB
LabVIEW Laboratory Virtual Instrument Engineering Workbench GUI (Graphic User Interface) code G (Graphical Language) C, BASIC FORTRAN Port Card
SCILAB LabVIEW
LabVIEW 8.6 SCILAB 4.1.2 ScriptScilab.dll National Instruments INRIA Scilab - LabVIEW Gateway 1.1 (Open source) http://www.scilab.org/products/other/labview_gateway
..
2
Introduction BASIC LabVIEW
LabVIEW Virtual Instrument (VI)
Virtual Instrument (VI) 3
1. Front Panel 2. Block Diagram 3. Icon Connector 3
3 1. Front Panel (
user interface) , , Front Panel GUI VI Front Panel 1.1
1.1 Front Panel LabVIEW
..
3
(Front Panel) LabVIEW 2 (Controls) (Indicator) 2
1.1 Controls (Input) Controls , , , Digital Controls (source) Controls 1.2
1.2 Control LabVIEW
1.2 Indicators , , Indicators output Indicators Indicators Indicators 1.3
1.3 Indicators LabVIEW
2. Block Diagram Source Code LabVIEW
G Block Diagram Executable Program LabVIEW
..
4
Block Diagram Block (wire) Block block Block Diagram 1.4
1.4 Block Diagram LabVIEW
Block Diagram
(Data Flow) 4 2.1 Terminal Control Indicator Front Panel Window Block Diagram Terminal Terminal Terminal Terminal Controls Terminal Terminal Indicator 1.6 2.2 Node / RUN VI Node 1.6
2.3 Functions sine, cos, tan, log Functions Palette Block Diagram Functions Palette 1.5 1.6
..
5
1.5 Functions Palette Block Diagram
2.4 Wires - terminal node Block Diagram wires terminal node terminal Data Flow Programming 1.1 1.1 Wires
Type Scalars 1-D Array 2-D Array Color Boolean
..
6
1.6 Terminal, Node, Function wire Block Diagram
3. Icon Connector Subroutine icon
block diagram Connector LabVIEW Subroutine subVI G VI VI VI subVI module
Icon 1.7 () Connector Terminal 1.7 ()
1.7 Icon Connector LabVIEW
Icon Connector
Wires
Terminal Output
Terminal Input
Block Diagram 3 Node
Functions
..
7
LabVIEW 1.2 LabVIEW 1.2 LabVIEW
LabVIEW VI Program
Function function sin, log
SubVI Subroutine
Front Panel user interface
Block Diagram Program code
..
8
CHAPTER 1 SCILAB with LabVIEW Gateway
SCILAB LabVIEW
ScriptScilab.dll National Instruments INRIA Scilab - LabVIEW Gateway 1.1 (Open source) http://www.scilab.org/products/other/labview_gateway :
Windows 2000/XP/Vista Scilab 4.1.1 release or higher LabVIEW 8.0 or 8.2.x
Scilab - LabVIEW Gateway 1. Scilab - LabVIEW Gateway 1.1 Scilab 4.1.1 LabVIEW 8.0 8.2.x (UNZIP) 1.8
1.8 Scilab - LabVIEW Gateway 1.1
Scilab 4.1.1 LabVIEW 8.6
..
9
2. Folder LabVIEW \examples\Scilab\Scilab 3D Graph.vi \examples\Scilab\Scilab Data Acquisition (lowlevel).vi \examples\Scilab\Scilab Data Acquisition.vi \examples\Scilab\Scilab Fourier Series.vi \examples\Scilab\Scilab Life.vi \examples\Scilab\Scilab Script Node Examples.aliases \examples\Scilab\Scilab Script Node Examples.lvproj \examples\Scilab\Scilab SignalGen-Analysis.vi \menus\Categories\Mathematics\_scriptsAndFormulas\MoreScriptNodes\scilab.mnu \resource\script\ScriptScilab.dll \vi.lib\Scilab\ScilabScript.vi \Scilab - LabVIEW readme.pdf
Examples LabVIEW 8.x
3. Scilab Script 3.1 Scilab - LabVIEW Gateway 1.1
Scilab Scripts LabVIEW 8.6 Functions 1.2
1.2 LabVIEW
..
10
3.2 Getting Started 1.3 Blank VI www.ni.com
1.3 Getting Started
3.3 Scilab Script Block Diagram Functions LabVIEW Mathematics >> Scripts & Formulas >> MoreScriptNodes >> Scilab >> Scilab Script (Icon) 1.4
1.4 Function Scilab
..
11
Scilab Script Scilab Scilab Scilab Error
Scilab Script (Icon) 1 cursor
(hand) Block Diagram 1 1.5
1.5 Scilab script
Scilab Script Scilab (algorithm) Add Input Add Out Scilab Script 1.6
1.6
..
12
CHAPTER 2 Examples of applications
3 1. Log 2 2. 2
2.1 (sinusoid waveform) 2.2 (sinc function)
2.3 (sinc function) 2.4 2 (sinc function)
3. 3 3.1 z = | 0.5*cos(2x) * cos(2y) |
3.2 (torus) 3.3 3 (sinc function)
..
13
1. Log 2 Log2 Scilab
( "" ) x b n x = bn
Log2(128) = 7 2 x 2 x 2 x 2 x 2 x 2 x 2 = 128
1.1 Front Panel 2 Modern Numeric Numeric Control 1 Modern Numeric Numeric Indicator 2.1
2.1 Controls Front Panel
1.2 Block Diagram Scilab script code Scilab
1.3 Add Input x Add Output z ( Add
Output CHAPTER 1) Log 0 Log 2.2 Code Input 0 Function Case Structure
z = log2(x)
1 2
logb(x) = n
..
14
Programming Structures Case Structure 2.3 Function Case Structure Programming Comparison Not Equal? 2.4
2.2 Error Function Scilab Script
2.3 Function Case Structure
2.4 Function Case Structure
1.4 code (True) Function Scilab script
2.5 (False) Code 2.6 Wires Node 2.6 2.7
..
15
2.5 Function Case Structure (True)
2.6 Function Case Structure (False)
1.4 Log 2 Run Continuously
2.7
2.7 Log 2 Scilab script
..
16
2.1 1 (sinusoid waveform)
2.1.1 Front Panel 2 Modern Graph XY Graph 2.8
2.8 Control XY Graph
2.1.2 Block Diagram Scilab script code Scilab
2.1.3 Add Output t y ( Add Output
CHAPTER 1) Function Bundle Programming Cluster, Class, & Variant Bundle 2.9 Wires Node 2.10
2.9 Bundle
-->t = 0:0.01:2; -->f = 1; -->y = sin(2*%pi*f*t);
y = sin(2ft)
..
17
2.10 Scilab script XY Graph
2.1.4 2 Run Continuously 2.11
2.11
..
18
2.2 2 (sinc function)
2.2.1 Front Panel
2 Modern Graph XY Graph 2.8 ( 1) 2.2.2 Block Diagram Scilab script code
Scilab
2.2.3 Add Output t y ( Add Output
CHAPTER 1) Function Bundle Programming Cluster, Class, & Variant Bundle 2.9 ( 1) Wires Node 2.12
2.12 Scilab script XY Graph
2.2.4 2 Run Continuously 2.13
x = -15:0.1:15; x = x + (x==0)*%eps; y = sin(x)./x;
y = sin(x) / x
..
19
2.13
..
20
2.3 3 (sinc function)
y y ( y 0.95) 2.3.1 Front Panel
2 Modern Graph XY Graph 2.8 ( 1) 2.3.2 Block Diagram Scilab script code
Scilab
2.3.3 Add Output t y ( Add Output
CHAPTER 1) Function Bundle Programming Cluster, Class, & Variant Bundle 2.9 ( 1) Wires Node 2.14
2.14 Scilab script XY Graph
2.3.4 2 Run Continuously () 2.15
x = [-15:0.01:15]; y = sin(x); y = y.*(abs(y)
..
21
2.15 ()
..
22
2.4 4 2 (sinc function)
y y (y 0.95 y 0.95) 2.4.1 Front Panel
2 Modern Graph XY Graph 2.8 ( 1) 2.4.2 Block Diagram Scilab script code
Scilab
2.4.3 Add Output t y ( Add Output
CHAPTER 1) Function Bundle Programming Cluster, Class, & Variant Bundle 2.9 ( 1) Wires Node 2.16
2.16 Scilab script XY Graph
2.4.4 2 Run Continuously
() 2.17
x = [-15:0.01:15]; y = sin(x); y = y.*(y=0.95);
y = sin(x) / x
..
23
2.17 ( 2)
..
24
3.1 1 z = | 0.5*cos(2x) * cos(2y) |
3.1.1 Front Panel
3 Classic Classic Graph ActiveX 3D Surface 2.18
2.18 Control ActiveX 3D Surface
3.1.2 Block Diagram Scilab script code Scilab
3.1.3 Add Output x , y z z
Array 2 z Choose Data Type 2-D Array of Complex 2.19
2.19 2-D Array of Complex
z = | 0.5*cos(2x) * cos(2y) |
x = linspace(0, 1, 21); y = linspace(0, 1, 21); z = abs(0.5*cos(2*%pi*x)'*cos(2*%pi*y));
..
25
3.1.4 Wires Node 2.20
2.20 Scilab script 3D Surface
3.1.5 3 Control 3D Surface
CWGraph3D Properties... 2.21 Plots Style Color map style Color Spectrum 2.22
2.21
2.22 ()
1
2
3
..
26
3.1.6 3 Run Continuously z = | 0.5*cos(2x) * cos(2y) | 2.23
2.23 z = | 0.5*cos(2x) * cos(2y) |
..
27
3.2 2 (torus)
3.2.1 Front Panel
3 Classic Classic Graph ActiveX 3D Parametric Graph 2.24
2.24 Control ActiveX 3D Parametric Graph
3.2.2 Block Diagram Scilab script code Scilab
3.2.3 Add Output x , y z Array 2 z Choose Data Type 2-D Array of Complex 2.19 ( 1)
phi = linspace(0, 2*%pi, 21); theta = linspace(0, 2*%pi, 21); a = 1.4; c = 0.5; [PHI, THETA] = ndgrid(phi, theta); x = (a + c*cos(PHI)) .* cos(THETA); y = (a + c * cos(PHI)) .* sin(THETA); z = c * sin(PHI);
x = (a+ccos( )) cos() y = (a+ccos( )) sin() z = c sin()
..
28
3.2.4 Wires Node 2.25
2.25 Scilab script 3D Parametric Surface
3.2.5 3 Control 3D Surface
CWGraph3D Properties... 2.21 ( 1) Plots Style Color map style Custom Edit 2.26 2.27
2.26 Custom
2
3
4
1
..
29
2.27 Color Map Editor
3.2.6 3 Run Continuously (torus) 2.28
2.28 (torus)
..
30
3.3 3 3 (3D sinc function)
3.3.1 Front Panel
3 Classic Classic Graph ActiveX 3D Parametric Graph 2.24 ( 2)
3.3.2 Block Diagram Scilab script code Scilab
3.3.3 Add Output x , y z
Array 2 z Choose Data Type 2-D Array of Complex 2.19 ( 1)
3.3.4 Wires Node 2.29
2.29 Scilab script 3D Parametric Surface
y = dsin(d) d = 2y2x +
x = -6:0.5:6; y = -6:0.5:6; [XX, YY] = ndgrid(x, y); d = sqrt(XX.^2 + YY.^2); d(find(d == 0)) = %eps; ZZ = sin(d)./d;
..
31
3.3.5 3 Control 3D Surface CWGraph3D Properties... 2.21 ( 1) Plots Style Color map style Custom Edit 2.26 ( 2) 2.30
2.30 Color Map Editor
3.3.6 3 Run Continuously (torus) 2.31
2.31 3
..
32
REFRENCE
[1] .... , LabVIEW, . [2] .. , SCILAB ( 2), , 2549. [3] www.scilab.org , LabVIEW to Scilab Gateway Version 1.1 for Windows, December 1, 2008