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?

12 visualizaciones (últimos 30 días)
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.

Respuestas (1)

Yifeng Tang
Yifeng Tang hace alrededor de 11 horas
ports = simscape.connectionPortProperties(gcb)
gcb here is pointing to a Pipe (TL) block, and I get
ports =
1×3 ConnectionPortProperties array with properties:
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 :)
  2 comentarios
Arepalli
Arepalli hace alrededor de 1 hora
Thankyou @Yifeng Tang, for your response, but currently our team is using 2022b. If there are any other way to extract information about Simscape ports, Kindly let me know. And if there is anyway to get a port's details like it's can be a
  1. Physical Signal port or energy signal port
  2. Unidirectional or Bidirectinal ports
even the above differences can help us in meeting our requirement.
Thankyou.

Iniciar sesión para comentar.

Categorías

Más información sobre Simscape en Help Center y File Exchange.

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by