1 Getting Started - MapleSim Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : MapleSim Toolboxes : MapleSim Control Design Toolbox : Getting Started Guide : MapleSimControlDesignGSG/Chapter01

Contents     Previous     Next     Index

1 Getting Started

1.1 Getting Help

In Maple, enter ?ControlDesign at a prompt in a worksheet.

1.2 Using the MapleSim Control Design Templates

The MapleSim Control Design Toolbox provides templates in the form of a Maple worksheet for linearizing MapleSim models and creating PID controllers. These templates contain pre-built embedded components that allow you to generate a linearized representation of your model subsystems, as well as custom components of your system controllers.

 

Viewing MapleSim Control Design Examples

Toolbox examples are available in the Control Design Examples palette in MapleSim.

Each example includes a linearization or PID tuning template in its Attachments palette.

 

To view an example:

1. 

In the Control Design Examples palette at the left side of the MapleSim window, click the entry for the model that you want to view.

2. 

Under the Project tab, expand the Attachments palette and then expand Documents.

3. 

Right-click (Control-click for Macintosh®) PIDTuning and select View. The template opens in Maple.

 

Some models include additional documents, such as templates that show model equations or define custom components. You can open any of these documents by right- or Control-clicking its entry and selecting View.

1.3 Example: DC Motor

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

 

Generating a Linearized Model

 

To generate a linearized model:

1. 

In the Control Design Examples palette, open the DC Motor - Getting Started model.

2. 

Click Templates ( ) in the Main Toolbar and from the list, select Linearization.

3. 

In the Attachment field, enter Linearized Motor as the worksheet name and click Create Attachment. Your MapleSim model opens in the MapleSim Linearization Template in Maple.

4. 

Using the navigation controls above the model, browse to the DC Motor subsystem.

 

5. 

Click Load Selected Subsystem. The Variable and Parameter Management fields are populated with information specific to the subsystem.  

6. 

You can now have Maple automatically calculate an equilibrium point to be used as a linearization point or you can clear the use equilibrium point check box to have the model linearized about the initial point.
To manually specify the values of the DAE, Input and Output variables, and Parameters, enter the values into appropriate value columns.  Alternatively, to calculate the equilibrium point automatically, select use equilibrium point. Also, to enable Baumgarte stabilization during linearization of the constraint equations, select use Baumgarte.

For this example, select use equilibrium point.

7. 

Click Linearize to generate the linearized model. The Linearized Model and Variable Mapping fields are automatically updated. In the Linearized Model display area, you can select and view the matrices of your linearized model. In the Variable Mapping fields you can now select and view the state, input, and output mappings.

8. 

Scroll to the bottom of the template and under Create Component in the Component Name field, you can enter a custom name for the linearized model, e.g. MyMotor for this example, or accept the default name shown in the worksheet. 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 (e.g. MyMotor) now appears in the Components palette of the Definitions tab in MapleSim.

10. 

Close the Linearization Template and return to the DC Motor model in MapleSim.

Creating a Custom Controller

 

To create a custom controller:

1. 

In the Navigation Toolbar, click Main to browse to the top level of your model.

2. 

Under the Definitions tab, the MyMotor custom component is found in the Components menu. Place the MyMotor custom component in the model workspace.

3. 

Click Templates ( ) in the Main Toolbar and from the list, select PID Tuning.

4. 

In the Attachments field, enter Motor PID as the worksheet name and click Create Attachment. Your MapleSim model opens in the PID Tuning Template in Maple.

5. 

In the Linearized Model section of the template, select the linearized model MyMotor from the drop-down list. The system is converted to a DynamicSystems object and stored in the zStateSpace variable.

6. 

In the Controller Design section, you can select the tuning method and controller type you want to create. For this example, 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 drop-down menu, select PID.  If additional information is required for your control design method, the fields below these menus will be populated and you can enter the required information.

7. 

Click Design Controller.

8. 

Next, in the Export to MapleSim subsection, enter MyPID,  and then click Export to MapleSim. A custom component generates and exports to MapleSim.

9. 

You can view the Modelica® code generated for the custom component in the Modelica subsection.

10. 

In the Analysis section, you can use the plotting tools to analyze properties such as Zero pole, Bode (magnitude and phase), Step Response, and Nyquist.

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. 

Under the Definitions tab, the MyPID custom component is found in the Components menu. Place the MyPID custom component in the Model Workspace.

4. 

In the Libraries tab, expand the Signal Blocks  Common menu and drag Feedback and Step signal components in the Model Workspace.

5. 

Connect the components to your model, as shown below.

6. 

Select Probe ( ) from the Model Workspace Toolbar and then click the connection line between the DC Motor and Feedback component.

7. 

Click the probe once to position it.

8. 

In the Inspector tab, select Real.

9. 

Click Run Simulation ( ) in the Main Toolbar to simulate your model. When the simulation is complete, the following graph appears.

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 Inspector tab.

 

Contents     Previous     Next     Index


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