Labview Pdf.pdf

  • Uploaded by: Hanen Abdelmoula
  • 0
  • 0
  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Labview Pdf.pdf as PDF for free.

More details

  • Words: 2,111
  • Pages: 138
LabVIEW A.U. 2016/2017

Contrôle et commande sous LabView

What is LabVIEW?

LabVIEW is a graphical programming environment you can used to develop sophisticated measurement, test, and control systems.

Benefits of LabVIEW

• A platform-based approach for measurement and control • Interfaces with wide variety of hardware • Scales across different targets and operating systems • Provides built-in analysis libraries

2

Initiation aux instruments virtuels de LabVIEW LabVIEW VIs contain three main components : 1- the front panel window 2- the block diagram 3- the icon/connector pane.

3

Front Panel User interface for the VI. Contains controls and indicators, which are the interactive input and output terminals of the VI, respectively.

control

indicator

control 4

Front Panel

5

Front Panel

Data Types

The string data type is a sequence of ASCII characters.

The Boolean data type represents data that only has two possible states, such as TRUE and FALSE or ON and OFF.

The numeric data type can represent numbers of various types, such as integer or real.

6

Front Panel

Data Types

7

Front Panel

Data Types

boolean

control

string

control

boolean

indicator

8

Block Diagram Block diagram objects include terminals, subVIs, functions, constants, structures, and wires, which transfer data among other block diagram objects.

9

Block Diagram

10

Block Diagram

11

Block Diagram

subVIs

Express VIs

12

Block Diagram

13

14

15

Dataflow Dataflow is the movement of data through the nodes of a block diagram.

Nœud

1

est exécuté lorsque les données à ses entrées (input) sont disponibles

Nœud

2

fournit des données à sa sortie (output) quand il termine l’exécution.

16

Dataflow

17

Dataflow

3

Dernier nœud à exécuter

indépendants 18

Dataflow

19

Dataflow

1

1er nœud à exécuter

indépendants

20

Dataflow

21

Dataflow

2

1 3

22

Dataflow

23

Dataflow

1

24

LabVIEW Data Types

1- Boolean Data

25

LabVIEW Data Types

Conversion automatique de

Conversion manuelle de

2- Numeric Data

au

au

26

LabVIEW Data Types

2- Numeric Data

27

LabVIEW Data Types

3- Strings

28

LabVIEW Data Types

4- Enums

Front panel

Properties

string

numeric

Block diagram

29

30

31

32

33

Using Loops

While Loops

-

Repeats code segment until a condition is met Always execute at least once

For Loops

-

Repeats code a certain number of times. Can execute zero times

34

35

36

37

38

39

Data Feedback in Loops Shift Registers Shift registers store data values from previous iterations of a loop in LabVIEW.

i=n+1

Input i=n

Output i=n

40

Data Feedback in Loops i=0

i=1

i=2

i=3

0

1

1

2

2

3

3

4

41

Data Feedback in Loops

42

Data Feedback in Loops What value is displayed in the Numeric indicator after the VI executes?

43

Plotting Data

Waveform Chart The waveform chart is a special type of numeric indicator that displays one or more plots of data typically acquired at a constant rate. Waveform charts can display single or multiple plots.

44

Plotting Data

Strip Chart

Shows running data continuously scrolling from left to right across the chart with old data on the left and new data on the right.

Scope Chart

Shows one item of data, such as a pulse or wave, scrolling partway across the chart from left to right.

Sweep Chart

Works similarly to a scope chart except it shows the old data on the right and the new data on the left separated by a vertical line. 45

Detection of warnings and errors

- Error Handling

Automatic error Handling Manual error Handling

- Error cluster

- Merge error

46

Detection of warnings and errors

Error Handling

Automatic Error Handling

At run time, LabVIEW suspends execution, highlights node where error occurred, and displays Error dialog box

Manual Error Handling

You control when dialog boxes appear, propagate errors through error in/error out clusters, terminate error chain with Simple Error Handler

47

Detection of warnings and errors

Error Handling

Automatic Error Handling

NB: Enabling automatic error handling does not override manual error handling. If the error cluster is wired and the VI uses the Simple Error Handler, then LabVIEW defaults to manual error handling. 48

Detection of warnings and errors

Error Handling

Automatic Error Handling

For the VI shown in the following block diagram, automatic error handling is enabled. If the file C:\data.txt does not exist, will an error dialog box pop up ?

No

propagate errors (wired)

Manual Error Handling

49

Detection of warnings and errors

Error Handling

Manual Error Handling

propagate errors

Simple Error Handler

50

Detection of warnings and errors

Error Handling

Manual Error Handling

The file C:\data.txt does not exist, but the VI does not report an error. Which code snippet reports an error and stops?

51

A-

B-

C-

D52

Detection of warnings and errors

Error Handling

Error Clusters

1- status : a Boolean value that reports TRUE if an error occurs 2- code : a 32-bit signed integer that identifies the error numerically. A non-zero error code is coupled with a status of FALSE signals a warning rather than an error 3- source : a string that identifies where the error occurred 53

Detection of warnings and errors

Error Handling

Error Clusters

54

Detection of warnings and errors

Error Handling

Error Clusters

Why does an error occur when the code executes?

55

Detection of warnings and errors

Error Handling

Merge Errors

The Merge Errors Function: - Returns the first error found. If no error is found, it returns the first warning. - Does not concatenate errors.

Use Merge Errors to - Propagate errors along wires. - Merge errors from different wire paths.

56

Detection of warnings and errors

Error Handling

57

Creating Data Structures

Arrays

Collection of data elements that are of the same type. The data that make up the array. Elements can be numeric, Boolean, path, string. 1D Arrays

2D Arrays

58

Creating Data Structures

Array Functions

Initialize Array

59

Creating Data Structures

Array Functions

Insert Into Array

60

Creating Data Structures

Array Functions

61

Creating Data Structures

Array Functions

Delete From Array

62

Creating Data Structures

Array Functions

63

Creating Data Structures

Array Functions

Array Max & Min

64

Creating Data Structures

Array Functions

Search 1D Array

65

Creating Data Structures

Polymorphism

The ability of VIs and functions to automatically adapt to accept input data of different data types.

66

Creating Data Structures Creating 1D Array 1D Array

67

Creating Data Structures Creating 2D Array 2D Array

68

Creating Data Structures Creating 2D Array 1D Array

2D Array

69

Creating Data Structures Creating 2D Array

If the iteration count terminal is wired and arrays of different sizes are wired to auto-indexed tunnels, the actual number of iterations becomes the smallest of the choices. 70

Creating Data Structures 1- What value does the Value Out indicator display after the VI executes? a. 0 b. 4 c. 5 d. 6 2- What is the output of the Initialize Array function after the following code has executed?

71

Creating Data Structures 3- What is the result in subarray after the following code has executed?

4- What is the result of the following Array addition?

72

error handling samples :

Automatic error handling :

1- Créer un fichier « RCI.txt »

73

2- activer « Automatic error handling »

74

3- simuler le programme :

 Pas d’erreurs détectées

75

4- donner l’ordre d’écriture à partir l’octet numéro «-2 » (qui est impossible) :

76

3- simuler le programme :

 détection d’une erreur

 Arrêt de la simulation au niveau du nœud  La simulation est suspendue

77

Manual error handling :

78

1- simuler le programme :

 détection et propagation de l’erreur

 Labview termine l’exécution du programme

 Le fichier RCI.txt est généré mais vide 79

Error cluster:

80

1- simuler le programme :

 détection et propagation de l’erreur (front panel)

 Labview termine l’exécution du programme

 Le fichier RCI.txt est généré mais vide 81

1- dissocier les éléments du cluster:

82

2- sur le Front Panel on aura :

error cluster

Les éléments du cluster

83

3- simuler le programme :

error cluster

Les éléments du cluster

 Labview termine l’exécution du programme

 Le fichier RCI.txt est généré mais vide 84

4- tester maintenant l’état de l’erreur « STATUS » en utilisant le case structure: 5- affichage en cas d’erreur dans une boite de dialogue le message « detection d’erreur » :

85

6- simuler le programme :

error cluster

Les éléments du cluster

Boite de dialogue

86

7- tester l’état d’erreur directement en utilisant le case structure: 8- affichage en cas d’erreur dans une boite de dialogue le message « detection d’erreur » :

87

7- utiliser les SUB VIs:

88

89

Using Structures

Case Structures

Case Selector label

Selector terminal

90

Using Structures

Case Structures

Selector Terminal Data Types Boolean

Enums

Integer

String

Error cluster 91

Using Structures

Case Structures

Input and Output Tunnels

92

case1 What value will be displayed in the Out indicator when this VI completes execution?

93

This graphic displays all the cases of a single case statement. What value does the Result indicator display after the VI executes?

36

94

Using Structures

Event Structures

95

Using Structures

Event Structures

96

Using Structures

Event Structures

97

Using Structures

Event Structures

98

Using Structures

Event Structures

Time out event

Après chaque 1s le nombre d’itération sera incrémenté 99

Using Structures

Event Structures

100

Using Structures

Flat sequence Séquence déroulée

Scénario

1

Scénario

2

Scénario

3

Composée d'un ou plusieurs sous-diagrammes ou étapes qui s'exécutent de façon séquentielle. Utilisez la structure Séquence déroulée pour garantir qu'un sousdiagramme s'exécute avant ou après un autre sous-diagramme. 101

Using Structures

Flat sequence

0,5s 0,5s 0,5s

Local variable (write)

Local variable (Read)

102

State Machines

Une machine d'état est un modèle de conception dans LabVIEW qui a généralement un début (START) et une fin (STOP), mais contient également d'autres états.

103

State Machines When to Use a State Machine ?

Sequential process

Driven process

104

State Machines

Sequential process

Exemple :

105

State Machines

Sequential process

106

State Machines

Sequential process

107

State Machines

Enumeration : - Arrêt - Descente - Montée

While loop

Sequential process

Case structure

Shift register

108

State Machines

state machine sequentiel.vi

Sequential process

109

State Machines Etat 1

Sequential process

Etat 2

Etat 3

110

State Machines

Enums

While loop

Driven process

Case structure

Event structure

Shift register

Le passage d’une étape à une autre sera par le changement de valeur « change value » des entrées

111

State Machines

Driven process

Exemple :

Exécution de l’étape 1

Exécution de l’étape 2

Sortie

112

State Machines

Driven process

113

State Machines

Driven process

114

State Machines

Driven process

115

State Machines

Driven process

116

State Machines

Driven process

117

State Machines

Driven process

118

Variables

Objective: Identify the differences between:

Local variables global variables

119

Variables Local and global variables pass information between locations in the application that you cannot connect with a wire.

120

Variables

Démo

Local variables

121

Variables

Local variables

122

Variables

Démo

Local variables

123

Variables

Local variables

124

Variables

Local variables

Démo 125

Variables

Local variables

126

Variables

Local variables

Démo 127

Variables

Local variables

0

128

Variables

Global variables VI 1.vi

VI 2.vi

129

Variables

Global variables VI 1.vi

Project

Variable globale

VI 2.vi

130

Variables

Drawbacks

1- Less readable block diagram code : Because variables break the dataflow model, you cannot use wires to follow the flow of data.

131

Variables

Drawbacks

2- Limited Boolean mechanical actions Boolean controls associated with variables must use a switch mechanical action. If a Boolean control has an associated local variable, it cannot use a latch mechanical action because the first local variable to read the Boolean control with latch action would reset its value to the default, which is not the expected behavior. 132

Variables

Drawbacks

3-Unexpected behavior in Vis Using variables instead of a connector pane or using variables to access values in each frame of a sequence structure is a bad practice and can cause unexpected behavior in VIs. Because variables only contain the latest value, you could have potential data loss if you fail to synchronize data operations properly. 133

Variables

Drawbacks

4- Race condition : When a data dependency is not established, LabVIEW can schedule tasks in any order, which creates the possibility for race conditions if the tasks depend upon each other.

134

Variables

Race condition

A race condition occurs when the timing of events or the scheduling of tasks unintentionally affects an output or data value.

Exemple : The code in this example has four possible outcomes, depending on the order in which the operations execute.

135

Variables

Race condition

136

Variables

Race condition

137

Variables

138

Related Documents

Labview Mathscrip
May 2020 11
Labview Pdf.pdf
May 2020 10
Documentation Labview
June 2020 9
Usb Labview
May 2020 13
Labview 4
August 2019 25
Labview Strings
May 2020 13

More Documents from ""

Labview Pdf.pdf
May 2020 10