set

Add or update element of operating point

Syntax

opNew = set(op, opPath, newElement)

Description

example

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.

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:

ssc_dcmotor
op = simscape.op.create(gcs, 'Start')
op = 

  OperatingPoint with children:
  -----------------------------
   DC Motor
   DC Voltage
   ERef
   Load Torque
   MRRef Motor
   MRRef Torque
   Sensing
  -----------------------------

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

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

  Target with properties:

    Description: ''
          Value: 1.5000
           Unit: 'A'
       Priority: 'High'
     Attributes: [0×1 containers.Map]

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.

Introduced in R2017b