Retrieve the NodePC from a Physical Port (P4C)

Hello,

I wonder in Capella why NodePC cannot be directly retrieve from a Physical Port.

Indeed I created Physical Paths to represent data buses in Capella, and I allocated PV to physical Ports.
I want to classify the NodePC in my Excel sheet depending on the PV allocated to the Physical Port that is involved in the Physical Path, but it seems not feasable.

I am forced to retrieved the 2 Physical Ports from the Physical Link and then for each NodePC of the Physical Link I retrieve the right Physical Port (by looping on all physical port and testing if it is equal to on of the 2 of the Physical Link).

Do you know if I am missing something please ?

Thanks,
Edgar

You can use the Java API:

for involvement in myPhysicalComponent.get_java_object().getInvolvingInvolvements():
    involver = involvement.getInvolver()
    if get_e_classifier("http://www.polarsys.org/capella/core/cs/" + capella_version(), "PhysicalPath").isInstance(involver)
        myPhysicalPath = PhysicalPath(involver)

Also PhysicalPort are contained in their PhysicalComponent, so you should be able to use:

myPhysicalPort.get_container()
1 Like

Hello,

Thank you Yvan for your answer !

I didn’t understood the concept of ‘to be contained in’ , so I was not using it. But in fact it worked ! Thank you very much !
Edgar

Capella is build on top of EMF to create and store models. A model is basically a graph but for serialization purpose (GUI, …) some references are marked as containment that allow to represent the graph as a tree.

1 Like

Ok thanks,

So, does containment is directly link to the way elements are stored in the Project Explorer ?
Meaning that we succeed to retrieve the NodePC from the Physical Port because the Physical Port is stored in the NodePC in the Project Explorer ?

Yes, the way a model can be displayed in the project explorer can be customized and it might not always be the case or element can be hidden or filtered even if they are contained. But this is a good approximation if you want to find other elements.

1 Like

Ok really interesting
Thanks

1 Like