link to a MapleSim model - MapleSim Help

Online Help

All Products    Maple    MapleSim


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

LinkModel - link to a MapleSim model

Calling Sequence

MapleSim:-LinkModel(options)

LinkModel(options)

Parameters

options

-

(optional) equation(s) of the form name = value

Returns

• 

module : evaluated ModelObject with the following exports:

  

ApplySubstitutions substitute simpler names for parameters and variables

  

DeleteAttachment  delete an attachment (such as a template or a file) from the model

  

GetAttachment return an attachment of the model

  

GetCompiledProc compile the active subsystem into executable code

  

GetEquations return the equations of the system or subsystem

  

GetICs return the initial conditions

  

GetModel return the name of the linked model

  

GetModelica return the Modelica description for the active subsystem

  

GetMultibody return the multibody portion of the active subsystem

  

GetParameters return the parameters of the active subsystem

  

GetPorts return ports and/or probes of a system or subsystem

  

GetProbes return probes of a system or subsystem

  

GetSettings return simulation settings (such as the simulation time, solver, and tolerances)

  

GetSubstitutions return substitution equations (used to create simpler parameter/variable names)

  

GetSubsystemName return the name of the active subsystem

  

GetVariables return the variables of the active subsystem

  

Linearize linearize the equations of the active subsystem

  

ListAttachments list the attachments (such as the templates, files, and data) of the model

  

ListSubsystems list the subsystems of the system

  

SetAttachment attach data to the model

  

SetComponent create a component from Modelica source

  

SetModel link to a particular model

  

SetParameters assign values of parameters

  

SetSubstitutions assign substitutions (to create simpler parameter/variable names)

  

SetSubsystemName assign the active subsystem

  

ShowResultsManager open the Results Manager window

  

Simulate simulate the system

Description

• 

The LinkModel command returns a "connection module" that allows programmatic access to a MapleSim model.

  

Important: You must first link to a MapleSim model as described on this page before accessing the MapleSim API commands for your model.

• 

There are two ways to link to a MapleSim model: by filename or by using a MapleSim Model embedded component.  See the Examples section on this page for more information.

• 

Alternatively, you can link to a Modelica model using the modelica option.

• 

The LinkModel command is part of the MapleSim package.  You can access this command using the long form of the command name, MapleSim:-LinkModel, or by first executing with(MapleSim) and then using the short form of the command name, LinkModel.

Notes

• 

Executing LinkModel( ) without options is equivalent to executing LinkModel(component="Simulation0");

• 

When linking to a model using a Modelica file, the following export commands can not be used:

– 

GetAttachment

– 

ListAttachments

– 

SetAttachment

– 

SetSubstitutions with savewithmodel = true

Examples

Example 1: Linking to a MapleSim model by specifying a filename. (The model is located in an .msim file.):

AMapleSim:-LinkModel'filename'=catkernelopts'toolboxdir'=MapleSim,/data/examples/RLCcircuit.msim:

Example 2: Linking to a MapleSim model by using a MapleSim Model embedded component.

1. 

Open a new Maple worksheet.

2. 

From the Components palette, click the MapleSim Model component icon (  ) to insert a MapleSim Model embedded component.

3. 

Right-click (Control-click for Macintosh) the MapleSim Model component and then select Component Properties. The Simulation Properties window appears.

4. 

Beside File, click Select... and browse to a MapleSim model.

5. 

Select a model to open. Click Open.  The Simulation Properties window appears.

6. 

Click OK. The model appears in the MapleSim Model component.  If desired, you can browse your model by using the navigation tools at the top of the MapleSim Model to navigate to a subsystem.

7. 

Execute the following command to complete the link to the model (and subsystem, if selected) shown in the MapleSim Model component: AMapleSim:-LinkModel

Example 3: Linking to a Modelica model.

Using the name of the model:

AMapleSim:-LinkModel'modelica'=catkernelopts'toolboxdir'=MapleSim,/data/examples/BouncingBall.mo,Main:

Using the last model defined in the file:

AMapleSim:-LinkModel'modelica'=catkernelopts'toolboxdir'=MapleSim,/data/examples/BouncingBall.mo,'use_last_model':

See Also

MapleSim


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