2 Creating and Exporting Mathematical Models in Maple ..................................... 17
2.1 Using a Template to Generate an S-Function Block ..................................... 17
2.2 Creating and Exporting a DynamicSystems Object Programmatically ............. 19
2.3 Example: DC Motor .............................................................................. 20
Index ........................................................................................................... 23
iii
iv • Contents
Introduction
The MapleSim™ Connector provides all of the tools you need to prepare and export your
dynamic systems models to Simulink® as S-function blocks. You can create a model in
MapleSim, simplify it in Maple™ by using an extensive range of analytical tools, and then
generate an S-function block that you can incorporate into your Simulink toolchain.
You can also use these tools for exporting mathematical models that you have created from
first principles in Maple as S-functions.
Furthermore, various options allow you to use the C code generation feature in Maple to
create code libraries of your MapleSim models for implementation in other applications.
Features of this toolbox include:
•Maple templates, which provide an intuitive user interface for optimizing your
MapleSim model, and then generate an S-function in Simulink.
•A range of examples illustrating how to prepare and export your models.
•A direct interface between Maple and Simulink allows you to generate and test an Sfunction block as you develop the model.
•Commands for developing S-functions of mathematical models from first principles in
the Maple environment and examples to illustrate how to do it.
•Access to commands in the SimulinkConnector and DynamicSystems packages for
developing automated applications to generate S-functions.
Scope of Model Support
MapleSim is a very comprehensive modeling tool where it is possible to create models that
could go beyond the scope of this MapleSim Connector release. In general, the MapleSim
Connector supports systems of any complexity, including systems of DAEs of any index,
in any mix of domains, as long as they exhibit continuous behavior. Systems that contain
any type of discontinuity, including discrete transforms, switches, logic gates, relational
and Boolean operations are not supported by the current release of this product.
Apart from all of the engineering and signal components that are continuous, this product
also supports lookup tables, and custom components that do not use discontinuous operations
such as piecewise functions.
v
vi • Introduction
System Requirements
The MapleSim Connector requires the following:
•MATLAB® 2008b, 2009a or 2009b
•Simulink 7.0 or later
•The latest versions of Maple and MapleSim
For installation instructions and a complete list of system requirements, see the Install.html
file on the product CD.
1 Getting Started
1.1 Setting Up the MapleSim Connector
Establishing a Connection with MATLAB
To generate an S-function block, you must set up Maple to communicate with MATLAB.
Start Maple and enter the following command to establish a connection with MATLAB.
>
A MATLAB command window is opened and the connection is established. If the window
does not open, follow the instructions in the ?Matlab[setup] help page to configure the
connection.
Next, set up the MATLAB mex compiler. Go to the MATLAB command window and enter
the setup command.
Follow the instructions to choose a local C compiler that supports ANSI (American National
Standards Institute) C code.
See the ?SimulinkConnector,setup help page for more information.
You are now ready to use the MapleSim Connector.
1.2 Getting Help
In Maple, enter ?SimulinkConnector at a prompt in a worksheet.
1
2 • 1 Getting Started
1.3 Using the Simulink Block Generation Template
The MapleSim Connector provides a Simulink Block Generation template in the form of
a Maple worksheet for manipulating and exporting MapleSim subsystems. This template
contains pre-built embedded components that allow you to generate S-function or C code
from a MapleSim subsystem, export the subsystem as a Simulink block, and save the source
code.
Using this template, you can define inputs and outputs for the system, choose the format of
the resulting S-function, and generate the source code, library code, block script, or Simulink
block. You can also assign the model equations to a variable and use any Maple commands
to perform analysis tasks.
Viewing MapleSim Connector Examples
Toolbox examples are available in the Simulink Connector Examples palette in MapleSim.
Each example includes a code generation template in its document folder.
To view an example:
1. In the Simulink Connector Examples palette at the left side of the MapleSim window,
expand one of the submenus, and then click the entry for the model that you want to view.
2. Click the document folder buttonin the top toolbar.
3. From the document list, select Simulink Block Generation.
4. Click Open Selected. The code generation template is opened in Maple.
Some models include additional documents, such as templates that display model equations
or define custom components. You can open any of these documents by selecting its entry
in the list and clicking Open Selected.
1.4 Example: RLC Circuit Model • 3
1.4 Example: RLC Circuit Model
In this example, you will generate a Simulink block from an RLC circuit model that was
created in MapleSim.
Before starting this tutorial, you must set up MATLAB and the mex compiler. For more
information, see Establishing a Connection with MATLAB (page 1).
To generate an S-function block:
1. In the Simulink Connector Examples palette, select the RLC Parallel Circuit example.
2. Click the document folder buttonin the top toolbar.
3. From the drop-down menu, select Simulink Block Generation.
4. Click New.
5. Enter RLC Circuit as the worksheet name and click OK.
6. In the document list at the left side of the dialog box, select RLC Circuit and click Open
Selected. Your MapleSim model is opened in the Simulink Block Generation for
MapleSim Template in Maple.
7. In the Model Summary section of the template, from the Subsystem drop-down menu,
select the RLC_Parallel subsystem. This list box displays all of the subsystems in your
MapleSim model.
8. Click System Update. All of the template fields are populated with information specific
to the subsystem.
9. In the S-Function block name field, enter RLC_Circuit. This is the name that will be
displayed for the block in Simulink.
Loading...
+ 21 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.