Cluster of References Constant

I want to do UI control of my front panel within a subVI.  Hence, I need to pass a number of references to front panel objects to a subVI.
See the attached (simplified) example to illustrate my point.  Everything that lies within the sequence structure frames would reside in the subVI.
In the top part of the block diagram, the references are explicitly bundled together, before being passed to the subVI to be applied to property nodes.  This works fine.
However, if I want to define a constant cluster of references, as in the bottom part of the block diagram, it returns an error: "Object reference is invalid".  How would I make this work?  Note: I created this constant by right-clicking on the cluster wire in the top part of the diagram.
Many Thanks,
Dan
Message Edited by DanB1983 on 04-20-2010 07:08 AM
Message Edited by DanB1983 on 04-20-2010 07:09 AM
Dan
CLD
Attachments:
cluster of refs.JPG ‏63 KB

You can pop-up on the middle input of teh bundle to create a constant. See this mini-Nugget.
This thread may help, here is a preview.
Ben
Ben Rayner
I am currently active on.. MainStream Preppers
Rayner's Ridge is under construction

Similar Messages

  • Cluster VI Reference Minor Bug

    Over on LAVA PJM_labview posted a video of a bug found in LabVIEW 2013 SP1.  It is a minor bug with the block diagram when showing a cluster constant with a VI reference constant in it.  Here is the video of how to reproduce the bug.
    http://screencast.com/t/gfKwlvMcCsHI
    And here is the original thread on LAVA.
    http://lavag.org/topic/18297-cool-little-lv-2013-sp1-bug/#entry109757
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

    I played with this and filed it as a CAR (#479432). Intriguingly, there are a couple workarounds:
    Option 1
    On block diagram:
    1. Create cluster constant containing refnum with auto-sizing set as arranged (vertical or horizontal)
    2. Create typedef
    3. Unlink from type def
    4. Change auto-sizing to desired value
    5. Recreate typedef
    Option 2
    On front panel:
    1. Create cluster containing refnum control
    2. Create typedef
    On block diagram:
    3. Create constant from cluster typedef on block diagram.
    4. Unlink constant from typedef, change auto-sizing as desired, recreate typedef
    Christopher S. | Applications Engineer
    Certified LabVIEW Developer
    "If in doubt... flat out." - Colin McRae

  • Strange Problem - Cluster of References

    Hello guys
    I had a strange problems using a cluster with references.
    How to reproduce the problem:
    - open a blank VI;
    - create two graphs in the front panel;
    - in the block diagram, create references for both graphs;
    - connect these references to a bundle (not bundle by name);
    - create an indicator for the bundle;
    - run the VI once;
    - right click on the bundle indicator and change it to a control;
    - delete references and bundle;
    - select the control in the front panel, go to EDIT, CUSTOMIZE CONTROL;
    - change to strict type def;
    - save this control as Control1.ctl;
    - connect the control to a unbundle by name;
    - right click on the unbundle by name and select one of the two graphs as an item (doesn't matter which one you select);
    - create a property node and feed its reference terminal with the reference from the unbundle by name;
    - use the property "Label.Text" in the property node;
    - create an indicator for the the property node;
    - run the VI;
    - the indicator will show the correct label for that graph;
    - perfect!!!
    If you save the VI and run it again, everything is fine.
    But............... if you close it, open again and run.... you will get an error 1055 "Object reference is invalid".
    Why it was working before closing?
    Find attached the VI and the Control.
    Thanks
    Dan07
    Solved!
    Go to Solution.
    Attachments:
    Cluster References.vi ‏11 KB
    Control1.ctl ‏7 KB

    Let see if I can answer before I have to start working.
    Do a quick experiment.
    Use a Type cast to cast your ref as a U32 and show that value on the FP.
    Save the VI run it and record the number on the FP.
    Mod the vi save it clsoe it open it and run again. The number should have changed.
    That is the issue you facing, the ref number changes so you need one that is valid when you run.
    How I do it;
    I use an Action Engine (see this Nugget to learn what an Action Engine is) that servse as a GUI controller and lets me get at refs where even I need them. The following is a case study.
    First I collect all of th refs I will need and bundle them in a type def. I sue a state machine to do the bundling if there are a lot.
    THe bundled clsuter get passed to an GUI Controller Action Engine
    Inside the Init I check the refs to make sure they are vlid. THis has saved a lot of wated time chasing invalid refs.
    If they were valid I cache the refs.
    For major mode changes that demand a lot of GUI punching I create sub-VI to do the dirty work.
    When ever other codes needs a ref to the GUI I have a method that returns the refs.
    THe following shows another VI using those GUI refs.
    I hope that helps,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Cluster Control References

    The Controls[] property of a cluster will provide an array of generic
    references to the cluster elements.  However, each element must have
    its own "Type Cast" or "To More Specific Class" node, and the resulting
    type must corresponding to the order of elements in the cluster.    
    An "Unbundle By Name" or "Bundle By Name" node will respectively read or write typed values of cluster elements.
    Is there an "Unbundle References By Name" node or VI to obtain a cluster of typed (not generic) references from a cluster?

    Attached is a very quick toy example of using a cluster's element references.
    Paul Falkenstein
    Coleman Technologies Inc.
    CLA, CPI, AIA-Vision
    Labview 4.0- 2013, RT, Vision, FPGA
    Attachments:
    element ref example.vi ‏14 KB

  • Cluster Typ-Def Constant Reset

    Hi all,
    Ahhhhhh....  I have a typ-def cluster array with many elements in each cluster.  I created a vi, in which I delcared a 20 elements with specified values (a vi that contain constant values).  I made a minor change in my typ-def, and all the values that I keyed in got reset.  How do I avoid that in the future?  Thx!
    Yik
    Kudos and Accepted as Solution are welcome!
    Solved!
    Go to Solution.

    Diane's suggestion is the only to solve your problem. Defaults values do not carry over from a typedef. The one thing you can do is save the defaults values you want in your typedef and recreate the constant. New constants created will pick up the current default values. However once you change the typedef all the constants you have will get reset.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • Cluster of control references: want to access the control value

    I want to be able to save and set control values that are saved (XML). I have my controls on about 5 sub vi's. So I thought it'd be a good idea
    to put all the control references in a cluster from the several sub vi's and save and read from one point.
    I can get the cluster values (i.e. the references to the controls), but how to proceed from here? If somebody has a better idea it is very welcome.
    I have also read Ben's nugget here, but it deals with references to controls in a cluster, not references to a reference of a control in a cluster

    Thank you for reading that Nugget!
    I use a GUI Controller in many apps so I can grab refs in sub-VI's.
    Here are some screen shots of them in use.
    The first "GUI Cnt" is a wrapper around the AE and invokes the action "Set Analysis mode" then another call let me get a cluster of the refs so I can choose based on the name.
    This image shows what that action does.
    THis is what happens when going into collection mode.
    That is a small set of what you will find in my image gallery Feel free to browse (yes I know there is a lot of Olivia in there ) and ask if anything catches your interest.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Class conflict with a cluster

    I want to pass a cluster to a SubVI.
    The size of cluster can be varied in some situations.
    How can I pass the cluster with the reference constant?
    Attachment: LV 8.2.1, non-executable.
    메시지가 08-07-2008 07:34 PM에 labmaster에 의해 편집되었음
    Attachments:
    subVI.vi ‏9 KB
    main2.vi ‏18 KB

    Okay, I found the solution using not strict reference control in the attachment.
    Any other simple suggestions?
    Attachments:
    ccc.jpg ‏26 KB

  • Sort Array of References by Label-Name

    I am developing on an DSC application with shared variables and alarming and events with a hugh amount of variables. Each variable is displayed on the front panel within tab controls. To reduce time and effort when expanding the variables I would like to arrange my references from the front panel by the label name. I've attached a part of the intialization of the front panel. There I have to manually expand each variable in the shared variable library, where the name of the variable has to be in the same order as the definition in the cluster.
    My approach was to build an array of references of digital type and sort the references by the label name. Because the shared variables have the same name as the controls they would be in the same order and I also could dislaim the cluster of references.
    maybe somebody can give my an hint.
    Kind Regards,
    Joachim
    Solved!
    Go to Solution.
    Attachments:
    fp.jpg ‏982 KB

    Hi Joachim,
    use the standard "sort an array of cluster" approach!
    Put the control label and the reference (in this order!) in a cluster, make an array of such clusters and sort the array. It will sort by the label and you can unbundle the reference in sorted order...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Queue Reference on a DVR?

    Hi All,
    I am trying to track down a bug in my code to no avail (so far). I wanted to check if my problem is caused by a 'feature' in LabVIEW while I continue to tear (whats left of) my hair out.....
    Here is what I'm doing:
    I create my 'communication queues' in my toplevel vi. These are unnamed. My toplevel vi is a queue-based state machine. I'm using OO by reference. Therefore the place where I've stored my reference is Object>DVR>Cluster>queue reference.
    Using the toplevel.vi I kick off a user interface. I do this by using Static VI reference>SetVal to pass the object/DVR value to the UI and then >Run (wait til done false) to start the UI.
    And here's the problem: when put an element on the toplevel state-machine queue using the UI its not received by the toplevel state machine. 
    Here's what I've looked at to try and find out what the problem is
    The element is placed in the queue with no errors
    The references are valid
    One this I did notice is that when I probed the reference hex numbers they are different - my understanding was creating a new queue reference by name would give two different references to the same queue in memory (and so they have to be closed). But in my case I only create one reference to the queue, put it in my DVR and remove it as needed.......so what are the values different?
    I've used this same architecture already in this project but in this case I didn't put the queue references on the DVR - instead I opened new references by name whenever I communicated between modules. This worked fine......but I'd prefer not to restrucutre my code if I can avoid it!
    If anyone can offer suggestions that I can check or indeed if this is a 'feature' which has come up before I'd appreciate any comments,
    Thanks,
    Dave
    Solved!
    Go to Solution.

    Hi All,
    Please disregard the comments about the reference hex numbers being different - I built a very simple test program to make sure performance was correct and found that it was. In my test code both reference numbers are identical as should be expected! Its a common/garden bug causing my problem not a LabVIEW 'feature'......just gotta find the bugspray now!
    Dave

  • Cluster elements limit

    Hi!
    I have problem with big cluster. Big meas that it has 1000 or maybe even more elements, such as numeric, string, boolean, ..., that are in subclusters. Memory that it allocate is less than 5MB. Problems starts when I try to do anythih with it (move, resize, copy, save VI), CPU usage jumps to 100% and it takes some time to drop down again. Next, if this cluster is a constant and try to change it to control, it is not visible on front panel. All I can see is label of that cluster. I need that big cluster because it contains setting of an vision algorithem.So I wonder if there is a limied number of elements in cluster or some other restrictiuons regarding usage of clusters
    Thanks,
    andrej

    Hey,
    I build a cluster which is a combination of 8 clusters with each 256 elements. When creating an indicater of that cluster i cannot see it in a proper way too. What I think is the limitation of the frontpanelsize which makes the cluster appear in that way.
    I would suggest you should splite your cluster in several sub-clusters and just use the bundle/unbundle function to handle it in the blockdiagram.
    Christian

  • DAQ device control reference bug

    I have found a bug when using a reference to a DAQ (8.3.0f3) physical channel control. We have a control that is hidden from view in a tab container and we have found that until the control is painted on the screen, we cannot extract the "value" property. Attached is a VI to illustrate the problem. To replicate the problem, do the following.
    1) Open the VI - you should see only the text control.
    2) Run the VI a number of times - the text control will not update.
    3) Scroll left and bring the DAQ control into view.
    4) Scroll right and bring the text control into view.
    5) Run the VI - everything works fine.
    I can force the control onto the screen and make it briefly visible to get around it, but it looks sloppy.
    Brian Rose
    Attachments:
    test1.vi ‏8 KB

    Just curious, though: is there a reason you can't
    just read the value from the terminal instead of a reference and
    property node and pass that value to wherever you need it?
    We are using a cluster of references to the front panel controls to pass to various subVIs that perform the operations. Since we have many controls that are manipulated at various times, we decided it was easier to just pass them all around and dereference them where we needed them. This way we have one wire connecting the various VIs instead of a ratsnest of wire and logic.
    The problem is that our main program front panel is a tabbed container. Our main window is in tab 1 and various other configuration controls are in the other tabs. We can't hide the control under something because the user may need to change it, so it would have to be accessable. The main front panel VI also does very little work and instead simply handles button presses and control updates and calls the appropriate subVI.
    Brian Rose

  • How to name elements and create cluster of named elements

    I wanted to detail the steps I found, so that others could more easily follow what I found going through these discussions.  While there are numerous examples, they lack details such as function names and how to achieve the steps.  Most of them seem to cover only arrays.  I welcome corrections.  I'm not saying this is the best way; it is, however, a simple detailed description of one way to do it.
    I wanted to create a cluster of various data types that could then be manipulated by name.  Unfortunately, simply wiring an existing cluster to a Bundle by Name.vi does not assign the existing labels of the elements to the name field of the cluster.  I don't know why.
    1.  Create an input cluster with dummy constants of the proper data type for each element.
    How do you create an input cluster?  Searching functions finds no "Input Cluster" function.
            The only way I found was to place a dummy Bundle by Name.vi , right-click at the top of the leftmost of the two rectangles and select Create, then Constant. The result looks like the attached Creating Input Cluster.PNG
             You might as well delete the Bundle by Name.vi at this point, because the changes make to the input cluster will only be reflected when it is connected to a NEW Bundle by Name.vi
             Next, for my purposes, I needed constants for DBL numeric, string, and array of strings.  I started by placing  one DBL and one string constant on the block diagram.  I copied these to create the ones I needed. Make the labels visible and type in the names corresponding the Bundle Names desired.  
             Since there is no function called "String Array constant", it is necessary to place the "Array Constant" function on the Block Diagram, then drag a string constant into the empty right hand square of the Array Constant.  It immediately changes color to show it is a string array.
              Drag each of these constants into the input cluster so that they appear in the order desired.  It is a bit of a pain because the square resizes tightly around the existing elements after each insertion.  You have to keep expanding the box at the bottom by dragging its sizing handles, so you can be sure each item is added to the bottom of the list.  When done, my input cluster looks like Completed Input Cluster.png attached.
    2.  Place a NEW Bundle by Name.vi on the Block Diagram.  Wire the input cluster to the top of the left rectangle of the function. Drag the down sizing handle of the Bundle by Name.vi until all the elements of the cluster are visible.  You will see the names and it will look like Bundle by Name with assigned names.png attached.
    3.  All that remains is to connect the data wires for the individual elements to the left side of each named block and wire the output cluster.  The result is shown in Complete design producing cluster of named elements.PNG attached. (Since only three attachments seem to be allowed, this last will be in a follow-up post.)
    Attachments:
    Creating Input Cluster.PNG ‏3 KB
    Completed Input Cluster.PNG ‏3 KB
    Bundle by Name with assigned names.PNG ‏8 KB

    I wanted to add a brief statement about EDITING cluster controls because newcomers to cluster usage (like myself).  The HELP is good on creation but says nothing about modification.  While it has been posted other places, I think a "newbie" might appreciate getting this info here.
    To edit a cluster control, open the CTL file, then
    Add a control by creating the control on the front panel, then save the control.
    To remove a a control, delete the control, then save the control file.
    (Simple enough)
    To modify an existing control
    1.  Move the control out of the cluster into a blank VI.  
    2.  SAVE the cluster control file (CTL).  
    3.  Modify the control in the blank VI.
    4.  Drag the modified control back into the cluster control.
    5.  SAVE the cluster control file (CTL)
    NOTE WELL: don't skip step 2. 

  • Re-casting of object from control reference

    I feel like this question is likely answered elsewhere, but after days of searching I couldn't find an answer. Sorry if I'm missing the answer in some obvious place.
    I'm given a reference to a cluster control and told that the elements of the cluster are all children of parent class A. Using the controls[] property I get an array of the elements, and the value property of each of those elements gives a variant that can be turned into class A. At that point, all of the object oriented overriding and private data stuff works as expected.
    So far so good.
    But one method I call on those objects changes the private data, and I need to update the control with the updated object. There I get a runtime error because the control isn't A but some child class of A.
    I think this is where Preserve Runtime Class comes into play, but since I only get a reference to work with, what do I do? This is especially frustrating because debugging probes show that LabVIEW knows the child class on the wire, but I can't see how to tell LabVIEW to cast down to the class that it knows it has.
    For example, is there some way to use the ClassName property of the control to cast the object of class A into the child that the control is expecting?
    Solved!
    Go to Solution.

    nathand wrote:
    So your trying to write to the specific control within the cluster, by reference, as a variant, and you're getting an error? What's the actual text of the error?
    Really you shouldn't ever be using a front panel object this way, especially one where the user never sees the data in it. For passing data around you should use a wire. Neither a wire nor a DVR will get you the ability to pass an arbitrary cluster, though, which it sounds like is what you're trying to do. With a bit more information we might be able to suggest a better approach.
    I don't have the text of the error handy, but it comes from the write value property node and basically says the given variant can't be converted to the type of the control. It happens only when the value is cast to the parent class, which makes sense.
    In other words, given a control of child type,
    control.value ---> variant ---> to parent ---> variant ---> control.value     failes with the error
    control.value ---> variant ---> to child ---> variant ---> control.value       succeeds
    So a solution would be a way to cast to the child instead of to the parent. LabVIEW knows what class the control contains; it is listed in a number of places from the ClassName property through the probe window. The problem is I know of no way to bridge the gap from "LabVIEW knows what class this thing is" to "have LabVIEW cast the variant to that class."
    I completely agree that I shouldn't have to ever be using a front panel control this way, but I don't want to get sidetracked into talking about the shortcomings of LabVIEW that have required such a use. Suffice it to say, that is the assignment.

  • Array of xy-graph references

    Hi all,
    I looked in the forum for a problem that I thought was simple, but I couldn't find anything helpful.
    I'm passing an array of references to XY graphs, from one VI to another. The sub-VI extracts the references when needed and wires them to property nodes. These change the active plot on the XY graph and its visibilty.
    I also tried to pass a cluster of references and convert it to an array inside the sub-VI, but it didn't help.
    I noticed that all the reference wires have a coercion dot on the build array. That may be the key of the problem, even if I can't see how.
    The error I get is:
    Error 1055 occurred at Property Node in make_trg_vis2.vi->main10.vi
    Possible reason(s):
    LabVIEW:  Object reference is invalid.
    The attached files explains the issue. Top.vi calls the sub-VI.
    I hope all this is clear enough. The thing works fine if, instead of using a sub-VI, I use property nodes in top.vi.
    Solved!
    Go to Solution.
    Attachments:
    top.vi ‏53 KB
    make_trg_vis2.vi ‏65 KB

    In your subVI,  you have your index array wired to the N terminal of the for loop.  Perhaps it should be the i terminal?
    N=8.  (Always, every iteration of the For Loop).  You multiply it by 3, then add 1, then another 1.  So you have indices 24, 25, 26.  But the array coming in has 24 elements which are at indices 0 to 23.  Thus you are immediately acting on an empty graph reference at index 24.
    You also appear to have a lot of duplicated cases in your case structures.  For example, cases 3 6 and 7  look identical.  Rather than using 3 different cases.  You can have one case that is 3, 6, 7.

  • Using control refnums in srtict typedef cluster

    I'm having a small problem using control refnums. I've not used them much so this could just be me doing something wrong!
    I'm building an application with a GUI which will need updating with data from within various subVIs and a couple of parallel loops. So, what I wanted to do was "build" a strict typedef cluster of references to the front panel objects I want to update, then I can pass this cluster to any subvi or structure which may need to update a FP object. So far so good...
    The problem:
    On my main GUI I have a strict typedef'd tab control, which I want to be able to reference. When I build my cluster of refnum's I duly create one for this typedef'd tab control. The problem is, if I modify the tab control in anyway, the cluster of refnum's breaks.
    Anyone tell me why this is happening?
    I've attached an example VI I created which shows the problem. Basically, open the typedef to the tab control and change anything, you'll see the cluster of refnums break... you can see a video of it here:  Video
    Any thoughts would be gratefully appreciated!
    Thanks
    Paul
    Attachments:
    refnums.zip ‏15 KB

    Hai,
    Just went through the post
    The strict typd controls automatically gets updated when the parent control changes.  But the refnums that are created out of the strictly typed controls needs manual updation coz there is no linkage between refnum that was created and the strict type control.
    You just create a strict type refnum that carries the properties of a strict type control and in no way a linkage exists between these two.  Hopefully if there is an option to link the refnum and control with "Update from typedef" will solve the problems
    With regards,
    JK
    (Certified LabVIEW Developer)
    Give Kudos for Good Answers, and Mark it a solution if your problem is solved.

Maybe you are looking for


HashFlare