P4C - Allocation of logical functions to logical components/ actors

Hi everyone,

I’m currently working on extending an existing Capella model by adding new Logical Functions. So far, I’ve successfully created these functions and linked them to higher-level functions. However, I’m having trouble allocating them to Logical Components.

I came across another post that explains how to allocate a function to a component in the System Analysis (SA) layer using the following code:

cfa = create_e_object("http://www.polarsys.org/capella/core/fa/" + capella_version(), "ComponentFunctionalAllocation");
cfa.setSourceElement(actor.get_java_object());
cfa.setTargetElement(sys_fct.get_java_object());
actor.get_java_object().getOwnedFunctionalAllocation().add(cfa);

I assume a similar approach can be used for the Logical Architecture (LA) layer, by changing the namespace to:

cfa = create_e_object("http://www.polarsys.org/capella/core/la/" + capella_version(), "<something>");

However, I’m not sure what to replace <something> with to correctly allocate a fuction to a component in LA. (ComponentFunctionalAllocation does not work)

Has anyone done this before or knows the correct element name to use in this context?
Any help would be greatly appreciated!

Thanks in advance!

You can use the ComponentFunctionalAllocation just like in the first code sample. Just replace the actor with a LogicalComponent for instance and the SystemFunction by a LogicalFunction and you should be good to go:

lc = LogicalComponent()
lf = LogicalFunction()
cfa = create_e_object("http://www.polarsys.org/capella/core/fa/" + capella_version(), "ComponentFunctionalAllocation");
cfa.setSourceElement(lc.get_java_object());
cfa.setTargetElement(lf.get_java_object());
lc.get_java_object().getOwnedFunctionalAllocation().add(cfa);

Thank you very much for this fast response, it works!

(I probably missed something the first time I tried).

1 Like