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
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)
kg⋅m2
Damping of the mechanical system (b)
N⋅m⋅s
Electromotive force constant (K)
N⋅mA
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
To obtain the parameter values, execute the following commands:
J=Do%Text_J
J=0.01
b=Do%Text_b
b=0.1
K=Do%Text_K
K=0.01
L=Do%Text_L
L=0.5
R=Do%Text_R
R=1
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
For more information on DocumentTools and the Text Area embedded component, see DocumentTools and TextAreaComponent.
Creating a DynamicSystems Object
The DynamicSystems package allows for the creation of six different types of System Objects.
Algebraic Equation System Objects
Coefficient System Objects
Differential Equation System Objects
State Space System Objects
Transfer Function System Objects
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.
eqElectrical≔L⋅i.t+R⋅it=Vt−K⋅θ.t
L⁢ⅆⅆt⁢i⁡t+R⁢i⁡t=V⁡t−K⁢ⅆⅆt⁢θ⁡t
Note: Maple provides two distinct methods to write derivatives with respect to t. The first method produces ⅆⅆt and can be obtained using the ⅆⅆx⁡f 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.
sysElectrical≔DiffEquationeqElectrical, inputvariable=Vt,outputvariable=θt
Diff. Equationcontinuous1 output(s); 1 input(s)inputvariable = V⁡toutputvariable = θ⁡t
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 = V⁡toutputvariable = θ⁡tde = L⁢i.⁡t+R⁢i⁡t=V⁡t−K⁢θ.⁡t
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.
eqMechanical≔J⋅ⅆ2ⅆ t2θt+b⋅ⅆⅆ tθt=K⋅it
J⁢ⅆ2ⅆt2⁢θ⁡t+b⁢ⅆⅆt⁢θ⁡t=K⁢i⁡t
→create differential equation
sysMechanical=Diff. Equationcontinuous1 output(s); 1 input(s)inputvariable = i⁡toutputvariable = θ⁡t
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.
eqOverall≔eqElectrical, eqMechanical
L⁢ⅆⅆt⁢i⁡t+R⁢i⁡t=V⁡t−K⁢ⅆⅆt⁢θ⁡t,J⁢ⅆ2ⅆt2⁢θ⁡t+b⁢ⅆⅆt⁢θ⁡t=K⁢i⁡t
Note: The syntax equation[ ] is used to extract the equations from the list. For instance, eqElectrical = L⁢ⅆⅆt⁢i⁡t+R⁢i⁡t=V⁡t−K⁢ⅆⅆ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 = V⁡toutputvariable = θ⁡tde = L⁢i.⁡t+R⁢i⁡t=V⁡t−K⁢θ.⁡t,J⁢θ..⁡t+b⁢θ.⁡t=K⁢i⁡t
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.
sysOverallTF≔TransferFunctionsysOverall:PrintSystemsysOverallTF
Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable = V⁡soutputvariable = θ⁡stf1,1 = KJ⁢L⁢s3+b⁢L+J⁢R⁢s2+b⁢R+K2⁢s
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
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.
sysOverallZPK≔ZeroPoleGainsysOverall:PrintSystemsysOverallZPK
Zero Pole Gaincontinuous1 output(s); 1 input(s)inputvariable = V⁡soutputvariable = θ⁡sz1,1 = p1,1 = −b⁢L+J⁢R−b2⁢L2−2⁢b⁢L⁢J⁢R+J2⁢R2−4⁢J⁢L⁢K22⁢J⁢L,−b⁢L+J⁢R+b2⁢L2−2⁢b⁢L⁢J⁢R+J2⁢R2−4⁢J⁢L⁢K22⁢J⁢L,0k1,1 = KJ⁢L
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
→convert to transfer function
→convert to zero pole gain
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
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
PhaseMarginsysOverall, parameters=params
86.57591706,0.09977136764
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.
colondash, DocumentTools, DynamicSystems, TextAreaComponent
Download Help Document