Main Content

modifyModule

Modify properties of modules

Since R2023b

Description

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

example

Examples

collapse all

This example shows how to quickly modify the number of series-connected parallel assemblies inside a battery pack by using the modifyModule 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 = modifyModule(battery,NumSeriesAssemblies=100);
disp(updatedbattery.ModuleAssembly(1).Module(1).NumSeriesAssemblies)
  100

This example shows how to quickly modify the number of series-connected parallel assemblies inside the fifth module of the second module assembly of a battery pack by using the modifyModule 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 number of series-connected parallel assemblies of the fifth module inside the second module assembly.

disp(battery.ModuleAssembly(2).Module(5).NumSeriesAssemblies)
1

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

updatedbattery = modifyModule(battery,Index=[2,5],S=100)
disp(updatedbattery.ModuleAssembly(2).Module(5).NumSeriesAssemblies)
  100

Input Arguments

collapse all

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

Example: modifyModule(Pack,InterParallelAssemblyGap=0.005) sets the value of the InterParallelAssemblyGap property of all the underlying Module objects inside the Pack object to 0.005 m.

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: modifyModule(Pack,InterParallelAssemblyGap=0.005)

Index of the underlying Module 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 you want to modify.

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

You can use the modifyModule function to modify all properties of the Module 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 Module object.

Output Arguments

collapse all

Parent battery object with modified modules, returned as a ModuleAssembly or Pack object.

Version History

Introduced in R2023b