How can I iteratively create blocks in simulink/simscape and populate them with variables?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Isaac Friedman
le 17 Jan 2020
Commenté : Fangjun Jiang
le 17 Jan 2020
I'm trying to design a program to create multiple "Repeating Sequence Interpolated" blocks as well as "Saturation Dynamic" blocks. The number created, the data used to create the sequences and minima/maxima, and the names of the blocks are all determined in an external .csv or .txt file. The goal is to use the sequences to control the joints of an imported Solidworks assembly. I already know how to import the model and the data, but I'm not sure how to iteratively create the blocks. How can I do this?
%pseudocode
%import t, time array
%import m, matrix of data for the joints
%import n, number of sequences needed
%for i:1:n
% create arr, temporary array of position data for column i of m
% create Repeating Sequence Interpolated (RSI) block that references t and arr
% create Saturation Dynamic (SD) block and constant blocks to limit range of signal
% connect constants, RSI, and SD blocks
%end for
0 commentaires
Réponse acceptée
Fangjun Jiang
le 17 Jan 2020
What you need are functions like add_block(), add_line(), set_param()
Follow examples in this section of the document "Programmatic Model Editing"
https://www.mathworks.com/help/releases/R2019b/simulink/programmatic-modeling.html
2 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Model Import dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!