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
OnAddItem event
June 4, 2021
17:15, EEST
Avatar
DenisF
Member
Members
Forum Posts: 22
Member Since:
March 26, 2021
sp_UserOfflineSmall Offline

Hello,

It’s not clear to me if and how you can add an item to the server at the request of the client, using I suppose the OnAddItem event of the TPsOPCProviderGroup class.

I couldn’t find an example of this in the examples provided, and the doc doesn’t say anything either. Am I going about this the wrong way? Is it possible to add an item that does not yet exist in this way in the server?

Thanks in advance.

Denis

June 4, 2021
18:54, EEST
Avatar
DenisF
Member
Members
Forum Posts: 22
Member Since:
March 26, 2021
sp_UserOfflineSmall Offline

Actually my problem is more annoying. I also need to be able to create items that are not necessarily strings of the pascal language identifier type. For example, a possible item in my OPC server could be something like: “MyVar[5].Field1”. The server I want to replace worked in this way. How is it possible to get the same result with your library?

Thank you.

Denis

June 7, 2021
11:14, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1009
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Hi Denis, Thanks for a good question.

TPsOPCProvider.OnFindItem is the best place for this. It’s called whenever the OPC Provider tries to find the component matching an ItemID, so in practice, when the client apps call AddItems. You can interpret the ItemID in your own style and return a reference to a new variable (or any other component), as necessary. If you return other than variables, they will work as “folders” or OPC Branches, instead of data items or OPC Leaves.

June 7, 2021
16:00, EEST
Avatar
DenisF
Member
Members
Forum Posts: 22
Member Since:
March 26, 2021
sp_UserOfflineSmall Offline

Hi,

Thank you for the reply. Is there any example available showing how to manage such items the right way ? I find it difficult to understand what should be done with the documentation and it takes much time.

Regards

Denis

June 7, 2021
16:27, EEST
Avatar
DenisF
Member
Members
Forum Posts: 22
Member Since:
March 26, 2021
sp_UserOfflineSmall Offline

When creating the variables that must be able to be browsed by the client, if we use components of type TPsVar, TPsBool, etc., is the itemID returned to the client necessarily the “name” property of the component, or is it possible to return a different itemID?

In this case, perhaps it is necessary to use another way to define the available variables and their ItemID?

Thanks in advance

June 7, 2021
17:38, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1009
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Unfortunately, there are no good examples.

But, basically, you can define the contents of the AddressSpace as you like.

By default, the AddressSpace will be filled with variables that are found in all forms and data modules that are added to the Application. You can use ‘PsOPCProvider.AddressSpace.AutoAddApplication := False;’ to disable this default logic. Use AddVariable(s) to add what you need in there. You can provide a custom name for each to be used in the address space. This is probably the easiest way to do it. See the help for ‘TPsOPCProviderAddressSpace’.

You will only need to use OnFindItem, if you wish to create variables dynamically, upon client request, instead of predefining everything.

June 10, 2021
10:48, EEST
Avatar
DenisF
Member
Members
Forum Posts: 22
Member Since:
March 26, 2021
sp_UserOfflineSmall Offline

Thank you very much for the help and support. I now have a DA server that seems to be working fine, with which items are created on demand by the client. Not being able to list the available items on the client side is still a drawback.

I will now switch to UA. Will I be able to set up a system that works in a similar way? Will the TPsVar descendant objects used for the DA server work the same way for UA?

Thank you in advance

June 10, 2021
17:24, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1009
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Great. If you add the variables to the AddressSpace with AddVariable, they will then also be visible to the clients.Check Stage 8.2 in the SentrolTutorial document for details.

June 10, 2021
17:25, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1009
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

And unfortunately, the OPC UA SDK does not yet support the TPsVar components, although that is the vision…

So at the moment you will have to do the mapping yourself from TPsVars to TUaVariables.

June 17, 2021
18:35, EEST
Avatar
DenisF
Member
Members
Forum Posts: 22
Member Since:
March 26, 2021
sp_UserOfflineSmall Offline

Thank you, for all advices.
I know we are not in the proper section there, but could you please point me to the right event I would have to use to create new UA variables from client queries, the same way than for the classic server above ?

June 18, 2021
12:58, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1009
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Hmm, I am trying to think how does this apply to OPC UA in fact. I guess you can add nodes dynamically upon request there as well, although the assumption is more like that the address space is defined by the server and if modifications are allowed they are done via the AddNodes service.

In any case, at the moment the solution is to create your own version of a NodeManagerUaNode and override methods in there. You could override TryGetNode, which is used whenever a node is looked up by it’s NodeId.

June 23, 2021
18:32, EEST
Avatar
DenisF
Member
Members
Forum Posts: 22
Member Since:
March 26, 2021
sp_UserOfflineSmall Offline

Thank you, it works very well.

My OPC UA server is almost functional, but I’m still missing some small details.

– To forbid the writing of a TUaVariable by the client, AccessLevel must contain [altCurrentRead], is that right? But the variable is still accessible and modified by the client.

– How do we get the information about the connected clients (IP address, name of the client software, others)?

June 24, 2021
16:44, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1009
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Yes these improvements are underway as well. At the moment, you can use TUaVariable.OnWriteValue to raise EUaStatusException with Bad_UserAccessDenied yourself.

The client info should be available from TUaServer.SessionManager, but it only provides SessionCount at the moment.

June 24, 2021
19:40, EEST
Avatar
DenisF
Member
Members
Forum Posts: 22
Member Since:
March 26, 2021
sp_UserOfflineSmall Offline

Thank you for your help.

Unfortunately this doesn’t seem to work, I do create the exception you indicated, but despite this the client receives a success status.

I am coming to the end of the one month trial extension tomorrow. I’ll probably have to stop testing, as I don’t know when we’ll order the licenses from you, hopefully next week. I would ask you for another extension, but I’m afraid I’m taking it a bit too far ? Anyway, thank you for your support until now.

June 24, 2021
19:49, EEST
Avatar
DenisF
Member
Members
Forum Posts: 22
Member Since:
March 26, 2021
sp_UserOfflineSmall Offline

In fact it’s more serious, it seems that when I raise the exception, the connection then breaks with timeouts and multiple cascading errors are returned by the client.

June 28, 2021
11:46, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1009
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Please, just contact us for an evaluation extension. We need to make you happy first, before you can place an order, anyways 🙂

Are you already using the latest version 7.3.0?

June 29, 2021
15:55, EEST
Avatar
DenisF
Member
Members
Forum Posts: 22
Member Since:
March 26, 2021
sp_UserOfflineSmall Offline

Indeed I was using the version 7.2.0 installed since the beginning. With the latest version, it seems that the problem has disappeared. Thank you for your help.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online:
17 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

rocket science: 77

ibrahim: 76

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

fred: 41

Member Stats:

Guest Posters: 0

Members: 680

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1467

Posts: 6260

Newest Members:

sagarchau, elviralangwell4, Donnavek, Eddiefauth, DonaldPooma, fidelduke938316, Jan-Pfizer, DavidROunc, fen.pang@woodside.com, aytule

Moderators: Jouni Aro: 1009, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 983, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 26, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 321, Lusetti: 0, Ari-Pekka Soikkeli: 5

Administrators: admin: 1