ApplySubstitutions - MapleSim Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : MapleSim : MapleSim Application Programming Interface : API Commands : MapleSim/LinkModel/ApplySubstitutions

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:-LinkModel'filename'=catkernelopts'toolboxdir'=MapleSim,/data/examples/RLCcircuit.msim:

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

eqsA:-GetEquations'nosubs'

eqs:=Main.RLC.C1.p.it+Main.RLC.I1.p.it+Main.RLC.SC1.n.vtsin2πt=0,ⅆⅆtMain.RLC.I1.p.it=Main.RLC.SC1.n.vt,ⅆⅆtMain.RLC.SC1.n.vt=Main.RLC.C1.p.it

(1)

A:-ApplySubstitutionseqs

C1_p_it+I1_p_it+SC1_n_vtsin2πt=0,ⅆⅆtI1_p_it=SC1_n_vt,ⅆⅆtSC1_n_vt=C1_p_it

(2)

Check that it is equivalent to getting equations with substitutions:

A:-GetEquations

C1_p_it+I1_p_it+SC1_n_vtsin2πt=0,ⅆⅆtI1_p_it=SC1_n_vt,ⅆⅆtSC1_n_vt=C1_p_it

(3)

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

varsA:-GetVariables

vars:=C1_p_it,I1_p_it,SC1_n_vt

(4)

A:-ApplySubstitutionsvars,'reverse'

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

(5)

Check that it is equivalent to getting variables without substitutions:

A:-GetVariables'nosubs'

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

(6)

See Also

MapleSim

MapleSim[LinkModel]

MapleSim[LinkModel][GetEquations]

MapleSim[LinkModel][GetSubstitutions]

MapleSim[LinkModel][GetVariables]

MapleSim[LinkModel][SetSubstitutions]

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam