Você está na página 1de 28

MATLAB and Simulink for Control Design Acceleration

Control Design

2006 The MathWorks, Inc.

Control Design

6-2

Section Outline

Uses of feedback Control design methods Time domain Frequency domain Control design tools

SISO tool Simulink Response Optimization

2006 The MathWorks, Inc.

Control Design

6-3

Uses of Feedback

Make things happen as closely as possible to some specification e.g. rise time.

Solve potential problems


Overshoot Oscillation Positioning errors Plant instability Place limits on parameters Reduce effect of plant uncertainty Make efficient use of control energy

2006 The MathWorks, Inc.

Control Design

6-4

Control Design Tools

The Control System Toolbox offers a variety of tools for designing and evaluating controllers

Root locus and Bode design (SISOTOOL) Pole placement LQR (Kalman filtering) techniques

The advanced control toolboxes offer alternative design techniques

Robust, Mu-Analysis, and Synthesis Fuzzy Logic, Neural Networks Model Predictive Control

>> doc control

2006 The MathWorks, Inc.

Control Design

6-5

Loop Shaping

Control system design essentially consists of shaping the nominal system in the frequency domain. This is typically done by adding transfer function terms to ensure: Enough roll-off at high frequency Enough gain at low frequency Good stability margins PID control is loop shaping with a constrained controller structure and is sufficient for many applications

2006 The MathWorks, Inc.

Control Design

6-6

Root Locus Diagram

Shows the effect of increasing gain k Diagram plotted from open loop plant, rlocus(G) Poles travel towards zeros or infinity as k increases Determination of destabilising gain

>> ms_transferfcn >> rlocus(ms_tf)


2006 The MathWorks, Inc.

Control Design

6-7

Root Locus Loop Shaping

Place dominant closed-loop poles in the desired region by changing the gain and by introducing additional poles and zeros.

2006 The MathWorks, Inc.

Control Design

6-8

Stability Margins

The amount by which gain and phase can change while still maintaining stability

Gain margin (GM) Phase margin (PM)

Gain Margin

Phase Margin

2006 The MathWorks, Inc.

Control Design

6-9

Frequency Domain Design



Phase-Lead Compensator PD is an ideal Phase-Lead Compensator Phase-Lag Compensator PI is an ideal Phase-Lag Compensator Lag-Lead and Lead-Lag

PID is an ideal lead-lag or lag-lead compensator These techniques can be used to change the phase and gain margins.

2006 The MathWorks, Inc.

Control Design

6 - 10

Phase-Lead

Phase-Lead
sz H ( s) k s p

z=1 p=5 peak=2.23 peak=6.98

z=1

p=5
2006 The MathWorks, Inc.

Control Design

6 - 11

Phase-Lag

Phase-lag
sz H ( s) k s p

z=5 p=1 peak=2.23 peak=-6.98

p=1

z=5
2006 The MathWorks, Inc.

Control Design

6 - 12

Lead-Lag and Lag-Lead


Lead-lag compensator Phase-lead and phase-lag cascade 1> 2 peak1< peak2
H (s) c (1 a 1s )(1 2 s ) (1 1s )(1 a 2 s )

Increases the magnitude of the system frequency response by 20log(a) in the range peak1-peak2 Lag-lead compensator Phase-lag and phase-lead cascade 1> 2 peak1< peak2
H (s) c (1 1s )(1 a 2 s ) (1 a 1s )(1 2 s )

Increases the magnitude of the system frequency response by -20log(a) in the range peak1-peak2
>> leadlaglaglead
2006 The MathWorks, Inc.

Control Design

6 - 13

Lead-Lag and Lag-Lead Plots


Lead-Lag Peak magnitude is 20*log10(5) Lag-Lead Peak magnitude is -20*log10(5)

peak1=1 peak2=100
>> leadlaglaglead

peak1=1 peak2=100

2006 The MathWorks, Inc.

Control Design

6 - 14

SISO Design Tool


Tools for adding controller poles and zeros

Zoom controls Feedback structure

Bode response Current control law Root locus Graphical display of open-loop, closed-loop, and controller poles and zeros Response Characteristics >> ms_transferfcn, sisotool(ms_tf) 2006 The MathWorks, Inc.

Control Design

6 - 15

Adding Design Constraints


Right-click and select New Design Constraint

Specify Settling Time

2006 The MathWorks, Inc.

Control Design

6 - 16

Adding a Controller

Controllers may be added and changed in several ways

1. Click here, and then drag the poles, zeros or gain in the Root Locus window.

2. Click in the Current Compensator box or on the red colored C block to see a controller editor GUI.
2006 The MathWorks, Inc.

Control Design

6 - 17

Viewing Responses (LTI Viewer)


Choose the Analysis menu to view time responses

Opens the LTI Viewer to display responses

2006 The MathWorks, Inc.

Control Design

6 - 18

Draw Simulink Diagram

LTI System block

2006 The MathWorks, Inc.

Control Design

6 - 19

Tuning the PID Gains


After the initial design there are several ways to further tune the controller

Adjust the gains by trial and error Write a custom optimization script Use the Optimization Toolbox Use Simulink Response Optimization

2006 The MathWorks, Inc.

Control Design

6 - 20

Simulink Response Optimization


Simulink Response Optimization offers designers the ability to: Optimize block parameters Place constraints on any signal

2006 The MathWorks, Inc.

Control Design

6 - 21

Using Simulink Response Optimization


Insert and connect the Signal Constraint block just like any other Simulink block

>> mass_spring_respopt

2006 The MathWorks, Inc.

Control Design

6 - 22

Specifying Constraints

There are two ways to specify constraints: Using the mouse to drag from the center point, end point or time boundary Right-clicking on a boundary and use the Constraint Editor
2006 The MathWorks, Inc.

Control Design

6 - 23

Specifying Tunable Parameters


Specify the tunable parameters by name

The tunable parameters must be specified. This is done using the Optimization->Tuned Parameters pull down menu
2006 The MathWorks, Inc.

Control Design

6 - 24

Running the Optimization


If left to run, the final response will be similar this

The constraint values that give this response can be loaded from mass_spring_constrains.mat.
2006 The MathWorks, Inc.

Control Design

6 - 25

Review: the Design Steps


We completed all steps in the design process: 1. Performance/control specifications 2. Model development 3. System analysis trim and linearize model 4. Controller design a.Import system into Control System Toolbox b.Design a controller, inspecting time and frequency domain response c. Use Simulink Response Optimization to further tune controller 5. Performance specification tests simulate complete system to see if specifications are met 6. Implementation
2006 The MathWorks, Inc.

Control Design

6 - 26

Additional Considerations
Real designs must take account of many of the following components Signal conditioning and prefilters Noise filters Notch filters Characteristics of the A/D and D/A converters Actuator dynamics Sensor dynamics Discretization of the controller Implementation of the controller
2006 The MathWorks, Inc.

Control Design

6 - 27

Implementation
Use Real-Time Workshop Rapid simulations: non-real time Rapid prototyping applications: hardware-in-the-loop Embedded system design: code generated for embedded systems
Rapid Simulation Deployment Code Generation

Prototyping Code
Hardware-inthe-Loop Simulation

Embedded System Test

Embedded Code

2006 The MathWorks, Inc.

Control Design

6 - 28

Summary Outline

Uses of feedback Control design methods Time domain Frequency domain Control design tools

SISO tool Simulink Response Optimization

2006 The MathWorks, Inc.

Você também pode gostar