Jump to content


Photo
- - - - -

[CR] Array Function XNodes


  • Please log in to reply
11 replies to this topic

#1 gb119

gb119

    Extremely Active

  • Premium Member
  • 256 posts
  • Location:Leeds, UK
  • Version:LabVIEW 2012
  • Since:1995

Posted 03 July 2009 - 05:22 AM

Posted Image

Name: Array Function XNodes
Submitter: gb119
Submitted: 03 Jul 2009
File Updated: 18 Jun 2012
Category: XNodes
LabVIEW Version: 8.6
License Type: BSD (Most common)

lava_lib_LabVIEW_API_array_xnodes v1.4.1.33 by University of Leeds
Author: Gavin Burnell
Copyright: Copyright © 2011, University of Leeds
License: BSD
Compatible LabVIEW Versions: >= 8.6.
Compatible OS Versions: ALL.

Description:
Description:

This is a collection LabVIEW 8.6.1 XNodes.

What is an XNode ?
~~~~~~~~~~~~

An XNode is a type of LabVIEW library (like a LVOOP class, XControl) that defines a collection of vis that provide on-the-fly scripted nodes on on the block diagram in LabVIEW. In other words, they allow you to create a node whose code is generated programatically as it is dropped on the block diagram or when inputs are changed. This allows the developer to simulate some of the effects of LabVIEW's builtin primitives such as polymorphism, node resizing and edit time configuration.

Unfortunately, it is not possible to edit XNodes in the regular IDE (unless you work for National Instruments) as they are locked in the IDE. However, the individual vis are not necessarily locked and either by editing the xml file of the XNode directly, or with the help of some third party tools listed below, it is possible to edit and implement new XNodes.

For a fuller introduction, you are rrecommend to read Adam Rofer's "XNodes - A Crash Course" presentation (http://lavag.org/fil...urse-powerpoint).

For developing XNodes I use (a slightly modified) XNode Manager by Aitor Solar (http://lavag.org/fil...7-xnode-manager).

There are also a couple of ini file settings that make it easier (but still not trivial) to debug XNodes:
XNodeWizardMode=True
XTraceXNode=True

At all times remember that XNodes are not a supported technology as far as NI is concerned (as of LV 2011 anyway) and you should expect neither sympathy nor support from NI if bad things happen as a result of using them.

This package contains the following XNodes:

* Array Dimension.xnode

This XNode will return the n'th dimension of the input array, or -1 if the use specifies a dimension number greater
than the number of dimensions of the array or a dimension less than 0. In terms of primitives this is a combination
of an Array-Size and Index Array with some bounds testing. This XNode itself uses the Array Dimension Array.xnode

* Array Size and Index

Gives the dimensions of an array on separate outputs - in effect what you get by doing an array size and then index array on the array dimensions array.

* Array Dimension Array.xnode

This XNode operates in a fashion similar to the Array size primitive Xnode except that it always returns an array
of sizes of dimensions. For a 1D array, this is an array with 1 element, for n-D arrays where n>1, this is the same as the primitive and for scalar inputs, returns a zero length array.


* Filter Array

This XNode splits the input array into two sub arrays according to a boolean array input - one for elements where the boolean filter was true and the other where the filter was false.

* Foreign Key Sort

Sorts one array based on the sort order of a second array - useful when you have an array of items and an array of keys and you want the first array elements in order of their keys.

* Shuffle Array

The inverse of an array sort - randomises the order of the elements of an array. For 2D arrays it can randomise either the rows, columns or both rows and columns.

* Unindex and Unbundle.xnode

Performs the inverse of Index and Bundle Cluster Array. Takes an input array of clusters and un-indexes and unbundles each cluster and returns arrays of each element of the original clusters. This is equivalent to feeding
a cluster array into a for loop with auto-indexing turned on, unbundling all elements, and wiring back out of a for
loop with auto-indexing turned on in order to generate arrays of each element.

* Minimum Array Size

This XNode will take the input array and either make it at least n elements long, or exactly n elements long. If additional elements are needed, the default value for the element is used and the new elements are appended to the end of the array. For the fixed-size variant, if elements are to be removed, they are removed from the end of the array.

NB If upgrading from an older version of the package, you may notice some XNodes that implemented the OpenG array functions are no longer included. They (along with implementations of all the OpenG Array tools can be found on the LAVA Code repository as a separate package.

This Package depends on these other packages:
lava_lib_labview_api_scripting_tools >= 0.21.5.15

Click here to download this file
Gavin Burnell
Lecturer in Condensed Matter Physics
School of Physics and Astronomy
University of Leeds, UK
http://www.stoner.le...ac.uk/people/gb

#2 gb119

gb119

    Extremely Active

  • Premium Member
  • 256 posts
  • Location:Leeds, UK
  • Version:LabVIEW 2012
  • Since:1995

Posted 03 July 2009 - 09:16 PM

The latest version of this (including a 8.6.x version) is available via the LAVACR subversion vepository on Google (http://code.google.com/p/lavacr/). As and when I regain ownership of the code repository file, I'll post an updated version of the array XNodes. Future developments will all be in 8.6 or greater.
Gavin Burnell
Lecturer in Condensed Matter Physics
School of Physics and Astronomy
University of Leeds, UK
http://www.stoner.le...ac.uk/people/gb

#3 Michael Aivaliotis

Michael Aivaliotis

    MindFreak

  • JKI
  • 2,662 posts
  • Version:LabVIEW 2012
  • Since:1994

Posted 04 July 2009 - 07:12 PM

The latest version of this (including a 8.6.x version) is available via the LAVACR subversion vepository on Google (http://code.google.com/p/lavacr/). As and when I regain ownership of the code repository file, I'll post an updated version of the array XNodes. Future developments will all be in 8.6 or greater.

You might want to leave this as it stands for those that only have LV 8.2. Renaming it to [LV8.2]Array Function XNodes. Then create a new submission with the 8.6 version.
Thank You
Michael Aivaliotis

VI Shots

#4 gb119

gb119

    Extremely Active

  • Premium Member
  • 256 posts
  • Location:Leeds, UK
  • Version:LabVIEW 2012
  • Since:1995

Posted 22 August 2010 - 09:37 PM

New build posted v 1.1.2 is now a VIPM Package file. No major changes in functionality, but should install a little more easily and has a palette file under a LAVAG Category.

Please ignore the slightly odd dependency of the .vip on itself. This is a result of a dirty hack that I've used to get VIPM to include a palette file of XNodes and is harmless :cool:
Gavin Burnell
Lecturer in Condensed Matter Physics
School of Physics and Astronomy
University of Leeds, UK
http://www.stoner.le...ac.uk/people/gb

#5 gb119

gb119

    Extremely Active

  • Premium Member
  • 256 posts
  • Location:Leeds, UK
  • Version:LabVIEW 2012
  • Since:1995

Posted 30 August 2010 - 07:08 PM

New version (1.2) adds an XNode version of the OpenG Array sort routine - uses exactly the same algorithm but works for any sortable array type without needing using polymorphic instances.
Gavin Burnell
Lecturer in Condensed Matter Physics
School of Physics and Astronomy
University of Leeds, UK
http://www.stoner.le...ac.uk/people/gb

#6 dannyt

dannyt

    Extremely Active

  • Premium Member
  • 363 posts
  • Location:Devon UK
  • Version:LabVIEW 2011
  • Since:2007

Posted 17 March 2011 - 01:33 PM

HI

I was interested in playing with this to see what the performance of the Xnodes was compared to doing some of this stuff long hand, specifically the Unindex and Unbundle.xnode function.

Unfortunately, the VIPM package does not work in LabVIEW 2010, I suspect this is due to the formal release of scripting so I cannot install (due to conflicts) the package lavag_scripting_tools >= 0.21.0.0 which is seen as a dependency by the xnodes package.

Are there plans for a 2010 release some time

Also does anybody using these function have any comment about performance.

cheers

Danny

#7 gb119

gb119

    Extremely Active

  • Premium Member
  • 256 posts
  • Location:Leeds, UK
  • Version:LabVIEW 2012
  • Since:1995

Posted 17 March 2011 - 02:17 PM

Unfortunately, the VIPM package does not work in LabVIEW 2010, I suspect this is due to the formal release of scripting so I cannot install (due to conflicts) the package lavag_scripting_tools >= 0.21.0.0 which is seen as a dependency by the xnodes package.


Have you installed the Scripting tools package from http://lavag.org/fil...cripting-tools/ ? That should provide the missing dependency (unless I've screwed up the packaging).

Are there plans for a 2010 release some time

Also does anybody using these function have any comment about performance.

I'm not using 2010 in production, although I've got it installed and as far as I know the scripting tools package works on it ok. With the release of scripting to the general public the need for the scripting tools package is rather less - they just wrap some scripting calls up a bit more neatly. I have seen some problems getting the custom palette to install correctly with some of these packages

Performance wise, the XNodes just generate static G code - all the scripting happens in the editor, so the resultant code should be close to what you would achieve with a sub-vi with the equivalent diagram to that generated by the scripting. There is a performance hit on the editor and compilation stage - especially when changing wire types and causing type propagation through the diagram.
Gavin Burnell
Lecturer in Condensed Matter Physics
School of Physics and Astronomy
University of Leeds, UK
http://www.stoner.le...ac.uk/people/gb

#8 dannyt

dannyt

    Extremely Active

  • Premium Member
  • 363 posts
  • Location:Devon UK
  • Version:LabVIEW 2011
  • Since:2007

Posted 17 March 2011 - 02:33 PM

Have you installed the Scripting tools package from http://lavag.org/fil...cripting-tools/ ? That should provide the missing dependency (unless I've screwed up the packaging).


Thanks for the quick response actually loading the scripting tools package is my problem so I will move my question over there

cheers

Dannyt

EDIT question moved to link for clarity

#9 gb119

gb119

    Extremely Active

  • Premium Member
  • 256 posts
  • Location:Leeds, UK
  • Version:LabVIEW 2012
  • Since:1995

Posted 05 September 2011 - 10:47 PM

New version released with a new Shuffle Array Xnode that randomises the order or elements in an array. A bit more explanatory text in the readme on the LAVACR entry.
Gavin Burnell
Lecturer in Condensed Matter Physics
School of Physics and Astronomy
University of Leeds, UK
http://www.stoner.le...ac.uk/people/gb

#10 Xeledon

Xeledon

    One hit wonder!

  • Members
  • 1 posts
  • Version:LabVIEW 2011
  • Since:2007

Posted 18 June 2012 - 09:51 AM

Hi,
I have been using Array Function XNodes 1.4.0.24 for a while now and find them quite useful.
I have however encountered an unexpected behaviour with large arrays that makes me doubt the filter array node.
The "False Elements" output array of the node is too large, filled with elements of identical nonsensical data after the seemingly correct data.
My input array is U8. Its size seems to be the problem. If it is smaller by a factor of 100 the vi will work as expected.

I have attached an example vi that shows this behaviour on my machine.
Am i doing something wrong there?

Best regards
Florian

Attached Files


Edited by Xeledon, 18 June 2012 - 09:51 AM.


#11 gb119

gb119

    Extremely Active

  • Premium Member
  • 256 posts
  • Location:Leeds, UK
  • Version:LabVIEW 2012
  • Since:1995

Posted 18 June 2012 - 12:51 PM

I have been using Array Function XNodes 1.4.0.24 for a while now and find them quite useful.
I have however encountered an unexpected behaviour with large arrays that makes me doubt the filter array node.
The "False Elements" output array of the node is too large, filled with elements of identical nonsensical data after the seemingly correct data.
My input array is U8. Its size seems to be the problem. If it is smaller by a factor of 100 the vi will work as expected.


Hi,

Thanks for the error report. I've identified the problem and will release a new package shortly. In the meantime I can tell you how to patch the XNode to make it work.

The problem arises in the code used to count the number of filtered elements. I take an array of booleans into a boolean to zero-or-one node and then sum the resultant array. The problem is that the boolean to zero-or-one node outputs an I16

Clipboard01.png

In the XNode folder find the template vi (<user.lib>/_LAVAcr/Array XNodes/Filter Array/Filter Array Template.vi probably) and insert a U32 conversion node:Untitled.png

You will need to force LabVIEW to regerenate the XNode after that. Forcing a type propagation should do the trick e.g. by changing the representation of some control upstream of the XNode).

Gavin
Gavin Burnell
Lecturer in Condensed Matter Physics
School of Physics and Astronomy
University of Leeds, UK
http://www.stoner.le...ac.uk/people/gb

#12 gb119

gb119

    Extremely Active

  • Premium Member
  • 256 posts
  • Location:Leeds, UK
  • Version:LabVIEW 2012
  • Since:1995

Posted 18 June 2012 - 10:01 PM

New package 1.4.1 uploaded. For reasons of having reinstalled my build machine, the Scripting Tools dependency is now the latest version on LavaG - although it doesn't actually need the latest version to work properly.
Gavin Burnell
Lecturer in Condensed Matter Physics
School of Physics and Astronomy
University of Leeds, UK
http://www.stoner.le...ac.uk/people/gb