Filter löschen
Filter löschen

How to programmatically tell directional physical connections and non-directional physical connections apart?

1 Ansicht (letzte 30 Tage)
Hello everyone,
In Simscape, there are two kinds of physical connections: directional "physical signals", e.g. from a PS Constant block to the in-port of a Controlled Voltage Source. In Simulink, they are displayed differently and can clearly be told apart by the triangles at their connecting line's beginning and end. My question is how such connections can be told apart programmatically. Consider the following script, with a connected Simscape block selected in Simulink:
phs = get_param(gcb, 'PortHandles');
hrconn1 = phs.RConn(1);
portparams = fieldnames(get_param(hrconn1, 'ObjectParameters'));
portproperties = [ portparams cellfun(@(c) get_param(hrconn1, c), portparams, 'UniformOutput', false) ]
hlrconn1 = get_param(hrconn1, 'Line');
lineparams = fieldnames(get_param(hlrconn1, 'ObjectParameters')); % all object parameters of the line
lineproperties = [ lineparams cellfun(@(c) get_param(hlrconn1, c), lineparams, 'UniformOutput', false) ]
When I do this with a block with a directional physical port on the top right side, or a non-directional physical port on the top right side, I can't find a hint on the former exchanging information only in one direction in the script's output. But making such an observation would be helpful in automatically analyzing Simscape models (which is my night job ;-) Also, the block's "PortConnectivity"-property gives no information as to direction of information flow. But that would be awesome, wouldn't it? :-)
Thanks to everyone for sharing his ideas!
Cheers Alex

Antworten (0)

Kategorien

Mehr zu Troubleshooting finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by