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: 11
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: 454
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: 66
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: 454
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: 454
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: 66
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: 11
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 messageGo to next message
Felipe Adriano is currently offline Felipe AdrianoFriend
Messages: 11
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 #1767881 is a reply to message #1767773] Tue, 11 July 2017 20:34 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 454
Registered: January 2014
Senior Member
I've spent some time with the standard and 4diac code. As far as I can see there is nothing in the standard that would prohibit to have a parameter and a connection on a data input of a FB instance. However I will also ask the IEC 61499 experts in the standardization working group to get further feedback.

Furthermore I noticed that if you would out a default value on your PIDs input (e.g., type default value), which would anyhow be a good design pattern for parameters that shouldn't be zero (e.g., Kp or Tr), on the creation of the connection the value would be automatically back-propagated to the RD_x output of the SUBSCRIBE FB. The reason for that is that the RD_x output is of type any and on creation of the connection the RD_x output will get its type from the other end of the connection. During this process currently not only the type but also the value is propagated. so for my point 2. above we only need to use RD_x's value and apply it to the OPC UA servers value.

Regarding the point Jose was mentioning with just removing a simple if in the IDE we can show the value and the connection on an FB input (see the attached screenshot). Although it is graphically not very nice it would work for experiments.

Therefore my proposal would be that we implement my suggestion in the current development branch so that if you agree Felipe can give it a try. With that we can get more experience on the usability and suitability of this approach.

What do you think?
Re: OPC_UA Subscribe FB Var Initialization [message #1767960 is a reply to message #1767881] Wed, 12 July 2017 12:10 Go to previous messageGo to next message
Martin Melik-Merkumians is currently offline Martin Melik-MerkumiansFriend
Messages: 27
Registered: March 2016
Junior Member
Hi all!

Your problem sounds like you would need some kind of MVC pattern in FORTE. Although Alois approach would definitely work, I am not sure if the behavior will be comprehensible and uniform for all different situations with this back-propagating mechanism.

Perhaps we should give a thought on how a clean MVC could be implemented in FORTE, which provides a clean separation of all three components and a comprehensible and uniform interface.

Best regards,
Martin

[Updated on: Wed, 12 July 2017 12:10]

Report message to a moderator

Re: OPC_UA Subscribe FB Var Initialization [message #1768202 is a reply to message #1767960] Fri, 14 July 2017 14:16 Go to previous messageGo to next message
Stefan Profanter is currently offline Stefan ProfanterFriend
Messages: 11
Registered: July 2017
Junior Member
Hi,
as a first fix and to keep consistent data between the FB inputs and the OPC UA variables, I implemented the initialization, so that the OPC UA variables are initialized with the initial value from the connected FB.

See https://bugs.eclipse.org/bugs/show_bug.cgi?id=519696 as a reference.

BR
Stefan
Re: OPC_UA Subscribe FB Var Initialization [message #1768546 is a reply to message #1768202] Wed, 19 July 2017 20:50 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 454
Registered: January 2014
Senior Member
I would like to add to Stefan's post that this is need so that there is a consistency between the values in IEC 61499 model and in OPC UA.
The question to Martin is then what would be the model. I would see it in the information model of OPC UA and the HMI as well as the 1499 application acts as View/Observer or Controller. The way how we are currently creating this model is that we are partly reflecting the IEC 61499 model. This has the advantage that it can be done rather quick and does not need to much FBs. But may not be to sufficient for bigger applications. But I guess with have to make more experience to say that.
Re: OPC_UA Subscribe FB Var Initialization [message #1768915 is a reply to message #1767881] Tue, 25 July 2017 00:45 Go to previous messageGo to next message
Felipe Adriano is currently offline Felipe AdrianoFriend
Messages: 11
Registered: February 2017
Location: Brazil
Junior Member
Sorry by the delay.

To me this sounds very good.
Re: OPC_UA Subscribe FB Var Initialization [message #1768919 is a reply to message #1768202] Tue, 25 July 2017 02:53 Go to previous messageGo to next message
Felipe Adriano is currently offline Felipe AdrianoFriend
Messages: 11
Registered: February 2017
Location: Brazil
Junior Member
This back var initialization has been implemented? I clone FORTE OPC_UA branch but the var initializarion to subscribe function block dont work..

Do I need to change something in the 4DIAC IDE?

[Updated on: Tue, 25 July 2017 02:57]

Report message to a moderator

Re: OPC_UA Subscribe FB Var Initialization [message #1768975 is a reply to message #1768919] Tue, 25 July 2017 10:35 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 454
Registered: January 2014
Senior Member
The initialization on OPC UA side has been implemented. However currently 4diac-ide is not downloading the paramters yet. As written above I wanted to confirm with the IC 61499 standardization working group before implementing it. At this was a good decision. We had some discussion if it is allowed, should be allowed and how to implement it, with the result that we should allow it. For this two changes are required in 4diac-ide (see Bugs [1] & [2]).

However till this is fixed it should be possible that you test this already by specifying initial values for the respective data inputs in your FB Type. As I pointed out above this is anyhow a good practice to do this for critical values like Kp or Ti. Also if the default initial values are chosen well it may even reduce the configuration burden for the user of your FB.

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=520137
[2] https://bugs.eclipse.org/bugs/show_bug.cgi?id=520136
Re: OPC_UA Subscribe FB Var Initialization [message #1769041 is a reply to message #1768975] Wed, 26 July 2017 05:16 Go to previous messageGo to next message
Felipe Adriano is currently offline Felipe AdrianoFriend
Messages: 11
Registered: February 2017
Location: Brazil
Junior Member
I understood, so as said above, forcing an initial value already be enough to initialize subscribe FB, because RD_x output is of type any and on creation of the connection the RD_x output will get its type from the other end of the connection and also the value is propagated. But despite doing it, when I put 4DIAC in debug mode the PID "Ti" was initialized with the value 0 from RD_x from OPC_UA SUBSCRIBE FB.

What is the procedure to initi
You can see this on the figure attached.

What "if" do I need to remove from 4DIAC IDE to show the value and the connection on an FB input?

Thanks in advance.
Re: OPC_UA Subscribe FB Var Initialization [message #1769090 is a reply to message #1769041] Wed, 26 July 2017 12:38 Go to previous message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 454
Registered: January 2014
Senior Member
The problem is that that the value is only written back the first time the connection is created. Therefore you would need to set the value and then create the connection. 4diac has for this a feature where you can online create connections and FBs. but this is rather clumsy to use. Especially in your setup. As pointed out already three times above. You should give initial values in your FB Type. I see this as crucial for a good FB like yours.

In addition I did a quick fix in the ide to implemented the the features which I have pointed above with the bug reports. Unfortunately I do not have time for testing today. So please use them with caution and let us know if you experience any issues.

BTW: you can also subscribe to 4diac's bugzilla to get informed about new bugs and changes to bugs via email. The description can be found in 4diac's developers mailing list.
Previous Topic:MQTT Raw Parsing
Next Topic:MODBUS Client FB dont write Coil registers and create one connection by Block
Goto Forum:
  


Current Time: Tue Feb 20 06:12:31 GMT 2018

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

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