Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » 4DIAC - Framework for Distributed Industrial Automation and Control » OPC_UA Subscribe FB Var Initialization(Use opc_ua FB to set parameters)
OPC_UA Subscribe FB Var Initialization [message #1767436] Thu, 06 July 2017 04:49 Go to next message
Felipe Adriano is currently offline Felipe AdrianoFriend
Messages: 8
Registered: February 2017
Location: Brazil
Junior Member
Hi there,

Sometimes you need to use OPC_UA blocks to set parameters (e.g. Kp and Tr from PID block), but the OPC_UA subscribe block begin the RD with zero and this can cause problemas (Tr = 0 !!!!) . Is there some way to init the var of OPC_UA subscribe function block, through the ID parameter, or other option?

I Saw in the opcua_layer.cpp in the method createPubSubNodes, the void *varValue is initialized but just with UA_new(conv->type);

Is there any way to initialize the varValue (variable that will be added to the server) with some value?

Thanks!

Re: OPC_UA Subscribe FB Var Initialization [message #1767478 is a reply to message #1767436] Thu, 06 July 2017 10:18 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 340
Registered: January 2014
Senior Member
hi,

this is an interesting problem you are pointing out here. I think I don't have a quick solution for you. But I also think that we need to provide you with a solution for that. One of the problems I see is that setting a default value on the RD_x outputs is maybe not the thin you would like to have. the problem is that even if you could set here a default value it would not come to your FB as this would require an event and this is not happening.

Therefore I would propose a different solution:
1. specifiy the default value on the input of your FB, either as default value in your FB type, or as parameter value in the application
2. on initionalisation this value is mirrored back to the RD_ output into the opc UA server

In order that this is working we would need to change a bit in the download process for supporting the second part of 1 and a change in the OPC UA layer. Although I think the latter should be pretty straight forward.

What do you think?
Re: OPC_UA Subscribe FB Var Initialization [message #1767492 is a reply to message #1767478] Thu, 06 July 2017 12:14 Go to previous messageGo to next message
Jose Maria Jesus Cabral Lassalle is currently offline Jose Maria Jesus Cabral LassalleFriend
Messages: 32
Registered: February 2016
Member
I did something similar to the picture. It sets and pass the default value using F_SEL. When a new value arrives through the SUBSCRIBE, SR will be reset and the new value will be passed. Take care that the connection INT2INT.CNF -> F_SEL.REQ allows to send many values, since the SR FB triggers only one output event when many R inputs come.
Re: OPC_UA Subscribe FB Var Initialization [message #1767516 is a reply to message #1767492] Thu, 06 July 2017 17:06 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 340
Registered: January 2014
Senior Member
Jose this is an excelent quick solutionfor Felipe's issue.

However I would still like come back to my proposal from above. As you can see in the attached screenshots it would eliminate quite some FBs. The only problem is that currently in 4diac we only write constants during deployment when they are not connected and we don't show them when there is a connection. Espcially changin the deployment would just mean to remove an if. However I wanted to get feedback from other 4diac users and IEC 61499 experts if they see an issue when we change the behavior?

P.S.: Changing the behavior would have also an aditional benefit that it would be very easy to set a type of an any input and we wouldn't need these int2int blocks like you used them in your example. Insteady write the constant INT#0 on the input of the FB_SEL.
Re: OPC_UA Subscribe FB Var Initialization [message #1767517 is a reply to message #1767492] Thu, 06 July 2017 17:07 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 340
Registered: January 2014
Senior Member
Jose this is an excelent quick solutionfor Felipe's issue.

However I would still like come back to my proposal from above. As you can see in the attached screenshots it would eliminate quite some FBs. The only problem is that currently in 4diac we only write constants during deployment when they are not connected and we don't show them when there is a connection. Espcially changin the deployment would just mean to remove an if. However I wanted to get feedback from other 4diac users and IEC 61499 experts if they see an issue when we change the behavior?

P.S.: Changing the behavior would have also an aditional benefit that it would be very easy to set a type of an any input and we wouldn't need these int2int blocks like you used them in your example. Insteady write the constant INT#0 on the input of the FB_SEL.
Re: OPC_UA Subscribe FB Var Initialization [message #1767551 is a reply to message #1767517] Fri, 07 July 2017 06:16 Go to previous messageGo to next message
Jose Maria Jesus Cabral Lassalle is currently offline Jose Maria Jesus Cabral LassalleFriend
Messages: 32
Registered: February 2016
Member
I really like the idea. I'm not sure if this information should appear in the Application View or not. At least maybe mark these connections somehow with a darker blue or something like that, because otherwise you won't see this information at least you click on each conneciton and check that an initial value was set on it, maybe taking a lot of time to realize this.
Re: OPC_UA Subscribe FB Var Initialization [message #1767771 is a reply to message #1767436] Tue, 11 July 2017 02:03 Go to previous messageGo to next message
Felipe Adriano is currently offline Felipe AdrianoFriend
Messages: 8
Registered: February 2017
Location: Brazil
Junior Member
Thank by the fast answer and sorry by the delay, I've been very busy these days, and and you response deserved more attention.

The solution proposed by Alois Zoitl, sounds very good to me, but I am not IEC 61499 expert then I do not know if this can be a problem or if run away for any design pattern.

The solution proposed by Jose Maria also is really good and fix my problem partially, because I am using node-red to set parameters via OPC UA, then if I start the HMI soon after FORTE have been initialized the default value (forced by F_SEL) will not apper in the HMI. The HMI will be synchronized with FORTE just only after I send the first value to Subscribe block.

For now I will use the solution proposed by Jose, but what have you decided?

Thank you again.
Re: OPC_UA Subscribe FB Var Initialization [message #1767773 is a reply to message #1767436] Tue, 11 July 2017 02:33 Go to previous message
Felipe Adriano is currently offline Felipe AdrianoFriend
Messages: 8
Registered: February 2017
Location: Brazil
Junior Member
Thank by the fast answer and sorry by the delay, I've been very busy these days, and and you response deserved more attention.

The solution proposed by Alois Zoitl, sounds very good to me, but I am not IEC 61499 expert then I do not know if this can be a problem or if run away for any design pattern.

The solution proposed by Jose Maria also is really good and fix my problem partially, because I am using node-red to set parameters via OPC UA, then if I start the HMI soon after FORTE have been initialized the default value (forced by F_SEL) will not apper in the HMI. The HMI will be synchronized with FORTE just only after I send the first value to Subscribe block.

For now I will use the solution proposed by Jose, but what have you decided?

Thank you again.
Previous Topic:MODBUS Client FB dont write Coil registers and create one connection by Block
Goto Forum:
  


Current Time: Tue Jul 11 12:59:01 GMT 2017

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

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