How to programmatically distinguish the port's domain for a simscape block? Like a connection belonging to foundation.electrical.electrical or physical signal?
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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
- Connect a physical signal port (V) to a node and stop execution.
- 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.
0 Commenti
Risposte (1)
Yifeng Tang
circa un'ora fa
ports = simscape.connectionPortProperties(gcb)
gcb here is pointing to a Pipe (TL) block, and I get
ports =
Name
Label
Type
and I can query into ports as
>> ports(1)
ans =
ConnectionPortProperties with properties:
Name: "A"
Label: "A"
Type: Domain (foundation.thermal_liquid.thermal_liquid)
The last line of output sounds like what you are looking for :)
1 Commento
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!