Reuse multiple subsystems with the same variable

1 次查看(过去 30 天)
Hi
I have a subsystem that in the block uses interpolation function that gets one of the parameters from that subsystem that is written in the workspace (e.g. variable named r). In more details it's the resistance block from simscape and I get it's value from interpolation using interp2 function.
I want to change the sample points used in interpolation lookuptable and the point values come from the same subsystem.
Since the subsystem is copy pasted how to have each copied subsystem behave on its on rather than all of them using global workspace variable without me changing the names manualy.
What is the recommended way to do this? To have a workspace variable of the same name work in the equation in the block but differently for multiple subsystems.

采纳的回答

Shubham
Shubham 2024-8-21
Hi Ante,
To achieve independent behavior for each copied subsystem, avoiding the use of global workspace variables, you can use a combination of techniques that leverage Simulink's parameterization capabilities. Here's a recommended approach:
1. Use Masked Subsystems
Create a masked subsystem for your block, which allows you to define parameters that are local to each instance of the subsystem. This way, each copy of the subsystem can have its own set of parameters without interfering with others. You can refer to this documentation: https://in.mathworks.com/help/simulink/ug/create-dynamic-masked-subsystems.html
2. Use Model Workspace or Data Dictionary
If you prefer not to use masked subsystems, you can also use a model workspace or a data dictionary to store parameters that are local to each model or subsystem.

更多回答(0 个)

类别

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

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by