LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

passing multiple graphs to sub vi

Solved!
Go to solution

Having found some additional information, i feel am closer to a solution but am still confused as to the cause of the problem.  My understanding is that the brown cluster contains elements of the same type and the pink cluster contains elements of different types.  However, the cluster (which is currently pink) should contain elements of the same type [see below]

 

The meter I use to read the data returns a string containing the voltage and current in the following format  [voltage1, current1, voltage2, current2, voltage3.....].  I convert this string to an array of data type double and then deliminate the string to get voltag and current as seperate 1-D arrays (type double).  If both arrays are the same size and of the same type, creating a cluster from these two arrays should mean that the elements are of the same type.  The arrays are wired to the build xy graph express vi and the output is a pink cluster (elements of different type).

 

Any ideas as to why this problem is happening?

0 Kudos
Message 11 of 18
(1,469 Views)

 


@pjr1121 wrote:

Any ideas as to why this problem is happening?


Yes. It's because you're using one of those evil Express VIs. That Express VI is actually creating a 1D array of clusters, not an individual cluster.

0 Kudos
Message 12 of 18
(1,460 Views)

Smercurio,

 

Thank you for your reply and this explanation does make some sense.  However, it did not fix the problem.  I've attached a small vi demonstrating the error I am enountering.  There is a class conflict (error list says renum types are different) when wiring the xy graph reference from the main vi to the sub vi.  I think this has to do with the fact that the clusters in the main and sub are different, but I do not know why they are different.

 

These were made with Labview 8.6

Download All
0 Kudos
Message 13 of 18
(1,447 Views)

You probably created the reference before the datatype for the XY graph had been set and moved the reference to the subVI's front panel to create the control. Since the reference control on the subVI has the "Include Data Type" option checked (right-click on the control), the data type has to match.

 

Graphs are tricky when it comes to creating references for them. You need to make sure you create the reference after you've wired the plot data, as this will update the data type of the graph. The default data type of the XY graph is a 1D array of clusters, with each cluster being 2 DBLs. Thus, if you place an XY graph on a front panel and create a reference, you get a reference to a data type of 1D array of clusters of 2 DBLs. If you then wire the plot data to the graph the reference on the main VI gets updated as far as data type, but the reference control on the subVI does not, since it's still based on the original data type.

 

So, you can either update the reference on the subVI with a new reference from the main VI, or you can uncheck the "Include Data Type" option on the reference control on the subVI. The latter means the Value property will return a variant which you will then need to cast to the appropriate data type using the Variant To Data function.

Message 14 of 18
(1,443 Views)

Thank you,

 

Although attempting the update the reference resulted in the same error, I did manage to get the void to data conversion to work. My program is now fully functional.

0 Kudos
Message 15 of 18
(1,425 Views)

The difference between the pink and brown wires are that the brown wires refer to numeric values only inside of a cluster as part of an array.  The pink wire is anything else, ie, arrays in clusters.  The sample VI should show what I mean.

 

17831i898E840E85F6BE6B

National Instruments
Applications Engineer
Download All
Message 16 of 18
(1,422 Views)

 


@pjr1121 wrote:

Thank you,

 

Although attempting the update the reference resulted in the same error, I did manage to get the void to data conversion to work. My program is now fully functional.


 

I don't see how that could have happened unless you did things out of order. I had tested it out just to make sure it would work, and it works just fine. Starting with the VIs that you posted:

  1. Open both the main and the subVI. 
  2. Drag the reference from the block diagram of the main VI onto the front panel of the subVI. This will create a new reference control on the subVI.
  3. Select the new reference control on the subVI and select Edit -> Cut.
  4. Select the old reference control on the subVI and select Edit -> Paste. This effectively replaces the reference control on the subVI with the updated reference.

Once you do the above you should not have any broken wires.

 

P.S. It's a variant, not a void. Big difference. Smiley Wink

0 Kudos
Message 17 of 18
(1,414 Views)

Tried replacing the reference again and it worked this time.  I must have made a small mistake last time that I didn't notice. 

 

In regards to the void vs variant, I thought I had typed variant in my last post but apparently I typed void out of habit.

 

Thank you again for all of your help.

0 Kudos
Message 18 of 18
(1,395 Views)