Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to...

53

Transcript of Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to...

Page 1: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Block Diagrams

Tim Wescott

Wescott Seminarswww.wescottdesign.com/seminars.html

November 2, 2012

Page 2: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Outline

The Language of Blocks

Analyzing with Blocks

Block Diagrams

Page 3: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Why we use Blocks

I Block diagrams are the control engineer's UML

I (Except it's not universal, as we shall see)

I Trying to describe a system entirely in math or in Englishdrives us crazy

I Block diagrams allow us to capture both structure andbehavior

I Blocks can be identi�ed with physical subsystems or withobjects in software

I Blocks can express the system behavior with enough detail towrite equations directly

Page 4: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

The World's Simplest Block Diagram

I This is the world's simplest (non-trivial) block diagram.

I It shows a system, �thing�, which is operating on an inputsignal u and generating an output signal, y .

I It does not say what �thing� does; it only says that y dependson u in a manner speci�ed by �thing�.

Page 5: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Another Block Diagram

I Block diagrams can be useful even to people who aren't versedin them.

I This block diagram shows a simple and generic control loop.

I Block diagram language is more ad-hoc and �uid than UML,unless you are working with speci�c control-engineering CADsoftware.

Page 6: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Outline

The Language of Blocks

Block Diagram Elements

A Dictionary of Blocks

Block Diagram Dialects

Analyzing with Blocks

Block Diagrams

Page 7: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Signals

I Represent a signal with a line with an arrow indicating thedirection of signal �ow

I Annotate with a signal name as appropriate

I Signals can be scalar, vector, continuous-value or discrete,continuous-time or discrete

I If you bundle signals together into a vector, choose a sensibleset of signals

Page 8: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Blocks Operating on One Signal

I Represent as a rectangle

I Optionally with a name above or belowI With one signal in and one out, usually horizontalI Optionally with a function inside

I This block diagram indicates that

I the system implements the transfer function H (z),I which operates on u to generate yI presumably all in sampled time, because H is in z .

Page 9: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Blocks Operating on Multiple Signals

I Represent as a circle,

I with a symbol denoting the operation insideI with signals going in,I with a signal coming out,I and decorated with modi�ers to the operation

I This block diagram shows that y = u1 − u2

Page 10: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Blocks that Span Domains

I A sample block captures theinput signal value at thegiven time:

yk = u (k Ts)

or

yk2 = u (k1 N)

I In real practice, this will bean ADC or an explicitsampling circuit.

I A hold block takes on thevalue of a sampled-timesignal at the samplinginstant, and holds it untilthe next sampling instant:

y (t) = x

(⌊t

Ts

⌋)I In real practice this will be a

DAC or PWM.

Page 11: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

More General Blocks

I Can stand for anything�a subsystem, an unknown system, orjust a marker for �something is here�

I Leftmost is our �simplest block diagram�

I Middle shows a system that operates on multiple inputs anddelivers multiple outputs

I Rightmost shows a system with an �auxiliary� input, such as atrigger, or mode command, or other signal that doesn't �t inthe class of �normal� signals.

Page 12: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Outline

The Language of Blocks

Block Diagram Elements

A Dictionary of Blocks

Block Diagram Dialects

Analyzing with Blocks

Block Diagrams

Page 13: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Transfer function blocks

I Implements H (z):Y (z) = H (z)U (z)

I It's the generic form for atransfer function

I Implements a speci�ctransfer function

I In this case a discrete-timedi�erentiator:

Y (z) =z − 1

zU (z)

Page 14: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Blocks that Implement Functions

I Implements yk = f (uk)

I The dot inside means theinput value

I Use for memorylessfunctions only, please

I Implement a speci�cfunction

I In this case, yk = (uk)2

Page 15: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Showing functions graphically

I Indicate function by showing an in/out plot, in this case alimiter:

yk =

ymax uk ≥ ymax

uk ymin < uk < ymax

ymin uk ≤ ymin

I Can also indicate frequency-domain functions such asproportional-integral, lead-lag, lowpass, notch, etc.

Page 16: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Blocks that Show Memory

I Shows a continuous-timeintegrator:

y (t) =

ˆ t

0x (τ) dτ

I It's a way to show memoryin the time domain

I Shows a discrete-timeintegrator:

yk =k∑

n=0

u (n)

I it shows memory in thediscrete-time domain

I It maps straight to software

Page 17: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Outline

The Language of Blocks

Block Diagram Elements

A Dictionary of Blocks

Block Diagram Dialects

Analyzing with Blocks

Block Diagrams

Page 18: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Block Diagram Dialects

I Di�erent disciplines have di�erent dialects of the language.

I The dialect changes over time, and with the practitioner

I Do not be surprised or dismayed if you are shown a diagramthat doesn't exactly �t.

I Ask questions�it's expected.

Page 19: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Outline

The Language of Blocks

Analyzing with Blocks

Block Diagrams

Page 20: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Outline

The Language of Blocks

Analyzing with Blocks

Direct Equation Extraction

Manipulating Block Diagrams

Multiple Inputs or Multiple Outputs

Block Diagrams

Page 21: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

A Fully-de�ned System

I This shows a system that is commanded to generate a certainaerodynamic thrust

I This thrust command is turned into a motor speed command

I The motor speed command is applied to a feedback loop todrive the motor

I The motor, in turn, drives a propeller

Page 22: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Blocks to Equations

I The motor speed command is the square root of the thrustcommand: uω =

√ut

I The motor speed is controlled with a PI controller,

I So the motor drive is calculated from the error between actualspeed and commanded speed, and from its discrete-timeintegral: um = kp (uω − ωm) + ki

∑t

0(uω − ωm)

I The motor speed is an (unknown) function of the motor drive:ωm = g (um, k)

I The propeller thrust is the square of the motor speed: ft = ω2m

I These equations are nonlinear, so we can't go further in ouranalysis, and must resort to linearizing around some operatingpoint, or simulating the system.

Page 23: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Outline

The Language of Blocks

Analyzing with Blocks

Direct Equation Extraction

Manipulating Block Diagrams

Multiple Inputs or Multiple Outputs

Block Diagrams

Page 24: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Motivations

I Structural diagrams let you see the shape, but not the behavior

I Translating straight to math works, but then we're back inmath-land, and clarity can be lost

I There are long-developed techniques which let you reduce alarge diagram with simple blocks into a small diagram with few(or one) big block.

Page 25: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

When you can

I The methods shown here depend on the properties of transferfunctions, so they only work when the constraints oftransfer-function design are not violated.

I If your system is linear, and shift-invariant (or time-invariantand entirely within the continuous-time domain) then you can.

Page 26: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

When you can't

I If your system is nonlinear

I But sometimes you can use clever transformations to exactlymodel a nonlinear system as linear

I And often you can approximate a nonlinear system as a linearone and proceed.

I But before you proceed, you need all linear blocks.

I If your system is shift- or time-varying (a sampling stage or ahold block are time-varying)

I But sometimes you can move a sampling or a hold block, andreduce everything on one side of it

Page 27: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Loop Reduction

I Turn a loop into one block.I Output is a function of error: Y (z) = E (z)G (z)I Error is a function of output and input:

E (z) = U (z)− Y (z)H (z)I Substituting: Y (z) = [U (z)− Y (z)H (z)]G (z)I And solving:

Y (z)

U (z)=

G (z)

1+ H (z)G (z)

Page 28: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Cascading Blocks

I Turn two blocks in cascade into one

I The signal in the middle is a function of the input:X (z) = U (z)G1 (z)

I The output is a function of the intermediate signal:Y (z) = X (z)G2 (z)

I They are easily put together: Y (z) = U (z)G1 (z)G2 (z), so

Y (z)

U (z)= G1 (z)G2 (z)

Page 29: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Summing Junctions

I Reduce two blocks and a summing junction to one block

I The two intermediate signals are functions of the input:X1 (z) = U (z)G1 (z), X2 (z) = U (z)G2 (z)

I The output is their sum: Y (z) = U (z)G1 (z) + U (z)G2 (z).Collecting, we get Y (z) = U (z) [G1 (z) + G2 (z)]. Solving forY (z)/U(z):

Y (z)

U (z)= G1 (z) + G2 (z)

Page 30: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

An Example

I Let us say that we have a DC motor, which is driven by acurrent ampli�er and has its speed sensed one way or another.

I A DC motor with a constant current drive, will have a torquethat is proportional to the drive. This means that the transferfunction from drive to motor speed will be an integrator:

G (z) =km

z − 1

I If we use a proportional-integral controller for good speedregulation. The block diagram might be like this:

Page 31: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

An Example, page 2

I We would like to reduce the block diagram above, to �nd thetransfer function of the system.

I We could just go straight to math�but block manipulationmay be easier.

I First, take care of the controller by eliminating the innersumming junction:

Page 32: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

An Example, page 3

I Now we have the controller taken care of, lump the controllertogether with the plant:

I (Note that the block's transfer function is what is known asthe �open loop� transfer function).

I Now remember that the transfer function of a wire is 1, anduse loop reduction:

Page 33: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

An Example, page 4

I Finally, we simplify our transfer function, to get

I At this point, we could plug in numbers for km, kp, and ki ,and get an idea of how our system might behave.

I Alternately, we could start with a desired system behaviorderived from some performance bounds, a measured orcalculated value of km, then �nd kp and ki .

Page 34: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Moving Summing Junctions

I Summing junctions can get in the way of loop reduction,cascading gains, and other operations.

I Sometimes you want to move a summing junction from oneside of a block to another: this can be done.

I This is just a graphical representation of the commutativeproperty of multiplication: if Y (z) = [U1 (z) + U2 (z)]G (z),then Y (z) = U1 (z)G (z) + U2 (z)G (z)

Page 35: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

More Moving Summing Junctions

I You can move a summing junction backward through a block,too:

I This is the same principal as before, except that we need tofake up the transfer function 1/G(z)

I that transfer function may not be at all realizable.I But keep in mind that at this point you're pretty much playing

with the math anyway.

Page 36: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

A Summing Junction Example

Say that you want a loop that uses feed-forward to do the heavylifting of getting a plant where you want it, but you need feedbackto clean up around the edges. You might end up with:

Page 37: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

A Summing Junction Example, page 2

I The loop has two summing junctions, which means that youcan't use the loop reduction rule.

I What to do?

I Move the inner summing junction back through H2, merging itwith the outer junction, or

I Move the outer summing junction forward through H1,merging it with the inner junction

I Either way, you have a de�nite loop.

I I will move the outer summing junction forward, because itavoids the 1/H2 term.

Page 38: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

A Summing Junction Example, page 3

I We can now see, by inspection, that the transfer function is

T (z) = (H1 (z) + H2 (z))G (z)

1+ G (z)H2 (z)

Page 39: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Outline

The Language of Blocks

Analyzing with Blocks

Direct Equation Extraction

Manipulating Block Diagrams

Multiple Inputs or Multiple Outputs

Block Diagrams

Page 40: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Multiple Input Systems

I All the systems we've analyzed so far are single-input,single-output (SISO) systems.

I A multiple-input, single output system might be called a MISOsystem.

I Systems can be more complex: they can have multiple inputs,multiple outputs, or both.

I You can use block diagrams to analyze linear systems withmore than one input or output

Page 41: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Treating Multiple Input Systems

I The fundamental tool that you use for analyzing linear systemswith multiple inputs is superposition.

I Remember that superposition says that given two inputsignals, a linear system will give the result

h (x1 + x2) = h (x1) + h (x2)

I Superposition extends to systems with inputs coming in atdi�erent spots.

I To analyze the system's response to two signals, hold onesignal at zero and �nd the response to the other one, thenrepeat.

Page 42: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Multiple-Input Example

I Here's an example system, with the plant split out intoactuator and mechanism.

I The controller commands the actuator, which �pushes� on themechanism.

I But the mechanism is also disturbed by some outside in�uence

I We would to quantify the degree to which that disturbance isrejected

Page 43: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Multiple-Input Example, page 2

I If we assume that the disturbance is zero, then the transferfunction from the intended input to the output is

Ti (z) =Y (z)

Ui (z)=

G (z)H1 (z)H2 (z)

1+ G (z)H1 (z)H2 (z)

I If we assume that the input is zero, then the transfer functionfrom the disturbance to the output is

Td (z) =Y (z)

Ud (z)=

H2 (z)

1+ G (z)H1 (z)H2 (z)

I Important things to note:

I the denominator the same in both cases,I and the transfer functions are closely related:Ti (z) = G (z)H1 (z)Td (z).

Page 44: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Multiple-Input Example, page 3

I Let's say that the block diagram in question is the heatercontrol system from day 1, with

I G = 500 z−1

z+ 50+ 1.0 z

z−1, H1 = 0.1, H2 =

0.0018z(z−0.97)(z−0.94)

I We'd like to know what the response to a step change inambient temperature is, so we calculate

Td (z) =Y (z)

Ud (z)=

0.0018z(z−0.97)(z−0.94)

1+(50 z−1

z+ 5+ 0.1z

z−1

)(0.0018z

(z−0.97)(z−0.94)

)I or

Td (z) =Y (z)Ud (z)

= 0.0018(z−1)z(z−1)(z−0.97)(z−0.94)+(55.1z2−105z+50)(0.0018)

I or Td (z) =Y (z)Ud (z)

= 0.0018(z−1)zz3−2.81082z2+2.6328z−0.8218

Page 45: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Multiple-Input Example, page 4

Td (z) =Y (z)

Ud (z)=

0.0018 (z − 1) z

z3 − 2.81082z2 + 2.6328z − 0.8218

I You can �gure out the step response from this, but there aretwo salient points to note:

1. The roots of the denominator arez ∈ {0.9740, 0.9184± j0.0161}. All three roots are stable, sothe system is stable

2. If you apply the �nal value theorem to the step response ofTd , the answer is

ydist = limz→1

((z − 1)

(z

z − 1

)Td (z)

)= 0

which means that the steady-state error is zero. This is due tothe zero at z = 0 in the numerator of Td , which is, in turn,due to the integrator in the controller.

Page 46: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Multiple-Input Example, page 5

I Here is a Bode plot showing the response of the system to acommand and to changes in ambient temperature

I The response to ambient temperature goes to zero as thefrequency goes to zero�that's the same as it's response to astep going to zero at in�nite time.

Page 47: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Multiple Output Systems

I A dual of the multiple-input, single-output system is the singleinput, multiple-output (SIMO).

I Analysis proceeds similarly to the MISO system: ignore oneoutput, �nd the transfer function, then ignore the other outputand �nd the transfer function.

Page 48: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Multiple-output example

I We want to control a plant and insure that the plant output,y , is correct.

I But we also want to make sure that the plant drive, ud isreasonable.

I So we �nd the transfer function from input to drive, and inputto plant output:

IUd (z)U(z) = H(z)

1+H(z)G(z) and Y (z)U(z) = H(z)G(z)

1+H(z)G(z)

Page 49: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Multiple-output example, page 2

I Let's say that the plant in question are a motor with amechanical time constant of 20ms, being driven by a voltage,and with its position taken as the output variable.

I After sampling, this motor will have a transfer function of

G (z) = 0.002(z+1)(z−0.95)(z−1) .

I Assume that we're going to drive this with aproportional-derivative controller

I with a transfer function H (z) = 2+ 50 z−1

z

Page 50: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Multiple-output example, page 3

I Here is the bode plot of the system, for the motor position andmotor drive

I Note the high gain on the motor drive at highfrequencies�this will bite us

Page 51: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Multiple-output example, page 4

I Motor response is nice and snappy

I Motor drive goes sky-high (up to 52), then the rest of the timeis spent braking

I In a real system the drive would probably limit, slowing thingsdown at best

Page 52: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Outline

The Language of Blocks

Analyzing with Blocks

Block Diagrams

Page 53: Block Diagrams - Wescott Design · Another Block Diagram I Block diagrams can be useful even to people who aren't versed in them. I This block diagram shows a simple and generic control

Block diagrams

I Block diagrams are a versatile and accessible way to describecontrol systems

I They can work at all levels from the abstract down to thenitty-gritty

I If you constrain your blocks correctly (i.e., make them linearand shift-invariant) you can analyze system behavior withblock diagrams

I Block diagrams can be you all the way from architecturalreview through to a �nished product.