How can I externally modify (without accessing the dialog box) the mask parameters of a Simscape element?

1 次查看(过去 30 天)
I would like to be able to modify the mask parameters of a simscape library element (Simscape / Electrical / Specialized Power Systems / Sources/ Battery) while running a simulation. Because I will have to take the model to a Hardware in the Loop (HIL) system afterwards, I need to modify parameters of a Simscape library element (Battery) while the simulation is running in real time in order to verify the simulation's behavior in different situations.
I have place the Battery of the library in a subsystem, which I have converted into a reference model and on the other hand, I have created another subsystem where the ‘Parameter writer’ is being modified, but it doesn't work.
Do you know how I can access the parameters of the mask of a simulink/simscape element externally, without opening its dialogue box? Is it possible to do this?
  1 个评论
Yifeng Tang
Yifeng Tang 2025-3-19
"modify parameters of a Simscape library element while the simulation is running" ... parameters are supposed to be quantities that are NOT changing as the simulation is running. Would you be able to provide an example of what you are trying to do. Maybe the community can help think of a workaround.

请先登录,再进行评论。

回答(1 个)

Javier Gazzarri
Javier Gazzarri 2025-7-9
Hello Daniel,
As Yifeng explained above, the parameters in Simscape blocks are read at initialization and cannot change during simulation. The workaround would be to create a custom block that defines its parameters as inputs. If you use the Battery Equivalent Circuit block of Simscape Battery, you can see the source code from the link in the block description and modify it so that the parameter you want to change becomes an input signal.
If you could give us more details about what parameter you need to change we may be able to send you an example of this kind of customization.
Best regards,
Javier

类别

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

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by