Main Content

simscape.op.Target

Variable initialization target object

Description

Target objects contain data necessary for model initialization. Each Target object consists of a variable value, unit, and initialization priority. Target objects are part of the data tree hierarchy of an OperatingPoint object. Use Target objects to add or manipulate initialization data saved in the OperatingPoint object. You can then use the data to initialize another model, or the same model before another simulation run.

Creation

Description

example

t = simscape.op.Target() creates an empty Target object.

example

t = simscape.op.Target(value) creates a Target object with the Value property set to provided value.

example

t = simscape.op.Target(value,unit) creates a Target object with the Value property set to provided value and the Unit property set to provided unit expression.

example

t = simscape.op.Target(value,unit,priority) creates a Target object with the Value property set to provided value, the Unit property set to provided unit expression, and the Priority property set to provided variable initialization priority.

example

t = simscape.op.Target(simscapeValue) uses a simscape.Value object to set the Value and Unit properties of the Target object. It creates a Target object with the Value property set to the numeric value of the simscape.Value object and the Unit property set to the unit of the simscape.Value object.

example

t = simscape.op.Target(simscapeValue,priority) creates a Target object with the Value and Unit properties set to the numeric value and unit of the simscape.Value object, respectively, and the Priority property set to provided variable initialization priority.

Input Arguments

expand all

Value with unit, specified as a simscape.Value object, to set the Value and Unit properties of the Target object. A simscape.Value object consists of an array of numeric values, specified as a scalar, vector, or matrix, and an associated unit of measure. For more information, see simscape.Value.

Properties

expand all

Variable initialization target numeric value, specified as a scalar, vector, or matrix.

Example: 1.5

Data Types: double | int32

Physical unit expression, specified as a character vector or string scalar. The expression can consist of valid physical unit names, numbers, math operators, such as +, -, *, /, and ^, and parentheses to specify the order of operations.

Example: 'm/s^2'

Data Types: char | string

Variable initialization priority, specified as 'High', 'Low', or 'None'.

Data Types: char | string

Descriptive name of target variable, specified as a character vector or string scalar. If you create an operating point by extracting data from log or model, the extraction algorithms populate this target property with the user-friendly description of the variable. However, you do not have to set this property to be able to use the target for model initialization.

Data Types: char | string

Examples

collapse all

Create an empty OperatingPoint object named op:

op = simscape.op.OperatingPoint
op = 

  OperatingPoint with no children.

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

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

  Target with properties:

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

Add the target t to the operating point op by assigning this target to the variable named v0:

op = set(op,'v0',t)
op = 
  OperatingPoint with children:

  Targets:

   ChildId   Value  Unit  Priority
   _______  ______  ____  ________

   'v0'     1.5000  'V'     'High'

You can create other Target objects or OperatingPoint objects and add them as children to the operating point op.

Using simscape.Value objects for programmatic model construction and manipulation provides the convenience of specifying both the numeric value and the unit at the same time.

Create a simscape.Value object to represent a value with unit:

V1 = simscape.Value(1.5,'V')
V1 = 

    1.5000 : V

Create an empty OperatingPoint object named op:

op = simscape.op.OperatingPoint
op = 

  OperatingPoint with no children.

Use the simscape.Value object V1 to create a Target object named t, with high initialization priority:

 t = simscape.op.Target(V1,'High')
t = 

  Target with properties:

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

Add the target t to the operating point op by assigning this target to the variable named v0:

op = set(op, 'v0', t)
op = 
  OperatingPoint with children:

  Targets:

   ChildId   Value  Unit  Priority
   _______  ______  ____  ________

   'v0'     1.5000  'V'     'High'
Introduced in R2017b