design of the hctl-1000’s/1100’s digital filter parameters by ......introduction the objective...

28
MOTION SENSING APPLICATIONS 2-199 H Design of the HCTL-1000’s/1100’s Digital Filter Parameters by the Combination Method Application Note 1032 Table of Contents Introduction ............................................................................ 2-199 Open loop vs. closed loop control systems .......................... 2-200 Theory ...................................................................................... 2-200 Open loop system modeling ................................................ 2-200 Bode Plots ............................................................................ 2-201 Summary of the Design Procedure ....................................... 2-202 The HCTL-1000’s digital filter design procedure .............. 2-202 System Modeling .................................................................... 2-203 Modeling the system components in the S-plane .............. 2-203 Introduction to the open loop transfer function ......................... 2-203 The zero-order-hold (ZOH) .......................................................... 2-204 The digital to analog converter (DAC) ........................................ 2-204 The amplifier ................................................................................ 2-205 The motor ..................................................................................... 2-205 The encoder .................................................................................. 2-207 Determination of the open loop system transfer function ......... 2-207 Determination of the gain crossover frequency, phase crossover frequency, gain margin, and phase margin of the open loop transfer function .............................................. 2-207 Modification of the open loop system using compensation ........ 2-209 Generation of new desired open loop characteristics ................. 2-209 Determination of the phase margin and gain of the open loop transfer function ............................................. 2-209 Design of the digital compensation filter of the HCTL-1000 ..... 2-210 Characteristics of the HCTL-1000’s digital filter ....................... 2-210 The combination method and the phase and magnitude graphs ....................................................................... 2-210 Generation of the phase and magnitude graphs ........................ 2-210 Determination of HCTL-1000’s digital filter parameters .......... 2-211 Appendices ............................................................................... 2-213 Appendix A: Design example of a system with voltage source amplifier ..................................................... 2-213 Appendix B: Design example of a system with a current source amplifier ..................................................... 2-219 Appendix C: Symbols for quantities and their units .......... 2-225 Bibliography .......................................................................... 2-226 Introduction The objective of this application note is to explain the combina- tion method and to show how it can be used for calculation of the HCTL-1000’s digital compensa- tion filter parameters to provide a stable, closed loop position control system. One of the primary advantages of digital closed loop control is that digital compensation can be added to the system to provide the desired closed loop response. Although the HCTL-1000 is a digital controller that employs a discrete sampling rate, the combination method allows the user to model all the system components as continuous (or analog) in the s-plane. This allows the designer to use the experience gained in s-plane, analog control theory to design with the HCTL-1000’s digital compensation filter. This appli- cation note shows the designer how the combination method can be used for digital compensation design with position control systems that employ a DC motor, an amplifier, an incre- mental encoder, and the HCTL- 1000. The amplifier can be a current or voltage source ampli- fier. The HCTL-1000 provides an 5964-3922E

Upload: others

Post on 25-Aug-2021

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Design of the HCTL-1000’s/1100’s Digital Filter Parameters by ......Introduction The objective of this application note is to explain the combina-tion method and to show how it

MO

TIO

N S

ENSI

NG

APPL

ICAT

ION

S

2-199

H

Design of the HCTL-1000’s/1100’sDigital Filter Parameters bythe Combination Method

Application Note 1032

Table of ContentsIntroduction ............................................................................ 2-199

Open loop vs. closed loop control systems .......................... 2-200Theory ...................................................................................... 2-200

Open loop system modeling ................................................ 2-200Bode Plots ............................................................................ 2-201

Summary of the Design Procedure ....................................... 2-202The HCTL-1000’s digital filter design procedure .............. 2-202

System Modeling .................................................................... 2-203Modeling the system components in the S-plane .............. 2-203 Introduction to the open loop transfer function ......................... 2-203 The zero-order-hold (ZOH) .......................................................... 2-204 The digital to analog converter (DAC) ........................................ 2-204 The amplifier ................................................................................ 2-205 The motor ..................................................................................... 2-205 The encoder .................................................................................. 2-207 Determination of the open loop system transfer function ......... 2-207 Determination of the gain crossover frequency, phase crossover frequency, gain margin, and phase margin of the open loop transfer function .............................................. 2-207Modification of the open loop system using compensation ........ 2-209 Generation of new desired open loop characteristics ................. 2-209 Determination of the phase margin and gain of the open loop transfer function ............................................. 2-209Design of the digital compensation filter of the HCTL-1000 ..... 2-210 Characteristics of the HCTL-1000’s digital filter ....................... 2-210 The combination method and the phase and magnitude graphs ....................................................................... 2-210 Generation of the phase and magnitude graphs ........................ 2-210 Determination of HCTL-1000’s digital filter parameters .......... 2-211

Appendices ............................................................................... 2-213Appendix A: Design example of a system with voltage source amplifier ..................................................... 2-213Appendix B: Design example of a system with a current source amplifier ..................................................... 2-219Appendix C: Symbols for quantities and their units .......... 2-225Bibliography .......................................................................... 2-226

IntroductionThe objective of this applicationnote is to explain the combina-tion method and to show how itcan be used for calculation of theHCTL-1000’s digital compensa-tion filter parameters to providea stable, closed loop positioncontrol system.

One of the primary advantagesof digital closed loop control isthat digital compensation can beadded to the system to providethe desired closed loop response.Although the HCTL-1000 is adigital controller that employs adiscrete sampling rate, thecombination method allows theuser to model all the systemcomponents as continuous (oranalog) in the s-plane. Thisallows the designer to use theexperience gained in s-plane,analog control theory to designwith the HCTL-1000’s digitalcompensation filter. This appli-cation note shows the designerhow the combination method canbe used for digital compensationdesign with position controlsystems that employ a DCmotor, an amplifier, an incre-mental encoder, and the HCTL-1000. The amplifier can be acurrent or voltage source ampli-fier. The HCTL-1000 provides an

5964-3922E

Page 2: Design of the HCTL-1000’s/1100’s Digital Filter Parameters by ......Introduction The objective of this application note is to explain the combina-tion method and to show how it

2-200

8 bit motor command port for alinear amplifier and a sign andpulse signal for a pulse widthmodulated amplifier. Digitalcompensation filter parametersfor two example closed loopsystems employing the HCTL-1000 will be designed in appendi-ces A and B of this applicationnote to illustrate the use of thecombination method.

The Hewlett-Packard HCTL-1000 is a high performance,general purpose, digital motioncontrol IC which can be used inmicroprocessor based, digitalclosed loop systems. The HCTL-1000 is designed to communicatewith a host microprocessorthrough an 8 bit parallel I/O portas shown in Figure 1. Commandsfrom the host processor are usedby the HCTL-1000 to control anamplifier/motor combination. Amotor with an incremental shaftencoder such as a Hewlett-Packard HEDS-5500 encoder isconnected to the amplifier. Theencoder’s quadrature output isthen fed back into the HCTL-1000 to “close the loop”.

Open Loop vs. ClosedLoop (Feedback)Control Systems:A block diagram of an open loopcontrol system is shown inFigure 2. The input to an openloop control system is indepen-dent of the output of the system.Therefore, if the open loopsystem does not provide thedesired response to an input, theerror between the actual re-sponse and the desired responseof the system will not be de-tected. Figure 1 shows the blockdiagram of a closed loop controlsystem. Closed loop controlsystems compare their actualoutput with a desired commandinput and use the difference

between them to regulate thesystem’s output. Some of theadvantages of closed loop controlsystems over open loop systems are:

A. Increased accuracy of thesystem’s response to an input.

B. Increased system bandwidth(speed). The bandwidth of asystem is the range frequen-cies over which a system willrespond “satisfactorily” to aninput. The system’s band-width is a measure of thespeed of the system’s re-sponse. The terms “band-width” and “satisfactoryresponse” are explained inmore detail in the section ofthis application note “BodePlots: Gain CrossoverFrequency, Phase CrossoverFrequency, Gain Margin, PhaseMargin, and SystemBandwidth”.

The disadvantage of closed loopcontrol systems is that they canbecome unstable and oscillate. TheHCTL-1000 has a built in, pro-grammable digital filter for com-pensation to increase the stabilityof the system. In this applicationnote, the combination method will

HOST MICROPROCESSOR HCTL–1000 AMP

INCREMENTAL ENCODER

(HEDS-5500)

MOTORLOAD

8

Figure 1. Block Diagram of a Closed Loop Motion Control System with theHCTL-1000.

CONTROLLER AMP

MOTOR LOAD

Figure 2. Block Diagram of an Open Loop System.

be used to determine values for theHCTL-1000’s digital filter that willmake the closed system stable.

TheoryComponent Transfer Functionsand the Open Loop SystemModel:Each of the components in an openor closed loop system can bemodeled mathematically by usingthe “transfer function” of thecomponent. The transfer functionmodels the dynamics of a compo-nent by relating the component’soutput to its input. The transferfunctions of commonly used compo-nents can be found in most books oncontrol systems.

A block diagram represents thephysical system mathematicallyby showing the transfer functionsof each component in its block ofthe diagram. A typical blockdiagram with its transfer functionis shown in Figure 3. The param-eters in each transfer functionmust be determined to accuratelymodel the system. The response ofopen loop system is then modeledwith a Bode plot to determine thestability and performance of thesystem when the loop is closed.Based on the characteristics of

Page 3: Design of the HCTL-1000’s/1100’s Digital Filter Parameters by ......Introduction The objective of this application note is to explain the combina-tion method and to show how it

MO

TIO

N S

ENSI

NG

APPL

ICAT

ION

S

2-201

the open loop system, theHCTL-1000’s programmabledigital filter parameters A, B,and K can be calculated usingthe combination method. Whenthe properly calculated valuesof A, B, and K are programmedinto the HCTL-1000, the closedloop system will respond in astable fashion with the desiredperformance when the systemis run in its linear region ofoperation. (i.e.. No componentin the system is saturated duringthe step response.)

This application note assumesthat the reader has a generalworking knowledge of analogcontrol design methods.Specifically, the reader should befamiliar with Laplace transforms,the s domain, pole/zero concepts,and Bode plots. Workingknowledge of Bode plots isespecially important forunderstanding the combinationmethod for digital compensationfilter design. It is for this reasonthat Bode plot design techniquesare reviewed in the next section.

Bode Plots: Gain CrossoverFrequency, Phase CrossoverFrequency. Gain Margin, Phase

Margin, and System Band-width:Bode plots are used to model thefrequency characteristics and therelative stability of a system. ABode plot consists of two graphs:the magnitude and the phase ofa transfer function of a systemplotted as a function of fre-quency. The substitution s = jωtransforms the s domain transferfunction into a complex numberwhose magnitude and phase canbe directly computed at anyfrequency (ω). The Bode plotprovides two values which areused to determine the stabilityand performance of a closed loopsystem from plots of the openloop system. These two valuesare known as the phase marginand the gain margin.

Figure 4 shows a Bode plot of thetransfer function representingthe block diagram and transferfunction shown in Figure 3. Thefrequency at which the open loopgain is 1 (0 db) is called the gaincrossover frequency (ωC). Thefrequency where the phase angleis -180 degrees is called thephase crossover frequency ((ωP).The gain margin (GM) is definedas the magnitude of the openloop transfer function evaluatedat the phase crossover frequencyand referenced to the 0 db axis.

The phase margin (PMU) is definedas the sum of the phase angle of theopen loop transfer function evalu-ated at the gain crossover frequencyplus 180 degrees. In cases whereboth the phase and gain margins ofthe open loop transfer function arepositive and there are no poles orzeros in the right half of the s-plane,the closed loop system will be stable.

In this application note thephase of the system componentsand transfer functions will becalculated in radians. When aBode plot is generated the phaseand phase margin will be plottedin degrees. The conversion factorfrom radians to degrees is:

1 radian = 57.296 degrees. (1)

Similarly, the magnitude of thesystem components and transferfunctions will be calculated asdecimal quantities (i.e. X.XXX)while the magnitude and gainmargin will be plotted on a Bodeplot in decibels (db). The conversionfactor from decimal to db is:

db = 20 log (decimal) (2)

Use of these conversions isstandard practice in motioncontrol design.

The phase margin of a system isa measure of the system’s stabil-

D (z) =K (z – A)

(z + B)e – 0.000265

HCTL-1000's DIGITAL FILTER

ZERO ORDER HOLD

INTERNAL TO THE HCTL-1000

DIGITAL TO ANALOG CONVERTER

AMP MOTOR (INCLUDES

LOAD)

POSITION INCREMENTAL ENCODER

SPEED (ω)

POSITION (θ)

31.74

(0.01497s + 1)

1

SPOSITION COMMAND INPUT (COUNTS)

COUNTS

VOLTS

THE OPEN LOOP TRANSFER FUNCTION IS:

VOLTS

KD = 0.039 KA = 2.0

[4][256]

OUTPUT POSITION (θE)

M(s) =403.56e-0.000265

s (0.01497s +1)

Figure 3. Open Loop Block Diagram of the Example System with a Voltage Source Amplifier.

Page 4: Design of the HCTL-1000’s/1100’s Digital Filter Parameters by ......Introduction The objective of this application note is to explain the combina-tion method and to show how it

2-202

ity. The higher the phase marginof the open loop system, the morestable the closed loop systembecomes. The designer selects acompensated phase margin (PHC)to provide the desired closed loopsystem response to a step inputand then designs a compensator(digital filter) to provide thedesired phase margin. A compen-sated phase margin of 30 to 60degrees is generally recom-mended for stable designs.Figure 5 shows the effect ofdifferent compensated phasemargins on the step response ofan actual closed loop systememploying a small DC motor,and a voltage source amplifier.

Increasing the gain margin ofthe open loop system also in-creases the stability of the closedloop system. The combinationmethod does not directly assistthe designer in easily computinga new gain margin for thecompensated system.

The system bandwidth is therange of frequencies over which asystem will respond “satisfacto-rily” to an input. “Satisfactoryresponse” of the system isdefined as the range of frequen-cies over which the magnitude ofthe Bode plot does not differ fromits DC value by more than -3db.

In this application note, theclosed loop bandwidth (BW) willbe approximated as equal to theopen loop gain crossoverfrequency (ωC) for systems witha high phase margin:*

ωC ≅ BW (3)

For systems with a low phasemargin, the bandwidth (BW) isgreater than or equal to the gaincrossover frequency (ωC) of thesystem and a correspondingincrease in overshoot occurs;*

BW ≥ ωC (4)

*Note: These approximations are basedon a two pole dominant closed loopsystem model.

For more information on ap-proximating the closed loopbandwidth by the desired openloop gain crossover frequencyand other relationships in thesesystems involving bandwidth,gain crossover frequency,risetime, falltime, percentovershoot, etc. several referenceson motion control are listed in

the bibliography at the end ofthis application note.

Summary of the DesignProcedureThe HCTL-1000’s Digital FilterDesign Procedure Using theCombination Method:The procedure recommended in thisapplication note for designingclosed loop systems that employ theHCTL-1000’s digital filter is asfollows:

A. Choose a motor to drive therequired load. One com-

Figure 4. Bode Plot for the Open Loop System and Transfer Function Shown inFigure 3.

Figure 5. Shaft Position vs. Time for a Selection of Phase Margins.

40

30

20

10

0

SH

AF

T P

OS

ITIO

N (

QU

AD

RA

TU

RE

EN

CO

DE

R C

OU

NT

S)

0 6 12 18 24 30TIME – MILLISECONDS

30°

40°

50°

60°

NOTE: THIS IS THE RESPONSE OF AN ACTUAL BENCHTOP SYSTEM WITH FRICTION TO A STEP INPUT COMMAND OF 25 QUADRATURE ENCODER COUNTS. (25 QUADRATURE ENCODER COUNTS – 8.79° OF ANGULAR ROTATION FOR THIS SYSTEM.)

(1,000)60

40(100)

20(10)

0(1)

-20(0.1)

-40(0.01)

-60(0.001)

-80(0.0001)

-60°(-1.05)

-80°(-1.39)

-100°(-1.74)

-120°(-2.09)

-140°(-2.44)

-160°(-2.79)

-180°(-3.14)

-200°(-3.49)

MA

GN

ITU

DE

– d

b (

DE

CIM

AL

)

PH

AS

E –

DE

GR

EE

S (

RA

DIA

NS

)

1 2 4 6 10 20 40 60 100 200 400 600 1,000FREQUENCY (ω) – RADIANS/SECOND

MAGNITUDE – MU (ω)

GM = 19.42 dB

PH = 20.27°

ωc

ωp

PHASE – PHU(ω)

Page 5: Design of the HCTL-1000’s/1100’s Digital Filter Parameters by ......Introduction The objective of this application note is to explain the combina-tion method and to show how it

MO

TIO

N S

ENSI

NG

APPL

ICAT

ION

S

2-203

mon criteria for choosing amotor is based on the ratio ofthe torque developed by themotor to the moment ofinertia of the motor’s armatureand the load. It is desirable tochoose a motor with a lowarmature inertia that candevelop a high torque to quicklyaccelerate and decelerate theload (i.e. the motor has a hightorque constant [KT])

B. Choose a digital incrementalencoder with quadratureoutput to monitor the posi-tion of the motor’s shaftbased on the encoder resolu-tion and accuracy requiredfor the application.

C. Choose an amplifier to drivethe motor. The amplifiermust be capable of supplyingthe current and voltagerequired by the motor for theload conditions.

D. Model the open loop transferfunction of the system usings-plane transfer functions. ABode plot showing the phasemargin and gain margin ofthe open loop system canthen be drawn from the openloop transfer function.

E. Choose the desired closedloop response (step responseand bandwidth). The desiredphase margin and gaincrossover frequency for thecompensated system canthen be determined from thedesired closed loop response.

F. Design the HCTL-1000’sdigital compensation filterbased on the desired phasemargin and gain crossoverfrequency for the compen-sated system.

System ModelingModeling the System Compo-nents in the S-Plane: The OpenLoop Transfer Function

Introduction to the open looptransfer function:Figures 6A and 6B show openloop block diagrams for systemswhich include a controller (theHCTL-1000’s digital filter andthe zero-order-hold representingthe HCTL-1000’s digital sam-pling delay), an amplifier, amotor, a load, and an incremen-tal encoder. The block diagram inFigure 6A shows an open loopmotion control system thatemploys a voltage source ampli-fier. The block diagram includesboth the mechanical time con-stant of the motor and theelectrical time constant of themotor. The block diagram shownin Figure 6B is used for systemsthat employ a current source

D (z) =K (z – A)

(z + B)

HCTL-1000's DIGITAL FILTER

ZERO ORDER HOLD

DIGITAL TO ANALOG CONVERTER

AMP MOTOR (INCLUDES

LOAD)

POSITION INCREMENTAL ENCODER

SPEED (ω)

POSITION (θ)

1

SPOSITION COMMAND INPUT (COUNTS)

COUNTS

M(s) =

VOLTS

THE OPEN LOOP TRANSFER FUNCTION IS:

VOLTSKD KA

[4][N]

OUTPUT POSITION (θE)

INTERNAL TO THE HCTL-1000

e

–st

2( ) KMV

(sTm + 1)(sTE + 1)

1

SKD KA

[4][N]

2πe

–st

2( ) KMV

(sTm + 1)(sTE + 1) [ ] [ ] [ ] [ ][ ] [ ]Figure 6a. The Open Loop Transfer Function of a System with a Voltage Source Amplifier. Note that the motor modelincludes the mechanical time constant (Tm) and the electrical time constant (TE) of the motor.

D (z) =K (z – A)

(z + B)

HCTL-1000's DIGITAL FILTER

ZERO ORDER HOLD

DIGITAL TO ANALOG CONVERTER

AMP MOTOR (INCLUDES

LOAD)

POSITION INCREMENTAL ENCODER

SPEED (ω)

POSITION (θ)

1

SPOSITION COMMAND INPUT (COUNTS)

COUNTS

M(s) =

VOLTS

THE OPEN LOOP TRANSFER FUNCTION IS:

AMPSKD KA

[4][N]

OUTPUT POSITION (θE)

INTERNAL TO THE HCTL-1000

e

–st

2( ) KMC

s

1

SKD KA

[4][N]

2πe

–st

2( )[ ] [ ] [ ] [ ][ ] [ ]KMC

s

Figure 6b. The Open Loop Transfer Function of a System with a Current Source Amplifier.

Page 6: Design of the HCTL-1000’s/1100’s Digital Filter Parameters by ......Introduction The objective of this application note is to explain the combina-tion method and to show how it

2-204

amplifier. This model does notuse the electromechanical timeconstants of the motor.

The open loop transfer functionM(s) for these systems is deter-mined by multiplying all of theindividual component transferfunctions together.

M(s) = [DAC gain (if used)] [Zeroorder hold] [Amp gain][Motor transfer function][encoder quadraturecounts/(2 π)] (5)

The following sections describe themethod for determining the transferfunction of each component, deter-mining the magnitude and phasecontribution of each component,computing the open loop transferfunction of the system, and thendrawing a Bode plot of the open loopsystem.

The Zero Order Hold (ZOH)transfer function:The zero order hold (ZOH) modelsthe delay of the discrete samplingtime of the HCTL-1000. The transferfunction (Z(s)) of the zero order hold(ZOH) is:

Z(s) = e-st/2 (6)

Where:t = the sampling time (ie. timebetween successive samples) ofthe HCTL-1000 (in seconds).

This transfer function of theZOH allows the designer tomodel the time delay of theHCTL-1000 as a continuouselement in the system. Analog,s-plane design techniques cantherefore be used to analyze thesystem.

The ZOH’s contribution to thephase (PZOH(ω)) of the open looptransfer function is:

Where:

ω = the frequency of interest (inradians/sec)

t = the sampling time of theHCTL-1000 (in seconds)

Phase lag is added to the systemby increasing the time delaybetween successive samples ofthe ZOH. It is usually desirabletherefore to choose the fastestsampling time possible so as toinduce the least amount of phaselag. Generally, the samplingfrequency (1 /t) should exceedthe system bandwidth (in hertz)at least tenfold:

Sampling time (t) < [1/10 Systembandwidth)] (8)

The ZOH provides unity gain atall frequencies of the system.

The sampling time (t), can beprogrammed into theHCTL-1000 through registerROFH. The sampling time (t)can be determined from theequation:

t = [16] [ROFH + 1] [1/fCLK] (seconds) (9)where:

t = sample time (in seconds)

fCLK = freq- of the HCTL-1000’sexternal clock (1 or 2MHz)

ROFH = sample timer register

The limits of minimum values(ie. fastest sampling times) thatcan be programmed into registerROFH are:

PZOH (ω) = –[ω] [t]

2(radians) (7)

ROFH ContentsMode: Minimum Limit:Position 7 (decimal)ControlProportional 7 (decimal)VelocityControlTrapezoidal 15 (decimal)Profile ControlIntegral 15 (decimal)Velocity Control

The Digital to AnalogConverter (DAC) transferfunction:Linear voltage source andcurrent source amplifiers requirea digital to analog converter tointerface with the HCTL-1000.

The DAC’s transfer function issimply its gain (KD). The digitalto analog converter (DAC)transfer function can include anelectrical time constant, but it isusually neglected because thebandwidth of the DAC is gener-ally much higher than thedesired bandwidth of the closedloop system.

The gain (KD) is the DAC’scontribution to the magnitude ofthe open loop transfer function.The formula for computing thegain (KD) of the DAC is:

Voltage range (volts)

2N (bits or counts)

5 – (-5) volts

28 counts

(10)

= =

Gain (KD) =

Example: For an eight bit DAC with an output range of -5 to +5 volts the equation would be:

KD =10

256

.039 volts/countNote that the units of the DACgain is volts/count. This gives thecombination of the linear voltage

Page 7: Design of the HCTL-1000’s/1100’s Digital Filter Parameters by ......Introduction The objective of this application note is to explain the combina-tion method and to show how it

MO

TIO

N S

ENSI

NG

APPL

ICAT

ION

S

2-205

source amplifier and the DACthe units of volts/count, and thelinear current source amplifier/DAC the units of amps/count.

The DAC does not contribute aphase shift to the open looptransfer function.

The amplifier transfer function:The amplifier transfer function isits gain (KA). The choice betweenusing either a current or voltageamplifier affects the motortransfer function. The amplifier’stransfer function can include anelectrical time constant, but thisis usually neglected as theamplifier’s bandwidth is gener-ally much higher than thedesired bandwidth of the closedloop system. In general, if thedesired bandwidth of the systemis 10 times smaller than theamplifier’s bandwidth, then theamplifier’s electrical time con-stant can be neglected. Note thatthe units of the gain (KA) varywith the type of amplifier chosen.

There are four types of amplifi-ers that can be used with theHCTL-1000:• Voltage source – pulse width

modulated• Current source – pulse width

modulated• Voltage source – linear• Current source – linear

The HCTL-1000 provides an 8 bitbinary word on its motor commandport to drive a linear amplifier, anda pulse and sign signal to drive apulse width modulated amplifier.

The amplifier does not contribute aphase shift to the open loop transferfunction when its electrical timeconstant is neglected. The gain (KA)is the amplifier’s contribution to themagnitude of the open loop transferfunction.

The gain and bandwidth of mostlinear amplifiers can be obtainedfrom the manufacturer’s data sheet.If the user desires to measure theamplifier’s gain, the DC-output for agiven DC-input can be measureddirectly. The units for the gain (KA)of a linear voltage source amplifierare volts/volt. The units for the gain(KA) of a linear current sourceamplifier are amps/volt.

A simplified formula that will beused in this application note forcomputing the gain of a pulse widthmodulated (PWM) amplifier is:

The gain of a PWM amplifier ismeasured by inputting a wave-form with a known duty cycle. Ifa voltage source PWM amplifieris being measured, the outputvoltage can be read with a DCvoltmeter to average the outputof the amplifier. If a currentsource PWM amplifier is beingmeasured, the current can bedropped across a load of knownvalue to produce a voltage andthen that voltage can be readwith a DC voltmeter to averagethe output of the amplifier.

For the HCTL-1000, the dutycycle of the input to the PWMamplifier is regulated by registerR09H. Register R09H has arange of 64H to 9CH (-100 to+100 decimal). The units of thegain (KA) are for the HCTL-1000and PWM amplifier combination

KA =

Maximum Minimum

signal signal

output output

duty cycle duty cycle

input to input to

get maximum get minimum

output output

(current or voltage)

(11)

are therefore volts or current percount.

The DC motor transferfunction:The DC motor transfer functionis calculated based on the totalinertia of the system, the param-eters used to describe the motor’sdynamic response, and the typeof amplifier used to drive themotor. Different transfer func-tions are used for a motor drivenby a voltage source amplifierthan for a motor driven by acurrent source amplifier. Thetotal inertia of the system andthe parameters used to describethe system’s dynamic responseare the same for both motortransfer functions. They aredescribed in the next two sec-tions. Following these twosections are two sections whichdescribe the transfer functionsfor motors driven by currentsource amplifiers and motors drivenby voltage source amplifiers.

1. DC motor manufacturer’smotor parameters:The DC motor parameters ofinterest that describe the electro-mechanical characteristics ofmotor mathematically are: thetorque constant (KT) [in N-m/amp], the moment of inertia ofthe armature (JM [in kg-m2], theterminal resistance (R) [inohms], the voltage constant(KE) [in volt-sec/rad], and thearmature inductance (L) [inhenries]. These motor param-eters can all be obtained directlyfrom the motor manufacturer’sdata sheet.

2. Total system moment ofinertia:The first step in determining themoment of inertia of the systemis to determine the moment ofinertia of the load (JL). For manyloads the moment of inertia of

Page 8: Design of the HCTL-1000’s/1100’s Digital Filter Parameters by ......Introduction The objective of this application note is to explain the combina-tion method and to show how it

2-206

the load (JL) can be read directlyfrom the manufacturer’s datasheet. The moment of inertia ofthe incremental encoder’scodewheel (JC) can also be readdirectly from the encodermanufacturer’s data sheet. It isrecommended that a book onmechanical design be consultedto find the moment of inertia ofother loads.

The total moment of inertia forthe system (J) includes themotor’s armature inertia (Jm),the load inertia (JL), and theencoder codewheel inertia (JC)Therefore:

J = JM + JL + JC (12)

3. DC motors driven by voltagesource amplifiers:The DC motor transfer functionfor a motor driven by a voltagesource amplifier is:

The term s in the denominatorindicates integration due to thefact that position is the output.Note that the transfer functionfor a motor driven by a voltagesource amplifier has three maincomponents; a gain constant(KMV), a mechanical time con-stant (TM) [in seconds] and anelectrical time constant (TE) [inseconds]. The gain constant(KMV) of the motor driven by avoltage source amplifier isdefined as the velocity at whichthe motor’s shaft will turn when1 volt is applied to the inputterminals. The mechanical andelectrical time constants of themotor describe the response timeof the motor to an input. Themechanical time constant (TM) of

position output

voltage input=

=

G(s) =

(13)

θ(s)

v(s)

KMV

s(sTm + 1)(sTE + 1)

a motor is defined as the timerequired for the unloaded motorto reach 63.2% of its final veloc-ity after the application of a DCstep voltage to the motor’sarmature. The electrical timeconstant (TE) of a motor isdefined as the ratio of thearmature inductance to thearmature resistance.

The constants in the motortransfer functions TE, TM, andKMV are determined by themanufacturer’s motor param-eters and the total systeminertial load that the motor isdriving.

The equations for the mechanical(TM) and electrical (TE) timeconstants are:

Where:R = the terminal resistance

of the motor (in ohms)J = the total system moment

of inertia (in kg-m2)KE = the voltage constant of

the motor (volt-sec/rad)KT = the torque constant of

the motor (in N-m/amp)

The electrical time constant canbe neglected if the mechanicaltime constant is greater than 10times the value of the electricaltime constant. This reduces themotor transfer function to:

[R] [J]

[KE] [KT]TM = (14)(seconds)

L

RTE = (15)(seconds)

1

KEKMV = (16)(rad/volt-sec)

The equation to calculate the gain constant (KMV) is:

Where:

(ω) = the frequency of interest(in radians)

TM = the mechanical timeconstant of the motor (inseconds)

TE = the electrical time constant ofthe motor (in seconds)

KMV = the gain constant of themotor (in rad/volt-sec)

Note: For cases where the electrical timeconstant has been neglected let TE = 0.

4. DC motors driven by currentsource amplifiers:The DC motor transfer functionfor a motor driven by a currentsource is:

G(s) =position output

voltage input=

θ(s)

v(s)

The phase contribution of a motor [PM(ω)], driven at frequency (ω) by a voltage source amplifier is:

The magnitude contribution of a motor [MM(ω)], driven at frequency (ω) by a voltage source amplifier is:

PM(ω) = – arctan ([ω][TM]) –

π

2(radians)*

= (17)KMV

s(sTM + 1)

– arctan ([ω][TE]) –

[ ] (18)

(19)

MM(ω) =

1 + ([ω] [TM])2 1 + ([ω] [Te])2ω

KMV *

position output

current input=

=

G(s) =

(20)

θ(s)

1(s)KMC

s2

The gain constant (KMC) for systems employing a current source amplifier is computed as:

Page 9: Design of the HCTL-1000’s/1100’s Digital Filter Parameters by ......Introduction The objective of this application note is to explain the combina-tion method and to show how it

MO

TIO

N S

ENSI

NG

APPL

ICAT

ION

S

2-207

The encoder’s codewheel count doesnot contribute to the phase of theopen loop transfer function. Themagnitude contribution of theencoder’s codewheel count (E) to theopen loop transfer function isindependent of frequency:

Where:C = quadrature counts per

revolution of the encoder’scodewheel

The phase and magnitudecontribution of the codewheel’sinertia (JC), has already beenconsidered in the total systemload on the motor.

Determination of the OpenLoop transfer function:Now that all of the individualtransfer functions have beendetermined for each componentof the open loop system, the openloop transfer function M(s) canbe determined by multiplyingthe individual transfer functionstogether.

For example, the open looptransfer function for the systemwith the current source amplifiershown in Figure 6B is:

KMC = (21)KT

J(rad/amp sec2)

Where:J = the total system moment of

inertia (in kg-m2)KT = the torque constant of the

motor (in N-m/amp)

The phase contribution of a motor[PM(ω)] driven at frequency (ω) by acurrent source amplifier is:

PM(ω) = −π (radians) (22)

The magnitude contribution of amotor [MM(ω)], driven at frequency(ω) by a current source amplifier is:

Where:ω = the frequency of interest

(in radians)KMC = the gain constant of the

motor (in rad/amp-sec2)

The encoder transfer func-tion:The incremental encoder’stransfer function (E) is:

Where:

C = quadrature counts perrevolution of the encoder’scodewheel

N = the number of slits in theencoder’s codewheel

The 2π indicates the number ofradians in one revolution of thecodewheel. Because the HCTL-1000 utilizes a four timesquadrature decoder, the closedloop system has four times theresolution (C) as the number ofslits in the codewheel (N). Thenumber of slits in the codewheel(N) can be found from the en-coder manufacturer’s data sheet.

MM(ω) = (23)KMC

(ω)2

(24)C

[4] [N]

2π(count/rad)E = =

(25)(count/rad)C

2πE =

M(s) = [e-st/2][Kd][Ka]

(26)KM

s[ ] [ ][ ]1

s

C

(2π)

Determination of the gaincrossover frequency, phasecrossover frequency, gainmargin, and phase margin of theopen loop transfer functionusing a Bode plot:

A Bode plot can be created usingthe open loop transfer functiongenerated in the last section.

The purpose of creating the Bodeplot is to show the characteristicsof the uncompensated systemover frequency. The Bode plotalso shows the designer howmuch compensation should beadded to the system to achievethe desired system bandwidthand stability.

The method for creating a Bodeplot from the open loop transferfunction is to plot the phase andmagnitude of the open looptransfer function over frequency.In the following equations for thephase and magnitude the con-stants are:

E = the gain of the incrementalencoder (counts/ radian)

KA = the gain of theamplifier (volts/voltfor linear voltage sourceamplifiers, amps/volt forlinear current sourceamplifiers, volts/count forPWM voltage sourceamplifiers, amps/countfor PWM current sourceamplifiers.)

KD = the gain of the DAC(volts/count)

KMC = the gain constant of amotor driven by a cur-rent source amplifier(rad/amp-sec2)

KMV = the gain constant of amotor driven by a voltagesource amplifier (rad/volt-sec)

MM(ω) = the magnitude of themotor transfer function

PM(ω) = the phase of the motortransfer function(radians)

PZOH(ω) = the phase of the zeroorder hold transferfunction (radians)

t = the sampling time of theHCTL-1000 (seconds)

TE = the electrical time con-

Page 10: Design of the HCTL-1000’s/1100’s Digital Filter Parameters by ......Introduction The objective of this application note is to explain the combina-tion method and to show how it

2-208

stant of the motor (seconds)TM = the mechanical time

constant of the motor(seconds)

ω = the frequency of interest(radians)

The phase [PHU(ω)] of theuncompensated open loop trans-fer function over frequency (ω) isdetermined by the equation:

PHU(ω) = PM(ω) + PZOH(ω) (radians)(27)

For a system employing a voltagesource amplifier, the followingequation is used for calculationof the phase [PHU(ω)] of the open

loop transfer function:When the equations for thephase [PHU(ω)] and gain [MU(ω)]of the open loop transfer functionhave been determined in termsof component parameters andfrequency (ω), then different val-ues of frequency (ω) may be sub-stituted into these equations tocreate a Bode plot of the phaseand gain of the open loop system.

The next step is to evaluate thephase and gain crossover fre-quencies and the phase and gain

For systems with a voltage source amplifier where the electrical time constant (TE) has been neglected, the equation becomes:

PHU(ω) = – arctan ([ω][TM]) –

π

2(rad)*

– arctan ([ω][Te])

[ ] [ ](28)

*Note: Multiply P HU(ω) by 57.296 (deg/rad) to obtain the phase in degrees.

– [ω] [t]

2

PHU(ω) = – arctan ([ω][TM])

π

2(rad)*[ ] [ ]

(29)

–– [ω] [t]

2

PHU(ω) = – π – (rad)*[ ](30)

(31)

[ω] [t]

2

For systems with a current source amplifier the eqation becomes:

The magnitude [MU(ω)] of the uncompensated open loop transfer function over frequency (ω) is:

MU(ω) = [MM(ω)][KD][KA][E](32)

(33)

MU(ω) =

[1 + ([ω] [TM])2] [1 + ([ω] [Te])2]ω

[KMV][KD][KA][(C/2π)] **

The magnitude [MU(ω)] of the uncompensated open loop transfer function of a system with a voltage amplifier is:

For systems with a voltage source amplifier where the electrical time constant (TE) has been neglected, the uncompen- sated magnitude [MU(ω)] is:

(34)

MU(ω) =

[1 + ([ω] [TM])2]ω

[KMV][KD][KA][C/(2π)] **

(35)

(36)

MU(ω) =

(ω)2

[KMC][KD][KA][C/(2π)] **

The uncompensated magnitude [MU(ω)] for the loop transfer function of systems with a current source amplifier is:

**Note: To express the magnitude in db, use:

db = 20 log [MU(ω)]

margins from the Bode plot.To find the phase crossoverfrequency (ωP) let the phase[PHU(ω)] equal - π radians (i.e.-180 degrees) in the appropriatephase equation and solve for thefrequency (ω). This value of thefrequency (ω) is the phasecrossover frequency (ωP). (37)To find the gain crossoverfrequency (ωC) let the magnitude[MU(ω)] equal 1 (0 db) in theappropriate magnitude equationand solve for the frequency (ω).This value of the frequency (ω)is the gain crossover frequency(ωC). (38)

The gain margin (GM) [in db] is:Figure 4 shows an example of aBode plot drawn from the openloop transfer function of theblock diagram shown in Figure 3.The Bode plot includes the phasecrossover frequency, gain cross-

[ ](40)

(39)

(41)

GM =MU(ωp)

1

MU(ωp)

1

(decimal)

= 20 log (db)

Where:MU(ωp) = the magnitude ofthe open loop system eval-uated at the phase crossoverfrequency (ωp).

The phase margin (PH) is

(PH) = [180 deg + (57.296(deg/rad) × PHU(ωc))] (degrees)

Where:

PHU(ωc) = the phase of theopen loop system eval-uated at the gain crossoverfrequency (ωc).

GM = -20 log MU(ωp)

Page 11: Design of the HCTL-1000’s/1100’s Digital Filter Parameters by ......Introduction The objective of this application note is to explain the combina-tion method and to show how it

MO

TIO

N S

ENSI

NG

APPL

ICAT

ION

S

2-209

over frequency, phase margin, andgain margin of the uncompensated,open loop system.

Once the Bode plot of the uncom-pensated, open loop transfer func-tion has been completed, the de-signer can determine how muchcompensation should be added tothe system to achieve the desiredsystem bandwidth and stability. Amethod for determining how muchcompensation to add to the systemis described in the next section.

Modification of the OpenLoop System TransferFunction UsingCompensation to Achievethe Desired Closed LoopCharacteristicsOnce the phase and gain mar-gins of the open loop transferfunction are known at the origi-nal gain and phase crossover fre-quencies, a new phase marginand gain crossover frequency canbe chosen to achieve a stableclosed loop system at a band-width equal to or higher than theuncompensated bandwidth.

The open loop transfer functioncan be modified with the HCTL-1000’s digital compensation filterto improve the bandwidth(speed) and stability of the sys-tem when the loop is closed withthe HCTL-1000. The stability ofthe closed loop system can be in-creased by increasing the phasemargin of the system. The band-width and the gain crossover fre-quency of the system can be in-creased by increasing the gain ofthe system.

Generation of new desiredopen loop characteristics usingthe desired closed loop band-width:In this application note, the

desired closed loop bandwidth(BW) will be approximated asequal to the desired open loopgain crossover frequency (ωC’) forhigh phase margin systems.

ωC’ ≅ BW [closed loop] (42)

Based on the required step re-sponse of the system, the usershould choose a realistic closedloop bandwidth (BW), and com-pensated phase margin (PHC).The digital compensation filtercan contribute a maximumphase lead of approximately 80degrees to the uncompensatedphase margin. The amount of band-width that can be added by the digi-tal filter depends on the type of sys-tem being compensated. Both thegain of the amplifier (KA) and thegain of the digital filter (K) can beused to change the gain margin ofthe system.

The desired gain crossover fre-quency (ωC’) is now the fre-quency of interest that will besubstituted into both the phaseand gain equations described inthe next section.

Determination of the phasemargin and gain of the open looptransfer function at the desired,open loop gain crossover fre-quency:The next step is to calculate thephase margin (PMU) of theuncompensated system at thedesired frequency (ωC’) and thegain (KF) required to achieve thedesired frequency (ωC’).

The uncompensated phasemargin (PMU) at the desiredopen loop gain crossover fre-quency (ωC’) can be calculated bysubstituting ωC’ as the frequencyof interest (ω) in the appropriateequation for the phase [PHU(ω)]:

PMU = [180 deg + [PHU(ωC’)]× 57.296(deg/rad)] degrees (43)

Where:

PHU(ωC’) = the phase angle ofthe open loop systemevaluated at thedesired gain crossoverfrequency (ωC’).

The phase lead (PL) that theHCTL-1000’s digital filter mustprovide to the closed loop systemto make it stable can be foundfrom the following equation:

PL = PHC - PMU (degrees) (44)

Where:

PHC = the desired compensatedmargin at ωC’ (degrees)

PMU = the uncompensated phasemargin at ωC’ (degrees)

The gain (KF) required from thedigital compensation filter tomake the overall gain equal toone at the desired gain crossoverfrequency (ωC’) is:

Where:

MU(ωC’) = the magnitude of theopen loop system eval-uated at the desiredgain crossoverfrequency (ωC’).

The HCTL-1000’s digital com-pensation filter, and a method forcomputing the values for thegain factor (K), the pole (B) andthe zero (A) are discussed in thenext section of this application

(45)KF =MU(ωc')

1

Page 12: Design of the HCTL-1000’s/1100’s Digital Filter Parameters by ......Introduction The objective of this application note is to explain the combina-tion method and to show how it

2-210

note.Use of the CombinationMethod to Design theHCTL-1000’s Digital Com-pensation Filter:Characteristics of the HCTL-1000’s digital filter:The digital compensation filter ofthe HCTL-1000 is of the form:

Both the pole term (B) and thezero term (A) contribute phaselead to the system. The K term isan independent gain factor thatcan be used to raise the systemgain for higher bandwidth, andto compensate for the gainreduction associated with thedigital filter’s pole and zero term.

The combination method andthe phase and magnitudegraphs:The combination method is agraphical analysis techniquethat can be used to designHCTL-1000’s digital compensa-tor filter. The four graphs shownin Figures 7, 8, 9, and 10 areemployed by the combinationmethod to show the phase ofdigital filter’s pole [PP(ωN)], thephase of digital filter’s zero[PZ(ωN)], the magnitude of thedigital filter’s pole [MP(ωN)]. andthe magnitude of the digitalfilter’s zero [MZ(ωN)] Note thatthe magnitude and phase forboth the pole and zero terms areplotted on individual graphs. Thecombination method employsthese plots to determine valuesfor the pole (B), zero (A), andgain (K) that will provide therequired phase lead and gain forthe desired closed loop systemresponse to a step input over a

specified bandwidth.Normalized frequencies are usedin these graphs to allow digitalcompensation to be designed forsystems with a wide range ofbandwidths and sample times.The normalized frequency[ωN(ω)] is calculated as thefrequency (ω) multiplied by thesampling time (t) of the system:

ωN(ω) = [ω] [t] (radians) (47)

ωNC' is the desired gain cross-over frequency (ωC’), normalizedto the sampling time (t) of theHCTL-1000 by equation (47):

ωNC' = [ωC] [t] (radians) (48)

Where:

ωC' = the desired gain crossoverfrequency (radians/sec)

t = the sampling time of theHCTL-1000 (seconds)

The normalized desired gaincrossover frequency (ωNC') isused as the frequency at whichthe phase and magnitude contri-butions of the digital filter’s poleand zero term are evaluated.

Figures 11, 12, 13, and 14 showexpanded versions of the phaseand magnitude graphs for thepole (B) and zero (A) term. Thesegraphs have been expanded forvalues of the normalized fre-quency [ωN(ω)] between 0.0 and0.65. This range of values ismost often used due to therequirement that the samplingfrequency (1/t) must be at least10 times the system bandwidth(in Hertz).

t ≤ 1/(10 × BW) (8)t ≤ (2 × π)/(10 × ωC')

Now:

ωNC' ≤ ωC' × t (48)ωNC' ≤ ωC' × (2 × π)/(10 × ωC')ωNC' ≤ (2 × π)/10

Therefore:

ωNC' ≤ .628

Note that for all four graphs thevalue of the pole term (B) andthe zero term (A) is always lessthan or equal to 1.0 for propersystem design. Also note thatwhen the phase lead from theHCTL-1000’s compensator isincreased the gain of the systemis decreased by the pole and zeroterms.

The normalized frequency plotsfor the phase and magnitude ofthe pole and zero terms allow thedesigner to use analog designtechniques to determine valuesfor the HCTL-1000’s digitalcompensation filter. This isaccomplished by mapping fromthe digital z-plane to the analogs-plane through the equationz = est = ejωt where t is thesampling time of the system, andωN(ω) is the normalized frequencyof the system.

Generation of the phase andmagnitude graphs:The following text describes themethod and equations for gener-ating the phase and magnitudegraphs. This information isuseful for designers who wouldlike to implement the combina-tion method in software, but it isnot necessary to read this text forthe designer to use the graphsfor filter design.

The graphs for the pole term aregenerated from the z/(z + B)portion of equation (46). The plotfor the phase of the pole term isderived by substituting z = ejωt

into z/(z + B) and then taking the

(46)K

4 Z[ [] ]=D(z) =

[K][z – A][4][z + B]

Z – A Z[ ]Z – B

Page 13: Design of the HCTL-1000’s/1100’s Digital Filter Parameters by ......Introduction The objective of this application note is to explain the combina-tion method and to show how it

MO

TIO

N S

ENSI

NG

APPL

ICAT

ION

S

2-211

argument of this term to get:

The graphs of the zero term arederived from the (z-A)/z portionof equation (46). The plot of thephase of the zero term is foundby substituting z = ejωt into (z-A)/z and then taking the argument

of this term to get:Determination of the HCTL-1000’s Digital Filter Parameters:A, B, and K by the CombinationMethod:Three programmable components,the zero (A), the pole (B), and thegain (K) are accessible to the userthrough registers 20H, 21H, and22H of the HCTL-1000 respectively.By changing these three numbers,the user can change the response of

90

80

60

40

20

0

PP –

PH

AS

E L

EA

D –

DE

GR

EE

S

0 0.4 0.8 1.2 1.6 2.0 2.4 2.8 3.2ωN – NORMALIZED FREQUENCY – RADIANS

B = 1.0

0.9

0.8

0.7

0.6

0.50.4

0.30.2

0.1

Figure 7. Phase Lead Contribution of the Pole Term.

MA

GN

ITU

DE

– M

P

2.00

1.75

1.50

1.25

1.00

0.75

0.50

0.25

00 0.4 0.8 1.2 1.6 2.0 2.4 2.8 3.2

ωN – NORMALIZED FREQUENCY – RADIANS

B = 1.0 0.7

0.60.7

0.8

0.5

0.4

0.3

0.2

0.1

0.5 0.40.3

0.20.1

B = 1.0 0.90.8

0.70.6

90

80

60

40

20

00 0.4 0.8 1.2 1.6 2.0 2.4 2.8 3.2

ωN – NORMALIZED FREQUENCY – RADIANS

A = 1.0

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.20.1

PZ –

PH

AS

E L

EA

D –

DE

GR

EE

S

Figure 8. Magnitude Contribution of the Pole Term.

Figure 9. Phase Lead Contribution of the Zero Term.

(51)

[ ]PZ(ωN) = arg ejωt – A

ejωt=

[ ]arctan(-A cos ωt) + 1

A sin ωt

The plot of the magnitude of thezero term is derived from:

[(-A cos ωt) + 1]2 + [A sin ωt]2

(52)

[ ]MZ(ωN) = ejωt – Aejωt

=

(49)

[(B cos ωT) + 1]2 + [B sin ωT]2

(50)

[ ]PP(ωN) = arg ejωt=

[ ]MP(ωN) = ejωt + B

ejωt=

[ ]arctan(B cos ωt) + 1

B sin ωt

The magnitude of the pole termis derived from:

1

ejωt + B

Page 14: Design of the HCTL-1000’s/1100’s Digital Filter Parameters by ......Introduction The objective of this application note is to explain the combina-tion method and to show how it

2-212

the system to an input. Table 1shows the effect of changing each ofthese parameters on the response ofthe system to a position step input.The combination method to findvalues for the pole (B), zero (A),and gain (K) is as follows:

1. On Figure 11, choose a largevalue for the pole term(B) to contribute significantphase lead [PP(ωNC')] at thenormalized desired gaincrossover frequency of thesystem (ωNC').

2. From Figure 12, read thevalue of the magnitude[MP(ωNC')] for the chosenvalue of B at the normalizeddesire gain crossoverfrequency (ωNC').

3. Determine the remainingphase lead [PZ(ωNC')] whichmust be provided by the zeroterm (A) of the digital filter.This can be done by use ofthe equation:

PZ(ωNC') = PL – PP(ωNC') (degrees) (53)

Where:PL = the required phase leadfrom the HCTL-1000’s digitalcompensation filter (degrees)

PP(ωNC') = the phase leadcontributed by the pole term(degrees)

4. On Figure 13, find the pointwhere the normalized,desired gain crossover fre-quency (ωNC') and the re-maining phase lead [PZ(ωNC')]intersect. Estimate the valueof the term (A) at this point.

5. From Figure 14, find thevalue of the zero term’smagnitude [MZ(ωNC')] byplotting the estimated valueof the zero (A) from step 4 atthe normalized desired gain

Table 1: Effect of changing digital filter parameters A, B, or K on theresponse of the system to a step input.

0 0.4 0.8 1.2 1.6 2.0 2.4 2.8 3.2ωN – NORMALIZED FREQUENCY – RADIANS

A = 1.00.9

0.8

0.7

0.60.5

0.40.3

0.2

0.1

MA

GN

ITU

DE

– M

P

2.00

1.75

1.50

1.25

1.00

0.75

0.50

0.25

0A = 1.0

0.90.8

0.7

0.60.50.4

0.30.20.1

Figure 10. Magnitude Contribution of the Zero Term.

18

16

12

8

4

0

PP

– P

HA

SE

LE

AD

– D

EG

RE

ES

0 0.1 0.2 0.3 0.4 0.5 0.6ωN – NORMALIZED FREQUENCY – RADIANS

B = 1.00.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

Figure 11. Phase Lead Contribution of the Pole Term.

Increase Effect on in Parameter Stability Response Stiffness

A Better Faster Decreases

B Slightly Better Faster Decreases

K Worse Faster Increases

Page 15: Design of the HCTL-1000’s/1100’s Digital Filter Parameters by ......Introduction The objective of this application note is to explain the combina-tion method and to show how it

MO

TIO

N S

ENSI

NG

APPL

ICAT

ION

S

2-213

crossover frequency (ωNC')and reading from the zeromagnitude (MZ) axis.

6. Use the following equation tofind the value of the gain (K):

Where:KF = the gain required by thedigital filter to provide thedesired frequency (ωNC')

MZ(ωNC') = the magnitude ofthe zero termMP(ωNC') = the magnitude ofthe pole term

7. Program the HCTL-1000 with:Register R20H = 256 × A (55)Register R21H = 256 × B (56)Register R22H = 4 × K (57)

Note: The range of allowable valuesfor registers 20H, 21 H, and 22H isintegers between 0 and 255 decimal(0 to 0FF Hex). If the requirednumber for the gain that must beprogrammed into register R22H isgreater that 255 decimal, then thegain of some other component in thesystem must be increased, or thedesired gain crossover frequency(ωC') must be decreased.

AppendicesAppendix A: Design Example of aSystem with a Voltage SourceAmplifier:In this section the HCTL-1000’sdigital filter parameters A, B, and Kwill be computed for an actualbenchtop system with a voltagesource amplifier.

Open Loop System Model:The open loop system model for asystem with a voltage sourceamplifier is shown in Figure 6A.

1.0

0.8

0.6

0.4

0.2

0

MA

GN

ITU

DE

– M

p

0 0.1 0.2 0.3 0.4 0.5 0.6ωN – NORMALIZED FREQUENCY – RADIANS

0.1

0.2

0.3

0.4

0.50.6

0.7

0.8

0.9

B = 1.0

Figure 12. Magnitude Contribution of the Pole Term.

90

80

60

40

20

0

PZ –

PH

AS

E L

EA

D –

DE

GR

EE

S

0 0.1 0.2 0.3 0.4 0.5 0.6ωN – NORMALIZED FREQUENCY – RADIANS

A = 1.0

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.20.1

Figure 13. Phase Lead Contribution of the Zero Term.

1.0

0.8

0.6

0.4

0.2

0

MA

GN

ITU

DE

– M

Z

0 0.1 0.2 0.3 0.4 0.5 0.6 0.65ωN – NORMALIZED FREQUENCY – RADIANS

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

A = 1.0

1.0

0.9

0.8

Figure 14. Magnitude Contribution of the Zero Term.

[MZ(ωNC')][MP(ωNC')]

(54)

K = KF

Page 16: Design of the HCTL-1000’s/1100’s Digital Filter Parameters by ......Introduction The objective of this application note is to explain the combina-tion method and to show how it

2-214

Choosing a bandwidth andsampling time:The first step is to determine thedesired bandwidth and samplingtime of the system. For thisexample, a bandwidth of 60 Hzwill be chosen. The samplingfrequency of the HCTL-1000should be at least 10 times thebandwidth of the system. TheHCTL-1000’s default sampletime (t) of .00052 sec will bechosen. This makes the samplingfrequency = 1/t = 1923 Hz whichis approximately 32 times thebandwidth of the system. SeeEquation 8.

The Zero Order Hold (ZOH)transfer function:The transfer function of the zeroorder hold is:

Z(s) = e-st/2 = e-.00026s (6)

Where the time between samples(sampling time) (t) of the HCTL-1000 has been chosen as .52milliseconds.

t = 0.00052 seconds

The phase contribution of thezero order hold [PZOH(ω)] to thesystem is:

Digital to Analog Converter(DAC) Parameters:A linear, voltage source amplifierhas been chosen to drive themotor. This amplifier requires adigital to analog converter (DAC)to convert the 8 bit motor com-mand word from the HCTL-1000into an analog voltage. The gain(KD) of the example -5 to +5 voltDAC is as follows:

Amplifier Parameters:Next, the gain of the voltagesource amplifier must be deter-mined. The gain of a linear,voltage source amplifier isdetermined by measuring theoutput voltage of the amplifierfor a known input voltage. Forthe example system, the linear,voltage source amplifier’s gain(KA) is:

Motor Parameters:The motor parameters from themanufacturer’s data sheet are:

Motor torque constant (KT) =3.15 × 10-2 N-m/ampMotor moment of inertia (JM) =2.69 × 10-6 kg-m2

Terminal resistance (R) = 5.44ohmsVoltage constant (KE) = 3.15 ×10-2 volt-sec/radArmature inductance (L) = 9.80× 10-4 henries

System Moment of Inertia:The total moment of inertia ofthe system (J) is determined byadding the moment of inertia ofthe motor’s rotor (JM), themoment of inertia of the load(JL), and the moment of inertiaof the encoder codewheel (JC).For the example system there isno load external to the motorother than the encodercodewheel. Therefore, the totalsystem moment of inertia (J) is:

J = JM + JL + JC = (2-69 × 10-6) + 0 + (4 × 10-8) kg-m2

= 2.73 × 10-6 kg-m2 (12)

The DC Motor Transfer Func-tion:The motor transfer function of aDC motor driven by a voltagesource amplifier is:

Calculation of the TransferFunction of the DC Motor:The motor parameters and the totalmoment of inertia of the system areused to calculate the mechanicaland electrical time constants andthe gain constant of the motor. Theequations for the mechanical timeconstant (TM) and the electricaltime constant (TE) of the motor are:

5 – (-5) voltsKD =

KD = .039 volts/count

(10)256 – 0 counts

PZOH (ω) =– [ω][t]

2(7)

2.00 – 0 volts-out

1.00 – 0 volts-inKA =

KA = 2.00 volts-out/volt-in.

(11)

(14)TM=[R][J]

[KE][KT](seconds)

TE =

TM = .015 seconds

TE = 0.18 milliseconds

9.8 × 10-4(seconds)

(seconds)

(15)TE= LR

(seconds)

(16)KMV =1

KE(rad/amp/-sec2)

The gain constant (KMV) of themotor is computed as:

KMV =1

.0315rad/sec/volt

For the example system:

5.44

TM =

KMV = 31.75 rad/sec/volt

[5.44][2.73 × 10-6][.0315][.0315]

Because the mechanical timeconstant (TM) is more than 10times larger than the electricaltime constant (TE) of the example, the DC motor transferreduces to:

G(s) = =

(17)

KMV

s(sTM + 1)31.75

s(0.15s+ 1)

G(s) =position output

voltage input=

θ(s)

v(s)

= (13)KMV

s[sTM + 1][sTE + 1]

Page 17: Design of the HCTL-1000’s/1100’s Digital Filter Parameters by ......Introduction The objective of this application note is to explain the combina-tion method and to show how it

MO

TIO

N S

ENSI

NG

APPL

ICAT

ION

S

2-215

Encoder Parameters:The parameters of the encodermust be determined. The param-eters of the Hewlett-PackardHEDS-5000 encoder chosen forthis example are:

N = 256 slits in the codewheelC = 4N = 1024 quadrature

encoder counts/codewheel revolution

JC = 4 × 10-8 kg-m2

Therefore, the transfer functionand magnitude contribution (E)of the encoder to the system is:

Calculation of the Open LoopTransfer Function:The open loop transfer functionis calculated as:

M(s) = [KD] [ZOH] [KA] [G(s)] [C/(2 × π)] (5)

The phase contribution [PM(ω)] ofthe motor driven at frequency (ω)by a voltage source amplifier tothe system is:

PM(ω) = – arctan (ωTM) –π2

(radians)

PM(ω) = – arctan (ω[.015]) –π2

(radians) (18)

Determination of the GainCrossover Frequency, PhaseCrossover Frequency, GainMargin, and Phase Margin ofthe Open Loop Transfer Func-tion Using a Bode Plot:The equation which is used tofind the phase [PHU(ω)] of theuncompensated, open looptransfer function is:

PHU(ω) = PM(ω) + PZOH(ω) (radians) (27)

The phase [PHU(ω)] can now becalculated for various values offrequency (ω). To be graphedonto a Bode plot, the values forthe phase [PHU(ω)] must beconverted from radians todegrees using the equation:

1 radian = 57.296 degrees (31)

Some values for the phase[PHU(ω)] are shown in degreesfor various values of frequency(ω) in Table 2.

The equation which is used tofind the magnitude [MU(ω)] ofthe uncompensated, open looptransfer function is:

The magnitude [MU(ω)] can nowbe calculated for various valuesof frequency (ω). To be graphedonto a Bode plot, the values forthe magnitude [MU(ω)] must beconverted from decimal todecibels using the equation:

db = 20 log [MU(ω)] (36)

Some values for the magnitude[(MU(ω)] are shown in decibel forvarious values of frequency (ω) inTable 2.

Figure 15 shows a Bode plot ofthe phase [PHU(ω)] and gain[MU(ω)].

The next step is to find the gainand phase crossover frequenciesof the uncompensated, open loopsystem. The gain crossoverfrequency (ωC) of the uncompensatedopen loop system can be com-puted by setting the magnitude[MU(ω)] in db equal to 0 db andsolving the equation for (ωC).

20 log [MU(ωC)] = 0 db (38)

The difficulty in choosing thismethod is that the solution caninvolve a fourth order (quartic)equation. A simpler method is toread the gain crossover fre-quency from the Bode plot

Magnitude contribution [MM(ω)]of the motor driven at frequency(ω) by a voltage source amplifier is:

(19)MM(ω) =

1 + ([ω] [TM])2ω

KMV

MM(ω) =

1 + ([ω] [.015])2ω

31.75

(24)

=C

1024

2πE = (count/radians)

(32)MU(ω) = [MU(ω)][KD][KA][E]

ω

[KMV][KD][KA][C/(2π)]MU(ω) =

1 + ([TM][ω])2

[[31.75][.039][2.0][(1024/(2π)]

MU(ω) =

1 + ([.015][ω])2ω

PHU(ω) = – arctan (ω × TM) –

π2

(radians)

(29)

–ωt

2

PHU(ω) = – arctan (ω × .015) –

π2

(rad)–ω[.00052]

2

[KMV][KD][KA][C/(2π)]

ωC 1 + ([ωC][TM])2

20 log

= 0 db

M(s) = [.039][e-.00026s][2.0]

M(s) =

[ ][ ]31.75 1024

2πs(.015s + 1)

s(.015s + 1)

403.56 e-.00026s

Page 18: Design of the HCTL-1000’s/1100’s Digital Filter Parameters by ......Introduction The objective of this application note is to explain the combina-tion method and to show how it

2-216

shown in Figure 15. From theBode plot it can be seen thatthe magnitude [MU(ω)] crossesthe 0 db axis at approximately160 radians/sec. Therefore thegain crossover frequency (ωC)of the uncompensated, openloop system is:

ωC = 160 radians/sec = 25.5 Hz

The phase crossover frequency(ωP) of the uncompensated,open loop system can be foundby setting the phase [PHU(ω)]equal to -π radians (i.e. -180degrees) and solving for (ωP):

As with the phase crossoverfrequency calculation, thesimplest method to find thephase crossover frequency (ωP)is to read it directly from theBode plot. The phase crossoverfrequency (ωP) is the pointwhere the phase [PHU(ω)]crosses the -180 degree axis.From the Bode plot shown inFigure 15 it can be seen thatthe phase crossover frequency(ωP) is approximately:

ωP = 500 radians/sec = 79.6 Hz

The gain margin (GM) iscomputed at the phase cross-over frequency (ωP) as:

Table 2. The magnitude (MU) and phase (PHU) of the open loop transferfunction over frequency (ω), for the system with a voltage sourceamplifier.

Frequency (ω) Magnitude (MU) Phase (PHU) (radians/sec) (decibels) (degrees)

1 52.12 -90.87

2 46.09 -91.753 42.57 -92.624 40.06 -93.495 38.11 -94.366 36.52 -95.227 35.17 -96.098 33.99 -96.959 32.95 -97.81

10 32.02 -98.6620 25.72 -106.9730 21.78 -114.6340 18.74 -121.5150 16.21 -127.5660 13.98 -132.8270 12.00 -137.3880 10.19 -141.3390 8.54 -144.76

100 7.01 -147.75200 -3.89 -164.51300 -10.68 -171.92400 -15.59 -176.48500 -19.42 -179.84600 -22.57 -182.59700 -25.23 -184.98800 -27.54 -187.15900 -29.58 -189.16

1000 -31.41 -191.08

(1,000)60

40(100)

20(10)

0(1)

-20(0.1)

-40(0.01)

-60(0.001)

-80(0.0001)

-60°(-1.05)

-80°(-1.39)

-100°(-1.74)

-120°(-2.09)

-140°(-2.44)

-160°(-2.79)

-180°(-3.14)

MA

GN

ITU

DE

– d

b (

DE

CIM

AL

)

PH

AS

E –

DE

GR

EE

S (

RA

DIA

NS

)

1 2 4 6 10 20 40 60 100 200 400 600 1,000(ω) – FREQUENCY – RADIANS/SECOND

MU (ωc') = 14.57 dB

PHU (ω)

MU (ω) GM = 19.42 dB

PH = 20.27°

ωc

ωp

ωc'

PHU = 4.43°

Figure 15. Bode Plot of the Open Loop System with the Voltage Source BeforeCompensation.

[KMV][KD][KA][C/(2π)]

(40)

dbωp 1 + ([ωp][TM])2

GM = –20 log

GM = –20 log [MU(ωp)] db

(37)

PHU(ωp) = -π radians – arctan

–π

2

[ωp][t]

2-π radians–

([ωp][TM])

=

Page 19: Design of the HCTL-1000’s/1100’s Digital Filter Parameters by ......Introduction The objective of this application note is to explain the combina-tion method and to show how it

MO

TIO

N S

ENSI

NG

APPL

ICAT

ION

S

2-217

GM = 19.42 db

The gain margin (GM) can alsobe read directly from the Bodeplot as the difference betweenthe 0 db axis and the magnitude[MU(ωP)] at the phase crossoverfrequency (ωP).

The phase margin (PH) is computedas 180 degrees plus the phase[PHU(ωC)] in degrees at the gaincrossover frequency (ωC).

The phase margin (PH) can alsobe read directly from the Bodeplot as the difference betweenthe phase [PHU(ω)] at the gaincrossover frequency (ωC) and the-180 degree axis.

Modification of the OpenLoop System TransferFunction UsingCompensation to Achievethe Desired Closed LoopCharacteristics:Now that the uncompensated,open loop characteristics of thesystem are known and plotted ona Bode plot, the HCTL-1000’sdigital compensation filter can be

designed to provide the desiredclosed loop characteristics.

For this system closed loopbandwidth (BW) of 60 Hertz [377radians/sec] is desired, and acompensated, desired phasemargin (PHC) of 40 degrees hasbeen chosen.

The desired open loop gaincrossover frequency (ωC') can beapproximated as the desiredclosed loop bandwidth (BW):

(ωC') = BW radians/sec (42)

(ωC') = 377 radians/sec

The normalized, desired gaincrossover frequency (ωNC') is:

ωNC' = [ωC'] [t] radians (48)ωNC' = [377 rad/sec] [.00052 sec] = .1960 radians

Determination of the phasemargin and gain of the openloop transfer function at thedesired, open loop gain cross-over frequency:For the example system with thevoltage source amplifier, wherethe electrical time constant hasbeen neglected, the phase mar-gin (PMU) of the uncompensatedsystem at the desired gain cross-over frequency (ωC') is computedas:

The phase lead (PL) that the HCTL-1000’s digital filter must provide toachieve the desired closed loopperformance is the differencebetween the desired, compensatedphase margin (PHC) at the gaincrossover frequency (ωC') and theuncompensated phase margin(PMU) at frequency (ωC'):

PL = PHC-PMU degrees (44)

PL = 40 - 4.43 = 35.57 degrees

The magnitude [MU(ωC')] of theuncompensated system at frequency(ωC') with a voltage source amplifierwhere the electrical time constanthas been neglected is:

The gain (KF) required from thedigital filter to make the overallgain of the system equal to 1 atthe desired gain crossoverfrequency (ωC') is defined as:

[PHU(ωC)]] degrees

PH = [180 deg. + [57.296(deg/rad]

= 180 + 57.296 –arctan ([ωC]

= 20.27 degrees

(41)

π2

–[ωC] [t]

2[TM]) – deg

= 180 + 57.296 –arctan ([160]

π2

––[160][.00052]

2[.015])

[[31.75][.039][2.0][(1024/(2π)]

1 + ([500][.015])2db

500 ×= –20 log

(deg/rad)][PHU(ωC')]] degrees

PMU = [180 deg. + ([57.296

([ωC'][TM]) –

PMU = 180 + [57.296][–arctan

PMU = 180 + [57.296][–arctan

(43)

π2

–[ωC] [t]

2

PMU = 4.43 degrees

3.142

2–

[377][.00052]

2

([377][.015]) –

(45)KF = 1

MU(ωC')

KF =

KF = 5.38

1

.186

[[31.74][.039][2.0][1024/([2][3.142])]

1 + ([.015][377])2

(34)[KMV][KD][KA][(C/(2 × π)]

ωC' 1 + ([TM][ωC'])2

MU(ωC') =

MU(ωC') =

MU(ωC') = .186

377

(– 20 log .186 = 14.6 db)

Page 20: Design of the HCTL-1000’s/1100’s Digital Filter Parameters by ......Introduction The objective of this application note is to explain the combina-tion method and to show how it

2-218

Use of the CombinationMethod to Design theHCTL-1000’s Digital Com-pensation Filter:On Figure 16 the plot of B = 0.9is chosen to contribute 5.3 degreesof phase lead (PP((ωNC')) at ωNC'= 0.196.

The plot of B = 0.9 in Figure 17at ωNC' = 0.196 gives a gain[MP(ωNC')] of 0.53.

The remaining phase lead atfrequency (ωC') which must becontributed by the zero term[PZ(ωNC')] is:

PZ(ωNC') = PL-PP(ωNC') (53) = 35.57 - 5.3 = 30.27 degrees

On Figure 18, the point where ωNC'= .196 and PZ(ωNC') = 30.27 inter-sect is A = 0.76.

The magnitude of the zero termwhere A = .76 at ωNC' = 0.196 onFigure 19 is MZ(ωNC') = 0.29.The gain (K) which must be con-tributed by the digital filter is:

The values which should beprogrammed into the HCTL-1000 are therefore:A = [256][0.76] = 194.56 ≅ 195 (55)

B = [256][0.9] = 230.4 ≅ 230 (56)

K = [4][34.4] = 137.6 ≅ 138 (57)

Figure 20 shows the actual re-sponse of the closed loop systemto a step input of 25 quadraturecounts. (25 quadrature counts ona 256 count codewheel that is

18

16

12

8

4

5.3

0

PP –

PH

AS

E L

EA

D –

DE

GR

EE

S

0 0.1 0.2 0.3 0.4 0.5 0.6ωN – NORMALIZED FREQUENCY – RADIANS

B = 1.00.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

0.196

Figure 16. Phase Lead Contribution of the Pole Term to the Closed Loop SystemCompensator.

1.0

0.8

0.6

0.53

0.4

0.2

0

MA

GN

ITU

DE

– M

p

0 0.1 0.2 0.3 0.4 0.5 0.6ωN – NORMALIZED FREQUENCY – RADIANS

0.1

0.2

0.3

0.4

0.50.6

0.7

0.8

0.9

B = 1.0

0.196

Figure 17. Magnitude Contribution of the Pole Term to the Closed Loop SystemCompensator.

90

80

60

40

30.3

20

0

PZ –

PH

AS

E L

EA

D –

DE

GR

EE

S

0 0.1 0.2 0.3 0.4 0.5 0.6ωN – NORMALIZED FREQUENCY – RADIANS

A = 1.0

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.20.1

A = 0.76

0.196

Figure 18. Phase Lead Contribution of the Zero Term to the Closed Loop SystemCompensator.

(54)

=

= 34.4

[MP(ωNC')][MZ(ωNC')]

KFK =

5.38

[0.53][.295]

Page 21: Design of the HCTL-1000’s/1100’s Digital Filter Parameters by ......Introduction The objective of this application note is to explain the combina-tion method and to show how it

MO

TIO

N S

ENSI

NG

APPL

ICAT

ION

S

2-219

multiplied by 4 equals 8.79 de-grees of angular rotation). Theamount of overshoot of the sys-tem’s response is roughly consis-tent with a system with 40 de-grees of phase margin.

For high phase margin systemsthe relationship between therisetime (tC) and the bandwidth(BW) of a closed loop system canbe approximated as:

For low phase margin systemswhich have some overshoot inthe closed loop step response, therelationship between therisetime (tR) and the bandwidth(BW) of a closed loop system canbe approximated as:

Figure 21 shows the actual risetime of the closed loop system toa step input of 25 quadraturecounts. Note that the risetime isdefined as the time required forthe output to go from 10% to 90%

1.0

0.8

0.6

0.4

0.2

0.29

0

MA

GN

ITU

DE

– M

Z

0 0.1 0.2 0.3 0.4 0.5 0.6 0.65ωN – NORMALIZED FREQUENCY – RADIANS

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

A = 1.0

0.196

A = 0.76

1.0

0.9

0.8

Figure 19. Magnitude Contribution of the Zero Term to the Closed Loop SystemCompensator.

of its final value. Since this sys-tem has some overshoot, equa-tion (59) applies. The risetime(tR) should therefore be:

The risetime measured fromfigure 21 is:

tR = 0.0042 seconds

Therefore the measured risetimefalls within the expected range ofvalues for a bandwidth of 60 Hertz.

Appendix B: Design Ex-ample of a System with aCurrent Source Amplifier:In this section the HCTL-1000’sdigital filter parameters A, B,and K will be computed for anactual benchtop system with acurrent source amplifier.

Open Loop System Model:The open loop system model for asystem with a current sourceamplifier is shown in Figure 6B.

Choosing a bandwidth andsampling time:The first step is to determine thedesired bandwidth and samplingtime of the system. For thisexample, a bandwidth of 60 Hzwill be chosen. The samplingfrequency of the HCTL-1000should be at least 10 times thebandwidth of the system. TheHCTL-1000’s default sampletime of .00052 sec will be chosen.This makes the sampling fre-quency = 1/t = 1923 Hz which isapproximately 32 times thebandwidth of the system. SeeEquation 8.

The zero order hold (ZOH)transfer function:The transfer function of the zeroorder hold is:

Z(s) = e-st/2 = e-.00026s (6)

Where the time between samples(sampling time) (t) of the HCTL-1000 has been chosen as .52milliseconds.

t = 0.00052 seconds

The phase contribution of thezero order hold (PZOH(ω)) to thesystem is:

Amplifier parameters:Next, the gain of the currentsource amplifier must be deter-mined. For the example system,a pulse width modulated, currentsource amplifier with a gain (KA)= 0.02 amps-out/count has beenchosen. No digital to analogconverter (DAC) is used with apulse width modulated amplifier.

KA = 0.02amps-out/count (11)

Motor parameters:The motor parameters from themanufacturer’s data sheet are:

(58)BW (in radians/sec)

2.2tR =

(59)<tR<0.6

BW

2.2

BW

PZOH(ω) = – (7)[ω][t]

2

.00159 < tR < .0058 seconds

seconds<tR<0.6

[60][6.28]

2.2

[60][6.28]

Page 22: Design of the HCTL-1000’s/1100’s Digital Filter Parameters by ......Introduction The objective of this application note is to explain the combina-tion method and to show how it

2-220

Motor torque constant (KT) =3.15 × 10-2 N-m/amp

Motor moment of inertia (JM) =2.69 × 10-6kg-m2

Terminal resistance (R) = 5.44ohms

Voltage constant (KE) = 3.15 ×10-2 volt-sec/rad

Armature inductance (L) = 9.8× 10-4 henries

System moment of inertia:The total moment of inertia ofthe system (J) is determined byadding the moment of inertia ofthe motor’s rotor (JM), the mo-ment of inertia of the load (JL),and the moment of inertia of theencoder codewheel (JC). For theexample system there is no loadexternal to the motor other thanthe encoder codewheel. There-fore, the total system moment ofinertia (J) is:J = JM + JL + JC = (2.69 × 10-6) + 0 + (4 × 10-8) kg-m2 (12) = 2.73 × 10-6 kg-m2

40

30

20

10

0

QU

AD

RA

TU

RE

EN

CO

DE

R C

OU

NT

S

0 302418126TIME – MILLISECONDS

Figure 20. Response of the Closed Loop System to a Step Input of 25Quadrature Encoder Counts.

10

20

30

40

0

0

QU

AD

RA

TU

RE

EN

CO

DE

R C

OU

NT

S

0 108642TIME – MILLISECONDS

RISE TIME (tR) = 4.2 MILLISECONDS

Figure 21. Rise Time of the Closed Loop System to a Step Input of 25Quadrature Encoder Counts.

The DC motor transferfunction:The motor transfer function of aDC motor driven by a currentsource amplifier is:

Calculation of the gain constantand transfer function of the DCmotor:The motor parameters and thetotal moment of inertia of thesystem including the motor areused to calculate the gain con-stant of the motor. The gainconstant (KMC) of the motor iscomputed as:

The phase contribution (PM(ω))of the motor driven at frequency(ω) by a current source amplifierto the system is:

PM(ω) = – π (radians) (22)

The magnitude contribution(MM(ω)) of the motor driven atfrequency (ω) by a current sourceamplifier is:

MU(ω) =

MU(ω) =

(23)KMC

(ω)2

11,538.46

(ω)2

KMC =

KMC =

= 11,538.46 rad/amp-sec2

(21)

.0315 N-m/amp

2.73 × 10-6kg-m2

KMC

s2

11,538.46

s2

KT

J

G(s) =

For the example system:

Therefore the motor transfer function is:

=

(rad/amp/-sec2)

(20)=KMC

s2

G(s) =position output

voltage input=

θ(s)

v(s)

Page 23: Design of the HCTL-1000’s/1100’s Digital Filter Parameters by ......Introduction The objective of this application note is to explain the combina-tion method and to show how it

MO

TIO

N S

ENSI

NG

APPL

ICAT

ION

S

2-221

Encoder parameters:The parameters of the encodermust be determined. The param-eters of the Hewlett-PackardHEDS-5000 encoder chosen forthis example are:

N = 256 slits in the codewheelC = 4N = 1024 quadrature encoder counts/codewheel revolutionJC = 4 × 10-8 kg-m2

Therefore, the transfer functionand magnitude contribution (E)of the encoder to the system is:

Calculation of the open looptransfer function:The open loop transfer functionis calculated as:

M(s) = [ZOHl [KA] [G(s)] [C/(2π)]

Determination of the gaincrossover frequency, phasecrossover frequency, gainmargin, and phase margin ofthe open loop transfer functionusing a Bode plot:The equation which is to be usedto find the phase [PHU(ω)] of theuncompensated, open looptransfer function is:

The phase [PHU(ω)] can now becalculated for various values offrequency (ω). To be graphed intoa Bode plot, the values for thephase [PHU(ω)] must be con-verted from radians to degreesusing the equation:

1 radian = 57.296 degrees (31)

Some values for the phase [PHU(ω)]are shown in degrees for variousvalues of frequency (ω) in Table 3.The equation which is used to findthe magnitude [MU(ω)] of theuncompensated, open loop transferfunction is:

The magnitude [MU(ω)] can nowbe calculated for various valuesof frequency (ω). To be graphedonto a Bode plot, the values forthe magnitude [MU(ω)] must beconverted from decimal todecibels using the equation:

db = 20 log [MU(ω)] (36)

Some values for the magnitude[MU(ω)] are shown in decibel forvarious values of frequency (ω)in Table 3.

Figure 22 shows a Bode plot ofthe phase [PHU(ω)] and gain[MU(ω)].

The next step is to find the gainand phase crossover frequenciesof the uncompensated, open loopsystem. The gain crossover fre-

quency (ωC) of the uncompensat-ed open loop system can be com-puted by setting the magnitude[MU(ω)] in db equal to 0 db andsolving the equation for (ωC):

Another method is to read thegain crossover frequency fromthe Bode plot shown in Figure22. From the Bode plot it can beseen that the magnitude [MU(ω)]crosses the 0 db axis at approxi-mately 195 radians/sec. There-fore gain crossover frequency(ωC) of the uncompensated, openloop system is:

ωC = 195 radians/sec = 31.04 Hz

The phase crossover frequency(ωP) of the uncompensated, openloop system can be found bysetting the phase [PHU(ω)] equalto –π radians (-180 degrees) andsolving for (ωP):

Another method to find the phasecrossover frequency (ωP) is to read itdirectly from the Bode plot. Thephase crossover frequency (ωP) isthe point where the phase crossesthe -180 degree axis. From the Bodeplot shown in Figure 22 it can beseen that the phase crossoverfrequency (ωP) is:

(ωP) = 0.0 radians/sec = 0.0 Hz

(5)M(s) = [e-.00026s][0.02]

M(s) =

11,538.46

s2

1024

37,610[e-.00026s]

s2

(24)

(counts/radian)C

1024

2πE = =

(27)

(30)

[ω][t]

2

PHU(ω) = PM(ω)

+ PZOH(ω) (radians)

PHU(ω) = – π –

(radians)

[ω][.00052]

2

PHU(ω) = – π –

(radians)

(32)MU(ω) = [MM(ω)][KA][E]

MU(ω) =

MU(ω) =

[KMC][KA][C/2π]

ω2

ω2

11,538.46 × 0.02 × (1024/(2π))

= – π radians

(37)

[ω][t]

2

PHU(ωp) = – π radians

– π –

[KMC][KA][(C/2π)]

[KMC][KA][(C/(2π)]

(38)

= 0 db

ωC =

20 log =

20 log [MU(ωC)] = 0 db

(ωC)2

Page 24: Design of the HCTL-1000’s/1100’s Digital Filter Parameters by ......Introduction The objective of this application note is to explain the combina-tion method and to show how it

2-222

The gain margin (GM) is com-puted at the phase crossoverfrequency (ωP) as:

GM = - 20 log [MU(ωP)] db (40)

However, since the phase cross-over frequency is zero, thesystem is unstable, and the gainmargin is minus infinity.

The phase margin (PH) can becomputed as 180 degrees plusthe phase [PHU(ω)] in degrees atthe gain crossover frequency (ωC).

The phase margin (PH) can alsobe read directly from the Bodeplot as the difference betweenthe phase [PHU(ω)] at the gaincrossover frequency (ωC) and the-180 degree axis.

Modification of the OpenLoop System TransferFunction UsingCompensation to Achievethe Desired Closed LoopCharacteristicsNow that the uncompensated,open loop characteristics of thesystem are known and plotted ona Bode plot, the HCTL-1000’sdigital compensation filter can bedesigned to provide the desiredclosed loop characteristics.

For this system closed loopbandwidth (BW) of 60 Hertz [377radians/sec] is desired, and acompensated, phase margin(PHC) of 40 degrees has beenchosen.

The desired open loop gaincrossover frequency (ωC') can beapproximated as the desiredclosed loop bandwidth (BW):ωC' = BW radians/sec (42)

ωC' = 377 radians/sec

The normalized, desired gaincrossover frequency (ωNC') is:

ωNC' = [ωC'] [t] radians (48)ωNC' = [377 (rad/sec)] [.00052 (sec)] = .1960 radians

Determination of the phasemargin and gain of the openloop transfer function at thedesired gain crossoverfrequency:For the example system with thecurrent source amplifier thephase margin (PMU) of theuncompensated system at thedesired gain crossover frequency(ωC') is computed as:

(deg/rad][PHU(ωC)]] degrees

PH = [180 deg. + [57.296

= 180 + [57.296]

(41)

Table 3. The magnitude (MU) and phase (PHU) of the open loop transferfunction over frequency (ω), for the system with a voltage sourceamplifier.

Frequency (ω) Magnitude (MU) Phase (PHU) (radians/sec) (decibels) (degrees)

1 91.61 -180.02

2 79.57 -180.033 72.52 -180.054 67.53 -180.065 63.65 -180.086 60.48 -180.097 57.81 -180.108 55.49 -180.129 53.44 -180.13

10 51.61 -180.1520 39.57 -180.3030 32.52 -180.4540 27.53 -180.6050 23.65 -180.7560 20.48 -180.8970 17.81 -181.0480 15.49 -181.1990 13.44 -181.34

100 11.61 -181.49200 -.43 -182.98300 -7.48 -184.47400 -12.47 -185.96500 -16.35 -187.45600 -19.52 -188.94700 -22.19 -190.43800 -24.51 -191.92900 -26.56 -193.41

1000 -28.39 -194.90

(deg/rad][PHU(ωC')]] degrees

PMU = [180 deg. + [57.296 (43)

= -2.9 degrees (ie. unstable!)

[ωC] [t]

2 – π –

= [180 + 57.296]

[195][.00052]

2 – π –

degrees

Page 25: Design of the HCTL-1000’s/1100’s Digital Filter Parameters by ......Introduction The objective of this application note is to explain the combina-tion method and to show how it

MO

TIO

N S

ENSI

NG

APPL

ICAT

ION

S

2-223

The phase lead (PL) that theHCTL-1000’s digital filter mustprovide to achieve the desiredclosed loop performance is thedifference between the desired,compensated phase margin (PHC)at the gain crossover frequency(ωC') and the uncompensatedphase margin (PMU) at frequency(ωC'):

PL = PHC - PMU degrees (44)

PL = 40 - (-5.62) = 45.62 degrees

The magnitude [MU(ωC')] of theuncompensated system at

(1,000)60

(10,000)80

(100,000)100

40(100)

20(10)

0(1)

-20(0.1)

-40(0.01)

-60(0.001)

-80(0.0001)

-160°(-2.79)

-155°(-2.71)

-150°(-2.62)

-165°(-2.88)

-170°(-2.97)

-175°(-3.05)

-180°(-3.14)

-185°(-3.23)

-190°(-3.32)

-195°(-3.40)

MA

GN

ITU

DE

– d

b (

DE

CIM

AL

)

PH

AS

E –

DE

GR

EE

S (

RA

DIA

NS

)

1 10 100 1,000ω – FREQUENCY – RADIANS/SECOND

MU (ωc') = 0.2678°

MU (ω)

PH = 2.9°

ωc ωc'

PMU = -5.62°

PHU (ω)

Figure 22. Bode Plot of the Open Loop System with the Current Source BeforeCompensation.

frequency (ωC’) with a currentsource amplifier is:

Use of the CombinationMethod to Design theHCTL-1000’s Digital Com-pensation Filter:On Figure 23 the plot of B = 0.9is chosen to contribute 5.3degrees of phase lead [PP(ωNC')]atωNC' = 0.196.

The plot of B = 0.9 in Figure 24at ωNC' = 0.196 gives a gain[MP(ωNC')] of 0.53.

The remaining phase lead atfrequency (ωC') which must becontributed by the zero term[PZ((ωNC')] is:

PZ(ωNC') = PL- PP(ωNC') (53) = 45.62 - 5.3 = 40.32 degrees

On Figure 25, the point whereωNC' = .196 and PZ(ωNC') = 40.32intersect is A = 0.826.

The magnitude of the zero termwhere A = .826 at ωNC' = 0.196on figure 26 is MZ(ωNC') = 0.249.

The gain (K) which must becontributed by the digital filteris:

The values which should beprogrammed into the HCTL-1000are therefore:

A = [256] [0.826] = 211.45 ≅ 211(55)B = [256] [0.9] = 230.4 ≅ 230 (56)K = [4] [28.57] = 114.3 ≅ 114 (57)

Figure 27 shows the actual re-sponse of the closed loop systemto a step input of 25 quadraturecounts. (25 quadrature counts ona 256 count codewheel that ismultiplied by 4 equals 8.79 de-

PMU = 180 + 57.296

PMU = -5.62 degrees

[ωC'] [t]

2 – π –

PMU = 180 + 57.296

[377][.00052]

2 – π –

K =

(54)

[MP(ωNC')] [MZ(ωNC')]

3.77

[.53][.249]

KF

= = 28.57

(45)

(35)

MU(ω) = .265

The gain (KF) required from the digital filter to make the overallgain of the system equal to 1 at the desired gain crossover frequency (ωC') is defined as:

MU(ω) =

.265KF =

KF = 3.77

MU(ω) =

[KM][KA][C/(2π)]

(ωC')2

(377)2

[11,538.46] × [0.02] × [1024/(2 × 3.1416)]

1

MU(ωC') KF =

1

Page 26: Design of the HCTL-1000’s/1100’s Digital Filter Parameters by ......Introduction The objective of this application note is to explain the combina-tion method and to show how it

grees of angular rotation). Theamount of overshoot of thesystem’s response is roughly con-sistent with a system with 40degrees of phase margin.

For high phase margin systemsthe relationship between therisetime (tR) and the bandwidth(BW) of a closed loop system canbe approximated as:

For low phase margin systemswhich have some overshoot inthe closed loop step response, therelationship between therisetime (tR) and the bandwidth(BW) of a closed loop system canbe approximated as:

Figure 28 shows the actualrisetime of the closed loop systemto a step input of 25 quadraturecounts. Note that the rise time isdefined as the time required forthe output to go from 10% to 90%of its final value. Since thissystem has some overshoot,equation (59) applies. Therisetime (tR) should therefore be:

.00159 < tR < .0058 secondsThe risetime measured fromfigure 28 is:

tR = 0.0050 seconds

Therefore the measured risetimefalls within the expected range ofvalues for a bandwidth of 60Hertz.

Figure 23. Phase Lead Contribution of the Pole Term to the Closed LoopSystem Compensator.

Figure 24. Magnitude Contribution of the Pole Term to the Closed LoopSystem Compensator.

Figure 25. Phase Lead Contribution of the Zero Term to the ClosedLoop System Compensator.

Page 27: Design of the HCTL-1000’s/1100’s Digital Filter Parameters by ......Introduction The objective of this application note is to explain the combina-tion method and to show how it

MO

TIO

N S

ENSI

NG

APPL

ICAT

ION

S

2-225

Appendix C: Symbols for Quantitiesand Their Units

Quantity Definition SI Units

A the HCTL-1000 digital _________compensation filter’sprogrammable zero term

B the HCTL-1000 digital _________compensation filter’sprogrammable pole term

BW bandwidth Hertzradians/sec

C quadrature counts per countsrevolution of the encoder’scodewheel

D(z) the transfer function of theHCTL-1000’s digital filter

E magnitude contribution of counts/radianthe encoder

fCLK frequency of the HCTL- hertz1000’s external clock

G(s) motor transfer function variesGM the gain margin of the decibels (db)

uncompensated open looptransfer function

J total system moment of kg-m2

inertiaJC Moment of inertia of the en- kg-m2

coder’s codewheelJL Moment of inertia of the kg-m2

loadJM Moment of inertia of the kg-m2

motor’s armatureK the programmable gain of _________

the HCTL-1000’s digitalcompensation filter

volts/voltamps/volt

KA gain of the amplifier volts/countamps/count

KD gain of the DAC volts/ countKE motor voltage constant volt-sec/radKF the gain required from the _________

HCTL-1000’s digital filterto provide an overall gainequal to one at the desiredgain crossover frequency (ωC')

KMC motor gain constant with rad/amp-sec2

a current source amp.KMV motor gain constant with rad/volt-sec

a voltage source amp.KT motor torque constant N-m/ampL motor armature inductance henries

MM(ω) magnitude contribution _________of the motor

MP(ωN) the magnitude of the pole _________term at ωNC'

MZ(ωN) the magnitude of the zero _________term at ωNC'

Quantity Definition SI Units

M(s) the open loop transfer variesfunction

MU(ω) the magnitude of the _________uncompensated open looptransfer function

N number of slits in the _________encoder’s codewheel

PH the phase margin of the degreesuncompensated, open looptransfer function

PHC desired, compensated open degreesloop phase margin

PHU(ω) the phase of the uncompen- radianssated, open loop transferfunction

PL the phase lead required degreesfrom the digital filter

PM(ω) phase contribution of the radiansmotor

PMU the phase margin of the degreesuncompensated, open loopsystem at the desired gaincrossover frequency (ωC')

PP(ωN) the phase of the pole degreesterm at ωNC'

PZ(ωN) the phase of the zero degreesterm at ωNC

PZOH(ω) phase of the zero order radianshold

R terminal resistance of ohmsthe motor

t the sampling time of the secondsHCTL-1000

TE electrical time constant secondsof the motor

TM mechanical time constant secondsof the motor

tR closed loop system rise secondstime to a step response

ω frequency radians/secωC the open loop gain radians/sec

crossover frequencyωC' the desired open loop gain radians/sec

crossover frequencyωN(ω) normalized frequency radiansωNC' the normalized desired radians

gain crossover frequency (ωC')ωP the open loop phase radians/sec

crossover frequencyZ(s) zero order hold transfer _________

function

Page 28: Design of the HCTL-1000’s/1100’s Digital Filter Parameters by ......Introduction The objective of this application note is to explain the combina-tion method and to show how it

2-226

BibliographyDiStefano, III, Joseph J.,Stubberud, Allen R., and Will-iams, Ivan J. Theory andProblems of Feedback andControl Systems, Schaum’sOutline Series. New York:McGraw-Hill, 1967.

Dorf, Richard C., Modem ControlSystems. 3rd ed. Menlo Park,Calif.: Addison-Wesley, 1983.

Roberge, James K., OperationalAmplifiers: Theory and Practice.New York: John Wiley & Sons,1975.

Tal, Jacob. Motion Control ByMicroprocessors. Mountain View,Calif.: Galil Motion Control Inc.,1984.

1.0

0.8

0.6

0.4

0.20.249

0

MA

DN

ITU

DE

– M

Z

0 0.1 0.2 0.3 0.4 0.5 0.6 0.65ωN – NORMALIZED FREQUENCY – RADIANS

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

A = 1.0

0.196

A = 0.826

1.0

0.9

0.8

Figure 26. Magnitude Contribution of the Zero Term to the Closed Loop SystemCompensator.

40

30

20

10

0

QU

AD

RA

TU

RE

EN

CO

DE

R C

OU

NT

S

0 302418126TIME – MILLISECONDS

Figure 27. Response of the Closed Loop System to a Step Input of 25Quadrature Encoder Counts.

10

20

30

40

0

0

QU

AD

RA

TU

RE

EN

CO

DE

R C

OU

NT

S

0 108642TIME – MILLISECONDS

RISE TIME (tR) = 5.0 MILLISECONDS

Figure 28. Rise Time of the Closed Loop System to a Step Input of 25 QuadratureEncoder Counts.