LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error writing variant data to network published shared variable

Solved!
Go to solution

Within my real-time project, on the host VI running on my Windows PC, I am attempting to write to a number of network-published shared variables.  All of these write operations are successful (meaning that I can subsequently read them on the RT target, a cRIO-9012), with the exception of those network-published shared variables with the data type defined as variant.  I'm not quite sure what is causing the problem.

 

I am taking the array of clusters shown here...

 

STS code 5.png

 

...and passing it through a "To Variant" VI, and then subsequently writing to the shared variable (data type: variant).  Diagnosing the failure of the real-time VI to read data, I found that the shared variable write on the host VI was producing the following error:

 

Error -2147467259 occurred at Shared Variable in PC host TTS CTRL.vi

Possible reason(s):

LabVIEW:  (Hex 0x80004005) Unspecified error.
=========================
NI System Configuration:  (Hex 0x80004005) Miscellaneous operation failure.

This error or warning occurred while writing the following Shared Variable:
\\My Computer\Network Shared Variables\TC Group Assignment Array - Network
\\128.144.90.143\Network Shared Variables\TC Group Assignment Array - Network

 

...where 128.144.90.143 is the IP address of the PC.

 

Any thoughts?

 

Sean

 

NI Alliance Partner
0 Kudos
Message 1 of 8
(2,870 Views)

CFER_STS, 

I did a little bit of research and found this Forum post that seems quite similar to yours. This solution suggests flattening the object to a string and passing that through. Have you tried this to see if it would work?

If it doesn't, can you provide more information? Computer OS? Attaching your VI? Anything that can allow us to see or get more information could be helpful if the other forum's solution isn't working for your.

Douglas Choisnet
0 Kudos
Message 2 of 8
(2,826 Views)
Solution
Accepted by CFER_STS

I did see that post, and when I found myself with no other options, I redefined the variables in question to string data type, and replaced all "To Variant" and "Variant to Data" functions with "Flatten to String" and "Unflatten from String" functions respectively.  At first, it didn't work - every "Unflatten from String" function would produce error 74, until I realized that the "data includes array or string size? (T)" input on every "Unflatten from String" function had to be set to FALSE. Wiring a false constant to each instance of "Unflatten to String" seems to have corrected the problem.

 

I still have no idea why the variant wouldn't work.  The shared variable editor allows you to set a variant datatype, so I presume it is supposed to?

 

Sean

 

NI Alliance Partner
0 Kudos
Message 3 of 8
(2,820 Views)

Hi Sean. You are correct that it is suppose to work as long as you don't have RT FIFOs enabled on the Shared Variable. However, there is a known issue where this doesn't work as expected when converting a LabVIEW class to a varient with shared variables (Ref # 443117). This could be related to that. I'm glad you were able to find a work-around. 

 

Applications Engineer
National Instruments
0 Kudos
Message 4 of 8
(2,795 Views)

Was someone able to resolve this without a workaround?

 

I'm currently facing the issue that

  • writing an array of doubles to a shared variable works fine.
  • writing the same data as a variant (i.e. key/value pairs) fails.

Full error:

Error -2147467259 occurred at Shared Variable in main.vi

Possible reason(s):

LabVIEW:  (Hex 0x80004005) Unspecified error.
=========================
NI System Configuration:  (Hex 0x80004005) Miscellaneous operation failure.

This error or warning occurred while writing the following Shared Variable:
\\NI-cRIO\networkPublishedVariables\valuesRead2
\\192.168.2.4\networkPublishedVariables\valuesRead2

 

0 Kudos
Message 5 of 8
(2,383 Views)

Patrick, what version of LabVIEW are you using?  Here is a snippet where I was able to get both setups that I believe you are describing to work without issue on LabVIEW 2015 SP1.

variant_shared_variable_double_array.png

0 Kudos
Message 6 of 8
(2,353 Views)

I'm using LabView 2015 SP1, too.

Maybe it's the type of variant that's causing issues?

 

I start with an empyt variant and add all my doubles as attributes via "Set Variant Attribute", then attempt to write the resulting variant to the shared variable

0 Kudos
Message 7 of 8
(2,344 Views)

I see what you mean.  I was able to reproduce that on my end.  Do you need to create your variant data that way?  If you can do the same thing by using "to Variant" I would just do it that way, because that seems to be working.

0 Kudos
Message 8 of 8
(2,331 Views)