+4

Array Channel as Function Group In/Out

Vincent Thiele 7 years ago in IQANdesign updated by Gustav Widén (System support) 1 month ago 7

I've been running into some limitations with passing Array Channels between Function Groups that I would very much like to see addressed. It has been very helpful to allow Array Channels to be Function Group outputs, but having that as an option begs to let them do more. Specifically:


1) Array Copying - It seems like we should be able to say "ArrayA := ArrayB" for the Qcode instead of "ArrayA[n] := ArrayB[n]" for all n items. This is notably frustrating when trying to pass an array from a child function group out of the parent function group. An alternative global solution (though I really want array copying for other purposes as well) would be the ability to set a Function Group Output from a child function group as a Function Group Output for the parent without the need to create an object to copy the data in order to set it as an output.


2) Arrays and Function Group Inputs - If I have an array in a one function group, I currently have no way to pass the data to another function group without breaking out all of the items into individual channels for linking to a FGI. I see two options that would work for my needs, and it would be nice to see both implemented if possible. a) Allow the FGI to have an Input type of Array and be able to pull date from the FGI via index like an array or b) Allow FGIs to link to a specific index of an array so I don't have to create a math channel for the sole purpose of copying the data from an Array index to link to the FGI.


Thanks!


Rather than copying the array (which could utilize a lot of memory depending on the size of the array), would changing the channel scope to  'Public' be an option for you?

That is an option for some cases, but we're trying to maintain scope control for our variables as part of our best practices. This is, to us, especially important with the v5 ability to have external functions. If we make a channel in an external function global, then we can't use that external function more than once in a project or we have naming conflicts in global variables.

+1
Under review

Good input. I can see the need for these features if you are using a lot of arrays. Feature request(s) added.

In addition of copying array, it would be nice to be able to do indirect addressing.  I have an application where I need to re-arrange the variables from one array into a new one to compress the data(Not the array size).  For example I have 24 data incoming from canbus generic message but only the first 7 of of the first 12 are valid and 7 of the bottom 12.  I do load them into one array of 24 elements. I would like to re-arrange them into one continuous group of 14followed by 10 elements with a value of 0.  The amount of compression is function of the application as the number of valid data may change in other projects.  I did not seem to find a way to do it.  I tried to store the data mapping in a config array but the Qcode screams type mismatch when I try to use the config array data as index. 

PS:  was able to do above but add to store config element as integer parameters instead of an array...

Had a recent question related to the discussion in this post. 

Point 1 in the original topic has been made easy through the propagate function group outputs function

The Point 2 request is not really feasible from a memory utilization point of view. 

Using private scope may be a feasible way of getting arrays to sub-groups without having to see it all over the application as with public scope.