How can I find and work with Physical Modeling I/O ports of a subsystem in Simulink?

14 次查看(过去 30 天)
I would like to use the model construction commands to manipulate the Physical Modeling (SimPowerSystems, SimMechanics, SimHydraulics, etc) connection i/o ports in a manner similar to regular block ports.

采纳的回答

MathWorks Support Team
The Connection Ports on the blocks are like any other port. The best way to get a handle is to first acquire the handle of the block (use find_system etc.). Once you have the block handle then do the following:
PortH = get_param(blockH,'PortHandles');
PortH will be a structure that will have all the port handles. The Physical Modeling connection port handles will be under the fields LConn and RConn (for left connection and right connection).
When finding a port handle corresponding to a port block, you need to do the following:
1. Search for the peer port blocks (find_system for BlockType PMIOPort with
SearchDepth 1 but not 0)
2. Filter out those with a different Side property
3. Work out the corresponding block number among blocks of matching Side
4. Index into the PortHandles.L/RConn

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Brakes and Detents 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by