Control Design Toolbox
New Features of the MapleSim Control Design Toolbox 6.4
Numerous improvements and additions have been made to the MapleSim Control Design toolbox, including:
New command for PID controller automatic tuning
Updates to existing PID tuning commands to choose the format of the returned controller parameters
Updates to existing control design commands to support the DynamicSystems parameters option, which is new in Maple 18
New commands for the automatic computation of design parameters, such as poles and weighting matrices, for state feedback control design
New commands for system manipulation (for example, determining the closed-loop equations of common feedback system configurations) and simplification (for example, eliminating the structurally non-minimal states of a system)
withControlDesign: withDynamicSystems:
PID automatic tuning
PID tuning commands returned format
Support of parameters option
State Feedback design parameters
System manipulation and simplification
See Also
The PIDAuto command performs automatic tuning of a PID controller based on a single tuning parameter, Tc, which has the same order of magnitude as the desired time constant of the closed-loop. The time constant is proportional to the settling time of the system (first order approximation) and, therefore, provides a simple way to specify the desired closed-loop system response. This command can obtain the PID controller parameters for a wide range of plants, including unstable systems. The best-suited tuning method is automatically selected according to both the order and stability of the input system. For instance, for stable higher order systems (order greater than 2), Skogestad internal model control (SIMC) tuning rules are applied.
infolevelControlDesign ≔ 3:
Design a PID controller for a system of order 7 with desired time constant Tc = 0.77.
sys1≔TransferFunction1−0.3⋅s⋅1+0.08⋅ss+1⋅2⋅s+1⋅0.4⋅s+1⋅0.2⋅s+1⋅0.05⋅s+13:
pid1 ≔ PIDAutosys1, 0.77
PIDAuto: Using Skogestad IMC tuning rules
pid1:=Recordpacked⁡Kp=2.077922078,Ki=0.6493506494,Kd=1.558441558,Tf=0.01558441558
Return a DynamicSystems system object directly.
pidsys1 ≔ PIDAutosys1, 0.77, 'returntype' = system: PrintSystempidsys1;
Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable=u1⁡soutputvariable=y1⁡stf1,1=1.590824759⁢s2+2.088041828⁢s+0.64935064940.01558441558⁢s2+s
Design a PID controller for an integrating process with desired time constant Tc = 1.0.
sys2 ≔ TransferFunction1s:
pid2 ≔ PIDAutosys2, 1.0
PIDAuto: Using PIDUnstable
pid2:=Recordpacked⁡Kp=2.,Ki=1.,Kd=0.,Tf=0
pidsys2 ≔ PIDAutosys2, 1.0, 'returntype' = system: PrintSystempidsys2;
Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable=u1⁡soutputvariable=y1⁡stf1,1=2.⁢s+1s
Existing PID tuning commands accept new options such as factored and returntype which are useful for specifying the way in which the controller parameters are returned. Use the option factored to return either the controller gains (proportional, integral, and derivative gain Kp, Ki, and Kd) or their factored version (proportional gain, integral time, and derivative time K, Ti, Td). Use the option returntype to return a record, a list or a system containing the controller parameters in either form or a DynamicSystems system object . The updated commands are CohenCoon, DominantPole, GainPhaseMargin, ZNFreq, and ZNTimeModified.
sys3 ≔NewSystems + 1/s^2 + s + 1:
fotd3 ≔ evalfParameterIdentify:-TimeDomainsys3
fotd3:=1.,1.414213562,1.
By default, the CohenCoon command returns a list containing the PID controller gains Kp, Ki, and Kd.
pid_list ≔ CohenCoonopfotd3, 'controller' = PID
pid_list:=2.152188309,1.079532192,0.7019962725
Using the new options factored and returntype, the CohenCoon command can return a record containing the factored version of the PID controller gains.
pid_rcrd ≔ CohenCoonopfotd3, 'controller' = PID, 'factored' = true, 'returntype' = record
pid_rcrd:=Recordpacked⁡K=2.152188309,Ti=1.993630504,Td=0.3261779044
By default, the DominantPole command returns a sequence of lists containing the controller gains ( Kp and Ki in this case) and the closed-loop poles.
pi_list ≔ DominantPolesys3, −3+2⋅I,−3−2⋅I, 'controller' = PI
pi_list:=478,918,−78,−3−2⁢I,−3+2⁢I
Using the option returntype, the DominantPole command can return a DynamicSystems system object directly.
pi_sys ≔ DominantPolesys3, −3+2⋅I,−3−2⋅I, 'controller' = PI, 'returntype' = system:PrintSystempi_sys
Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable=u1⁡soutputvariable=y1⁡stf1,1=47⁢s+918⁢s
Existing ControlDesign commands that accept DynamicSystems system objects as input now accept the parameters option. You can use this option to define numeric values for symbolic parameters existing in the system object. This option is the same as the DynamicSystems parameters option. For examples of its use see the sections below.
Two new commands ComputePoles and ComputeQR help with the calculation of the pole locations for Ackermann's formula and the Q and R weighting matrices for LQR design.
ComputePoles
The Ackermann command calculates the state feedback gain required in order to place the closed-loop poles in the desired locations. The ComputePoles automatically computes these pole locations such that the closed-loop system response has a desired time constant, Tc.
sys4≔StateSpaceMatrix⁡1,f,3,g,4,−1,2,5,7,Matrix⁡3,9,5,Matrix⁡1,0,0,0,1,0,0,0,1,Matrix⁡3,1:
PrintSystem⁡sys4
State Spacecontinuous3 output(s); 1 input(s); 3 state(s)inputvariable=u1⁡toutputvariable=y1⁡t,y2⁡t,y3⁡tstatevariable=x1⁡t,x2⁡t,x3⁡ta=1f3g4−1257b=395c=100010001d=000
params ≔ f=2,g=0:
τ ≔ 0.1:
p ≔ ComputePolessys4, τ, 'parameters' = params
p:=−1.124260354+3.158898890⁢I,−1.124260354−3.158898890⁢I,−10.
Kc≔StateFeedback:-Ackermannsys4,p, 'parameters' =params
ComputeQR
The LQR command calculates the linear quadratic state feedback regulator (LQR) gain given the weighting matrices Q and R. The ComputeQR command automatically computes these weighting matrices Q and R to obtain a closed-loop system with desired time constant, Tc.
QRmat≔ ComputeQRsys4, τ, 'parameters' = params
Kc≔LQRsys4,QRmat:-Q,QRmat:-R, 'parameters'=params
The new commands for system manipulation and simplification are ControllerObserver, PIDClosedLoop, StateFeedbackClosedLoop, and ReduceSystem.
ControllerObserver
The ControllerObserver command calculates the equations of the subsystem comprised of a state feedback controller and an observer. This command is useful, for example, to construct an LQG controller comprised of an LQR state feedback controller and a Kalman observer. Use the closedloop option to obtain the closed-loop equations of the system with state feedback and observer.
sys5≔StateSpaceMatrix⁡0,1,0,0,Matrix⁡α,1,Matrix⁡1,0,Matrix⁡1,1:
PrintSystem⁡sys5
State Spacecontinuous1 output(s); 1 input(s); 2 state(s)inputvariable=u1⁡toutputvariable=y1⁡tstatevariable=x1⁡t,x2⁡ta=0100b=α1c=10d=0
Define the numeric value for parameter α
param ≔ α=2:
Design the LQR controller
W ≔ ComputeQRsys5, 0.5, 'parameters' = param
Kc5,Kr5≔LQRsys5,W:-Q,W:-R, 'parameters' =param, 'return_Kr' = true
Design the Kalman observer
G1≔LinearAlgebra:-IdentityMatrixsys5:-statecount:
Q1≔23⋅ LinearAlgebra:-IdentityMatrixsys5:-statecount:
H1≔Matrix1,0:
R1≔Matrix2:
Kobs≔Kalmansys5,G1,H1,Q1,R1, 'parameters'=param1
Obtain the LQG controller.
LQG:=ControllerObserver⁡sys5,Kc5,Kobs, 'Kr'=Kr5, 'parameters'=param:
PrintSystem⁡LQG
Obtain the LQG control system closed-loop equations.
clLQG≔ControllerObserversys5,Kc5,Kobs, 'Kr'=Kr5, 'parameters'=param, 'closedloop'=true:
PrintSystem⁡clLQG
PIDClosedLoop
The PIDClosedLoop command calculates the closed-loop system equations of a feedback system with the controller Gc located in the forward path before the plant Gp and inside the feedback loop. The feedback system has unity negative feedback. This is a basic feedback structure commonly used for P/PI/PID control, hence the name of the command.
Gp ≔ TransferFunctionω2⁢As2+2⁢ω⁢θ⁢s+ω2:
Gc ≔ TransferFunctionkp+ki/s:
cl ≔ PIDClosedLoopGp, Gc:
PrintSystemcl
Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable=y1_ref⁡soutputvariable=y1⁡stf1,1=ω2⁢A⁢kp⁢s+ω2⁢A⁢kis3+2⁢ω⁢θ⁢s2+ω2⁢A⁢kp+ω2⁢s+ω2⁢A⁢ki
clnum ≔ PIDClosedLoopGp, TransferFunction0.5+0.1/s, 'parameters' = A=1, ω=1.2, θ=2:
PrintSystemclnum
Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable=y1_ref⁡soutputvariable=y1⁡stf1,1=0.7200000000⁢s+0.1440000000s3+4.800000000⁢s2+2.160000000⁢s+0.1440000000
Use the PIDClosedLoop command to access the controller output node through the augment_output option.
claug ≔ PIDClosedLoopGp, Gc, 'augment_output' = true:
PrintSystemclaug
Transfer Functioncontinuous2 output(s); 1 input(s)inputvariable=y1_ref⁡soutputvariable=y1⁡s,u1⁡stf1,1=ω2⁢A⁢kp⁢s+ω2⁢A⁢kis3+2⁢ω⁢θ⁢s2+ω2⁢A⁢kp+ω2⁢s+ω2⁢A⁢kitf2,1=kp⁢s3+2⁢kp⁢ω⁢θ+ki⁢s2+2⁢ki⁢ω⁢θ+kp⁢ω2⁢s+ω2⁢kis3+2⁢ω⁢θ⁢s2+ω2⁢A⁢kp+ω2⁢s+ω2⁢A⁢ki
StateFeedbackClosedLoop
The StateFeedbackClosedLoop command calculates the closed-loop system equations of a plant with state feedback. This command requires the state feedback gain matrix Kc, but can also accept the feed-forward matrix Kr to support a state feedback structure with control law uc=−Kc.x+Kr.r.
Kc, Kr≔StateFeedback:-Ackermannsys4,p, 'parameters' =params, 'return_Kr' = true
clsf ≔ StateFeedbackClosedLoopsys4, Kc, ':-Kr' = Kr, ':-parameters' = params:
PrintSystemclsf
ReduceSystem
The ReduceSystem command simplifies a state-space system by detecting and removing its structural unobservable and uncontrollable states. These struturally non-minimal states may occur, for example, as a result of extracting a subsystem from a subset of its inputs and/or outputs. The reduced state-space system is structurally minimal, that is, contains a subset of the original system states but preserves its state structure and variable names. The input/output response of the reduced system is equivalent to the transfer function of the original system.
sys6≔StateSpaceMatrixδ,0,−φ,σ,3,0,0,3,1,0,−1,1,0,0,0,0, Matrix5, z,−1,1,3,−x,0,2,y, 0,0,z, Matrix1,0,3,5, −3,0,σ,7, Matrix1,0,0,0,1,1:
PrintSystemsys6
State Spacecontinuous2 output(s); 3 input(s); 4 state(s)inputvariable=u1⁡t,u2⁡t,u3⁡toutputvariable=y1⁡t,y2⁡tstatevariable=x1⁡t,x2⁡t,x3⁡t,x4⁡ta=δ0−φσ300310−110000b=5z−113−x02y00zc=1035−30σ7d=100011
Get a subsystem with inputs u1(t) and u2(t). This subsystem is uncontrollable and unobservable.
subsys6 ≔ Subsystemsys6, 1,2: Controllablesubsys6, Observablesubsys6
false,false
Get a structurally minimal system removing the non-minimal (structural uncontrollable and unobservable) states.
redsys ≔ReduceSystemsubsys6:Controllableredsys, Observableredsys
true,true
PrintSystemredsys
State Spacecontinuous2 output(s); 2 input(s); 2 state(s)inputvariable=u1⁡t,u2⁡toutputvariable=y1⁡t,y2⁡tstatevariable=x1⁡t,x3⁡ta=δ−φ1−1b=5z02c=13−3σd=1001
Verify the input/output response is not affected by the removed states.
verifyTransferFunctionsubsys6:-tf, TransferFunctionredsys:-tf, 'Matrix'
true
ControlDesign, DynamicSystems
Download Help Document