Specify any block parameter values from other constant block (simulink)

2 次查看(过去 30 天)
I have multiple RLC blocks, and I want to control their parameter from one single block, so that I don't have to set for each RLC block.
What worked: Named a workspace variable as L1 with the desired value and as shown in RLC-block parameter it fetched the value easily.
What I'm trying: Remove the dependency of workspace variable. Hence, created one constant block. Named the block as L1 and called it in RLC-block. But, it is not working.
Is it possible? If yes, how?
update 1: using str2num(get_param('modelName/L1','Value')) works, but is there any other/efficient way to do it?
  5 个评论
Pramit Biswas
Pramit Biswas 2018-4-3
Yes, sorry to say that will not serve the purpose. Musking is very helpful for setting subsystem values from main block. What I require somewhat different. I have multiple blocks of same thing in different location. And I want to change their parameter in one single go. In case if it was coding, I would have used function to reduce repeatability. Thanks for assisting though.
Birdman
Birdman 2018-4-3
I have multiple blocks of same thing in different location
Ok, then why don't you gather them within one subsystem? Will it be challenging? You can set inports and outports accordingly to that from subsystem and will not change the hierarchy of your model.

请先登录,再进行评论。

回答(1 个)

Birdman
Birdman 2018-4-2
The easiest overcome to this problem is using Masking in Simulink. Take all RLC blocks within the same subsystem and right click on your subsystem and go to Mask->Create Mask(or the shortcut with Ctrl+M), create a simple mask with the number of parameters you want to change in your model. I attach a model with simple mask. When you double click the subsystem, it immediately opens the parameter window where you can enter your parameter and simply hit Apply button. In the simulation, you will see immediate change.
  1 个评论
Ege Can Koçak
Ege Can Koçak 2021-6-3
Hello, I am actually doing same thing for a different application. I have lots of constant block to run the simulation, I wanted to make them more useful so I masked but I cannot change the values of the constant with mask, everthing works fine but the valus does not change. I tried to do promote them but still its not working. Any suggestion for me ?
Regards,
Ege

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Subsystems 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by