Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: [email protected], Tlf: +45 25533552.
-
Upload
asher-lawrence -
Category
Documents
-
view
219 -
download
3
Transcript of Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: [email protected], Tlf: +45 25533552.
![Page 1: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/1.jpg)
Samuel Alberg Thrysøe, PhD, PostDoc,Kontakt info: Email: [email protected], Tlf: +45 25533552
Virtuel Instrumentering:LabView Introduction 3
![Page 2: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/2.jpg)
2
Repetition
![Page 3: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/3.jpg)
Plotting data with irregular spacing
3
1. 2. 3. 4.
17%
33%
50%
0%
1. Waveform Chart2. Waveform Graph3. XY Graph4. Indicator Graph
![Page 4: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/4.jpg)
Plotting data with an offset and regular spacing delta X
4
1. 2. 3. 4.
25% 25%
0%
50%
1. Waveform Chart2. Waveform Graph3. XY Graph4. Indicator Graph
![Page 5: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/5.jpg)
Plotting data with continual updating
5
1. 2. 3. 4.
88%
0%0%
13%
1. Waveform Chart2. Waveform Graph3. XY Graph4. Indicator Graph
![Page 6: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/6.jpg)
6
Controlling program flow:Case structures
![Page 7: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/7.jpg)
7
Case Structures
• Have one or more sub-diagrams (cases)
• Only one will run when the structured is called
• The control wired to the selector input chooses which case to run– Can be Boolean, string,
integer, enum etc.
• Right-click on the structure border to remove/add cases
![Page 8: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/8.jpg)
8
Case structures
![Page 9: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/9.jpg)
9
Select Function
• Return the T(rue) value, if the boolean input is true
• Returns the F(alse) value, if the boolean input is False
![Page 10: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/10.jpg)
10
3.1 – Cases
• 3.1.1 - Temperature Case• 3.1.2 – Dice Throw Response• 3.1.3 – Square Root• *3.1.4 - Addition/Subtraction
![Page 11: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/11.jpg)
11
Controlling program flow:Select structures
![Page 12: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/12.jpg)
Which block runs first?
12
1. 2. 3.
22%
78%
0%
1
2
1. Block 1 2. Block 23. They run simultaneously
![Page 13: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/13.jpg)
13
Dataflow Programmering
• Block Diagram Execution– Depends on the dataflow– Does NOT execute left to
right/top to bottom
• A node is executed when data is present at ALL the inputs
• Nodes pass data to the output terminals when they are done
![Page 14: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/14.jpg)
14
Sequence Structures
• Controls dataflow in VI block diagrams
• Divides VI into frames– Looks like celluloid film
• Flow passes from frame to frame when all the nodes in the individual frame are done
• Drawn like loops and case structures
• Right-click the border to add/remove frames
• Two types of sequence structures:– Flat
• Provides better overview
– Stacked• Like case structures• Gives the opportunity to
use local sequence variables
![Page 15: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/15.jpg)
15
Sequence structures
Flat structure
Stack structure
![Page 16: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/16.jpg)
16
Local variables
• You can read from / write to controls and indicators everywhere in the sequence diagram
• Right-click the icon and choose:– Create Local variable– Right-click the local variable to switch between• Read• Write
![Page 17: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/17.jpg)
17
3.2 – Sequencestructures
• 3.2.1 – Response Time• *3.2.2 - Time to Match 2
![Page 18: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/18.jpg)
18
Formula nodes
• A formula node contains … Formulas!• Y=x^2+x+1 on a normal block diagram:
• And as a formula node:
![Page 19: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/19.jpg)
19
Creating a formula node
![Page 20: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/20.jpg)
20
Another way to create a formula
• Use the Formula Express VI– Express -> Arithmetic
& Comparison -> Formula
• Write the formula using the inputs, which you can label
• Wire the in-/outputs on the Block Diagram
![Page 21: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/21.jpg)
21
3.3 – Formula Nodes
• 3.3.1 - Temp Conversion 2
![Page 22: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/22.jpg)
22
Sub VIs
![Page 23: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/23.jpg)
23
Sub VIs
• Collections of code• Low-level VI inside high-level VI– Reduces the number of Block Diagram nodes– Increases readability – Modular approach
• Analogue to functions in text-based languages
![Page 24: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/24.jpg)
Function Pseudo Codefunction average (in1, in2, out){out = (in1 + in2)/2.0;}
SubVI Block Diagram
Calling Program Pseudo Codemain{average (in1, in2, pointavg)}
Calling VI Block Diagram
LabView SubVIs ~ Functions
![Page 25: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/25.jpg)
25
Creating SubVIs
• 2 methods– Create a blank VI and insert the wanted nodes– Mark a number of nodes in the Block Diagram and
choose Edit -> Create SubVI• Controls Inputs• Indicators Outputs
![Page 26: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/26.jpg)
• Mark the area, to be turned into a SubVI• Choose Edit Create SubVI
Creating SubVIs
![Page 27: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/27.jpg)
27
Changing the Icon
• Important to differentiate the SubVIs• Right-click the standard-icon to the top right
on the Block Diagram and choose: Edit Icon
![Page 28: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/28.jpg)
28
Changing the Connections
• Right-click the VI icon to the top right on the Front Panel and choose: Show Connector
• The Icon changes to connector– Edit the terminals by right-clicking the connector
and choose Add/Remove Terminal– Or choose standard configurations• Right-click Connector -> Patterns
• Connect inputs (left) with controls• Connect outputs (right) with indicators
![Page 29: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/29.jpg)
29
Changeing the Connections
![Page 30: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/30.jpg)
30
Connect SubVIs in the Block Diagram
• The terminals are named according to the names of the controls/indicators in SubVIs
![Page 31: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/31.jpg)
31
Connection Properties
• Connections can be– Required– Recommended– Optional
![Page 32: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/32.jpg)
32
Default values
• The values of controls can be set to standard– Edit -> Make Current Values Default
• These are used, if theinput is not connected
![Page 33: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/33.jpg)
33
SubVIs
TempConversion.vi
![Page 34: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/34.jpg)
34
3.4 – SubVIs
• 3.4.1 – Choose Column• 3.4.2 - DiceThrows3_SubVIs• *3.4.3 - Random LED_SubVI
![Page 35: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/35.jpg)
35
Cluster Data
![Page 36: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/36.jpg)
36
LabView Clusters
• Analogue to Structs in C++ / Matlab• Combines one or more data types in a single
structure– Eg boolean, strings and integers
• Reduceres the complexity of block diagrams• Unbundle gives access to the individual
elements
![Page 37: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/37.jpg)
37
Creating Clusters
• Create a cluster shell– Using same approach as case structures and loops– Controls -> Modern -> Array, Matrix & Cluster
![Page 38: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/38.jpg)
38
Cluster Ordering
• Changing the order of cluster components:– Right-click the border of the
cluster on the Front Panel– Choose ”Reorder Controls In
Cluster…”
• Two boxes will appear on all the cluster components– White = Current position– Black = New position
• To move a component:– Choose the top space– Click on the control
1
2
![Page 39: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/39.jpg)
39
Cluster Order
ClusterOrder
![Page 40: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/40.jpg)
40
Bundle / Unbundle
Terminal labels reflect the data type
Updates specific cluster object values
Returns the cluster elements named
![Page 41: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/41.jpg)
41
Cluster <-> Array
• You can change between clusters and arrays IF– All cluster components have the same data type• All are boolean/numeric/string etc.
![Page 42: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/42.jpg)
42
3.5 – Clusters
• 3.5.1 - Cluster IO• 3.5.2 - Cluster Bundling• *3.5.3 – Login
![Page 43: Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Email: sat@iha.dk, Tlf: +45 25533552.](https://reader036.fdocuments.net/reader036/viewer/2022081603/56649eaa5503460f94baef85/html5/thumbnails/43.jpg)
43