Can't set the modeling options parameter of the simscape battery block using set_param function

5 次查看(过去 30 天)
How can I programmatically set the modeling option parameter for a Simscape Battery block in MATLAB to "Instrumented | Show thermal port" to display both the SOC and thermal ports?
I tried using get_param to retrieve the parameters of the battery block, but I couldn’t find any related to the modeling options (SOC or thermal ports). Is there a way to programmatically enable these ports or set these parameters through a MATLAB script?
  2 个评论
Sameer
Sameer 2024-9-12
编辑:Sameer 2024-9-12
Have you tried exploring the available parameters using "get_param" to see if the "SOC" and "Thermal" port options are directly accessible?
Here's a line of code for that:
params = get_param(blockPath, 'ObjectParameters');
Additionally, have you checked for any mask parameters that might control these options?
You can use the following code:
maskParams = get_param(blockPath, 'MaskNames');
Mohamed
Mohamed 2024-9-16
编辑:Mohamed 2024-9-16
Yes, I have displayed the mask parameters and the object parameters using the 2 lines of code you provided but i didn't find any parameter related to the thermal and the soc ports.

请先登录,再进行评论。

回答(1 个)

Ayush
Ayush 2024-9-16
I understand that you want to modify parameters of the SimScape "Battery" block via a MATLAB script or the command window.
The thermal port configuration is available under “Modelling options” in the block parameters of "Battery" block component. I tried to change it using command window by using “ports” parameter and “set_param” function but was unable to do so, as it was read-only parameter. You can read more about “set_param” function here:https://in.mathworks.com/help/releases/R2022b/simulink/slref/set_param.html
It appears that, as of MATLAB R2022b, this parameter can only be modified through the graphical user interface (GUI), and not through scripting or command-line instructions.
Here, matrix [0 0 0 0 0 2 2 0 0 0] denotes the “Instrumented | Show thermal port” configuration. You can view it using “get_param” function. You can read more about it here: https://in.mathworks.com/help/releases/R2022b/simulink/slref/get_param.html
However, I was able to change the configuration using command window in MATLAB R2024b.In this version, the parameter name is modified to “thermal_port”. You can try upgrading to MATLAB R2024b.
You can read more about “Battery” SimScape block and its configuration parameters here: https://in.mathworks.com/help/releases/R2022b/simscape-battery/ref/battery.html
Hope this helps!

类别

Help CenterFile Exchange 中查找有关 Battery Pack Modeling 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by