<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://labviewwiki.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=LuI</id>
	<title>LabVIEW Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://labviewwiki.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=LuI"/>
	<link rel="alternate" type="text/html" href="https://labviewwiki.org/wiki/Special:Contributions/LuI"/>
	<updated>2026-04-25T03:55:24Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://labviewwiki.org/w/index.php?title=Error_Cluster_data_type&amp;diff=4046</id>
		<title>Error Cluster data type</title>
		<link rel="alternate" type="text/html" href="https://labviewwiki.org/w/index.php?title=Error_Cluster_data_type&amp;diff=4046"/>
		<updated>2009-05-07T08:02:56Z</updated>

		<summary type="html">&lt;p&gt;LuI: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Error Cluster  ==&lt;br /&gt;
&lt;br /&gt;
An error cluster contains a Boolean “status”, an I32 numerical “code” and a “source” string in that order. Any cluster with this structure is treated as an error cluster in LabVIEW. The default value, “status” = false, “code” = 0 and “source” empty, is shown in &#039;&#039;&#039;Figure 1&#039;&#039;&#039; for a typical control. &lt;br /&gt;
&lt;br /&gt;
[[Image:Error cluster control and terminal.JPG|frame|center|Figure 1:  3D error cluster control and terminal‎]] &lt;br /&gt;
&lt;br /&gt;
Note that the default terminal and wire color was changed from pink to dark yellow in LabVIEW 8.2 ([http://www.ni.com/pdf/manuals/371780b.pdf upgrade notes] p. 35). The “status” is true if an error has occurred but remains false for warnings. The “code” assumes positive and negative values (see “error codes, ranges of” in &#039;&#039;LabVIEW Help&#039;&#039;), with the range -8999 to -8000 (LabVIEW 8.2)&amp;amp;nbsp;and&amp;amp;nbsp;5000 to 9999 reserved for user defined error codes. The “source” identifies a VI and possibly its call chain as the origin of an error. Possible reasons for an error can be obtained from the &#039;&#039;&#039;Explain Error&#039;&#039;&#039; tool (see &#039;&#039;&#039;Figure 2&#039;&#039;&#039;). This tool is activated by selecting the &#039;&#039;&#039;Explain Error…&#039;&#039;&#039; item under the &#039;&#039;&#039;Help&#039;&#039;&#039; menu in LabVIEW or by right-clicking on any element of an error cluster with “status” true and selecting &#039;&#039;&#039;Explain Error&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
[[Image:Explain Error tool.jpg|frame|center|Figure 2:  Explain Error tool]] &lt;br /&gt;
&lt;br /&gt;
LabVIEW provides several VIs for working with error clusters. For example, the &#039;&#039;&#039;Error Cluster from Error Code.vi&#039;&#039;&#039; generates an error cluster based on a specified “code” (see &#039;&#039;&#039;Figure 3&#039;&#039;&#039;). You can also define custom codes using the &#039;&#039;&#039;General Error Handler.vi&#039;&#039;&#039; or by creating an XML-based text file in the &amp;amp;lt;labview\user.lib\ errors&amp;amp;gt; directory (see “error codes, defining custom” and “error codes, defining custom in text files” in &#039;&#039;LabVIEW Help&#039;&#039;). This VI outputs a “message”, like the “Explanation” from &#039;&#039;&#039;Explain Error&#039;&#039;&#039;, which identifies the “source” and describes possible causes associated with the “code”. This information can also be displayed using several different types of dialogs. This feature is commonly employed to identify errors in user interface applications. &lt;br /&gt;
&lt;br /&gt;
[[Image:Fig 3-VI connectors.JPG|frame|center|Figure 3:  connectors for Error Cluster from Error Code.vi and General Error Handler.vi]] &lt;br /&gt;
&lt;br /&gt;
Error clusters are also valid inputs to some comparison and array functions and can be used to control case structures and while loops (see &#039;&#039;&#039;Figure 4&#039;&#039;&#039;). &lt;br /&gt;
&lt;br /&gt;
[[Image:Fig 3-error cluster examples.JPG|frame|center|Figure 4:  structures, comparison and array functions involving error cluster inputs]] &lt;br /&gt;
&lt;br /&gt;
The comparison functions &#039;&#039;&#039;Equal?&#039;&#039;&#039;, &#039;&#039;&#039;Not Equal?&#039;&#039;&#039;, &#039;&#039;&#039;Greater?&#039;&#039;&#039;, &#039;&#039;&#039;Less?&#039;&#039;&#039;, &#039;&#039;&#039;Greater Or Equal?&#039;&#039;&#039; and &#039;&#039;&#039;Less Or Equal?&#039;&#039;&#039; can operate in two modes. The output is Boolean in the &#039;&#039;&#039;Compare Aggregates&#039;&#039;&#039; mode, while a cluster of three Booleans corresponding to each component of the error cluster is generated in the &#039;&#039;&#039;Compare Elements&#039;&#039;&#039; mode (see &#039;&#039;&#039;Figure 5&#039;&#039;&#039;). &lt;br /&gt;
&lt;br /&gt;
[[Image:Comparison function indicators.JPG|frame|center|Figure 5:  typical indicators for both modes of a comparison function]] &lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;Select&#039;&#039;&#039;, &#039;&#039;&#039;Max &amp;amp;amp; Min&#039;&#039;&#039; and &#039;&#039;&#039;In Range and Coerce&#039;&#039;&#039; functions can output an error cluster. While the &#039;&#039;&#039;Max &amp;amp;amp; Min&#039;&#039;&#039; function returns ordered inputs in the Compare Aggregates mode, an output may not correspond to either error cluster if Compare Elements is selected (default). The &#039;&#039;&#039;Array Max &amp;amp;amp; Min&#039;&#039;&#039; function always returns ordered inputs corresponding to the first and last elements of the &#039;&#039;&#039;Sort 1D Array&#039;&#039;&#039; output. The primary sort is performed on “status”, with secondary ordering by “code” and then “source”. Strings are sorted by ASCII code starting with the leading character. Note that error clusters behave like their Boolean “status” value when connected to the selector terminal of a &#039;&#039;&#039;Select&#039;&#039;&#039; function and &#039;&#039;&#039;Case Structure&#039;&#039;&#039; or the conditional terminal of a &#039;&#039;&#039;While Loop&#039;&#039;&#039;. &amp;lt;!-- Bill VanArsdale, 21:18, 3 May 2007 (CDT) --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Error Selection  ==&lt;br /&gt;
&lt;br /&gt;
A common programming issue in LabVIEW involves selecting between two or more error clusters. This process involves finding the cluster with “status” true or “code” not equal zero if no “status” is true. The &#039;&#039;&#039;Merge Errors.vi&#039;&#039;&#039; shown in &#039;&#039;&#039;Figure 4&#039;&#039;&#039; implements this search for up to three error clusters and an array of such clusters. This subVI is relatively fast with large error arrays. However, a significant portion of the execution time involves concatenation of inputs for the small arrays (&amp;amp;lt;10 elements) typical in most applications. This result suggests that time critical applications should be built around the immediate selection between two error clusters rather than their concatenation into an array. The simplest method of comparing the “status” of two error clusters involves the Select function (see &#039;&#039;&#039;Figure 6&#039;&#039;&#039;). &lt;br /&gt;
&lt;br /&gt;
[[Image:Simple error selector diagram.JPG|frame|center|Figure 6:  diagram for a simple error selector that does not detect warnings]] &lt;br /&gt;
&lt;br /&gt;
This function selects the first error cluster with “status” true, much like the &#039;&#039;&#039;Or&#039;&#039;&#039; function operating on Boolean inputs. Connecting “error 2” instead of “error 1” to the selector terminal is more analogous to the &#039;&#039;&#039;And&#039;&#039;&#039; function, which is typically less useful. While about 30 times faster than the &#039;&#039;&#039;Merge Errors.vi&#039;&#039;&#039; (LabVIEW 7.0), the &#039;&#039;&#039;Select&#039;&#039;&#039; function does not detect a warning (“status” false and “code” not equal zero). &lt;br /&gt;
&lt;br /&gt;
Diagrams for several VIs that compare error clusters and detect warnings are shown below (fastest to slowest). &lt;br /&gt;
&lt;br /&gt;
[[Image:Error selector diagram A.JPG|frame|center]][[Image:Error selector diagrams B.JPG|frame|center|Figure 7:  possible diagrams for an error selector that detects warnings]] &lt;br /&gt;
&lt;br /&gt;
These VIs execute about 5 times faster than the &#039;&#039;&#039;Merge Errors.vi&#039;&#039;&#039; (LabVIEW 7.0), even with normal priority execution. (&#039;&#039;&#039;Merge Errors.vi&#039;&#039;&#039; uses the “subroutine” priority.) Inputs to selector terminals in the first and second diagrams are passed to “error” for the cases not shown. Otherwise, “error 1” is checked for nonzero “code” since neither cluster has “status” true. The last approach uses the Max &amp;amp;amp; Min function in Compare Aggregates mode to order inputs. If just one of these clusters has “status” true, that input will be the “max” output since true &amp;amp;gt; false. However, this output must be checked for “status” true or “code” nonzero to determine selection. &amp;lt;!-- Bill VanArsdale, 21:18, 3 May 2007 (CDT) --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Error Cluster as Execution Order Specifier  ==&lt;br /&gt;
&lt;br /&gt;
LabVIEW is a dataflow language and as such preferred way to specify execution order of block diagram items is to connect output of a block diagram item to an input of another block diagram item. There are situations when some certain execution order is required but the outputs of the items to be executed earlier cannot be connected to the inputs of the items to be executed later. In these situations error cluster is a preferred way to specify the execution order of the items. It&#039;s preferred over sequence structures in almost all use cases.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This can easily be achieved by a private replacement for the &#039;merge errors&#039; node, that also contains a &#039;No_Error&#039;&amp;amp;nbsp; constant:&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Image:SerializeprocessesBD.png|merge errors with No_Errors]] The connector pane looks like this: [[Image:SerializeprocessesCP.png|Connector Pane for &#039;SerializeIndependentProcesses]]&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
It can be used like this: &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[[Image:SerializeprocessesUsage.png]] &lt;br /&gt;
&lt;br /&gt;
So a VI-Ref is opened independently if an error occured before, but after all preliminary portions of code had been finished. The printing actions relate to the eventual error of the OpenVI-Ref node only. All errors are merged as final action, so any error that might have shown up is reported, while the printing actions care only on VI-server related errors. &amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This little helper is too simple to provide its code as VI, though...&lt;br /&gt;
&lt;br /&gt;
== See also  ==&lt;br /&gt;
&lt;br /&gt;
*[[Error handling]] &lt;br /&gt;
*[[Error Case Structure]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Data_types]]&lt;/div&gt;</summary>
		<author><name>LuI</name></author>
	</entry>
	<entry>
		<id>https://labviewwiki.org/w/index.php?title=File:SerializeprocessesUsage.png&amp;diff=4045</id>
		<title>File:SerializeprocessesUsage.png</title>
		<link rel="alternate" type="text/html" href="https://labviewwiki.org/w/index.php?title=File:SerializeprocessesUsage.png&amp;diff=4045"/>
		<updated>2009-05-07T07:55:02Z</updated>

		<summary type="html">&lt;p&gt;LuI: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>LuI</name></author>
	</entry>
	<entry>
		<id>https://labviewwiki.org/w/index.php?title=File:SerializeprocessesCP.png&amp;diff=4044</id>
		<title>File:SerializeprocessesCP.png</title>
		<link rel="alternate" type="text/html" href="https://labviewwiki.org/w/index.php?title=File:SerializeprocessesCP.png&amp;diff=4044"/>
		<updated>2009-05-07T07:42:21Z</updated>

		<summary type="html">&lt;p&gt;LuI: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>LuI</name></author>
	</entry>
	<entry>
		<id>https://labviewwiki.org/w/index.php?title=File:SerializeprocessesBD.png&amp;diff=4043</id>
		<title>File:SerializeprocessesBD.png</title>
		<link rel="alternate" type="text/html" href="https://labviewwiki.org/w/index.php?title=File:SerializeprocessesBD.png&amp;diff=4043"/>
		<updated>2009-05-07T07:42:04Z</updated>

		<summary type="html">&lt;p&gt;LuI: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>LuI</name></author>
	</entry>
</feed>