SlideShare a Scribd company logo
1 of 19
6. Clustere




TOPICS
A. Introduction to Clusters
B. Cluster Functions
C. Error Clusters
A. Clustere (Grupuri)

•   Sunt structuri de date care grupează datele împreună
•   Datele pot fi de tipuri diferite (numerice, Booleene, stringuri, e.t.c.)
•   Elementele trebuie să fie, fie toate controale, fie toate indicatoare
•   Analog cu o legătură de fire dintr-un cablu
•   Fiecare fir din cablu reprezintă un element al clusterului
•   Deoarece un cluster are un singur fir (de intrare sau de ieșire) chiar dacă acesta
    transportă multiple valori de diferite date, clusterele reduc firele și numărul de terminale
    conector pe care un subVI le necesită. Figura de mai jos ilustrează conceptul de
    grupare, respectiv degrupare, a elementelor de date într-un cluster.
Cluster Controls and Indicators
1. Select a Cluster shell   2. Place objects inside the shell
   from the Array &
   Cluster subpalette




                                                     3
Creating Cluster Constants
1. Select Cluster
   Constant shell from the
   Cluster subpalette




2. Place objects in the Cluster shell
Cluster Order
• Elements have a logical order (start with 0)
• To change order, right-click the border and select Reorder
  Controls in Cluster...




                                                   5
Utilizarea Clusterelor pentru transferul
            datelor în SubVI-uri
Unul dintre avantajele
clusterelor este acela că
acestea pot fi utilizate pentru
gruparea datelor la intrarea și
respectiv ieșirea subVI-urilor.
Clusterele reduc astfel
numărul de fire într-o
diagramă.




                                  6
B. Funcții Cluster
• Aceste funcții se găsesc în subpaleta Cluster, Class & Variant a paletei
  Functions>>Programming
Funcţia Bundle
• Grupează mai multe componente, realizând
  un grup, sau înlocuieşte una sau mai multe
  componente ale unui grup existent.
• Gruparea elementelor se realizează în ordinea acestora în cadrul grupului. Prima componentă conectată la funcţia Bundle este componenta cu index-ul 0, urmează componenta cu index-ul 1, s.a.m.d.
  Numărul de intrări poate fi modificat fie prin selectarea Add Input din meniul contextual al intrării fie utilizând unealta de poziţionare / redimensionare din caseta Tools.
• O altă exemplificare a utilităţii funcţiei Bundle este prezentată în
  figura de mai jos.
• Constanta numerică (setată la valoarea 0) defineşte punctul de
  origine real iar prin controlul numeric se impune valoarea de
  incrementare. Funcţia Bundle reuneşte datele numerice permiţând
  reprezentarea grafică.
• Funcţia Bundle poate fi utilizată și pentru înlocuirea unor componente
  ale unui grup (cluster) deja existent. În acest caz, grupul trebuie
  conectat la intrarea cluster a funcţiei.
• În cadrul aplicaţiei de mai jos, funcţia bundle permite înlocuirea valorii
  numerice corespunzatoare controlului Knob şi respectiv a controlului
  Numeric 2, cu valorile numerice corespunzătoare controalelor
  knob_input, respectiv Numeric 2_input.
Funcţia Bundle by Name
• Funcţia Bundle by Name este folosită doar pentru înlocuirea unei componente
  dintr-un grup existent. Modul de lucru este asemănător cu cel prezentat anterior.
  Cluster-ul existent se conectează la intrarea specificată a funcţiei (input cluster). În
  ordinea logică a construcţiei se introduce controlul care va înlocui o componentă.
  Componenta de înlocuit se va identifica după numele reprezentat prin eticheta
  asociată. Numărul posibilităţilor de înlocuire se pot vizualiza din meniul contextual
  al intrării funcţiei prin selectarea opţiunii Select Item.
Funcțiile Unbundle și Unbundle by Name
• Descompunerea (degruparea) grupurilor (clusterelor) în
  componente, se realizează cu ajutorul a două funcţii, Unbundle
  şi Unbundle by Name.
C. Error Clusters
•Use the error in and error out clusters in each VI you use or build to handle errors in the VI.
•The error clusters located on the Controls»Array & Cluster palette include the components
 of information shown
• Error cluster contains the following information:
   – Boolean to report whether error occurred
   – Integer to report a specific error code
   – String to give information about the error
Error Cluster Details

     • Status is a Boolean value that reports
       TRUE if an error occurred. Most VIs,
       functions, and structures that accept
       Boolean data also recognize this
       parameter.
     • Code is a signed 32-bit integer that
       identifies the error numerically. A non-
       zero error code coupled with a status
       of FALSE signals a warning rather
       than a fatal error.
     • Source is a string that identifies where
       the error occurred.
Error Handling with Clusters
• You can make error handling decisions on the block diagram
• Error handling in LabVIEW follows the dataflow model. Just as data flow through a
  VI, so can error information
• Wire the error information from the beginning of the VI to the end
• Error information is passed from one subVI to the next
• If an error occurs in one subVI, all subsequent subVIs are not executed in the usual
  manner
• Error Clusters contain all error conditions
• Automatic Error Handling




                                                               Error Cluster
Simple Error Handler
Use the Simple Error Handler to handle the error at the end of
the execution flow.

The Simple Error Handler is located on the Functions»All
Functions»Time and Dialog palette. Wire the error cluster to
the Error In (no error) input.
Using While Loops for Error Handling
You can wire an error cluster to the conditional terminal of a While Loop
to stop the iteration of the While Loop.
Only the TRUE or FALSE value of the status parameter of the error
cluster is passed to the terminal.
When an error occurs, the
While Loop stops.
Exercise: Error Clusters & Handling
Summary
• Clusters group data elements of mixed types. A cluster cannot
  contain a mixture of controls and indicators.
• To create a cluster control or indicator, select a cluster on the
  Controls»Array & Cluster palette, place it on the front panel, and
  drag controls or indicators into the cluster shell.
• Use the Cluster functions located on the Functions»All
  Functions»Cluster palette to create and manipulate clusters.
• Error checking tells you why and where errors occur.
• The error cluster reports the status, code and source of the error.
• Use the error cluster controls and indicators to create error inputs
  and outputs in subVIs.

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Cap.6

  • 1. 6. Clustere TOPICS A. Introduction to Clusters B. Cluster Functions C. Error Clusters
  • 2. A. Clustere (Grupuri) • Sunt structuri de date care grupează datele împreună • Datele pot fi de tipuri diferite (numerice, Booleene, stringuri, e.t.c.) • Elementele trebuie să fie, fie toate controale, fie toate indicatoare • Analog cu o legătură de fire dintr-un cablu • Fiecare fir din cablu reprezintă un element al clusterului • Deoarece un cluster are un singur fir (de intrare sau de ieșire) chiar dacă acesta transportă multiple valori de diferite date, clusterele reduc firele și numărul de terminale conector pe care un subVI le necesită. Figura de mai jos ilustrează conceptul de grupare, respectiv degrupare, a elementelor de date într-un cluster.
  • 3. Cluster Controls and Indicators 1. Select a Cluster shell 2. Place objects inside the shell from the Array & Cluster subpalette 3
  • 4. Creating Cluster Constants 1. Select Cluster Constant shell from the Cluster subpalette 2. Place objects in the Cluster shell
  • 5. Cluster Order • Elements have a logical order (start with 0) • To change order, right-click the border and select Reorder Controls in Cluster... 5
  • 6. Utilizarea Clusterelor pentru transferul datelor în SubVI-uri Unul dintre avantajele clusterelor este acela că acestea pot fi utilizate pentru gruparea datelor la intrarea și respectiv ieșirea subVI-urilor. Clusterele reduc astfel numărul de fire într-o diagramă. 6
  • 7. B. Funcții Cluster • Aceste funcții se găsesc în subpaleta Cluster, Class & Variant a paletei Functions>>Programming
  • 8. Funcţia Bundle • Grupează mai multe componente, realizând un grup, sau înlocuieşte una sau mai multe componente ale unui grup existent. • Gruparea elementelor se realizează în ordinea acestora în cadrul grupului. Prima componentă conectată la funcţia Bundle este componenta cu index-ul 0, urmează componenta cu index-ul 1, s.a.m.d. Numărul de intrări poate fi modificat fie prin selectarea Add Input din meniul contextual al intrării fie utilizând unealta de poziţionare / redimensionare din caseta Tools.
  • 9. • O altă exemplificare a utilităţii funcţiei Bundle este prezentată în figura de mai jos. • Constanta numerică (setată la valoarea 0) defineşte punctul de origine real iar prin controlul numeric se impune valoarea de incrementare. Funcţia Bundle reuneşte datele numerice permiţând reprezentarea grafică.
  • 10. • Funcţia Bundle poate fi utilizată și pentru înlocuirea unor componente ale unui grup (cluster) deja existent. În acest caz, grupul trebuie conectat la intrarea cluster a funcţiei. • În cadrul aplicaţiei de mai jos, funcţia bundle permite înlocuirea valorii numerice corespunzatoare controlului Knob şi respectiv a controlului Numeric 2, cu valorile numerice corespunzătoare controalelor knob_input, respectiv Numeric 2_input.
  • 11. Funcţia Bundle by Name • Funcţia Bundle by Name este folosită doar pentru înlocuirea unei componente dintr-un grup existent. Modul de lucru este asemănător cu cel prezentat anterior. Cluster-ul existent se conectează la intrarea specificată a funcţiei (input cluster). În ordinea logică a construcţiei se introduce controlul care va înlocui o componentă. Componenta de înlocuit se va identifica după numele reprezentat prin eticheta asociată. Numărul posibilităţilor de înlocuire se pot vizualiza din meniul contextual al intrării funcţiei prin selectarea opţiunii Select Item.
  • 12. Funcțiile Unbundle și Unbundle by Name • Descompunerea (degruparea) grupurilor (clusterelor) în componente, se realizează cu ajutorul a două funcţii, Unbundle şi Unbundle by Name.
  • 13. C. Error Clusters •Use the error in and error out clusters in each VI you use or build to handle errors in the VI. •The error clusters located on the Controls»Array & Cluster palette include the components of information shown • Error cluster contains the following information: – Boolean to report whether error occurred – Integer to report a specific error code – String to give information about the error
  • 14. Error Cluster Details • Status is a Boolean value that reports TRUE if an error occurred. Most VIs, functions, and structures that accept Boolean data also recognize this parameter. • Code is a signed 32-bit integer that identifies the error numerically. A non- zero error code coupled with a status of FALSE signals a warning rather than a fatal error. • Source is a string that identifies where the error occurred.
  • 15. Error Handling with Clusters • You can make error handling decisions on the block diagram • Error handling in LabVIEW follows the dataflow model. Just as data flow through a VI, so can error information • Wire the error information from the beginning of the VI to the end • Error information is passed from one subVI to the next • If an error occurs in one subVI, all subsequent subVIs are not executed in the usual manner • Error Clusters contain all error conditions • Automatic Error Handling Error Cluster
  • 16. Simple Error Handler Use the Simple Error Handler to handle the error at the end of the execution flow. The Simple Error Handler is located on the Functions»All Functions»Time and Dialog palette. Wire the error cluster to the Error In (no error) input.
  • 17. Using While Loops for Error Handling You can wire an error cluster to the conditional terminal of a While Loop to stop the iteration of the While Loop. Only the TRUE or FALSE value of the status parameter of the error cluster is passed to the terminal. When an error occurs, the While Loop stops.
  • 19. Summary • Clusters group data elements of mixed types. A cluster cannot contain a mixture of controls and indicators. • To create a cluster control or indicator, select a cluster on the Controls»Array & Cluster palette, place it on the front panel, and drag controls or indicators into the cluster shell. • Use the Cluster functions located on the Functions»All Functions»Cluster palette to create and manipulate clusters. • Error checking tells you why and where errors occur. • The error cluster reports the status, code and source of the error. • Use the error cluster controls and indicators to create error inputs and outputs in subVIs.

Editor's Notes

  1. Clusters group like or unlike components together. Equivalent to a record in Pascal or a struct in C. Cluster components may be of different data types. Examples: Error information—Grouping a Boolean error flag, a numeric error code, and an error source string to specify the exact error. User information—Grouping a string indicating a user’s name and an ID number specifying their security code. All elements of a cluster must be either controls or indicators. You cannot have a string control and a Boolean indicator. Clusters can be thought of as grouping individual wires (data objects) together into a cable (cluster).
  2. Demonstrate how to create a cluster front panel object by choosing Cluster from the Array & Cluster palette. This option gives you a shell (similar to the array shell when creating arrays). You can size the cluster shell when you drop it. right-click inside the shell and add objects of any type. Note: You can have a cluster inside of a cluster. The cluster becomes a control or an indicator cluster based on the first object you place inside the cluster. Create a cluster constant on the block diagram by choosing Cluster Constant from the Cluster palette. This gives you an empty cluster shell. You can size the cluster when you drop it. Put other constants inside the shell. Note: You cannot place terminals for front panel objects in a cluster constant on the block diagram, nor can you place “special” constants like the Tab or Empty String constant within a block diagram cluster shell.
  3. You create a cluster constant on the block diagram by selecting a cluster constant on the Functions»All Functions»Cluster palette, placing it on the block diagram, and dragging a constant into the cluster shell. If you have a cluster control or indicator on the front panel and you want to create a cluster constant containing the same elements on the block diagram, you can either drag that cluster from the front panel to the block diagram or right-click the cluster on the front panel and select Create»Constant from the shortcut menu.
  4. Elements are assigned an order based on the order in which they are added to the cluster. For example, if you have two Booleans and you want to update one of them, you need to know which is which. You can change the order of the elements by popping up on the edge of the cluster and choosing Cluster Order. A small number appears next to each object. You can then change the order. (Hint: Click on each object in the order in which you want the cluster order. This will renumber the objects as desired.) Demonstrate how to create a cluster with two Booleans, a numeric control, an array, and a string. Show that if you change one object to an indicator, all objects are changed to indicators. Modify the cluster order. Emphasize how to easily make clusters using the Create Constant/Control/Indicator options on the block diagram, and by copying/pasting clusters on the front panel. This will save the students significant time when working on the exercises, and prevent possible bad wires due to incorrect cluster order.
  5. One advantage of clusters is that you can use them to group information together to pass into and out of subVIs. Clusters overcome the limit of 28 terminals for passing data between VIs. If you have a great deal of information to pass, group it into logical units using clusters, pass a single cluster into the subVI, and then unbundle the cluster in the subVI. Clusters can reduce the number of wires in diagrams, so there are fewer wires going into and out of the subVIs. Explain the diagram on the slide.
  6. Bundle function — Forms a cluster containing the given objects (explain the example). Bundle by Name function—Updates specific cluster object values (the object must have an owned label). Note: You must have an existing cluster wired into the middle terminal of the function to use Bundle By Name.
  7. Error clusters are a powerful means of handling errors. The LabVIEW DAQ VIs, File I/O functions, networking VIs, and many other VI’s use this method to pass error information between nodes. The error cluster contains the following elements: status , a Boolean which is set to True if an error occurs. code , a numeric which is set to a code number corresponding to the error that occurred. source , a string which identifies the VI in which the error occurred. When you perform any kind of I/O, consider the possibility that errors will occur. Almost all I/O functions return error information. Include error checking in VIs, especially for I/O operations such as file, serial, instrumentation, data acquisition, and communication operations, and provide a mechanism to handle errors appropriately. Checking for errors in VIs can help you identify the following problems: You initialized communications incorrectly or wrote improper data to an external device. An external device lost power, is broken, or is not working properly. You upgraded the operating system software, which changed the path to a file or the functionality of a VI or library. You might notice a problem in a VI or a system program. When you perform any kind of I/O, consider the possibility that errors will occur. Almost all I/O functions return error information. Include error checking in VIs, especially for I/O operations such as file, serial, instrumentation, data acquisition, and communication operations, and provide a mechanism to handle errors appropriately. Checking for errors in VIs can help you identify the following problems: You initialized communications incorrectly or wrote improper data to an external device. An external device lost power, is broken, or is not working properly. You upgraded the operating system software, which changed the path to a file or the functionality of a VI or library. You might notice a problem in a VI or a system program.
  8. The error clusters located on the Controls»Array & Cluster palette include the components of information shown.
  9. Error handling in LabVIEW follows the dataflow model. Just as data flow through a VI, so can error information. Wire the error information from the beginning of the VI to the end. Include an error handler VI at the end of the VI to determine if the VI ran without errors. Use the error in and error out clusters in each VI you use or build to pass error information through the VI. As the VI runs, LabVIEW tests for errors at each execution node. If LabVIEW does not find any errors, the node executes normally. If LabVIEW detects an error, the node passes the error to the next node without executing. The next node does the same thing, and so on. Use the Simple Error Handler, shown in the following example, to handle the error at the end of the execution flow. The Simple Error Handler is located on the Functions»All Functions»Time & Dialog palette. Wire the error cluster to the Error In (no error) input.
  10. As the VI runs, LabVIEW tests for errors at each execution node. If LabVIEW does not find any errors, the node executes normally. If LabVIEW detects an error, the node passes the error to the next node without executing. The next node does the same thing, and so on. Many students will ask what the difference between the Simple Error Handler and the General Error Handler are. Have them investigate by looking at the block diagram of the Simple Error Handler. They will see that it calls the General Error Handler. Explain that the Simple Error Handler can recognize all of LabVIEW’s built in error functions, but if they want to create their own errors for their code, that they can use the General Error Handler. If they want more information, tell them that it is not covered in the scope of this course but that information is in the Help >> VI, Function, & How-To Help… under the index of “error codes, defining custom”.
  11. You can wire an error cluster to the conditional terminal of a While Loop to stop the iteration of the While Loop. When you wire the error cluster to the conditional terminal, only the TRUE or FALSE value of the status parameter of the error cluster is passed to the terminal. When an error occurs, the While Loop stops. When an error cluster is wired to the conditional terminal, the shortcut menu items Stop if True and Continue if True change to Stop on Error and Continue while Error. I would demo how to use error codes for a more effective approach by using the unbundle by name function to get the status and use an OR function so that a stop button OR an error would stop the loop.
  12. Estimated Completion Time: 20 minutes. Create a VI that takes the square root of a number. If the number is greater than or equal to zero, the VI should return its square root, and generate no error. If the number is less than zero, the VI should return the value -9999.90, and insert an error into the error cluster. Use a Case structure from the and the Greater or Equal To 0? function from the numeric palette to determine whether the VI will compute the square root or generate the error. The “False” case shown above is the error case. Use a Bundle By Name function from the cluster palette to insert a Boolean, Numeric, and String Constant into the Status, Code, and Source cluster items, respectively. The values of the constants should be True, 5008 (an arbitrary user defined error code), and “Square Root.vi” (the name of the VI that generated the error). Wire the new cluster into the Error Out indicator, and a constant value of -9999.90 to the Square Root indicator. The True case, not shown, should merely wire the error in control directly through the case to the error out indicator. The Square Root Input should be wired to the Square Root function from the numeric palette, and the result should be wired out of the case into the Square Root indicator. Point out that this VI could be easily configured as a subVI for a larger piece of code, and troubleshooting and debugging is much easier when errors clusters are properly used.
  13. Do not immediately display this slide. Suggested questions for class participation: What is the difference between an array and a cluster? What items are contained in the error cluster?