Main Content

modifyBattery

Modify properties of battery objects

Since R2023b

Description

example

updatedBattery = modifyBattery(battery,Name=Value) modifies one or more properties of the battery object battery by using one or more name-value arguments.

Unlike the modifyCell, modifyParallelAssembly, modifyModule, and modifyModuleAssembly functions, you do not need to know which battery object contains the property you want to modify.

Examples

collapse all

This example shows how to quickly modify the number of series-connected parallel assemblies inside a battery pack by using the modifyBattery function.

Create a Pack object and display the number of series-connected parallel assemblies.

battery = batteryPack;
disp(battery.ModuleAssembly(1).Module(1).NumSeriesAssemblies)
  1

Change this value to 100 series-connected parallel assemblies and display the updated value.

updatedbattery = modifyBattery(battery,NumSeriesAssemblies=100);
disp(updatedbattery.ModuleAssembly(1).Module(1).NumSeriesAssemblies)
  100

Input Arguments

collapse all

Battery to modify, specified as a ParallelAssembly, Module, ModuleAssembly, or Pack object.

Example: modifyBattery(Pack,CellMass=10) sets the value of the Mass property of all the underlying Cell objects inside the Pack object to 10.

Name-Value Arguments

Specify pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: modifyBattery(Pack,CellMass=10)

Cell component in the parallel assembly, specified as a Cell object.

Example: modifyBattery(Pack,Cell=Cell(Geometry=CylindricalGeometry))

Capacity of the battery cell, specified as a positive scalar or a simscape.Value object that represents a scalar with the specified unit of measurement. The value of this property must be strictly positive.

If you set this argument directly with a positive scalar value instead of using a simscape.Value object, the function converts the value to a simscape.Value object with A*hr as its physical unit.

Example: modifyBattery(Pack,CellCapacity=8)

Mass of the battery cell, specified as a scalar in the range (0, 100] or a simscape.Value object that represents a scalar with the specified unit of measurement. The value of this property must be strictly positive and lower than 100 kg.

If you set this property directly with a positive scalar value instead of using a simscape.Value object, the object converts the value to a simscape.Value object with kg as its physical unit.

Example: modifyBattery(Pack,CellMass=10)

Shortest distance between modules inside the module assembly, specified as a scalar in the range (0, 0.1] or a simscape.Value object that represents a positive scalar with a unit of length. The value of this property must be less than 0.1 m.

If you set this property directly with a positive scalar value instead of using a simscape.Value object, this object converts the value to a simscape.Value object with meter as its physical unit.

Example: modifyBattery(Pack,InterModuleGap=simscape.Value(0.01,"m"))

Dependencies

To enable this name-value argument, the input argument battery must be a ModuleAssembly object.

Number of parallel-connected cells inside the parallel assembly, specified as an integer in the range (0, 150].

You can also modify this name-value argument by using the name P.

Example: modifyBattery(Pack,NumParallelCells=48)

Example: modifyBattery(Pack,P=48)

Number of series-connected parallel assemblies inside the module, specified as an integer in the range (0, 150].

You can also modify this name-value argument by using the name S.

Example: modifyBattery(Pack,NumSeriesAssemblies=48)

Example: modifyBattery(Pack,S=48)

Dependencies

To enable this name-value argument, specify the battery as a Module, ModuleAssembly, or Pack object.

Output Arguments

collapse all

Updated battery, returned as a ParallelAssembly, Module, ModuleAssembly, or Pack object.

Version History

Introduced in R2023b