Specify any block parameter values from other constant block (simulink)
1 view (last 30 days)
Show older comments
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 Comments
Birdman
on 3 Apr 2018
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.
Answers (1)
Birdman
on 2 Apr 2018
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 Comment
Ege Can Koçak
on 3 Jun 2021
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
See Also
Categories
Find more on Subsystems in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!