ApplySubstitutions - MapleSim Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.

Online Help

All Products    Maple    MapleSim


ApplySubstitutions

apply variable and parameter substitutions

 

Calling Sequence

Parameters

Returns

Options

Description

Examples

Calling Sequence

A := MapleSim:-LinkModel();

A:-ApplySubstitutions(expr, options)

Parameters

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

Returns

• 

A modification of expr.

Options

• 

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.

Description

• 

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.

Examples

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

(1)
> 

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

(2)

Check that it is equivalent to getting equations with substitutions:

> 

A:-GetEquations⁡

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

(3)

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

(4)
> 

A:-ApplySubstitutions⁡vars,reverse

Main.RLC.C1.p.i⁡t,Main.RLC.I1.p.i⁡t,Main.RLC.SC1.v⁡t

(5)

Check that it is equivalent to getting variables without substitutions:

> 

A:-GetVariables⁡nosubs

Main.RLC.C1.p.i⁡t,Main.RLC.I1.p.i⁡t,Main.RLC.SC1.v⁡t

(6)

See Also

MapleSim

MapleSim[LinkModel]

MapleSim[LinkModel][GetEquations]

MapleSim[LinkModel][GetSubstitutions]

MapleSim[LinkModel][GetVariables]

MapleSim[LinkModel][SetSubstitutions]