Main Content

modifyCell

Modify properties of cells

Since R2023b

Description

updatedBattery = modifyCell(battery,Name=Value) modifies one or more properties of the underlying Cell objects inside the battery object battery by using one or more name-value arguments. To modify the properties of a single Cell object, specify the Index argument. To modify the properties of all the Cell objects, do not specify the Index argument.

example

Examples

collapse all

This example shows how to quickly modify the mass of the battery cells inside a battery pack by using the modifyCell function.

Create a Pack object and display the mass of the battery cells that constitute this battery pack.

battery = batteryPack;
disp(battery.ModuleAssembly(1).Module(1).ParallelAssembly.Cell.Mass)
0.1000 : kg

Change the mass of all the battery cells inside battery to 1 Kg. Display the updated mass.

updatedbattery = modifyCell(battery,Mass=simscape.Value(1,"kg")); 
disp(updatedbattery.ModuleAssembly(1).Module(1).ParallelAssembly.Cell.Mass)
1 : kg

This example shows how to modify the mass of the battery cells of only specific modules and module assemblies inside a battery pack by using the modifyCell function.

Create a Pack object that comprises two identical ModuleAssembly objects. Each ModuleAssembly object comprises six identical Module objects.

module = batteryModule;
moduleassembly = batteryModuleAssembly(repmat(module,6,1));
battery=batteryPack(repmat(moduleassembly,2,1));

Display the mass of the battery cells of the fifth module inside the second module assembly.

disp(battery.ModuleAssembly(2).Module(5).ParallelAssembly.Cell.Mass)
0.1000 : kg

Change the mass of the battery cells of the fifth module inside the second module assembly of battery to 10 Kg. Display the updated mass.

updatedbattery = modifyCell(battery,Index=[2,5],Mass=simscape.Value(10,"kg"));
disp(updatedbattery.ModuleAssembly(2).Module(5).ParallelAssembly.Cell.Mass)
10 : kg

Input Arguments

collapse all

Parent battery object of the Cell object that you want to modify, specified as a ParallelAssembly, Module, ModuleAssembly, or Pack object.

Example: modifyCell(pSet,Mass=1) sets the value of the Mass property of all the underlying Cell objects inside the ParallelAssembly object pSet to 1 Kg.

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: modifyCell(pSet, Mass=100)

Index of the underlying Cell object that you want to modify inside the parent battery object battery, specified as one of these values:

  • A positive integer if battery is a ModuleAssembly object.

  • A two-element vector of positive integers if battery is a Pack object. The first and second elements of this vector define the first and second indices of the module assembly and module, respectively, that contain the Cell object that you want to modify.

If you do not specify this argument, the modifyCell function modifies the specified properties of all underlying cells inside the battery object battery.

Dependencies

To enable this argument, specify the battery input as a ModuleAssembly or Pack object.

You can use the modifyCell function to modify properties of the Cell object inside the parent battery object battery using name-value arguments. For a list of all supported name-value arguments, see the Properties section of the Cell object.

Output Arguments

collapse all

Parent battery object with modified cells, returned as a ParallelAssembly, Module, ModuleAssembly, or Pack object.

Version History

Introduced in R2023b