How to obtain Component Ports + Component Exchanges?

Is it possible to get the Components PORTS or/and Components EXHANGES from a Logical Component?
I have been looking at the functions available in the capella simplified api and been experimenting as follows but something might be wrong:

  1. I got a Logical Component inside the the variable wrap3
wrap3=EObject.get_class(Pre)(Pre)#Python Object

I tried this function (get_realizing_behavior_p_cs) → Error:

  1. I tried the other available function in the simplified api but this has more to do with “capabilities” than actual exhanges:

This time, we have no error… contrary to the previous function:

→ Something might be wrong with the function: (get_realizing_behavior_p_cs)

  1. Moving on the functions available for LC_Pkgs:
print(C.size()) #0
print(C2.size()) #0

I tried this with my 3 Logical Component packages (the one containing the Logical System, and the other containing the Logical Actors)
The result was always EMPLY lists.

  1. Moving on, now I went to the INTERPRETER:
    I found out there was no method to get the component exchanges or component ports from a Logical Component?

All of these 5 trials gave 0 results, eventhough I was trying on a model that I knew for sure had Components ports on that specific LC I was testing, we got 3 outgoing logical component exchanges and 1 incoming:

Yes in the interpreter, nothing shows up with those 5 commandes.
I know I could use .eContents() and put the class of component exhanges as a parameter i guess, but that could prove SLOW in python 4 Capella.

I saw there was some classes defined for Component exchanges or Component Ports in the API but I can’t find any function to “GET” them, wether that’s from the component package(s) or from a logical component…

Any idea how to obtain the CE or C Ports? (Logical Analysis layer). Thanks

LogicalComponent extends BehavioralComponent and on BehavioralComponent you have methods that should help:

def get_contained_component_ports(self):
def get_incoming_component_exchanges(self):
def get_outgoing_component_exchanges(self):
def get_inout_component_exchanges(self):

I didn’t try them myself though.

1 Like