Presentation is loading. Please wait.

Presentation is loading. Please wait.

F. Diagrama Bloc Diagrama Bloc (DB) reprezintă programul propriu-zis dezvoltat în mediul LabVIEW şi conţine codul sursă al instrumentului virtual. O DB.

Similar presentations


Presentation on theme: "F. Diagrama Bloc Diagrama Bloc (DB) reprezintă programul propriu-zis dezvoltat în mediul LabVIEW şi conţine codul sursă al instrumentului virtual. O DB."— Presentation transcript:

1 F. Diagrama Bloc Diagrama Bloc (DB) reprezintă programul propriu-zis dezvoltat în mediul LabVIEW şi conţine codul sursă al instrumentului virtual. O DB conţine următoarele elemente: - terminale - noduri - fire de legătură - structuri

2 Figure 2.15. Example of a Block Diagram and Corresponding Front Panel

3 Terminalele sunt porturi de intrare-ieşire ce fac legătura dintre PF şi DB.
Ele sunt corespondentele obiectelor de pe PF şi se reprezintă pe DB printr-un simbol care este în concordanţă cu tipul de dată vehiculată de obiect.

4 Terminale Same label name
Data values you enter on the front panel controls enter the block diagram through the control terminals on the block diagram. During execution, the output data values from the block diagram pass from indicator terminals to the front panel indicators. Indicate that front panel items share the same label name as the block diagram terminal. Discuss the visual difference between controls and indicators on the block diagram, and discuss the difference in operation between controls, constants, and indicators. Note that constants are available only on the block diagram. Demonstrate that you can right-click a terminal to change it between a control or indicator. Same label name

5 Terminalele pot fi şterse de pe DB doar odată cu obiectul de pe PF
Terminalele pot fi şterse de pe DB doar odată cu obiectul de pe PF. Mutarea unui terminal pe DB nu conduce la mutarea obiectului corespunzător de pe PF. Terminalele cu conturul îngroşat corespund controalelor, iar cele cu conturul subţire corespund indicatoarelor de pe PF.

6 View Terminals as Icons
By default, View as Icon option enabled. Deselect View as Icon for a more compact view.

7 The terminals in Figure 2
The terminals in Figure 2.15 belong to four front panel controls and indicators. Because terminals represent the inputs and outputs of your VI, subVIs and functions also have terminals shown at left. For example, the connector panes of the Add and Subtract functions have three node terminals. To display the terminals of the function on the block diagram, right-click the function node and select Visible Items»Terminals from the shortcut menu.

8 Controls, Indicators, and Constants
Controls, indicators, and constants behave as inputs and outputs of the block diagram algorithm. Consider the implementation of the algorithm for the area of a triangle:

9 Figure 2.16. Area of a Triangle Front Panel

10 Figure 2.17. Area of a Triangle Block Diagram with Icon Terminal View

11 Figure 2.18. Area of a Triangle Block Diagram without Icon Terminal View

12 Noduri în DB Nodurile sunt obiecte de pe DB care sunt caracterizate de un număr de intrări/ieşiri şi care execută diverse operaţii şi funcţii în timpul rulării IV-ului. Nodurile sunt analoage instrucţiunilor, funcţiilor şi subrutinelor din limbajele de programare bazate pe text. Nodurile pot fi funcții, subVI-uri sau structuri.

13 Noduri Noduri Nodes are analogous to statements, operators, functions, and subroutines in text-based programming languages. Nodes can be functions, subVIs, or structures.

14 Structurile sunt elemente pentru controlul proceselor, cum ar fi structura Case, bucla For și bucla While. Structurile din LabView sunt echivalentul grafic al instrucţiunilor de ciclare (for, while) şi de decizie (if,case) din limbajele de programare clasice. O structură este reprezentată printr-un dreptunghi a cărui dimensiune poate fi modificată.

15 Noduri Funcție Functions are:
Fundamental operating elements of LabVIEW. Do not have front panels or block diagrams, but do have connector panes. Has a pale yellow background on its icon. Double-clicking a function only selects the function. Functions do not open like VIs and subVIs.

16 SubVI Nodes SubVIs : Are VIs that you use on the block diagram of another VI. Have front panels and block diagrams. Use the icon from the upper-right corner of the front panel as the icon that appears when you place the subVI on a block diagram. When you double-click a subVI, the front panel and block diagram open. Any VI has the potential to be used as a subVI. Describe subVIs in this slide. In lesson 4, the student will learn how to build a subVI.

17 Any VI has the potential to be used as a subVI
Any VI has the potential to be used as a subVI. When you double-click a subVI on the block diagram, its front panel window appears. The front panel includes controls and indicators. The block diagram includes wires, icons, functions, possibly subVIs, and other LabVIEW objects. The upper right corner of the front panel window and block diagram window displays the icon for the VI. This is the icon that appears when you place the VI on a block diagram as a subVI.

18 SubVIs also can be Express VIs
SubVIs also can be Express VIs. Express VIs are nodes that require minimal wiring because you configure them with dialog boxes. Use Express VIs for common measurement tasks. You can save the configuration of an Express VI as a subVI. LabVIEW uses colored icons to distinguish between Express VIs and other VIs on the block diagram. Icons for Express VIs appear on the block diagram as icons surrounded by a blue field whereas subVI icons have a yellow field.

19 Express VIs Express VIs:
Are a special type of subVI. Require minimal wiring because you configure them with dialog boxes. Save each configuration as a subVI. Icons for Express VIs appear on the block diagram as icons surrounded by a blue field.

20 Expandable Nodes versus Icons
You can display VIs and Express VIs as icons or as expandable nodes. Expandable nodes appear as icons surrounded by a colored field. SubVIs appear with a yellow field, and Express VIs appear with a blue field. Use icons if you want to conserve space on the block diagram. Use expandable nodes to make wiring easier and to aid in documenting block diagrams. By default, subVIs appear as icons on the block diagram, and Express VIs appear as expandable nodes. To display a subVI or Express VI as an expandable node, right-click the subVI or Express VI and remove the checkmark next to the View As Icon shortcut menu item.

21 Figure 2.19. Icon vs. expandable node

22 Firele de legătură Transferă datele între obiectele de pe DB. Fiecare fir are o singură sursă de date, dar oricât de mulţi receptori. Firele au diferite culori, stiluri şi grosimi ce depind de tipurile de date vehiculate. Un fir rupt, ce nu poate transporta date, se reprezintă printr-o linie întreruptă. Un fir cu două surse de date este un fir rupt. In figura următoare sunt prezentate principalele tipuri de fire ce vehiculează date într-un IV.

23

24 Informaţia vehiculată în VI-urile construite în LabVIEW se prezintă sub forma unei largi varietăţi de tipuri de date. Cele mai importante sunt datele numerice, dar şi alte tipuri cum ar fi booleenele, şirurile de caractere sau clusterele sunt de asemenea foarte utilizate. Mai jos sunt date tipurile de date numerice precum şi celelalte tipuri de date care sunt în mod obişnuit utilizate în construcţia VI-urilor.

25 Tipuri de date cu firele de legătură corespunzătoare, în LabVIEW
LabVIEW uses many common data types: Boolean, numeric, strings, clusters, and so on. The color and symbol of each terminal indicate the data type of the control or indicator. Control terminals have a thicker border than indicator terminals. Also, arrows appear on front panel terminals to indicate whether the terminal is a control or an indicator. An arrow appears on the right if the terminal is a control and on the left if the terminal is an indicator. Definitions Array: Arrays group data elements of the same type. An array consists of elements and dimensions. Elements are the data that make up the array. A dimension is the length, height, or depth of an array. An array can have one or more dimensions and as many as (231) – 1 elements per dimension, memory permitting. Cluster: Clusters group data elements of mixed types, such as a bundle of wires in a telephone cable, where each wire in the cable represents a different element of the cluster. See Help»Search the LabVIEW Help… for more information. The LabVIEW User Manual on ni.com provides additional references for data types found in LabVIEW. © National Instruments Corporation 25 Introduction to LabVIEW Hands-On

26 Definitii Array (Tablou): Un Array grupează date de acelaşi tip şi este alcătuit din elemente şi dimensiune. Elementele sunt reprezentate de datele ce alcătuiesc tabloul. Dimensiunile sunt repezentate de lungimea, înălţimea sau adâncimea tabloului. Un tablou se poate construi din date de tip numeric, boolean, căi de fişiere, string, waveform şi cluster. Se poate selecta din subpaleta Array&Cluster. Cluster (Grupuri): Un Cluster grupează elemente de date de tipuri diferite, la fel ca un mănunchi de fire dintr-un cablu telefonic, în care fiecare fir din cablu reprezintă un element diferit al grupului (cluster-ului).

27 Paleta de funcţii Paleta de funcţii este o fereastră ce se deschide doar de pe DB. Aceasta conţine operatori, funcţii, noduri, structuri şi subIV-uri cu ajutorul cărora se construieşte programul în LabVIEW. Accesarea paletei de funcţii se face în modurile următoare: • View – Show Functions Palette • MD pe DL. In cel de-al doilea mod, paleta poate fi fixată ca fereastră pe ecran prin mouse stânga pe pioneza din stânga sus a acestei ferestre. Altfel, paleta se închide după realizarea unui mouse stânga oriunde pe DB.

28 To view or hide categories, click the Customize button on the palette, and select or deselect the Change Visible Palettes option. Figure Functions Palette

29 Funcţiile pe paletă sunt grupate după destinaţia lor
Funcţiile pe paletă sunt grupate după destinaţia lor. Cele mai utilizate sunt cele din subpaleta Programming, care se expandează în mod implicit. Celelalte sunt biblioteci care pot fi apelate de către utilizator la construirea de aplicaţii dedicate. De exemplu, dacă se realizează un IV necesar procesării unor semnale achiziţionate în prealabil, se utilizează funcţii din subpaleta Signal Processing.

30 Dacă este necesar un aparat matematic complex, avem la dispoziţie biblioteca Mathematics.
Multe din aceste subpalete nu sunt populate cu funcţii. Adăugarea de biblioteci acestor subpalete se face prin instalarea toolkit-urilor dedicate puse la dispoziţie de National Instruments. Meniul shortcut al funcţiilor Fiecare funcţie are disponibil un meniu shortcut, cu ajutorul căruia se stabilesc o serie de parametri, se pot vizualiza etichete (funcţia poate fi etichetată, la fel ca orice terminal), se poate apela helpul mare, se pot vizualiza exemple, se pot face descrieri ale funcţiei sau se pot stabili punct de întrerupere în vederea depanării programului.

31 Aceste opţiuni sunt comune tuturor funcţiilor, în prima parte a meniului, prin opţiunile:
• Visible Items • Help • Examples • Description and Tip… • Set Breakpoint Pe lângă acestea, mai există o serie de opţiuni specifice fiecărei funcţii. O opţiune comună mai este Replace, prin care se permite utilizatorului înlocuirea funcţiei cu o alta prin deschiderea automată a paletei de funcţii.

32 Bara cu unelte în DB În figura de mai jos sunt prezentate comenzile barei de meniuri a diagramei bloc.

33 Semnificaţiile comenzii barei de meniuri sunt prezentate în cele ce urmează:
Run – lansează programul; Run Continuously - lansează programul în mod continuu ca şi în limbajul de programare C cu ajutorul buclei While; Abort execution – opreşte programul; High light execution (Execuție animată) – comandă foarte utilă care permite vizualizarea fluxurilor de informaţii în blocurile diagramei în timpul execuţiei programului;

34 Retain Wires – atunci când este activat cablurile (wires) păstrează o copie a ultimei valori în cazul în care programul este oprit; Step in – rulează programul treptat revenind la fiecare buclă în parte; Step over – rulează programul nod cu nod fără însă a intra în detaliile de execuţie ale buclei; Finish Block Diagram - opreşte execuţia.

35 G. Căutarea Controalelor, VI-urilor și Funcțiilor
Until you are familiar with the location of VIs and functions, search for the function or VI using the Search button. For example, if you want to find the Random Number function, click the Search button on the Functions palette toolbar and start typing Random Number in the text box at the top of the palette. LabVIEW lists all matching items that either start with or contain the text you typed.

36 You can click one of the search results and drag it to the block diagram, as shown in Figure Double-click the search result to highlight its location on the palette. If the object is one you need to use frequently, you can add it to your Favorites category. Right-click the object on the palette and select Add Item to Favorites, as shown in Figure 2.22.

37 Figure 2.21. Searching for an Object in the Functions Palette
Figure Adding an Item to the Favorites Category of a Palette

38 Similar cu butonul Search, se poate utiliza cutia de dialog Quick Drop pentru a găsi după nume, diferitele obiecte și apoi plasarea lor in DB sau în PF. Pentru afișarea cutiei de dialog Quick Drop se va selecta View»Quick Drop. Apoi se va tipării numele obiectului dorit a se adăuga în DB sau în PF. LabVIEW va afișa rezultatul căutării în Name Match List.

39 Figure 2.23. Searching for an Object in the Quick Drop Dialog Box

40 Apelarea helpului în LabVIEW
LabVIEW prezintă un puternic sistem de helpuri prin care utilizatorul este ghidat şi îndrumat în activitatea de programare. In plus, utilizatorul are la dispoziţie un număr mare de exemple, grupate pe categorii de aplicaţii, în care sunt exemplificate diverse situaţii de operare a unor funcţii şi în care se pot găsi de multe ori soluţii tehnice. Atât helpurile, cât şi exemplele, sunt disponibile în meniul principal Help, accesabil atât de pe PF cât şi pe DB.

41 De remarcat faptul că National Instruments pune la dispoziţie o bibliotecă a utilizatorilor accesibilă pe Internet denumită LabVIEW Zone, în care dezvoltatorii de instrumente virtuale pot găsi soluţii la problemele lor, dar pot oferi ei înşişi soluţii prin posibilitatea de a posta în această bibliotecă propriile VI-uri. Local, există două tipuri de helpuri ale programului: un help sumar, apelabil din meniul principal Help – Show Context Help, prin care se deschide o fereastră permanentă în care se afişează informaţii sumare despre funcţia de pe DB sau obiectul de pe PF.

42 Informaţia este afişată doar la suprapunerea prompterului mouse-ului peste acel obiect sau funcţie (fără a se face clic). De asemenea, helpul mic furnizează informaţii despre funcţiile din paleta de funcţii la simpla accesare a acestora cu mouse-ul. Un help detaliat, specific doar funcţiilor de pe DB, apelabil din meniul shortcut al funcţiei (mouse dreapta pe funcţie), opţiunea Help. Help-ul detaliat se mai poate deschide şi apăsând pe linkul Detailed help din help-ul sumar. Aici se dau informaţii mai detaliate privind funcţia, inclusiv exemple sau aplicaţii.

43 H. Fluxul datelor Programele scrise în limbaje procedurale, bazate pe instrucţiuni text (Visual Basic, C/C++, Java, etc.), sunt executate secvenţial, după conceptul „flux controlat”, în care instrucţiunile se execută într-o ordine prestabilită prin program.

44 Limbajul G, după care funcţionează LabVIEW, foloseşte tehnica „fluxului de date” (data flow), în care datele şi efectuarea funcţiilor şi a nodurilor se realizează în paralel. Chiar în interiorul unui VI programul lucrează multitasking, în sensul că se pot executa mai multe funcţii în acelaşi timp, cu condiţia ca acestea să aibă toate datele disponibile la intrare.

45 După acest concept, pot rula în acelaşi timp mai multe VI-uri
După acest concept, pot rula în acelaşi timp mai multe VI-uri. Aşadar, un nod care are disponibile datele la toate intrările, este efectuat indiferent de starea celorlalte noduri. Evident însă, dacă ieşirea unui nod reprezintă intrare pentru alt nod, cel de-al doilea nod va trebui să aştepte până ce este efectuat cel dinainte. Un model al conceptului „data flow” este ilustrat în figura următoare. In figură se prezintă modul în care se realizează funcţiile f şi g, ambele de variabile A şi B, în cazul programării procedurale şi al programării în LabVIEW.

46

47 In cazul Programării clasice întâi se citesc datele A, apoi cele B, după care se efectuează funcţia f(A,B), apoi funcţia g(A,B). De remarcat că funcţia g se efectuează abia după efectuarea funcţiei f, deşi datele de intrare sunt disponibile pentru ambele funcţii. E posibil însă ca datele B să fie disponibile înaintea datelor A. Programul aşteaptă întâi datele A, apoi le citeşte pe cele B, ducând la pierdere de timp.

48 In cazul programării în LabVIEW, nu există o prioritate între intrările A şi B, fiecare dată fiind citită de îndată ce este disponibilă. Mai mult, funcţiile f şi g se efectuează independent una de cealaltă, de îndată ce datele de intrare sunt disponibile.

49 In felul acesta se obţine o economie substanţială de timp, esenţială în aplicaţiile în care operaţiile trebuie să se succeadă cu viteză (ex.: achiziţii de semnale de frecvenţă ridicată şi prelucrarea concomitentă a informaţiei). Alocarea şi managementul memoriei se face automat de către program, doar pentru datele care sunt în lucru. După ce datele cu care s-a lucrat nu mai sunt necesare, memoria se eliberează. In felul acesta se realizează şi o economie importantă de resurse.

50 For a dataflow programming example, consider a block diagram that adds two numbers and then subtracts from the result of the addition, as shown in Figure In this case, the block diagram executes from left to right, not because the objects are placed in that order, but because the Subtract function can not execute until the Add function finishes executing and passes the data to the Subtract function. Remember that a node executes only when data are available at all of its input terminals and supplies data to the output terminals only when the node finishes execution. Figure Dataflow Programming Example

51 In Figure 2.25, consider which code segment would execute first—the Add, Random Number, or Divide function. You cannot know because inputs to the Add and Divide functions are available at the same time, and the Random Number function has no inputs. In a situation where one code segment must execute before another, and no data dependency exists between the functions, use other programming methods, such as error clusters, to force the order of execution. Figure Dataflow Example for Multiple Code Segments

52 I. Realizarea unui VI simplu
Most LabVIEW VIs have three main tasks—acquiring some sort of data, analyzing the acquired data, and presenting the result. When each of these parts are simple, you can complete the entire VI using very few objects on the block diagram. Express VIs are designed specifically for completing common, frequently used operations. In this section, you learn about some Express VIs that acquire, analyze, and present data. Then you learn to createa simple VI that uses these three tasks, as shown in Figure 1.27.

53 On the Functions palette, the Express VIs are grouped together in the Express category. Express VIs use the dynamic data type to pass data between Express VIs. Figure Acquire, Analyze, and Present Example Front Panel Window and Block Diagram Window

54 Acquire Express VIs used for the Acquire task include the following: DAQ Assistant, Instrument I/O Assistant, Simulate Signal, and Read from Measurement File. DAQ Assistant The DAQ Assistant acquires data through a data acquisition device. You must use this Express VI frequently throughout this course. Instrument I/O Assistant The Instrument I/O Assistant acquires instrument control data, usually from a GPIB or serial interface. Simulate Signal The Simulate Signal Express VI generates simulated data such as a sine wave.

55 Read From Measurement File
The Read From Measurement File Express VI reads a file that was created using the Write To Measurement File Express VI. It specifically reads LVM or TDM file formats. This Express VI does not read ASCII files. Analyze Express VIs used for the Analyze task include the following—Amplitude and Level Measurements, Statistics, Tone Measurements, and so on. Amplitude and Level Measurements The Amplitude and Level Measurements Express VI performs voltage measurements on a signal. These include DC, rms, maximum peak, minimum peak, peak to peak, e.t.c.

56 Statistics The Statistics Express VI calculates statistical data from a waveform.This includes mean, sum, standard deviation, and extreme values. Spectral Measurements The Spectral Measurements Express VI performs spectral measurement on a waveform, such as magnitude and power spectral density. Tone Measurements The Tone Measurements Express VI searches for a single tone with the highest frequency or highest amplitude. It also finds the frequency and amplitude of a single tone. Filter The Filter Express VI processes a signal through filters and windows. Filters used include the following: Highpass, Lowpass, Bandpass, Bandstop, and Smoothing. Windows used include Butterworth, Chebyshev, Inverse Chebyshev, Elliptical, and Bessel.

57 Present Present results by using Express VIs that perform a function, such as the Write to Measurement File Express VI, or indicators that present data on the front panel window. The most commonly used indicators for this task include the Waveform Chart, the Waveform Graph, and the XY Graph. Common Express VIs include the Write to Measurement File Express VI, the Build Text Express VI, the DAQ Assistant, and the Instrument I/O Assistant. In this case, the DAQ Assistant and the Instrument I/O Assistant provide output data from the computer to the DAQ device or an external instrument. Write to Measurement File The Write to Measurement File Express VI writes a file in LVM or TDMS file format.

58 Build Text The Build Text Express VI creates text, usually for displaying on the front panel window or exporting to a file or instrument. Running a VI After you configure the Express VIs and wire them together, you can run theVI. When you finish creating your VI, click the Run button on the toolbar to execute the VI. While the VI is running, the Run button icon changes to the figure shown at left. After the execution completes, the Run button icon changes back to its original state, and the front panel indicators contain data.

59 Run Button Errors If a VI does not run, it is a broken, or nonexecutable, VI. The Run button appears broken when the VI you are creating or editing contains errors. If the button still appears broken when you finish wiring the block diagram, the VI is broken and cannot run. Generally, this means that a required input is not wired, or a wire is broken. Press the broken run button to access the Error list window. The Error list window lists each error and describes the problem. You can double-click an error to go directly to the error.

60 Refer to Figure 1.28 to answer the following quiz questions.
Figure Dataflow Questions 1. Which function executes first: Add or Subtract? a. Add b. Subtract c. Unknown 2. Which function executes first: Sine or Divide? a. Sine b. Divide

61 3. Which function executes first?
a. Random Number b. Divide c. Add d. Unknown 4. Which function executes last: Random, Subtract or Add? b. Subtract 5. What are the parts of a VI? a. Front panel window c. Project b. Block diagram window d. Icon/connector pane


Download ppt "F. Diagrama Bloc Diagrama Bloc (DB) reprezintă programul propriu-zis dezvoltat în mediul LabVIEW şi conţine codul sursă al instrumentului virtual. O DB."

Similar presentations


Ads by Google