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

13 views (last 30 days)
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.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 10 Jul 2009
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

More Answers (0)

Categories

Find more on Brakes and Detents in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!