How can I get information about the structure of a Simscape model (i.e. which blocks are used and how they are connected)?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Philipp
am 26 Nov. 2014
Kommentiert: Philipp
am 2 Dez. 2014
I need to get information about the used blocks in a Simscape model and how they are connected with each other. I already tried to use the find_system command without any success. Is there a way to get easy access to the blocks and connections of a simscape model?
I appreciate if anyone could help me.
0 Kommentare
Akzeptierte Antwort
Steve Miller
am 27 Nov. 2014
Bearbeitet: Steve Miller
am 27 Nov. 2014
Each block has a parameter called 'PortConnectivity'. The value of this property is an array of structures, each of which describes one of the block's input or output ports. Here is some code that shows how to programmatically find the connected blocks in a Simscape model:
ssc_bridge_rectifier
diode_conns = get_param('ssc_bridge_rectifier/Diode 1',...
'PortConnectivity');
for port_i=1:length(diode_conns)
bh = diode_conns(port_i).DstBlock;
for block_i = 1:length(bh)
disp(['Port ' num2str(port_i) ': ' ...
get_param(bh(block_i),'Name')]);
end
end
You will see this response in the command window:
Port 1: Ideal Transformer
Port 1: Diode 3
Port 2: Diode 2
Port 2: Voltage
Sensor
Port 2: Load
Port 2: C
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Electrical Sensors finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!