Can't set the modeling options parameter of the simscape battery block using set_param function
5 views (last 30 days)
Show older comments
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 Comments
Sameer
on 12 Sep 2024
Edited: Sameer
on 12 Sep 2024
Hi @Mohamed
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');
Answers (1)
Ayush
on 16 Sep 2024
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!
0 Comments
See Also
Categories
Find more on Battery Pack Modeling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!