smbNameofPort

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - SimMechanics
Introduced first in SolidGeometry 3.2, Creation date: 2016-12-26, Last change: 2025-09-14

returns the Connection of a Port

Description

Auxiliary function used in smbGetConnectedBlocks. The functions gets the real port handle and analyzses LConn and RConn wether the port handle is part of LConn or RConn

See Also: smbGetConnectedBlocks

Example Illustration

 missing image of smbNameofPort(b,ph)

Syntax

s=smbNameofPort(b,ph)

Input Parameter

b: Block Name
ph: Port Name used

Output Parameter

s: String

Examples

Get the used connection for a known Port
a=smbGetConnectedBlocks(smbWhich('N4'))
smbNameofPort(a{2,3},a{2,4})




Copyright 2016-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Algorithm (Workflow)

This function, smbNameofPort, is designed to determine the connection type of a specified port in a Simulink block. It is an auxiliary function used in conjunction with smbGetConnectedBlocks.

Input Parameters

Output

Algorithm Steps

  1. Initialize an empty string s to store the result.
  2. Use the get_param function to retrieve the port handles of the block b. This includes both right connections (RConn) and left connections (LConn).
  3. Iterate over each right connection (RConn) using a loop:
    • Check if the current right connection handle matches the specified port handle ph.
    • If a match is found, set s to 'RConn' followed by the index of the connection.
  4. Iterate over each left connection (LConn) using a loop:
    • Check if the current left connection handle matches the specified port handle ph.
    • If a match is found, set s to 'LConn' followed by the index of the connection.
  5. Return the string s which indicates the connection type of the port.

This function is useful for identifying the specific connection type of a port within a Simulink block, which can be critical for understanding the block's connectivity in a model.

Algorithm explaination created using ChatGPT on 2025-08-18 23:18. (Please note: No guarantee for the correctness of this explanation)

Last html export of this page out of FM database by TL: 2025-09-21