Skip to main content



      Home
Home » Modeling » eTrice » replicated ports
replicated ports [message #982127] Mon, 12 November 2012 19:05 Go to next message
Eclipse UserFriend
I'm trying to contain a ref to N replicated actors. The actor contained in the replicated ref has a port defined, but when I look at the container actor expecting to see a replicated port I can refer to, I find no replicated port.

I went through the code examples but was unable to find any example using replicated ports and/or replicated actor references. Does anyone have a small snippet showing this missing link, please?

Maybe it's just me, or maybe it's some interaction between replicated ports and replicated refs. I would love to peek at a working example to help me past this.

thanks,
-tim
Re: replicated ports [message #982145 is a reply to message #982127] Mon, 12 November 2012 19:26 Go to previous messageGo to next message
Eclipse UserFriend
Deleting the replicated actor ref and recreating it caused the replicated port to appear as expected.
Initial diagram issue solved.

Now that I have a replicated port, this raises many questions:
- Is the index zero based?
- How do I specify a broadcast? Or do I need to explictly walk all?
- How do I know how many are bound?
- How do I know which are bound? Do they have to be contiguous or can we have [0],[1],[4] bound with [2],[3] unbound?

thanks,
-tim
Re: replicated ports [message #984550 is a reply to message #982127] Wed, 14 November 2012 15:01 Go to previous messageGo to next message
Eclipse UserFriend
Hi Tim,

yes we know that we have more features than tutorials. I have attached a small model with a replicated actor and a replicated port.

In principle:
Actors may have a fixed replication factor. This will generate as much actor instances as specified.
Ports may have a fixed replication factor. If there are less connected than specified, there will be just as many generated as connected.
Therefore Ports may have a variable replication factor (see model). In this case eTrice will calculate the replication factor for you. You have to make sure that you always have a distinct situation so that eTrice is able to calculate the correct replication.
Ports will allways be bound from 0 to N.

For the ports you will get the replication with portName.getReplication() (see model)
You will get the portindex with portName.getIndexOf(ifitem) (see model)
You may send a message to a dedicated peer with portName[idx].message() (the generated code looks different).

portName.message() (without specified index) will broadcast the message to all connected peers.

You will find the methods to get the index and replication in the generated protocoll classes.

Other than in OT you will not get an indication that a port is not connected.

The attached model is a java model. Please let me know if you need a simmilar example for C.

Let me know if you have more questions.

Regards
Thomas
Re: replicated ports [message #985715 is a reply to message #984550] Thu, 15 November 2012 14:03 Go to previous message
Eclipse UserFriend
Thank you Thomas. This is a most helpful response.

Yes, I'm largely working in Java these days, so your model example is perfect for my needs. I plan on sharing this with some of my colleagues when I meet with them, as I am sure understanding how port replication works will be very important.

best,
-tim
Previous Topic:message priority
Next Topic:group transitions
Goto Forum:
  


Current Time: Sun May 11 11:10:26 EDT 2025

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

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

Back to the top