Reuse multiple subsystems with the same variable
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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.
0 Kommentare
Akzeptierte Antwort
Shubham
am 21 Aug. 2024
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Subsystems finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!