フィルターのクリア

Turn a simulink model into a digraph

4 ビュー (過去 30 日間)
Darin McCoy
Darin McCoy 2016 年 9 月 16 日
編集済み: Monika Jaskolka 2019 年 7 月 25 日
I have a simulink model that I would like to turn into a digraph (<http://www.mathworks.com/help/matlab/ref/digraph-object.html>)
Essentially what I want to do is find all of the blocks... find all of the blocks they are connected to... make this a matrix... and then feed it into digraph.
I'm starting with code similar to this one https://www.mathworks.com/matlabcentral/answers/216496-m-script-how-to-find-which-block-is-connected-to-which-block
which includes things like
allBlks = find_system(myModel,'FindAll','on','FollowLinks','on','Type', 'block');
allPorts = get_param(allBlks(k), 'PortConnectivity');
etc, etc... but that doesn't take care of the complexity of subsystems, multiple ports, bus's, etc. Any ideas? (Or has anybody else tried to solve this problem?)
  3 件のコメント
Darin McCoy
Darin McCoy 2018 年 4 月 17 日
Sort of. I've started creating code to do just the thing I described above. It's ugly, but it does work (in most cases). If I have time, I'd like to make this code open source
sibabalo noludwwe
sibabalo noludwwe 2019 年 7 月 23 日
May you please share on how you did it

サインインしてコメントする。

回答 (1 件)

Monika Jaskolka
Monika Jaskolka 2018 年 5 月 22 日
編集済み: Monika Jaskolka 2019 年 7 月 25 日
You may be interested in some functions provided by the Auto Layout Tool available on the File Exchange. Those provided in src/GraphPlot_Portion, particularly blocksToDigraph.m and plotSimulinkDigraph.m, deal with generating a digraph from a Simulink subsystem.
  2 件のコメント
sibabalo noludwwe
sibabalo noludwwe 2019 年 7 月 24 日
hi Monika,
I have a problem generating a digraph from my simulink system. i tried running the function plotSimulinkDigraph(IEEE_9bus_new_o,diagraph(A, nodes)); and it is giving me parameter warining and errors. and the error is Undefined function or variable 'A'. I am not sure is I am calling the function correct. please assist me I am quite new in matlab.
my Simulink system is modelled using simscape elecetrical I am not sure if that is the problem.
Monika Jaskolka
Monika Jaskolka 2019 年 7 月 25 日
Please look at the script comments at the top of each file to understand how they work.
b = find_system('IEEE_9bus_new_o', 'SearchDepth', 1, 'Type', 'block');
h = get_param(b, 'Handle');
h = cell2mat(h);
dg = blocksToDigraph(h)
plotSimulinkDigraph(h, dg)

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeBlock Libraries についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by