Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Using elements of array for read and write
November 7, 2014
11:50, EET
Avatar
gjevremovic
Member
Members
Forum Posts: 49
Member Since:
January 30, 2014
sp_UserOfflineSmall Offline

Hi,

I need help related to using of range offset for accessing array’s elements with sdk 2. I think with available prosys client sample it is not possible to read or write arrays.
Could you please provide sample for reading and writing arrays (1 and 2 dimensional of simple types)?

BR,
Goran

November 7, 2014
15:59, EET
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

// Read element #1 of the array
client.readValue(arrayVariableId, new NumericRange(1));
// Read elements #1-#3 of the one-dimensional array
client.readValue(arrayVariableId, new NumericRange(1, 3));
// Read elements #1-#2/#2-#3 of the two-dimensional array
client.readValue(arrayVariableId, new NumericRange(new int[] { 1, 2 },
new int[] { 2, 3 }));

I think the spec. defines that indexes start from 1.

November 12, 2014
15:17, EET
Avatar
gjevremovic
Member
Members
Forum Posts: 49
Member Since:
January 30, 2014
sp_UserOfflineSmall Offline

Thanks, much easier with sdk 2. Practically we have only one NodeId for accessing arrays.
Is that mean that all n elements are read or it is the same read as we have like in legacy support mode where each array element has its own NodeId?

BR,
Goran

November 13, 2014
8:37, EET
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Yes, it was improved – or written properly in SDK 2. Also the server side is properly supporting array indexing now.

The server should provide only the elements that are requested, if you use an IndexRange. The array elements can also be provided as individual variables with specific NodeIds, if you wish.

November 18, 2014
9:51, EET
Avatar
Darko
Member
Members
Forum Posts: 8
Member Since:
November 18, 2014
sp_UserOfflineSmall Offline

Hi,

I have an OPC UA Server that has nodes with arrays of Int16 elements.
When I try to use SDK 2 and method from UaClient with signature writeValue(NodeId nodeId, Object value, NumericRange indexRange),
I get an error stated below:

com.prosysopc.ua.StatusException: Bad_WriteNotSupported (0x80730000) "The server not does support writing the combination of value, status and timestamps provided." StatusCode=Bad_WriteNotSupported (0x80730000) "The server not does support writing the combination of value, status and timestamps provided."
at com.prosysopc.ua.client.UaClient.a(Unknown Source)
at com.prosysopc.ua.client.UaClient.writeAttribute(Unknown Source)
at com.prosysopc.ua.client.UaClient.writeValue(Unknown Source)

My code had an intention to update values of some range of elements in an array:

NodeId nodeId = new NodeId(4, "GVL.nAnalogINput.Input[1].Data"); // this is the node containing value in format of Int16 Array[4]
NumericRange range = new NumericRange(1, 2); // second and third element in an array
Short[] newValues= new Short[2];
newValues[0] = 21;
newValues[1] = 22;
client.writeValue(nodeId, newValues, range);

Is there a solution for this problem (updating values of some elements in an array)?

November 18, 2014
11:32, EET
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

That sounds more like a problem in the server, which is giving the error.

November 18, 2014
15:26, EET
Avatar
Darko
Member
Members
Forum Posts: 8
Member Since:
November 18, 2014
sp_UserOfflineSmall Offline

Jouni Aro said

That sounds more like a problem in the server, which is giving the error.

I understand that the server is not able to process the request, but there are two more things that are strange:

1. Through UaExpert client it is possible to change the values for arbitrary elements in array on problematic server.
2. Using Prosys OPC-UA and the same code I am able to write values in array’s elements, on OPC UA C++ Demo Server (from Unified Automation).
3. I am able to write other simple data type values with no problem, on both demo server and the other one.

Is it possible that Prosys library (version 2.0.2), in its implementation, does not send correct Write request for arrays for every type of server?

November 18, 2014
16:03, EET
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Yes, it is definitely an interoperability issue, but what I actually mean is that it is probably easier to examine the server, why it rejects the write. The value is written as DataValue, which does get a timestamp and quality by default. The server should just ignore those, in my opinion. But if you could find out why the server rejects the write and what it actually requires for this to work, it will be easier to modify the client code respectively.

Which server is this?

November 19, 2014
7:40, EET
Avatar
Darko
Member
Members
Forum Posts: 8
Member Since:
November 18, 2014
sp_UserOfflineSmall Offline

Thank You for elaborating Your answer.

It is Beckhoff’s server running together with TwinCAT 3 and their newest OPC UA server – TF6100 TC3 OPC-UA ver 3.1.11.0 (Runtime Server 2.0.0.62, Runtime Client 2.1.0.18).

Any ideas towards where to search to find the reason behind all this?

Thank You,
Darko

November 19, 2014
9:32, EET
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

I just discussed with the Beckhoff developer (we are currently at the Interoperability Workshop) and he told me that index ranges are not yet supported by the Twincat server.

If you want to write to sub elements, you can enable ArraySubItemLegacySupport for the arrays, as described at

http://infosys.beckhoff.com/co…..spaces.htm

That will, of course increase the size of the namespace, but should help you with the issue at the moment.

November 20, 2014
10:44, EET
Avatar
Darko
Member
Members
Forum Posts: 8
Member Since:
November 18, 2014
sp_UserOfflineSmall Offline

Thank You.

I know about the legacy and non-legacy mode on TwinCAT 3 server, but I really need to know how to write values of arrays when ArraySubItemLegacySupport is disabled.

What bothers me now is that I am able to write values in array in this mode when I use UaExpert client and not able when I use Prosys’ library in Java.

Could be that UaExpert uses another stack (bulit in C) and that Unified Architecture’s Java stack does not sen something that Beckhoff’s server is demanding? (Timestamps or something else).

I will repeat what I said about successful and failed scenarios while testing different servers and client programs:

1. Through UaExpert client it is possible to change the values for arbitrary elements in array on TwinCAT 3 server.
2. Using Prosys OPC-UA and the same code I am able to write values in array’s elements, on OPC UA C++ Demo Server (from Unified Automation).
3. I am able to write other simple data type values with no problem, on both demo server and TwinCAT 3 server.

Best Regards,
Darko

November 20, 2014
13:02, EET
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

UaExpert is always writing the complete array. It does not support IndexRanges.

TwinCAT server does not support IndexRange with the Write service. Only with the Read service.

So the only option for you is to write the complete array.

November 20, 2014
15:19, EET
Avatar
Darko
Member
Members
Forum Posts: 8
Member Since:
November 18, 2014
sp_UserOfflineSmall Offline

Thank You.

That was something that I dropped out of sight.

I guess we will have wait for Beckhoff to implement this feature for optimization of writing service. Thank You again for all the information.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
66 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Heikki Tahvanainen: 402

hbrackel: 144

rocket science: 88

pramanj: 86

Francesco Zambon: 83

Ibrahim: 78

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

Member Stats:

Guest Posters: 0

Members: 738

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1524

Posts: 6451

Newest Members:

jonathonmcintyre, fannielima, kristiewinkle8, rust, christamcdowall, redaahern07571, nigelbdhmp, travistimmons, AnnelCib, dalenegettinger

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1026, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0

Administrators: admin: 1