How to extract connections from architecture ports in a System Composer Mapping block

5 次查看(过去 30 天)
Hi everyone, I have question regarding architecture ports and dot notation for buses. I have a simple architecture, and I want to create an Input/Output excel file automatically through a Matlab script.
My problem is that I cannot find a way to get which PDU inside the CAN1 bus is connected to which PDU in CAN2. This is, I cannot get the connections I made inside the MappingBlock. Through Matlab commands I am able to get all the ports and all the components, and inside I can see the connections between CAN1 and the CAN2 PDUs, but not the specific CAN1 PDUs that are linked to the ones in CAN2. Also I am able to see which CAN1 PDUs are selected, however not to which CAN2 PDUs they are connected. Could you help me with this?
modelName = "Arch";
model = systemcomposer.openModel(modelName);
arch = get(model, modelName);
load_system(modelName);
open_system(modelName);
MappingBlock = arch.Components(1,3);

采纳的回答

Altaïr
Altaïr 2025-1-10
Hey @Andrea,
The MappingBlock has its own architecture where the connectors are located. To access the three connectors within the MappingBlock, the following command can be used:
MappingBlock = arch.Components(1,3);
MappingBlock.Architecture.Connectors
The PDUs created become data elements for the architecture named CAN1, and they can be accessed using this command:
MappingBlock.Ports(1,1).Connectors.Interface.Elements
The order of the PDU data elements corresponds directly to the order of connectors in the MappingBlock, allowing for easy identification of the corresponding PDU for a given connection.
Additionally while iterating over different model elements, the iterate function can be quite useful. More information about it can be found here:

更多回答(0 个)

产品


版本

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by