How do I automaticaly change values of blocks inside a reference model?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Zack Peters
2016-4-7
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
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!