Getting Started with the MapleSimControl Design Toolbox

Copyright © Maplesoft, a division of Waterloo Maple Inc.
2024

Getting Started with the MapleSim Control Design Toolbox
Copyright
Maplesoft, Maple, and MapleSim are all trademarks of Waterloo Maple Inc.
© Maplesoft, a division of Waterloo Maple Inc. 2009-2024. All rights reserved.
No part of this book may be reproduced, stored in a retrieval system, or transcribed, in any form or by any means — electronic, mechanical, photocopying, recording, or otherwise. Information in this document is subject to change without notice and does not represent a commitment on the partof the vendor. The software described in this document is furnished under a license agreement and may be used or copied only in accordance withthe agreement. It is against the law to copy the software on any medium except as specifically allowed in the agreement.
Macintosh is a registered trademark of Apple, Inc.
Modelica is a registered trademark of the Modelica Association.
All other trademarks are the property of their respective owners.
This document was produced using Maple and DocBook.

ContentsIntroduction ..................................................................................................................................... iv
1 Getting Started ................................................................................................................................. 1
1.1 Getting Help .............................................................................................................................. 1
1.2 Viewing MapleSim Control Design Examples ................................................................................. 1
1.3 Using the MapleSim Control Design Apps ...................................................................................... 1
1.4 Example: DC Motor ................................................................................................................... 1
Generating a Linearized Model ...................................................................................................... 1
Creating a Custom Controller ........................................................................................................ 2Index ................................................................................................................................................ 5iii

Introduction
The MapleSim™ Control Design Toolbox provides the necessary control design tools to extend the plant modelingcapabilities of MapleSim. Using a symbolic approach, you can design, analyze, and test control systems.
You can also use the technical documentation tools available with MapleSim to document your design decisions.
Features of this toolbox include:• Model linearization• Standard PID tuning techniques: Ziegler-Nichols time response, Ziegler-Nichols frequency response and CohenCoon• Advanced PID tuning techniques: Dominant pole placement, pole placement in a specified region, and gain andphase margin• State Feedback Control: Single input pole placement (Ackermann), multiple input pole placement, and LQR• State Estimation: Single output pole placement (Ackermann), multiple output pole placement, and Kalman filter• Access to commands in the ControlDesign and DynamicSystems packages in Maple™

Scope of Model SupportMapleSim Control Design Toolbox is a very comprehensive modeling tool where it is possible to design linear controllers
for models created in MapleSim. The Control Design Toolbox linearizes systems of any complexity, including systems
of DAEs of any index.
Systems that contain any type of discontinuity, including discrete transforms, switches, logic gates, relational andBoolean operations are not supported by the current release of this product.

iv1 Getting Started
1.1 Getting HelpIn Maple, enter ?ControlDesign at a prompt in a worksheet.

1.2 Viewing MapleSim Control Design Examples
Toolbox examples are available in MapleSim.
To view an example:• From the Help menu, select Examples > Control Design Examples, and then select the model that you want toview.
Some models include additional documents, such as Maple worksheets that show model equations or define custom
components. To view an attached Maple worksheet:
1. From the main toolbar in MapleSim, click the Load a Maple Worksheet icon ()2. Select the document from the list of attached worksheets, and click OK. The worksheet opens in Maple.
Alternatively, all attachments to a MapleSim model can be found under the Attached Files tab ( ). You can rightclick (Control-click, for Mac) on an attachment and select View to open it in Maple (for Maple worksheets) or in theappropriate program.

1.3 Using the MapleSim Control Design Apps
The MapleSim Control Design Toolbox provides apps for linearizing MapleSim models and creating PID controllers.
These Maple-based apps allow you to generate a linearized representation of your model subsystems, as well as custom
components of your system controllers. Apps are found in the Apps Manager, opened by clicking Show Apps Manager() from the main toolbar in MapleSim.

1.4 Example: DC Motor
In this example, you will generate a linearized state-space model of the models you created in MapleSim. You willthen use this linearized model to create and tune a PID controller.

Generating a Linearized Model
To generate a linearized model:
1. From the Help menu, select Examples > Control Design Examples, and then select the DC Motor - Getting
Started model.
2. From the main toolbar, click Show Apps Manager ( ), and from the Apps palette double-click on the Linearization entry under Component Creation. The Linearization app opens.
3. Using the drop-down list above the model, select the DC Motor1 subsystem.

12 • Getting Started

4. Click Load Selected Subsystem. In the Configuration section, the fields for the Inputs, Outputs, and Parameterstables are populated with information specific to the subsystem.
5. In the Configuration section, select Linearization Options.
You can now have the app automatically calculate an equilibrium point to be used as a linearization point or you
can choose to have the model linearized about the initial point.
If you specify manual values in the Initial Conditions of a component, these will be used in the Initial Configurationof the system. Alternatively, to calculate the equilibrium point automatically, select Equilibrium Point. Also, toenable Baumgarte stabilization during linearization of the constraint equations, select use Baumgarte.
6. For this example, select Equilibrium Point.
7. In the Linearize section, click Linearize to generate the linearized model. In the Analysis section, you can selectand view the matrices of your linearized model (select Basic). Select Mappings to view the state, input, and output
mappings.
8. Scroll to the bottom of the app and under Create Model in the Component Name field, you can enter a custom
name for the linearized model, for example, MyMotor for this example. In the description field, you can add more
information about your model.
9. Click Create to create the linearized state-space model. A custom component with the specified component name(for example, MyMotor) now appears in the Components palette of the Local Components tab (Motor model in MapleSim.

) of the DC

Creating a Custom Controller
To create a custom controller:
1. If you are not in the top level of your model, click Return to Main () in the Navigation Toolbar.

2. Under the Local Components tab (), the MyMotor custom component is found in the Components palette.
Place the MyMotor custom component in the Model Workspace.
3. From the main toolbar, click Show Apps Manager ( ), and then double-click the PID Tuning entry underControl Design in the Apps palette. The PID Tuning app opens.
4. In the Linearized Model section of the app, select the linearized model MyMotor from the drop-down list.
5. In the Controller Design section, you can select the tuning method and controller type you want to create. For thisexample, design a PID controller using the modified Ziegler-Nichols (MZN) Time Domain tuning method:
From the Method drop-down menu, select Ziegler-Nichols Time Domain (MZN). From the Controller dropdown menu, select PID. If additional information is required for your control design method, the fields below thesemenus will be populated and you can enter the required information.
6. Click Design Controller.

3 • Getting Started

7. Next, in the Export to MapleSim subsection, enter MyPID, and then click Export to MapleSim. A custom component generates and exports to MapleSim.
Notes:• You can view the Modelica® code generated for the custom component in the Modelica Code Editor ().

To simulate your model using the MyPID custom component:
1. Return to your MapleSim model.
2. Select the MyMotor custom component and click Disable ( ) to exclude it from the next simulation.
3. In the Local Components tab (), the MyPID custom component is found in the Components palette. Placethe MyPID custom component in the Model Workspace.
4. In the Library Components tab (), expand the Signal Blocks → Common menu and drag the Feedback
component in the Model Workspace.
5. Connect the components to your model, as shown below.

6. Click Run Simulation (following graph appears.

) in the Main Toolbar to simulate your model. When the simulation is complete, the4 • Getting Started

You can change the parameters of your controller directly in your model in MapleSim by selecting the PID controller
component and editing the parameters in the Properties tab ().

IndexAapps
Control Design, 1

BBaumgarte, 2CControl Design Examples, 1Control Design help, 1Control Design package, iv
custom controller
creating, 2E
Equilibrium Point, 2Ggenerating a linearized model, 1LLinearization template, 1
linearized model
generating, 1

P
PID Tuning template, 2Probe Plots, 3

S
Simulation Graph, 3T
templates
Linearization, 1PID Tuning, 25