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 » Howto use Adapters
Howto use Adapters [message #1749637] Thu, 08 December 2016 22:05 Go to next message
Ernst Murnleitner is currently offline Ernst MurnleitnerFriend
Messages: 19
Registered: December 2016
Junior Member
I want to transfer 5 real values (parameter for a polynome). Therefore I have constructed an adapter. It is possible to add this adapter as a socket or a plug into the FB. But how can I use it?

In the type navigator, I open an FB and in the context menu, I can choose "create socket" and choose the existing adapter. Afterwards, the adapter is shown in the FB with a green symbol. But how can I access the variables of the plug? I only can see the variables of an adapter if I open the adapter in the type view. But I cannot use it together with a FB.

Does anybody use adapters?
Is there a tutorial?
Is there an example?


Kind regards,
Ernst
Re: Howto use Adapters [message #1749757 is a reply to message #1749637] Sun, 11 December 2016 11:31 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1585
Registered: January 2014
Senior Member

Hi,

yes I'm using adapters quite a lot. The Traffic Light example which is coming with 4diac show some usage of adapters. In principle it depends what kind of FB you are using. The easiest way of using adapters is in Composite FBs. There the plugs and sockets appear in the internal FB network of the composite FB and you can wire events and data connections to it as with any other FB.

But I assume you are more interested in using adapters with basic FBs. There you can use the events and variables of an adapter by using the name of your plug or socket as prefix. E.g., myplug.Var1 or socket.Var3. The code completion provided for the algorithm and transition condition editors should give you these variables as suggestions.

Finally I'm not sure if an adapter is the most suitable element for you. As in addition to your 5 values you would also need an event which would inform your FB about value changes of your polynome parameters. Maybe an array input can give you the same featuers with less effort. Not sure.
Re: Howto use Adapters [message #1750385 is a reply to message #1749757] Tue, 20 December 2016 15:03 Go to previous messageGo to next message
Ernst Murnleitner is currently offline Ernst MurnleitnerFriend
Messages: 19
Registered: December 2016
Junior Member
Alois Zoitl wrote on Sun, 11 December 2016 11:31


yes I'm using adapters quite a lot. The Traffic Light example which is coming with 4diac show some usage of adapters.


Hmm. I can only see one adapter: ATraficLight. But this one does not have any variables. It has only events.



Alois Zoitl wrote on Sun, 11 December 2016 11:31


But I assume you are more interested in using adapters with basic FBs. There you can use the events and variables of an adapter by using the name of your plug or socket as prefix. E.g., myplug.Var1 or socket.Var3. The code completion provided for the algorithm and transition condition editors should give you these variables as suggestions.


Yes, in the meantime I used it this way and it works.

I used "REQ" and "CNF" in my two FB, where I want to transfer data from the first named "Interface" to the second named "Corrector". I used "REQ" and "CNF" also in the adapter (together with 5 REAL values on the left side of the adapter) and in the first FB, not only "CNF" is set, but also the CNF of the Adapter.

However, I tried not to set the "CNF" of the adapter and it still worked. Is this OK?
Is it possible to remove alle the signals from the adapter?




Alois Zoitl wrote on Sun, 11 December 2016 11:31



Finally I'm not sure if an adapter is the most suitable element for you. As in addition to your 5 values you would also need an event which would inform your FB about value changes of your polynome parameters. Maybe an array input can give you the same featuers with less effort. Not sure.


This is done automatically, because I have a "CNF" and a "Adapter.CNF" and also a "REQ" and a "Adapter.REQ"?



And yes, an array would be sufficient now as I need now only 5 identical parameters.


Re: Howto use Adapters [message #1750416 is a reply to message #1750385] Tue, 20 December 2016 21:00 Go to previous message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1585
Registered: January 2014
Senior Member

Ernst Murnleitner wrote on Tue, 20 December 2016 15:03
Alois Zoitl wrote on Sun, 11 December 2016 11:31


yes I'm using adapters quite a lot. The Traffic Light example which is coming with 4diac show some usage of adapters.


Hmm. I can only see one adapter: ATraficLight. But this one does not have any variables. It has only events.


There should also be a ATimeOut. This has a data element.

Ernst Murnleitner wrote on Tue, 20 December 2016 15:03

Alois Zoitl wrote on Sun, 11 December 2016 11:31


But I assume you are more interested in using adapters with basic FBs. There you can use the events and variables of an adapter by using the name of your plug or socket as prefix. E.g., myplug.Var1 or socket.Var3. The code completion provided for the algorithm and transition condition editors should give you these variables as suggestions.


Yes, in the meantime I used it this way and it works.

I used "REQ" and "CNF" in my two FB, where I want to transfer data from the first named "Interface" to the second named "Corrector". I used "REQ" and "CNF" also in the adapter (together with 5 REAL values on the left side of the adapter) and in the first FB, not only "CNF" is set, but also the CNF of the Adapter.

However, I tried not to set the "CNF" of the adapter and it still worked. Is this OK?
Is it possible to remove alle the signals from the adapter?


Unfortunately not. Adapters have their own with constructs. Without Adapter events the values would not be updated. Therefore as you did it arrays are in your case the better modelling element.



Ernst Murnleitner wrote on Tue, 20 December 2016 15:03

Alois Zoitl wrote on Sun, 11 December 2016 11:31



Finally I'm not sure if an adapter is the most suitable element for you. As in addition to your 5 values you would also need an event which would inform your FB about value changes of your polynome parameters. Maybe an array input can give you the same featuers with less effort. Not sure.


This is done automatically, because I have a "CNF" and a "Adapter.CNF" and also a "REQ" and a "Adapter.REQ"?



And yes, an array would be sufficient now as I need now only 5 identical parameters.



If you don't have the identical parameters then there would also be Structs. But the usage of structs in 4diac is currently very clumsy.

Previous Topic:Flip-Flop Tutorial problem
Next Topic:MQTT
Goto Forum:
  


Current Time: Thu Apr 25 01:40:48 GMT 2024

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

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

Back to the top