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

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

• 

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

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):

AMapleSim:-LinkModelfilename=catkerneloptstoolboxdir=MapleSim,/data/examples/RLCcircuit.msim:

Get equations without substitutions and apply the substitutions using the ApplySubstitutions command:

eqsA:-GetEquationsnosubs

eqsMain.RLC.C1.p.it+Main.RLC.I1.p.itMain.RLC.SC1.vtsin2πt=0,ⅆⅆtMain.RLC.I1.p.it=Main.RLC.SC1.vt,ⅆⅆtMain.RLC.SC1.vt=Main.RLC.C1.p.it

(1)

A:-ApplySubstitutionseqs

C1_p_it+I1_p_itSC1_vtsin2πt=0,ⅆⅆtI1_p_it=SC1_vt,ⅆⅆtSC1_vt=C1_p_it

(2)

Check that it is equivalent to getting equations with substitutions:

A:-GetEquations

C1_p_it+I1_p_itSC1_vtsin2πt=0,ⅆⅆtI1_p_it=SC1_vt,ⅆⅆtSC1_vt=C1_p_it

(3)

Obtain the original variable names by applying the reverse substitutions to the variables:

varsA:-GetVariables

varsC1_p_it,I1_p_it,SC1_vt

(4)

A:-ApplySubstitutionsvars,reverse

Main.RLC.C1.p.it,Main.RLC.I1.p.it,Main.RLC.SC1.vt

(5)

Check that it is equivalent to getting variables without substitutions:

A:-GetVariablesnosubs

Main.RLC.C1.p.it,Main.RLC.I1.p.it,Main.RLC.SC1.vt

(6)

See Also

MapleSim

MapleSim[LinkModel]

MapleSim[LinkModel][GetEquations]

MapleSim[LinkModel][GetSubstitutions]

MapleSim[LinkModel][GetVariables]

MapleSim[LinkModel][SetSubstitutions]