Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » 4DIAC - Framework for Distributed Industrial Automation and Control » Write and Read OPC_UA Variables in the same server
Write and Read OPC_UA Variables in the same server [message #1783555] Wed, 14 March 2018 06:39 Go to next message
Felipe Adriano da Silva Gonçalves is currently offline Felipe Adriano da Silva GonçalvesFriend
Messages: 35
Registered: February 2017
Location: Brazil
Member
In the examples of how to use opc_ua I saw that is possible access in the server some methods and variables using client or subscribe function blocks.

Accessing variables or methods by this way will create more trheads to implement the client function block to access the opc_ua node using an TCP connection? (as reference see the last example OPC UA Client in the documentation)

Is there another way to to do it? like the simple example in the open62541 repo

Att.

Felipe
Re: Write and Read OPC_UA Variables in the same server [message #1783565 is a reply to message #1783555] Wed, 14 March 2018 08:06 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1560
Registered: January 2014
Senior Member

As far as I can see FORTE uses just one thread for managing all OPC UA communication. Maybe Stefan can explain this better. Could you tell us in more detail what you would like to do?

[Updated on: Wed, 14 March 2018 08:06]

Report message to a moderator

Re: Write and Read OPC_UA Variables in the same server [message #1783571 is a reply to message #1783555] Wed, 14 March 2018 09:18 Go to previous messageGo to next message
Felipe Adriano da Silva Gonçalves is currently offline Felipe Adriano da Silva GonçalvesFriend
Messages: 35
Registered: February 2017
Location: Brazil
Member
To be clearer see this image bellow:

In the example was created a variable in a server with function block SUBSCRIBE_1 (opc_ua[/Objects/1:OPCT01_HV]) to modify this variable inside the server I am using the PUBLISH_3 (opc_ua[opc.tcp://127.0.0.1:4840#/Objects/1:OPCT01_HV/OPCT01/HV]). For some reason when I do this the forte process (./forte) consumes a lot of cpu resource. In other words instantly the processor activity goes to 90-100%.
Re: Write and Read OPC_UA Variables in the same server [message #1783574 is a reply to message #1783555] Wed, 14 March 2018 09:34 Go to previous messageGo to next message
Felipe Adriano da Silva Gonçalves is currently offline Felipe Adriano da Silva GonçalvesFriend
Messages: 35
Registered: February 2017
Location: Brazil
Member
The images bellow show how the processing increases with forte and with forte after deploy.
I make a filter to show just process with name forte.
Re: Write and Read OPC_UA Variables in the same server [message #1783726 is a reply to message #1783574] Fri, 16 March 2018 10:23 Go to previous messageGo to next message
Stefan Profanter is currently offline Stefan ProfanterFriend
Messages: 12
Registered: July 2017
Junior Member
Forte handles subscriptions and clients in two different ways:

1. If you are accessing variables on the same local server, it is done by directly accessing the server nodes, without TCP
2. For remote variables an additional thread is used and a async read is performed.

To tell forte if you want to access the local server's nodes or a remote server you need to use the correct syntax for the ID:

Remote:
opc_ua[opc.tcp://127.0.0.1:4840#/Objects/1:OPCT01_HV/OPCT01/HV]

This tells forte to connect to the server on localhost with port 4840. Since (for now) forte is not so intelligent to detect that it is the local server it is creating a new thread.
Therefore you need to use the following syntax:

Local:
opc_ua[/Objects/1:OPCT01_HV/OPCT01/HV]

i.e. leave the ip and port away.

Does that help?
Re: Write and Read OPC_UA Variables in the same server [message #1783729 is a reply to message #1783726] Fri, 16 March 2018 10:38 Go to previous messageGo to next message
Jose Maria Jesus Cabral Lassalle is currently offline Jose Maria Jesus Cabral LassalleFriend
Messages: 199
Registered: February 2016
Senior Member
Hi,

regarding the 100% cpu usage, may I ask which forte commit are you using for compiling it? Please update the develop branch and see if the problem remain. There might have been a problem that was fixed in august 2017
Re: Write and Read OPC_UA Variables in the same server [message #1784012 is a reply to message #1783726] Wed, 21 March 2018 14:28 Go to previous messageGo to next message
Felipe Adriano da Silva Gonçalves is currently offline Felipe Adriano da Silva GonçalvesFriend
Messages: 35
Registered: February 2017
Location: Brazil
Member
Hi Stefan,

well I have tried this but the Publish block can't write on variable created by the Subscribe. The writing just works if I use the PORT and IP.

You can see in the image that the indicator of SIFB SUBSCRIBE never was triggered although the PUBLISH was triggered several times.

Thanks in advance.
Re: Write and Read OPC_UA Variables in the same server [message #1784013 is a reply to message #1783729] Wed, 21 March 2018 14:32 Go to previous messageGo to next message
Felipe Adriano da Silva Gonçalves is currently offline Felipe Adriano da Silva GonçalvesFriend
Messages: 35
Registered: February 2017
Location: Brazil
Member
Thanks by the response Jose,

I am using the release the 4diac-rte 1.9.0 RC2. Downloaded in https://www.eclipse.org/4diac/en_dow.php.

Is it better clone the forte repo and checkout the development branch?

Re: Write and Read OPC_UA Variables in the same server [message #1784015 is a reply to message #1784013] Wed, 21 March 2018 14:48 Go to previous messageGo to next message
Jose Maria Jesus Cabral Lassalle is currently offline Jose Maria Jesus Cabral LassalleFriend
Messages: 199
Registered: February 2016
Senior Member
Hi Felipe,

regarding the 100% CPU the problem shouldn't be there anymore. Your version should be Ok regarding that. Regarding the PUBLISH trying to write to the subscribe, the fix is right in revision so it would be in the next release, and in the repository in the following days
Re: Write and Read OPC_UA Variables in the same server [message #1784017 is a reply to message #1784015] Wed, 21 March 2018 14:58 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1560
Registered: January 2014
Senior Member

Hi, I just merged the commit into the 1.9.x branch of FORTE's git repo [1] and should be available for you to test.

[1] http://git.eclipse.org/c/4diac/org.eclipse.4diac.forte.git
Re: Write and Read OPC_UA Variables in the same server [message #1784044 is a reply to message #1784017] Wed, 21 March 2018 21:50 Go to previous messageGo to next message
Felipe Adriano da Silva Gonçalves is currently offline Felipe Adriano da Silva GonçalvesFriend
Messages: 35
Registered: February 2017
Location: Brazil
Member
Thanks again by the fast answer,

I have cloned the repo, and checked out the branch 1.9.x.

When I try to write in a variable created by SUBSCRIBE block with using a PUBLISH block with the following ID, the variable receive the new value and the SUBSCRIBE block increment the IND event.

ID: opc_ua[opc.tcp://localhost:4840#/Objects/1:Incrementer/Increment/IN]



But when I try write in the SUBSCRIBE block using the following ID bellow, nothing happens:

ID: opc_ua[/Objects/1:Incrementer/Increment/IN]



This can viewed in the attached pictures.
Re: Write and Read OPC_UA Variables in the same server [message #1784129 is a reply to message #1784044] Thu, 22 March 2018 17:13 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1560
Registered: January 2014
Senior Member

The fix is currently only in the 1.9.x branch. Are you on the development branch?
Re: Write and Read OPC_UA Variables in the same server [message #1784138 is a reply to message #1784129] Thu, 22 March 2018 19:08 Go to previous messageGo to next message
Felipe Adriano da Silva Gonçalves is currently offline Felipe Adriano da Silva GonçalvesFriend
Messages: 35
Registered: February 2017
Location: Brazil
Member
I think so..
When I type:

$ git branch


I can see that my current branch is 1.9.x like in the attached image.
Re: Write and Read OPC_UA Variables in the same server [message #1784203 is a reply to message #1784044] Fri, 23 March 2018 13:46 Go to previous messageGo to next message
Jose Maria Jesus Cabral Lassalle is currently offline Jose Maria Jesus Cabral LassalleFriend
Messages: 199
Registered: February 2016
Senior Member
Hi,

if I understoor correctly from your pictures, you're writing a value to the WRITE_INCREMENT (bottom part) and then in one case this change is detected by the SUBSCRIBE_1 with the same opcua variable name, but only when you use localhost:....

is this right?

If so, I'm wondering is it right that WRITE_INCREMENT uses /Objects/1:incrementer/increment/IN, but SUSBCRIBE_1 uses /Objects/1:incrementer. Is this right? are the names different?
Re: Write and Read OPC_UA Variables in the same server [message #1784213 is a reply to message #1784203] Fri, 23 March 2018 14:31 Go to previous messageGo to next message
Jose Maria Jesus Cabral Lassalle is currently offline Jose Maria Jesus Cabral LassalleFriend
Messages: 199
Registered: February 2016
Senior Member
Oh I see what you're doing now. With the WRITE_INCREMENT you are accesing the absolut path of the variable from SUBSCRIBE_1. I'm not sure about this, but when you use a publish in your local server, it creates or tries to get the variables from the localserver using the ID plus the name and data input/output of the connected FB, like SUBSCRIBE_1 (which uses increment/IN). But if you specify an endpoint (like you did in localhost:4840) it doesn't try to create the variables but only to get them, in your case, it works, since it retrieves the varaible from the server at localhost:4840 (the forte server).

Now, if you don't use localhost:4840, as said it will try to get or create the variable. In your case it looks for Objects/incrementer/IN/NumToIncrement/OUT (since it uses the connected FB). I think the problems lies here because Objects/incrementer/IN is already a variable and it will try to create another variable in it.

I'd say to use the localhost:4840 trick for now, but also suggest to specify in the ID of the opc_ua somehow to specify that the parameter is a absolut path and don't use the connected FB (maybe just for the type but not for the name). This will need some opinion from Stepahn
Re: Write and Read OPC_UA Variables in the same server [message #1784235 is a reply to message #1784213] Fri, 23 March 2018 23:54 Go to previous messageGo to next message
Felipe Adriano da Silva Gonçalves is currently offline Felipe Adriano da Silva GonçalvesFriend
Messages: 35
Registered: February 2017
Location: Brazil
Member
Exactly Jose Maria,

I don't now again if this broke some principle of IEC 61499.

The idea of example is provide a way to the client (from HMI for example) write in some variable inside the application, running in the device througth opc_ua, but also to allow the own application write in this variable in some way.

See this example. The server internally create a Integer variable but it can internally (without additional connection) write in the created variable (see the function writeVariable).

This is so useful when some parameter can be alternated in the run time environment (PLC) by the operator thought an HMI (that is opc_ua client), but this variable under certain conditions can be modified internally by the application logic running in the PLC and in same time this value need to be updated in the HMI.

Thank for your attention.

[Updated on: Fri, 23 March 2018 23:58]

Report message to a moderator

Re: Write and Read OPC_UA Variables in the same server [message #1784245 is a reply to message #1784235] Sat, 24 March 2018 13:00 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1560
Registered: January 2014
Senior Member

No I don't think this breaks some principles of IEC 61499. The problem I see is that our current OPC UA interface is not suited to this use case. Interestingly we already started discussing that we need to expand/change the way how we represent OPC UA in IEC 61499 FBs. Not only because of your use case but with the upcoming pub/sub support, which is very interesting for 4diac we also need to find ways to represent that.

I proposal that I got inspired by your question/problems is the following:

  • use the publish subscribes FBs solely for the OPC UA's pub sub mechanism
  • for variable access introduce a new FB, which would allow use-cases like yours. I've attached a quick and dirty mock-up of such an FB:
    index.php/fa/32438/0/

What are your opinions on this?

[Updated on: Sat, 24 March 2018 13:01]

Report message to a moderator

Re: Write and Read OPC_UA Variables in the same server [message #1784250 is a reply to message #1784245] Sat, 24 March 2018 18:18 Go to previous messageGo to next message
Felipe Adriano da Silva Gonçalves is currently offline Felipe Adriano da Silva GonçalvesFriend
Messages: 35
Registered: February 2017
Location: Brazil
Member
I really think that this OPCUA_Var block will be useful.
I was trying to implement something similar but I stayed a little bit lost in the forte source code.

I have sujestions/doubts about the InitialVal and PARAMS:

Maybe that InitialVal is no necessary since the PUBLISH FB will always be connected to another FB, and it have back initialization capability. Unless that INPUT of the FB in which PUBLISH is connected was not intialized, but in this case I think that the value can be zero since there was no concern about the INPUT initialization.

Will the PARAMS be somethink like node attributes (Namespace Index, IdentifierTYpe and Identifier) or simply the BrowsePath to the variable?

Thanks by the sujestion.
Re: Write and Read OPC_UA Variables in the same server [message #1784611 is a reply to message #1784250] Fri, 30 March 2018 11:19 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1560
Registered: January 2014
Senior Member

If you need a inital value strongly depends on who is the master of your hmi data and how you system should be have when no UA client is connected. For many systems I understand that on startup some reasonable values should be present so that the system operates in a save mode. These values should be presented to the HMI and be tunabel by the HMI. In such cases an inital value is needed. However it could also be part of the config string.

Params would be anything needed to create the right node in the information model with as little configuration effort as possible.
Re: Write and Read OPC_UA Variables in the same server [message #1784690 is a reply to message #1784044] Mon, 02 April 2018 14:34 Go to previous messageGo to next message
Kirill Dorofeev is currently offline Kirill DorofeevFriend
Messages: 70
Registered: February 2016
Member
Hi. The reason why you cannot read and write variables on the same server is that Publish/Subscribe blocks while creating variables on the server use the previous/next convert blocks to create a node path. Thus, in your example you read a variable with your Subscribe block from /Objects/Incremeter (your Subscribe block ID) /Increment/IN (your INT2INT block), whereas you write a variable with your WRITE_INCREMENT Publish block to /Objects/Incrementer/Increment/IN (your WRITE_INCREMENT block ID) /INT2INT/OUT (coming from INT2INT block). So you're writing and reading to/from different places. And there's no way to make it work with current forte.

I am not sure if it is a bug or a feature, but it seems it'd be more natural to write the whole node path in the Publish/Subscribe ID parameter for Server FB's, as we do it for our Client FB's, where you specify the whole path in ID parameter.

I did some tests and was able to achieve the setup what you were trying to (see screenshot).
Re: Write and Read OPC_UA Variables in the same server [message #1785471 is a reply to message #1784690] Sat, 14 April 2018 16:18 Go to previous messageGo to next message
Felipe Adriano da Silva Gonçalves is currently offline Felipe Adriano da Silva GonçalvesFriend
Messages: 35
Registered: February 2017
Location: Brazil
Member
Well I can't write in the SUBSCRIBE block in this way. What is the version of forte that are you using?

[Updated on: Sat, 14 April 2018 16:35]

Report message to a moderator

Re: Write and Read OPC_UA Variables in the same server [message #1785674 is a reply to message #1785471] Wed, 18 April 2018 08:30 Go to previous messageGo to next message
Kirill Dorofeev is currently offline Kirill DorofeevFriend
Messages: 70
Registered: February 2016
Member
Hi Felipe. Yes, I did customize forte code to be able to do so. What I did is I excluded the usage of previous/next FB names by creating the OPC UA variable path in the OPC UA server (it's mainly in createPubSubNodes() method in opcua_layer). One just specifies the whole variable path in the FB ID input. The reason why I don't want to push that to the repository is that this will constraint our current implementation, as doing so it'll be only possible to use only SUBSCRIBE_1 FB, i.e. create only one variable per FB. The reason, why we include previous/next FB instance names in the node names was exactly that this allows us to create more than one variable, using one SUBSCRIBE FB.
The clean solution was already pointed out earlier by Alois. We'd need to define OPC UA specific FB's for OPC UA Variables, Objects and so on..
Re: Write and Read OPC_UA Variables in the same server [message #1793952 is a reply to message #1785674] Tue, 21 August 2018 05:18 Go to previous message
Felipe Adriano da Silva Gonçalves is currently offline Felipe Adriano da Silva GonçalvesFriend
Messages: 35
Registered: February 2017
Location: Brazil
Member
Hi there.

I am trying create a OPCUA_Var block to allow the forte application write on a OPC UA variable internally, but actually forte create variables (PUBLISh and SUBCRIBE FB) using the numeric ID and is not possible to know what numeric ID will be attributed to the variable a priori. just after using uaexpert.
Is there any way to force a numeric ID when using SUBSCRIBE or PUBLISH Function Blocks, this would make it easier to configure the OPCUA_Var block with the numeric ID defined in the PUBLISH or SUBSCRIBE Blocks.

Previous Topic:Hexa decimal PARAM input
Next Topic:OPCUA_Var Function Block
Goto Forum:
  


Current Time: Fri Mar 29 04:36:47 GMT 2024

Powered by FUDForum. Page generated in 0.05499 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top