LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Replacing outdated datasocket with lv2015 datasocket vi

Hi,

 

I am trying to replace the datasocket vi from an old version of labview with the datasocket vi from LV2015 without having to change my input variables. The VI that currently exists in my code is this one 

Asasafuchi_0-1738079579372.png

And I am trying to replace it with this: 

Asasafuchi_1-1738079613528.png

But I dont know how I should modify the DataSocket Reference In wire such that it becomes compatible with this one. Could anybody help me with this? The datasocket reference in is a 1d array of clusters containing the following elements: 

Asasafuchi_2-1738079701616.png

 

 

0 Kudos
Message 1 of 4
(113 Views)

My DataSocket is a little rusty.

Here is the old and new style of setting up DataSocket.

 

The old style required you to create a DS reference, connect it to a URL and then you could read it.

With the new style you can open a connection with the URL and then use that reference to read OR you can wire the URL directly into the read. I believe using the connection reference is faster if you are reading/writing the item often.

 

Unfortunately, the DS references inside the old DS Reference cluster are not the type of reference the new style is looking for. But you can use that reference to get the URL. Then you can use that URL to open a new style reference. 

 

Obviously it would be better to just replace the old-style DS Create and DS Connect with the new DS Open, but if you are stuck with the old style references for some reason, you can get the URL and then DS Open with that.

Lavezza_0-1738104796669.png

 

 

 

0 Kudos
Message 2 of 4
(85 Views)

Ok thanks, I will try that out.

 

And to write the data do I just wire in the values for the data and attribute to two separate VIs like this?

 

Asasafuchi_1-1738136213711.png

Given that the outdated datasocket write VI looks like this:

Asasafuchi_2-1738136242396.png

 

0 Kudos
Message 3 of 4
(74 Views)

I don't think the new interface supports attributes. 

 

NI has a page here: DataSocket Functions and Variant Data - NI that writes to DS as a variant. You can add attributes to variants if you need. But in my opinion this isn't a great solution. First, you always need to cast from variant to read the data. Second, every time you want to update the data or any attributes you need to write everything. In other words, if you create a variant with a data value, add some attributes and then write a new data value the attributes will be gone because they were attached to the initial variant, not the DataSocket. See example below.

 

Lavezza_0-1738178310592.png

 

0 Kudos
Message 4 of 4
(49 Views)