modifyCell
Description
modifies one or more properties of the underlying updatedBattery
= modifyCell(battery
,Name=Value
)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.
Examples
Modify Mass of All Cells Inside Pack
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
Modify Mass of Cells Inside Specific Module and Module Assembly of Pack
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
battery
— Parent battery object to modify
ParallelAssembly
object | Module
object | ModuleAssembly
object | Pack
object
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
— Index of underlying object to modify
positive integer | two-element vector of positive integers
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 aModuleAssembly
object.A two-element vector of positive integers if
battery
is aPack
object. The first and second elements of this vector define the first and second indices of the module assembly and module, respectively, that contain theCell
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
updatedBattery
— Parent battery object with modified cells
ParallelAssembly
object | Module
object | ModuleAssembly
object | Pack
object
Parent battery object with modified cells, returned as a
ParallelAssembly
, Module
,
ModuleAssembly
, or Pack
object.
Version History
Introduced in R2023b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)