MaplePortal/DynamicSystems - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : MaplePortal/DynamicSystems

DynamicSystems in Maple

Go to Maple Portal     Maple Portal for Engineers

 

The DynamicSystems package in Maple contains a collection of commands which allows you to extract analytical information from your system models.

 

To begin, load the package into the workspace by using the with command. This enables the use of the short form of the command names.

 

withDynamicSystems:

 

It is important to note that the DynamicSystems package only applies to causal systems (systems that have well-defined input and output variables).

 

This document uses the system equations of a DC motor model to illustrate how the commands in the DynamicSystems package can be used.

 

Extracting DC Motor Parameter Values

System Creation and Conversion

Plotting in DynamicSystems

System Manipulation and Analysis

See Also

Extracting DC Motor Parameter Values

 

The parameters and variables that define the DC motor model are shown in the tables below:

 

Parameter Names

Value

Units

Parameters

Moment of inertia of the motor (J)

kgm2

Damping of the mechanical system (b)

Nms

Electromotive force constant (K)

NmA

Motor coil resistance (R)

Ω

Motor coil inductance (L)

H

 

Variable Names

Description

Input Variables

Vt

Applied Voltage

Output Variables

Θt

Motor Shaft Angular Position

it

Motor Current

 

The parameter values are contained in TextArea embedded components.  Each parameter value can be extracted from the Text Area using Maple's DocumentTools package. The commands in the DocumentTools package can be accessed by loading the package into the Maple environment. To see the names for each Text Area embedded component, right-click on the Text Area and select Component Properties from the context-sensitive menu.

 

withDocumentTools

Do,GetDocumentProperty,GetProperty,Retrieve,SetDocumentProperty,SetProperty

(1)

 

To obtain the parameter values, execute the following commands:

J=Do%Text_J

J=0.01

(2)

b=Do%Text_b

b=0.1

(3)

K=Do%Text_K

K=0.01

(4)

L=Do%Text_L

L=0.5

(5)

R=Do%Text_R

R=1

(6)

Now that the parameter values are extracted, combine the values into a list for use in the subsequent sections.

 

params,,,,

J=0.01,b=0.1,K=0.01,L=0.5,R=1

(7)

 

For more information on DocumentTools and the Text Area embedded component, see DocumentTools and TextAreaComponent.

System Creation and Conversion

Creating a DynamicSystems Object

 

The DynamicSystems package allows for the creation of six different types of System Objects.

 

1. 

Algebraic Equation System Objects

2. 

Coefficient System Objects

3. 

Differential Equation System Objects

4. 

State Space System Objects

5. 

Transfer Function System Objects

6. 

Zero Pole Gain System Objects.

 

A DynamicSystems object is a data container structure that encapsulates all of the information about a system.

 

The following example shows how to create a Differential Equation System Object. The differential equation describing the DC motor's electrical system is defined by eqElectrical.

 

eqElectricalLi.t+Rit=VtKθ.t

Lⅆⅆtit+Rit=VtKⅆⅆtθt

(8)

 

Note: Maple provides two distinct methods to write derivatives with respect to t. The first method produces ⅆⅆt and can be obtained using the ⅆⅆxf operator from the Expressions palette, while the second method makes use of Maple's dot notation for time derivatives. To get the dot notation, first type the variable and then press Ctrl + Shift + '' to raise the cursor above the variable. Now, type a period (.) above the variable to indicate the derivative. 

 

Example: Time derivative of y in 2-D Math:

 

1.

2. Press Ctrl + Shift + " :

3. Type (.):

4. Press Ctrl + = :

 

  For more details and shortcuts for using 2-D Math notation to enter derivatives, see 2-D Math Shortcut Keys and How Do I Enter an ODE?.

 

Now that the equation is defined, you can use the DiffEquation command to create a DynamicSystems System Object which can then be accessed by other commands in the DynamicSystems package.

 

sysElectricalDiffEquationeqElectrical, inputvariable=Vt,outputvariable=θt

Diff. Equationcontinuous1 output(s); 1 input(s)inputvariable = Vtoutputvariable = θt

(9)

 

The System Object created in (9) provides us with information about the system. For instance, sysElectrical has 1 input and 1 output. This information becomes very useful when dealing with large scale systems.

 

Once a System Object is created you can use the PrintSystem command to print the contents of the System Object.

 

PrintSystemsysElectrical

Diff. Equationcontinuous1 output(s); 1 input(s)inputvariable = Vtoutputvariable = θtde = Li.t+Rit=VtKθ.t

(10)

 

An alternative method for creating a DynamicSystems Object is through the context-sensitive menu. Following is an illustration of the use of the context menu to create a System Object of the DC motor's mechanical system.

 

The differential equation describing the DC motor's mechanical system is defined by eqMechanical.. To create a Differential System Object from this equation, right-click on the equation and select Differential Equation from the DynamicSystems>System Creation menu. A dialog appears asking you to define a name for the System Object. For this example, use the name sysMechanical. Then, you are asked to specify the input and outputs of the system. In this case the input of the system is it and the output is thetat.

 

eqMechanicalJⅆ2ⅆ t2θt+bⅆⅆ tθt=Kit

Jⅆ2ⅆt2θt+bⅆⅆtθt=Kit

(11)

create differential equation

sysMechanical=Diff. Equationcontinuous1 output(s); 1 input(s)inputvariable = itoutputvariable = θt

(12)

By combining equations in (8) and (11) you can create a Differential Equation System Object describing the entire DC motor model in terms of the voltage, Vt, and angular position, θt.

 

eqOveralleqElectrical, eqMechanical

Lⅆⅆtit+Rit=VtKⅆⅆtθt,Jⅆ2ⅆt2θt+bⅆⅆtθt=Kit

(13)

 

Note:  The syntax equation[ ] is used to extract the equations from the list.  For instance, eqElectrical = Lⅆⅆtit+Rit=VtKⅆⅆtθt.  The two equations are then combined in a new list.

 

sysOverall  DiffEquationeqOverall, inputvariable=Vt, outputvariable=θt:PrintSystemsysOverall

Diff. Equationcontinuous1 output(s); 1 input(s)inputvariable = Vtoutputvariable = θtde = Li.t+Rit=VtKθ.t,Jθ..t+bθ.t=Kit

(14)

Converting between different DynamicSystems System Object Representations

 

A Transfer Function System Object can be obtained directly from the Differential Equation System Object sysOverall by applying the TransferFunction command to the System Object.

 

sysOverallTFTransferFunctionsysOverall:PrintSystemsysOverallTF

Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable = Vsoutputvariable = θstf1,1 = KJLs3+bL+JRs2+bR+K2s

(15)

 

The equation for the Transfer Function Model can be extracted from the Transfer Function System Object by accessing the exports of the Transfer Function System Object. This is done by appending :-tf to the end of the System Object variable.

 

exportssysOverallTF

tf,inputcount,outputcount,statecount,sampletime,discrete,systemname,inputvariable,outputvariable,statevariable,systemtype,ModulePrint

(16)

sysOverallTF:-tf

 

Information about the exports of each System Object type can be found in the help page SystemObject.  For general information about accessing exports using ':-', see colondash.

 

Similarly, a Zero Pole Gain System Object can be obtained by applying the ZeroPoleGain command to sysOverall.

 

sysOverallZPKZeroPoleGainsysOverall:PrintSystemsysOverallZPK

Zero Pole Gaincontinuous1 output(s); 1 input(s)inputvariable = Vsoutputvariable = θsz1,1 = p1,1 = bL+JRb2L22bLJR+J2R24JLK22JL,bL+JR+b2L22bLJR+J2R24JLK22JL,0k1,1 = KJL

(17)

The zero, pole and gain matrices are exports of the System Object that can be extracted from the Zero Pole Gain model by appending :-z, :-p and :-k to the end of the System Object variable.

 

sysOverallZPK:-z

sysOverallZPK:-p

sysOverallZPK:-k

Converting between different DynamicSystems Representations

 

In the last section, you saw how easy it is to convert between different DynamicSystems System Object Representations. The DynamicSystems package, through the DynamicSystems context menus, allows you to convert between different DynamicSystems representations without first having to create a System Object.

 

For instance, the differential equation defined in eqOverall can be quickly converted into a Transfer Function or to a sequence of State Space or Zero Pole Gain Matrices. This is done by right-clicking on the differential equation defined in eqOverall and selecting from the choices found in the DynamicSystems>Conversions menu.

 

eqOverall

Lⅆⅆtit+Rit=VtKⅆⅆtθt,Jⅆ2ⅆt2θt+bⅆⅆtθt=Kit

(18)

convert to transfer function

convert to zero pole gain

Plotting in DynamicSystems

 

The DynamicSystems package also provides the user with a multitude of commands for generating plots, such as Bode Plots, Magnitude Plots, Phase Plots, Root Locus Plots, Zero Pole Plots, Impulse Response Plots, and Response Plots. The user can generate these plots by applying a DynamicSystems plotting command to their System Object definition, or by accessing the DynamicSystems context menu for the desired expression. Both these methods will be illustrated in the following section.

 

Assuming that the user has already created a DynamicSystems Object such as the one defined by sysOverall then creating a Bode Plot is simply a matter of applying the BodePlot command to the System Object.

 

BodePlotsysOverall,parameters=params

 

The sine response plot for the System Object can be obtained in a similar manner.

 

ResponsePlotsysOverall, Sine, parameters=params

Alternatively, one can use the DynamicSystems context menu to access the plotting features in the DynamicSystems package. To access the context menu simply right click on a Differential Equation, Transfer Function, State Space Matrices or Zero Pole Gain Matrices and choose any of the plots available from the DynamicSystems>Plots menu.

 

For example, the Impulse Response plot can be generated by right-clicking on the sequence of three Zero Pole Gain Matrices.  From the context menu, select DynamicSystems>Plots>Continuous>ImpulseResponsePlot.  In the Parameter Editor, specify the parameters J=0.01, K=0.01, L=0.5, R=1, b=0.1.

 

ZeroPoleGainMatrices

impulse response plot

System Manipulation and Analysis

 

The DynamicSystems package also provides the user with many commands to allow them to extract meaningful analytical information from their system models. As you saw in the previous section, the commands that are available for system manipulation and analysis can be applied to both a DynamicSystems System Object or to set of Differential Equations, Transfer Functions, State Space Matrices, or Zero Pole Gain Matrices.

 

For example, the gain and phase margin for the System Object defined by sysOverall can be easily obtained using the following commands.

 

GainMarginsysOverall,parameters=params

41.59230648,4.474371464

(19)

PhaseMarginsysOverall, parameters=params

86.57591706,0.09977136764

(20)

This information could have also been obtained by right-clicking on the differential equation defined in (13), the transfer function defined in , or the zero pole gain matrices defined in  and selecting the GainMargin and PhaseMargin options found in the DynamicSystems>Manipulation menu.

See Also

colondash, DocumentTools, DynamicSystems, TextAreaComponent

 

Go to Maple Portal     Maple Portal for Engineers