make a serie of repeating elements

1 ビュー (過去 30 日間)
Mohammad Shtiwi
Mohammad Shtiwi 2021 年 10 月 15 日
コメント済み: Mohammad Shtiwi 2021 年 10 月 21 日
Hallo everyone
I'm trying to make a transmission line for my project in simulink.
I need to connect a big number of elements in serie without copying the element many times and connect then individually.
you can see the element in the attached picture.
thank you in advanced for your answers

採用された回答

Pavan Guntha
Pavan Guntha 2021 年 10 月 20 日
Hello Mohammad,
In order to automate the task of connecting large number of elements in Simulink you could leverage 'Programmatic Modeling Basics' documentation page which describes about instantiating and connecting multiple Simulink blocks using MATLAB commands. The following example illustrates this approach:
1) Instantiate and connect the elements which we want to repeat in the Simulink model:
2) Enclose this within a subsystem (Keyboard Shortcut Ctrl + G):
3) Then you could use the MATLAB commands as illustrated in the documentation page linked above to instantiate this Subsystem again and connect these 2 subsystems as follows:
load_system('repeat_elements') % Simulink Model Name is repeat_elements
add_block('repeat_elements/Subsystem','repeat_elements/Subsystem1'); % Instantiating a copy of this Subsystem
% Connecting these subsystems:
add_line('repeat_elements', 'Subsystem/RConn1', 'Subsystem1/LConn1') % For Simscape blocks, RConn1 - Output Port 1, LConn1 - Input Port 1
add_line('repeat_elements', 'Subsystem1/RConn1', 'Subsystem/LConn1')
The model is as follows after running these commands:
You could also leverage looping constructs to automate the process of instantiating the subsystems and connect them as per the requirement.
Hope this helps!
  1 件のコメント
Mohammad Shtiwi
Mohammad Shtiwi 2021 年 10 月 21 日
Thank you

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

その他の回答 (0 件)

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by