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
Prosys UA Max array size
October 27, 2022
6:06, EEST
Avatar
WML
Member
Members
Forum Posts: 6
Member Since:
October 27, 2022
sp_UserOfflineSmall Offline

Hi

I seem to have hit a max array size as some of my arrays are not being created correctly on the server

this is the code i am using to define one of the arrays that doesnt work

gOPCHistLiveValid := MyNodeManager.CreateVariable(‘gHistLiveValid’);
gOPCHistLiveValid.DataTypeId := Id_Byte;
gOPCHistLiveValid.ArrayDimensions := [1,24, 0,33, 1,144, 1,2];
MyDevice.AddComponent(gOPCHistLiveValid);
gHistLiveValid := VarArrayCreate([1,24, 0,33, 1,144, 1,2], varByte);
vararraylock(gHistLiveValid);
gOPCHistLiveValid.Value := TUaVariant.Create(gHistLiveValid);

smaller ones using the same code are fine.

What is the default max array size and can this be increased and if so how?

thanks

wayne

October 27, 2022
14:46, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Thanks for the request.

Do you really want to define a 4-dimensional array? I am afraid that we don’t really support that at the moment, but I can take a look if that’s indeed what you need.

October 27, 2022
16:22, EEST
Avatar
WML
Member
Members
Forum Posts: 6
Member Since:
October 27, 2022
sp_UserOfflineSmall Offline

4 dimensional arrays do work already if you define them as variant arrays

I have done further tests and it seems there is a limit of 65536 values in an array, go higher than this and the tag doesn’t seem to get created properly.
Is this a hard limit or is there a setting somewhere to increase it.

thanks

Wayne

October 28, 2022
14:03, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Yes, you are right. It seems that the Stack defaults to 65535, although we are setting -1 by default. But, you can extend the limit with

uses
ProsysOPC.UaStack,

begin
TUaStack.SerializerMaxArrayLength := MaxInt;

Add it to the beginning of the project file to be sure it’s set in time. These values are applied when the first TUaServer or TUaClient-component is created. So it applies to bothe server and client applications.

October 28, 2022
14:38, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

And you should actually initialise the ValueRank and Dimensions like this:

gOPCHistLiveValid.ValueRank := 4; // Dimensions
gOPCHistLiveValid.ArrayDimensions := [24, 34, 144, 2];

The values define the maximum number of elements in each dimensions.

If you don’t wish to define any maximums, you can use

gOPCHistLiveValid.ValueRank := 4; // Dimensions
gOPCHistLiveValid.ArrayDimensions := [0, 0, 0, 0];

If your array may also have a variable number of dimensions, you can use

gOPCHistLiveValid.ValueRank := vrOneOrMoreDimensions;
gOPCHistLiveValid.ArrayDimensions := [];

And note that the arrays are delivered without the low index over OPC UA, so the client will not be able to distinguish if you define the the index range with 0,33 or 1,34. In OPC UA the array dimensions are always 0-based – and the client apps can actually access just some elements by defining the IndexRange parameter to Read calls.

But, if it helps you to define the data in the server with 1-based dimensions, just use them.

EDIT: The dimensions are maximums, not fixed sizes.

October 28, 2022
15:02, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Here’s the reference to the specification:

https://reference.opcfoundation.org/v105/Core/docs/Part3/5.6.2/

October 31, 2022
5:40, EET
Avatar
WML
Member
Members
Forum Posts: 6
Member Since:
October 27, 2022
sp_UserOfflineSmall Offline

Unfortunately it doesn’t appear setting TUaStack.SerializerMaxArrayLength := MaxInt; does anything i tried going both ways larger and i still had the same issue.
So i set it to 20 which should have broken the other OPC arrays i was creating and they still worked.

I don’t have the source code version of your component so cant check the code but my guess is the stack is being set to -1 after i try to set it to the value i require.

I put the TUaStack.SerializerMaxArrayLength as the first line of code in formcreate.

October 31, 2022
10:37, EET
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

FormCreate is too late. The values are applied when the components are loaded and FormCreate happens after that.

That’s why you have to put it in the program source. Or you can add it to the form unit’s ‘initialization’ phase, if you don’t have other units that have UA components.

Eventually, you should, preferably use a smaller limit than MaxInt, to avoid potential side effects from malicious clients. since the limits are applied to all arrays in the stack layer.

November 1, 2022
7:48, EET
Avatar
WML
Member
Members
Forum Posts: 6
Member Since:
October 27, 2022
sp_UserOfflineSmall Offline

setting the stack size in initialize has fixed the issue thank you

November 1, 2022
16:31, EET
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Thanks for the confirmation. Good to know you got it working!

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
20 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: 734

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1523

Posts: 6449

Newest Members:

christamcdowall, redaahern07571, nigelbdhmp, travistimmons, AnnelCib, dalenegettinger, howardkennerley, Thomassnism, biancacraft16, edgardo3518

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

Administrators: admin: 1