Main Content

set

Add or update element of operating point

Description

opNew = set(op, opPath, newElement) returns a copy of the OperatingPoint object op, with element newElement added at the specified location in the data tree hierarchy. The new element can be either another OperatingPoint or a Target. If the element already exists in the operating point, its content is replaced.

example

Examples

collapse all

Open the Permanent Magnet DC Motor example model and create an OperatingPoint object named op using the Start values from the model:

openExample('simscape/PermanentMagnetDCMotorExample')
op = simscape.op.create(gcs, 'Start')
op = 

  OperatingPoint with children:

  OperatingPoints:

   ChildId         Size
   ______________  ____

   'DC Motor'       1x1
   'DC Voltage'     1x1
   'ERef'           1x1
   'Load Torque'    1x1
   'MRRef Motor'    1x1
   'MRRef Torque'   1x1
   'Sensing'        1x1
   'Step Input'     1x1

Create a Target object named t, consisting of a numeric value, unit, and initialization priority:

 t = simscape.op.Target(1.5, 'A', 'High')
t = 
  Target with fields:

        Value: 1.5000 : A
     Priority: High
   Attributes: containers.Map
  Description:

Add the target t to the operating point op by assigning this target to the Inductor current variable, i_L, of the Rotor Inductance block in the DC Motor subsystem:

op = set(op, 'DC Motor/Rotor Inductance/i_L', t);

Input Arguments

collapse all

The original operating point in the workspace, specified as an OperatingPoint object, to which you are adding the new element.

Location where you want to add the new element, specified as a slash-delimited character vector or string scalar. Define the location by the path through the data tree hierarchy of the original operating point, op. Separate the tree node names with slash symbols (/). You can use the relativePath function to determine the path.

Example: 'DC Motor/Rotor Resistance'

Data Types: char | string

Element to be added to the original OperatingPoint object, op, specified as an OperatingPoint or a Target object.

Output Arguments

collapse all

New OperatingPoint object, which is a copy of the original OperatingPoint object, op, with newElement added at the opPath location. You can add elements recursively, that is, the name of the new OperatingPoint object, opNew, can be the same as the name of the original OperatingPoint object, op.

Version History

Introduced in R2017b