ApplySubstitutions
apply variable and parameter substitutions
Calling Sequence
Parameters
Returns
Options
Description
Examples
A := MapleSim:-LinkModel();
A:-ApplySubstitutions(expr, options)
expr
-
expression, can be any algebraic expression, equation, or a set, list, Vector, or Matrix of expressions and equations
options
(optional) equation(s) of the form name = value
given expression where substitutions that are applied to variable and parameter names in other API function calls (or, optionally, the reverse of these substitutions) were applied
reverse : true or false
Specifies whether the reverse of the substitutions that are used in all API calls are applied to expr. Default is false.
A:-ApplySubstitutions returns the given expression where variable and parameter names have been substituted using the substitutions that were applied to variable and parameter names in other API function calls (or the reverse of these substitutions, if the reverse option was passed).
The A := MapleSim:-LinkModel() statement needs to be run prior to successfully using any of the ModelObject A's export functions.
Linking to a MapleSim model (located in .msim file):
A≔MapleSim:-LinkModel⁡filename=cat⁡kernelopts⁡toolboxdir=MapleSim,/data/examples/RLCcircuit.msim:
Get equations without substitutions and apply the substitutions using the ApplySubstitutions command:
eqs≔A:-GetEquations⁡nosubs
eqs≔Main.RLC.C1.p.i⁡t+Main.RLC.I1.p.i⁡t−Main.RLC.SC1.v⁡t−sin⁡2⁢π⁢t=0,ⅆⅆtMain.RLC.I1.p.i⁡t=−Main.RLC.SC1.v⁡t,ⅆⅆtMain.RLC.SC1.v⁡t=−Main.RLC.C1.p.i⁡t
A:-ApplySubstitutions⁡eqs
C1_p_i⁡t+I1_p_i⁡t−SC1_v⁡t−sin⁡2⁢π⁢t=0,ⅆⅆtI1_p_i⁡t=−SC1_v⁡t,ⅆⅆtSC1_v⁡t=−C1_p_i⁡t
Check that it is equivalent to getting equations with substitutions:
A:-GetEquations⁡
Obtain the original variable names by applying the reverse substitutions to the variables:
vars≔A:-GetVariables⁡
vars≔C1_p_i⁡t,I1_p_i⁡t,SC1_v⁡t
A:-ApplySubstitutions⁡vars,reverse
Main.RLC.C1.p.i⁡t,Main.RLC.I1.p.i⁡t,Main.RLC.SC1.v⁡t
Check that it is equivalent to getting variables without substitutions:
A:-GetVariables⁡nosubs
See Also
MapleSim
MapleSim[LinkModel]
MapleSim[LinkModel][GetEquations]
MapleSim[LinkModel][GetSubstitutions]
MapleSim[LinkModel][GetVariables]
MapleSim[LinkModel][SetSubstitutions]
Download Help Document