Borrar filtros
Borrar filtros

Reuse multiple subsystems with the same variable

34 visualizaciones (últimos 30 días)
Ante
Ante el 20 de Ag. de 2024 a las 10:45
Respondida: Shubham el 21 de Ag. de 2024 a las 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.

Respuesta aceptada

Shubham
Shubham el 21 de Ag. de 2024 a las 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.

Más respuestas (0)

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by