How to programmatically distinguish the port's domain for a simscape block? Like a connection belonging to foundation​.electrica​l.electric​al or physical signal?

5 visualizzazioni (ultimi 30 giorni)
How to programmatically distinguish the port's domain for a simscape block? Like a connection belonging to foundation.electrical.electrical or physical signal?
I am trying to automate connections between simscape custom blocks, the custom library is old and hard to change now. So for explaining the situation, consider the below example, a simple voltage sensor and code
LConn1 => + (node and bidirectional)
RConn1 => V (Physical Signal, unidirectional)
RConn2 => - (node and bidirectional)
So to automate the connections, add_line, RConn and LConn properties are used:
SourceConn = PortDetails.RConn(x)
add_line(Model_Name, SourceConn,... are the commands used.
But to automate, the distinction between RConn1 and RConn2 is needed, so a if-block can be used in code, that can allow add_line command to connect nodes to nodes only and wont try to
  1. Connect a physical signal port (V) to a node and stop execution.
  2. Connect a physical signal port (V) to another physical signal port (which could be on other block's input side ... I tried "try-catch-end" but failed due to this scenario).
So kindly let me know if there are anyways/commands/or a work around way to extract information about Simscape ports by which such automation is possible.
Thankyou.

Risposte (0)

Prodotti


Release

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by