merge - Create operating point by merging data from two operating points - MATLAB (original) (raw)
Create operating point by merging data from two operating points
Syntax
Description
[opNew](#d126e125353) = merge([op1](#d126e125305), [op2](#d126e125327))
creates a new OperatingPoint
object opNew
, with children from two OperatingPoint
objects,op1
and op2
.
The function starts by copying all children from op1
intoopNew
. Then, if a child ID exists inop2
but not in op1
, the function adds the child to opNew
. If a child ID exists both inop1
and op2
, then:
- If both children are
OperatingPoint
objects, the function merges them according to the same rules. - If at least one of the two children is a
Target
object, the function retains the child ofop1
and discards the child ofop2
.
Examples
Create the first OperatingPoint
object,op1
.
t1 = simscape.op.Target(1.5, 'V', 'High'); op1 = simscape.op.OperatingPoint; op1 = set (op1, 'V0', t1); op1 = set (op1, 'V1', t1)
op1 = OperatingPoint with children:
Targets:
ChildId Value Unit Priority
'V0' 1.5000 'V' 'High' 'V1' 1.5000 'V' 'High'
This operating point has two children, Target
objectsV0
and V1
.
Create the second OperatingPoint
object,op2
.
t2 = simscape.op.Target(1, 'V'); op2 = simscape.op.OperatingPoint; op2 = set (op2, 'V1', t2); op2 = set (op2, 'V2', t2)
op2 =
OperatingPoint with children:
Targets:
ChildId Value Unit Priority
'V1' 1 'V' 'None' 'V2' 1 'V' 'None'
This operating point has two children, Target
objectsV1
and V2
.
Merge the two operating points into a new OperatingPoint
object, op
.
op =
OperatingPoint with children:
Targets:
ChildId Value Unit Priority
'V0' 1.5000 'V' 'High' 'V1' 1.5000 'V' 'High' 'V2' 1 'V' 'None'
The new operating point has two children from the first operating point,V0
and V1
, and theV2
child from the second operating point. TheV1
target from the second operating point is discarded because it conflicts with the child ID existing in the first operating point.
Input Arguments
First operating point to be merged, specified as anOperatingPoint
object.
Second operating point to be merged, specified as anOperatingPoint
object.
Output Arguments
New OperatingPoint
object, which contains children fromop1 and op2.
Version History
Introduced in R2017b