make a serie of repeating elements
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Mohammad Shtiwi
il 15 Ott 2021
Commentato: Mohammad Shtiwi
il 21 Ott 2021
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
0 Commenti
Risposta accettata
Pavan Guntha
il 20 Ott 2021
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!
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Subsystems in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!