darwin applied to labview: the evolution of the data management
DESCRIPTION
The survival of the fittest applied to the LabVIEW Dataflow model... With deep humor this presentation makes the link between the evolution of the LabVIEW data and the Darwin's Theory of Evolution. PS : You can download the presentation Darwin applied to LabVIEW V2.1.pdf attachment and LabVIEW examples code. Recently, I made a new presentation (LabVIEW User group LUGE) "Darwin applied to LabVIEW: the evolution of the data management." subtitle “The survival of the fittest applied to the LabVIEW Dataflow model ”. For diner tonight: Functional Global variable (FGV, LV2), Action Engine (AE), DVR, OOP, State Machine and QMH. Speed demonstration, UI thread, memory management (buffer copies) and Race Condition with simple and downloadable examples. Auteur livre LabVIEW "Programmation et applications" édition Dunod, jusqu'au niveau pour l'examen CLD Luc Desruelle CLA : Certified LabVIEW Architect / Certifié Architecte LabVIEWTRANSCRIPT
![Page 1: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/1.jpg)
www.mesulog.fr
Darwin applied to LabVIEW :
The evolution of the data management
Luc DESRUELLE – Certified LabVIEW Architect
The survival of the fittest applied to the LabVIEW Dataflow model
![Page 2: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/2.jpg)
Summary
I. MESULOG & the conference speaker
II. Overview: Dataflow model & Data communication
III. Darwin & LabVIEW
IV. Darwin & Data communication methods
V. To OOP
VI. To Framework
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 2
![Page 3: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/3.jpg)
MESULOG
www.mesulog.fr
Activity: Test and measurement Software development
Skills: LabVIEW (Windows, RT, FPGA, PDA, DSC),
TestStand
VeriStand
Location: Grenoble (France)
National Instruments Alliance Member
LabVIEW and TestStand Certified
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 3
![Page 4: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/4.jpg)
Luc DESRUELLE
Software Architect
NI Forums Community
CLA
The conference speaker
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 4
Community blog
• Blank diagram syndrome
• Development rules
• Animated gif to avoid code
• Transparent Windows
• LabVIEW Project
• OOP
• Modbus
• ….
![Page 5: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/5.jpg)
Author of the LabVIEW French book « LabVIEW : programming and applications »
3rd Edition, Dunod 05/2015, Prefaced by Jeff Kodosky
book website link
Chapter 1: LabVIEW EDI and dataflow programming environment
Chapter 2: Data communication methods
Chapter 3: Advanced knowledge and skills to design, develop and deploy a
scalable, readable and maintainable application .
Chapters 4, 5 and 6: Data acquisition, analysis and report.
The conference speaker
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 5
![Page 6: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/6.jpg)
II] Overview
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 6
![Page 7: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/7.jpg)
LabVIEW Dataflow model
LabVIEW follows a dataflow model
Dataflow programming does not usually require variables.
For a literal implementation of this model.
Dataflow models describe nodes as:
consuming data inputs
producing data outputs.
Advanced concepts : LabVIEW contains many data communication methods.
For example, local and global variables are not inherently part of the LabVIEW
dataflow execution model.
Darwin applied to LabVIEW : The evolution of the data 7
Source: Data Communication Methods in LabVIEW
![Page 8: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/8.jpg)
"Always" the same observation
LabVIEW Rookie mistakes:1 time OK
But Exaggeration prevents the evolution
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 8
LabVIEW
Spaghetti
The most famous LabVIEW code
![Page 9: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/9.jpg)
Data Communication Methods
LabVIEW contains many “data communication” methods, each suited for a
certain use case.
Can by order into 3 types:
Dataflow elements, the primary methods
Variable Interfaces
Buffer Interfaces
Darwin applied to LabVIEW : The evolution of the data 9
Source: Data Communication Methods in LabVIEW
Dataflow Elements
• Wire
• Shift register
• Feedback Node
Variable Interfaces
• Local variable
• Global variable
• FGV
• AE
• DVR
• …
Buffer Interfaces
• Queue
• User events
• RT FIFO
• …
Data Communication methods
![Page 10: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/10.jpg)
The presentation
Evolution of Data communication methods,
Dataflow element to Variable Interfaces, to Buffer Interfaces
To store a value in memory
To access the value
This presentation does answer the following questions:
why avoiding local, global, Property Node?
Which method to use? Why?
For diner tonight: local, global, FGV, AE, DVR, OOP, State Machine and QMH.
Speed demonstration, UI thread, memory management (buffer copies) and Race
Conditions with simples and downloadable examples.
Darwin applied to LabVIEW : The evolution of the data 10
![Page 11: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/11.jpg)
III] Darwin & LabVIEW
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 11
![Page 12: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/12.jpg)
Darwin
Charles Robert Darwin (1809 – 1882)
All species of life have descended from one common
ancestor
This branching pattern of evolution resulted from the
natural selection
The survival of the fittest
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 12
![Page 13: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/13.jpg)
With deep humor this presentation makes the link
between
the evolution of the LabVIEW data management
and the Darwin's Theory of Evolution
the survival of the fittest
Darwin & LabVIEW
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 13
Darwin LabVIEW
One common ancestor LabVIEW Control
All species of life All data communication methods
The survival of the fittest The survival of the most scalable
![Page 14: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/14.jpg)
II] Data communication
Once upon a time…. A very nice Data…
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 14
![Page 15: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/15.jpg)
Dataflow elements
Data transfer
To take advantage of the dataflow
The primary data communication methods in your
application
Darwin applied to LabVIEW : The evolution of the data 15
Dataflow Elements
Dataflow Elements
•Wire = between objects
• Shift register = between loop iterations
• Feedback Node = between iterations
![Page 16: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/16.jpg)
Variables Interfaces
Store a value in memory
Value that Readers and writers can access
Advanced concepts
Darwin applied to LabVIEW : The evolution of the data 16
Dataflow Elements
Variable Interfaces
• Local variable
•Global variable
•…
•…
Variables interfaces
others…
![Page 17: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/17.jpg)
Quiz N°1
CLAD exam: Which of the following is the best method
to update an indicator on the front panel?
A. Use a Local variable
B. Wire directly to the indicator « Data Out »
C. Use an implicit « value » property node
D. Use an explicit « value » property node (reference)
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 17
![Page 18: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/18.jpg)
Quiz N°1 Demo: Execution speed
Demo
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 18
For 10 000 iterations Time (ms)
Indicator 100
Local 100
Global 100
Property node (implicit) 4 000
Property node (explicit) 4 000
0
500
1000
1500
2000
2500
3000
3500
4000
4500
Indicator Local Global Property
node
(implicit)
Property
node
(explicit)
![Page 19: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/19.jpg)
Quiz N°1: Explanation
Synchronous nodes
A few nodes are synchronous, meaning they do not multitask
with other nodes.
In a multithreaded application, they run to completion, and the
thread in which they run is monopolized by that task until the
task completes.
Property Nodes
Synchronize with the UI thread, even for the Value property
Cause the front panel of a subVI to remain in memory
Force a front-panel redraw every time you update the value
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 19
Source: Multitasking in LabVIEW
![Page 20: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/20.jpg)
Quiz N°1 Front panel in memory
When front panel is in memory: which can cause
unnecessary memory usage -> Buffer copies
Programmation Avancée sous LabVIEW 20
Buffer copy
Operate Buffer
Transfer Buffer
Execution Buffer
Buffer copy
![Page 21: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/21.jpg)
Quiz N°1 Explanation
Memory consideration
Local variables make copies of the data buffers
Global variables make copies of the data buffers
Have slower execution speed than using a wire
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 21
![Page 22: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/22.jpg)
Quiz N°1 Property node VS local
Property node Buffer copies
UI Thread
Front panel redraw
Synchronous node
Front-panel in memory
Race Condition
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 22
Local variable
Buffer copies
Any Threads
Race condition
V.S.
![Page 23: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/23.jpg)
Quiz N°1: Answer
1. Indicator
2. Local variable
3. Implicit property node
4. Explicit property node
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 23
![Page 24: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/24.jpg)
Quiz N°2
To store the variable "Data In", what is best? Wiring
“Data In” to:
A. Local variable « Data Out »
B. Global variable « Data »
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 24
![Page 25: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/25.jpg)
Quiz N°2 Answer
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 25
Local variable VS Global variable
The game is a draw
![Page 26: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/26.jpg)
Overview
Avoid local variables – global variables - property nodes
Buffers Copies
Slower execution
Race Conditions
No error handler
1 time OK but Exaggeration prevents the evolution
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 26
![Page 27: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/27.jpg)
How to avoid local variables, global variables and
property nodes
How ????
To avoid
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 27
![Page 28: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/28.jpg)
FGV : Functional Global Variable or LV2
Provide global access to data
VI that uses uninitialized shift register (USR)
Non reentrancy is required
To store a data: Set (Writers)
To share the « global » data: Get (Readers)
FGV: Functional Global Variable
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 28
Writer Reader
![Page 29: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/29.jpg)
Quiz N°3
Why the names :
FGV or LV2 Style Global or VIGlobals or….?
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 29
![Page 30: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/30.jpg)
Quiz N°3 Answer : HIStory
Same as: HIStory World Tour (Michael Jackson 1997)
LabVIEW HIStory Version Tour: FGV or LV2 Style
Global or VIGlobals?
Prior to LabVIEW 2: the value of the initialized shift register
had not been defined.
LabVIEW 2: uninitialized shift register would retain its
previous value.
This technique became the methodology for storing global
data in LabVIEW.
The native global variable was not introduced until
LabVIEW 3.
FGV is a Global… VIGlobal
Source: Advanced Architectures in LabVIEW
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 30
![Page 31: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/31.jpg)
FGV: Example
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 31
2 cases:
> Set = Store
> Get = share
Store data
![Page 32: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/32.jpg)
Race conditions
Race conditions ?????????????
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 32
![Page 33: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/33.jpg)
Race conditions
Race conditions: The evolution of the fittest
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 33
![Page 34: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/34.jpg)
Race condition: a bug
Race condition or race hazard: output is dependent on
the sequence of other uncontrollable events.
The term originates with the idea of two signals racing
each other to influence the output first.
Unpredictable outcomes = A bug!!!!
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 34
Data Out = ??
X=1 or 0
Y=1 or 0(0;0) or (0;1)
or (1;0) or(1;1)
X=0 et
Y=0
Source : https://en.wikipedia.org/wiki/Race_condition
![Page 35: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/35.jpg)
Quiz N°4
Does FGV prevents the Race Conditions?
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 35
Data Out = ??
X = ?
Y= ?
Data In
X = 0
Y= 0
![Page 36: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/36.jpg)
Quiz N°4: Result
No (with multi-writers)
LabVIEW code demo
Download code MESULOG website >> Société >> Présentations Techniques
www.mesulog.fr/presentations_techniques
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 36
![Page 37: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/37.jpg)
FGV: recommended Use
Only 1 writer
N Readers
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 37
To share a « global » data: only 1 writer
![Page 38: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/38.jpg)
Race conditions & N Writers
N Writers (not only 1 writer)
How to Avoid Race conditions ?????????????
N Writers
N Readers
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 38
![Page 39: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/39.jpg)
AE : Action Engine : FGV evolution with actions
Not only set and get methods
Actions = Encapsulate data and code = block other instance
until complete execution
Actions that modify data = critical section
Data protection: private access, data is always private
AE : Action Engine
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 39
![Page 40: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/40.jpg)
AE : Action Engine
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 40
EncapsulationAction that modify the dataData is always private
![Page 41: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/41.jpg)
AE: Example
Example
FGV + Actions (enum)
Reusable modules – simplified LV code – Error Handler –
more readable
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 41
LV Code that
modify the
data
ActionsStore Data
(private)
![Page 42: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/42.jpg)
Quiz N°5
Does AE prevents Race Conditions?
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 42
Data Out = ??
X = ?
Y= ?Data In
X = 0
Y= 0
![Page 43: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/43.jpg)
Quiz N°5: Answer
YES
Encapsulation: LV Code that modify the data, data is
always private = prevents Race Conditions
LabVIEW code demo
Download code MESULOG website >> Société >> Présentations Techniques
www.mesulog.fr/presentations_techniques
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 43
![Page 44: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/44.jpg)
Reference
Reference
Reference
DVR: Data Value Reference
Reference is a pointer to the data
Wire is the reference, not the data
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 44
Data Copy
Data Copy
Data
Avoid Race Conditions
![Page 45: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/45.jpg)
Quiz N°5
Which of the following statements regarding the DVR
are true:
A. Forking creates a copy of the reference, not a copy of the
data
B. Avoid data copies
C. Avoid Race conditions
D. Allow error handler
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 45
![Page 46: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/46.jpg)
Quiz N°5: Answer
A, B, C & D are all true
LabVIEW code demo
Download code MESULOG website >> Société >> Présentations Techniques
www.mesulog.fr/presentations_techniques
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 46
![Page 47: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/47.jpg)
Overview: variable interfaces
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 47
Variable Interfaces
1 time OK but Exaggeration prevents the evolution
The evolution of the fittest• N Writers• Reusable modules• Error Handler• Avoid data copies• Avoid Race Conditions
![Page 48: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/48.jpg)
Overview: variable interfaces
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 48
Features - Scalable
Simplicity
![Page 49: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/49.jpg)
to Buffer Interfaces
To avoid overwriting or losing any value
Buffer Interfaces, for example: Queue
Darwin applied to LabVIEW : The evolution of the data 49
Enqueue Element
Obtain Queue
Dequeue Element
Release Queue1 2 4
3
1 2 3 4
![Page 50: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/50.jpg)
to go further with the… evolution
Darwin applied to LabVIEW : The evolution of the data 50
Data communication
Dataflow Elements
Wire
Shift register
Feedback Node
Variable Interfaces
Inter-Target
Local & Global
FGV -> AE
DVR
Networked Shared variable
Buffer Interfaces
Intra-TargetQueue
User events
NetworkedTCP
Network Streams
Data communication methods in LabVIEW (without RT and FPGA)
![Page 51: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/51.jpg)
V] OOP
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 51
From variable interfaces to OOP
Variable Interfaces
OOP
![Page 52: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/52.jpg)
OOP
A class is a collection of data (attributes) and methods that allow to
change these data
Attributes are private
Encapsulation
Inheritance
Dynamic dispatch
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 52
Class
Attributes
methodsCode
![Page 53: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/53.jpg)
LabVIEW and OOP
OOP is a evolution from the AE (according to Darwin)
Shift Register become “attributes”
Actions become “methods”
Native LabVIEW class = by value
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 53
Action n°1
= case 1
Action n°2
= case 2
Action …
= case
1. Data = shift register
2. Actions = states
Actions = methods
1 method = 1 vi
AE = Action Engine
OOP
More advanced concepts:
Inheritance
Dispatch dynamic
![Page 54: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/54.jpg)
Quiz N°6
Does OOP by Value prevents Race Conditions?
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 54
Data Out = ??
X = ?
Y= ?
Data In
X = 0
Y= 0
![Page 55: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/55.jpg)
Quiz N°6: answer
OOP by Value? No
Forking creates a copy of the data
LabVIEW code demo
Download code MESULOG website >> Société >> Présentations Techniques
www.mesulog.fr/presentations_techniques
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 55
![Page 56: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/56.jpg)
To OOP by Ref
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 56
OOP by Ref
![Page 57: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/57.jpg)
Quizz N°7
OOP by Ref prevents the Race Conditions?
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 57
![Page 58: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/58.jpg)
Résultat Quizz N°7
Yes
Forking creates a copy of the reference, not a copy of the data
Démonstration code LabVIEW
Code téléchargeable sur le site MESULOG >> Société >> Présentations Techniques
www.mesulog.fr/presentations_techniques
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 58
![Page 59: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/59.jpg)
VI] Framework
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 59
Evolution to framework…
Framework
Variable Interfaces
![Page 60: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/60.jpg)
Action Engine (AE): execute only one action then
stops
Need to add transitions to perform multiple actions
Need to describe a “Moore Machine”?
More “scalable” ?
The evolution of the Action to the state
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 60
![Page 61: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/61.jpg)
Moore Machine or State Machine
Darwin applied to LabVIEW : The evolution of the data 61
InitCheck
statusCleanup
Measure
5000 ms
125ms
Quit buttondefault
Transitionswhich state to go to next
Moore Machine
Idle Cleanup
Quit button
![Page 62: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/62.jpg)
« state & transition »
States = performs a specific action for each state in the
diagram
Transition = in-state calculation to determine which state to go
to next
A terminal state is the final state executed and performs
cleanup actions.
Any algorithm described by a “Moore machine”
State Machine
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 62
InitCheck
statusCleanup
Measure
5000 ms
125ms
Quit bouton
default
Source : white-paper State Machine
![Page 63: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/63.jpg)
State Machine: grey's anatomy
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 63
Shift register to store the
value of the current state
The case structure contains one frame
for each state (Moore Machine)
Shift register to store
private data
Next state : contains state transition
information, which state to go to next
Typdef EnumFirst State Next State
State
?
Code
While Loop
![Page 64: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/64.jpg)
State Machine: LabVIEW Example
Demo
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 64
InitCheck
statusCleanup
Measure
5000 ms
Quit bouton
default
![Page 65: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/65.jpg)
Demo
State Machine: LabVIEW Example
Darwin applied to LabVIEW : The evolution of the data 65
One frame for each
State
Loop Timing
Shift register
![Page 66: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/66.jpg)
State Machine: Overview
One of the fundamental LabVIEW architectures
(basic!)
Use to build applications quickly (Moore Machine)
Source CLAD exam: What is one disadvantage of
using the State Machine VI architecture?
If two state changes occur at the same time, only the first
state change will be handled and the second will be lost
Why?
Shift register is used to store the value of the next state
Shift register store only the current value
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 66
![Page 67: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/67.jpg)
State Machine: evolution?
It is important to avoid losing any value…
No shift register
No variable interfaces
Evolution???
You must use:
Buffer interfaces
FIFO queue for example
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 67
![Page 68: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/68.jpg)
Evolution? Queue State machine
Darwin applied to LabVIEW : The evolution of the data 68
Queue State Machine
FIFO Queue
![Page 69: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/69.jpg)
Other? Event Structure
For handling user interactions
Dialog box for example
Waits until an event happens, then executes the appropriate
case to handle that event.
Optional Timeout (wait for an event to occur)
Darwin applied to LabVIEW : The evolution of the data 69
![Page 70: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/70.jpg)
Event structure example
Darwin applied to LabVIEW : The evolution of the data 70
![Page 71: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/71.jpg)
Other? Producer/Consumer
For data sharing between multiple process
Two process categories:
those that produce data,
those that consume the data produced.
Data buffering:
Data queues (Message)
Communicate data between loops
Darwin applied to LabVIEW : The evolution of the data 71
![Page 72: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/72.jpg)
QMH
Darwin applied to LabVIEW : The evolution of the data 72
QMH: Queue Message Handler
![Page 73: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/73.jpg)
QMH: a combination of all
QMH: Queue Message Handler
Is a combination of (evolution of!)
producer/consumer
event handler
state machine
Overview
multiple sections of code (task)
running in parallel
sending data (Message) between them (Queue)
Error handling
Project organization
Darwin applied to LabVIEW : The evolution of the data 73
= State (required)
= Data (optional)
![Page 74: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/74.jpg)
QDMH
Grey's anatomy
1. The producer loop (EHL) contains an event structure that sends
messages to the consumer loop.
2. The consumer (MHL) receives and processes the messages in
a state machine.
3. A message can be triggered by UI events or from other states
in the state machine
Provides a powerful and efficient architecture
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 74
Source : white-paper QMH
![Page 75: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/75.jpg)
State Machine: grey's anatomy
demo
Darwin applied to LabVIEW : The evolution of the data 75
2_Send a message
1_Obtain Queue3_ receives the
messages 5_can add a
message
4_ executes the
appropriate
case
Shift register to store
private data
![Page 76: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/76.jpg)
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 76
The End: Exaggeration prevents the evolution
Framework
Variable interfaces
OOP
Dataflow Elements
Buffer Interfaces
Inter-Target
Inter-Target
Networked
Networked
The survival of the most scalable
![Page 77: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/77.jpg)
More speaker Links
More technical presentationswww.mesulog.fr/presentations_techniques
National Instruments : luc desruelle's Blogue
Tutorials developpez.com : luc Desruelle
tools that wish you well (Best practices for managing large LabVIEW applications)
More French book"LabVIEW programmation et applications" 3iéme édition, Dunod
More National Instruments Francophone websitesForum francophone NI LabVIEW
Forum francophone Autres produits NI
Communauté Francophone
Luc Desruelle | LinkedIn
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 77
![Page 78: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/78.jpg)
Where to find help?
Community is working for you
2 NI “Francophone” Forums http://forums.ni.com/t5/Discussions-au-sujet-de-NI/bd-p/4171
http://forums.ni.com/t5/Discussions-au-sujet-des-autres/bd-p/4170
1 “Francophone” community https://decibel.ni.com/content/community/regional/france/labview
Rencontre développeurs : cf LUGE
And… All websites forums et communities, for example LabVIEW Development Best Practices
Large Applications : ni.com/largeapps
LAVA
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 78
![Page 79: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/79.jpg)
MESULOG: About us
www.mesulog.fr
Past projects
Technical Presentations
LabVIEW
TestStand
VeriStand
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 79
Past projects
Company -> Technical Presentations
![Page 80: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/80.jpg)
MESULOG: Our customers
Our customers:
ALSTOM Grid
AREVA NP
CEA (Commissariat à l'Énergie Atomique)
CETIAT (Centre Technique des Industries Aérauliques et Thermiques)
CNES (Centre National d'Études Spatiales)
CNRS (Centre National de la Recherche Scientifique)
EDF
HONEYWELL Security
LNE (Laboratoire National d'Essais)
ONERA
PECHINEY
RADIALL
RENAULT
STMicroelectronics
THALES Alenia Space
THALES LCD...
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 80
![Page 81: Darwin applied to LabVIEW: The evolution of the data management](https://reader034.vdocuments.site/reader034/viewer/2022052605/579073711a28ab6874ab6a57/html5/thumbnails/81.jpg)
Questions
Luc DESRUELLE - Darwin applied to LabVIEW : The evolution of the data 81