フィルターのクリア

Reuse multiple subsystems with the same variable

34 ビュー (過去 30 日間)
Ante
Ante 2024 年 8 月 20 日 10:45
回答済み: Shubham 2024 年 8 月 21 日 4:01
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 日 4:01
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 件)

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by