How to use a custom simscape battery model block in battery builder app?

20 views (last 30 days)
I am building a custom simscape battery model block which I want to use to simulate a battery pack. How can I use it in the battery builder app?
What common inputs, outputs and nodes do I need to have for my lock in-order to use it in the battery builder app?
Also, instead of simscape, an I use simulink blocks in battery builder app?

Answers (2)

Subhajyoti
Subhajyoti on 3 Sep 2024
You can use the “buildBattery” function to build custom library blocks from battery objects. It generates one or more custom Simscape library files and a MAT file from the battery object. You can then import the battery objects into the “Battery Builder” App from your workspace or from a MAT file. The steps are as follows:
  1. Under the Battery Builder tab, in the Import section of the toolstrip, click Import.
  2. Then click Import from Workspace or Import from MAT-file.
The Battery Builder app typically expects certain inputs, outputs, and nodes to facilitate the simulation of battery packs.
Some of the common I/O are as follows:
  • Voltage (V): Your block should output the terminal voltage of the battery. This is essential for monitoring and controlling the battery pack.
  • Current (I): The block should accept current as an input, simulating the load or charging current.
  • State of Charge (SoC): Providing the state of charge as an output is crucial for battery management systems to track the battery's capacity.
  • Temperature (T): Depending on your model's complexity, temperature can be an input (if you are simulating thermal effects externally) or an output (if your model internally calculates temperature changes).
Electrical Nodes:
  • Positive Terminal: Serves as the positive connection point for the battery.
  • Negative Terminal: Serves as the negative or ground connection point.
The following are some helpful resources you can refer to for modelling Batteries in Simulink:
I hope this helps.

Xiangchun
Xiangchun on 6 Sep 2024
Hi Soham,
When using Battery Builder, you can use your own custom cell block built in Simscape, as long as your custom cell block meets all of these requirements:
  • The custom block must provide exactly two electrical conserving ports named n and p.
  • All variables must be scalar-valued.
  • The custom block cannot contain a variable or intermediate variable called power_dissipated.
For details, please refer to CellModelBlockPath under Properties for CellModelBlock: Set of conditional parameters for Cell object - MATLAB (mathworks.com).
If you use Battery Builder API, here is how to do it:
If you use Battery Builder App, you can change the CellModelBlockPath under "Cell Model Options" accordingly.
The Battery Builder in Simscape Battery only supports cell blocks built in Simscape, and it does not support cell blocks built in Simulink.
Here is the documentation on how to create custom components in Simscape:
Best wishes,
Xiangchun

Products


Release

R2024a

Community Treasure Hunt

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

Start Hunting!