What Component for my function

I am looking for a way to find the direction of a Allocated Functional exchange

In fact I am listing Components exchange, finding the Allocated Functional exchange

|Name|Direction|Destination Component|Allocated Functional Exchanges|

{m:for lc | self.eAllContents (la::LogicalComponent)}
{m:for ce | lc.ownedFeatures->filter (fa::ComponentPort).componentExchanges}
{m:for ei | ce.allocatedFunctionalExchanges }
{m:ei.name}
… closing For loop

I put some controls of emptiness but the idea is there

using this I can also have access to the functions (using the allocated functional exchange) but how can I have access to the final component ? because if I want to know the in or out direction, having the component where the function belong should be very usefull !!

Hi Pierre,

FYI we are organizing a M2Doc for Capella training
Just in case :wink:

Samuel

Yes !! I am very interested ! I’ll try getting in the loop

On the FunctionalExchange you have two EReferences:

  • incomingFunctionalExchangeRealizations
  • outgoingFunctionalExchangeRealizations

That will give you the FunctionalExchangeRealization then, you can navigate to realized functions and their allocating component exchanges:

fer.realizedFunctionalExchange.allocatingComponentExchanges

At this point you have two EReferences:

  • sourcePort
  • targetPort

You can use one of them depending in which direction you are going and get port allocations and finally climb the model to the containing component

ace.sourcePort.ownedPortAllocations.eContainer().eContainer()

In you example it could look like that:

{ m:ei.incomingFunctionalExchangeRealizations.
realizedFunctionalExchange.allocatingComponentExchanges.sourcePort.ownedPortAllocations.eContainer().eContainer() }

Thank you, you give me hints to solve my problem
I am really in favor for your training proposal because
all this M2Doc stuff must be strengthen by strong basis,
and learning on my own is not enough

Unfortunataly it did not work

  • incomingFunctionalExchangeRealizations
  • outgoingFunctionalExchangeRealizations
    are empty and lead to nothing on my model

But finaly I found a solution that I would like to share with folk on the forum, may be it could help

So per LogicalComponent I look for Component exchanges :
{m:for lc | self.eAllContents (la::LogicalComponent)}

I try to find the Allocated Functional Exchange :
{m:for ce | lc.ownedFeatures->filter (fa::ComponentPort).componentExchanges}
{m:for ei | ce.allocatedFunctionalExchanges }

and I display the name of FE
{m:ei.name}

What I want to know is : does this Functional exchange is in intput (get info from the other component) or in output (send info)
for this I search the output function linked to this FE and look if it is in the originator component
so I look back to my component lc and find the functions inside : lc.allocatedFunctions

{m:for af | lc.allocatedFunctions.name}{m:if ei.sourceFunctionOutputPort.eContainer().name = af}
it is an Output !!

I close my if and my for, and display the 2 functions m:ei.sourceFunctionOutputPort.eContainer().name and m:ei.targetFunctionInputPort.eContainer().name

Thank you for sharing.