How do I automaticaly change values of blocks inside a reference model?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Pablo García Auñón
am 7 Apr. 2016
Bearbeitet: Pablo García Auñón
am 7 Apr. 2016
Hello everybody
I am using a reference model and including several instances of it inside of another model. Each instance has initial conditions, "To workspace" blocks, constants, etc., which need to be different among each instance. For example:
Instance 1-> Initial conditions: X_ini(1,1:3), "To workspace" name: X_out_1
Instance 2-> Initial conditions: X_ini(2,1:3), "To workspace" name: X_out_2
where X_ini [2,3] would be a matrix with all the initial conditions and X_out_1 and X_out_2 would be the variables saved in the Workspace.
One possibility would be to add an input and output port, and set the initial conditions and save the data from outside. The problem with this solution is that I do not have only initial conditions and saved variables, but many other things. I would be cleaner and faster if every time I introduce a reference model, it automatically changes those values.
Does anybody know how to do it? Should I use a library block instead?
Thank you very much in advance, Pablo
0 Kommentare
Akzeptierte Antwort
Zack Peters
am 7 Apr. 2016
Hi Pablo,
What you are looking for is what we call the "Model Workspace". It allows you to pass in data that is scoped only to that particular model block - perfect for multi-instance model references.
Here is a link to get you started on reading about them: http://www.mathworks.com/help/simulink/ug/using-model-workspaces.html
At the bottom of that page are some links to examples on how to make this work.
~Zack
1 Kommentar
Pablo García Auñón
am 7 Apr. 2016
Bearbeitet: Pablo García Auñón
am 7 Apr. 2016
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Simulink Environment Customization 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!