PID Control

6,191 views 20 slides Mar 22, 2019
Slide 1
Slide 1 of 20
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20

About This Presentation

Analog PID control using OP-AMPS


Slide Content

1
EXPERIMENT6
ANALOGPIDCONTROL
USINGOP-AMPS
GROUPMEMBERS
Name UIN EmailId Date
ChenLin(GroupLeader) [email protected] 12/7/2018
WeLi [email protected]/7/2018
AngieKampert [email protected]/7/2018
ShriramVasudevan [email protected]/7/2018
VijayAnandVelmurugan [email protected]/7/2018

2
Contents
1.SUMMARY................................................................................................................................3
2.DESCRIPTIONOFTHEEXPERIMENT.........................................................................................4
2.1BasicConcepts..............................................................................................................4
2.2AnalysisoftheCircuit...................................................................................................7
3.LISTOFCOMPONENTS...........................................................................................................12
4.Porcedures..............................................................................................................................13
5.Results......................................................................................................................................14
6.Conclusion................................................................................................................................20

3
SUMMARY
Thebelowobjectiveswereaccomplishedwithresultsdescribingthedifferentmodesof
operationusingvoltagecharacteristics.
Understandingthetheoryofsumming,inverting,differential,derivative,andintegrator
op-amps.
BuildacompleteanalogPIDcontrolcircuit.
Testtheinput–outputsignalrelationofaPIDcircuit(i.e.,P-only,Donly,Ionly,PID
versionsofthecircuit).
Comparetheresultsandevaluatethereasonsfordifferencebetweenrealand
simulatedoutputs.
Figuringoutconclusions.

4
DESCRIPTIONOFTHEEXPERIMENT
1.BasicConcept
The“pure”derivativehasalargegainathighfrequencyandwillamplifythenoiseintheclosed
loop,andhenceleadtostabilityproblems.Toreducethegainofthepurederivativeathigh
frequency,apracticalderivativeop-ampcircuitismodifiedsothatithasafirst-orderpolein
additiontothederivative,hencereducingthehighfrequencygainofthetransferfunction
therebyreducingtheproblemofnoiseamplification.
Figure1.PIDcontrol
addingaresistorR1inserieswiththecapacitorC.Letusderivethetransferfunctionforthis
practicalderivativecircuit.Noticethatv+=GNDandv+=v−attheinputterminalsoftheop-
amp.Sincetherecannotbecurrentdrawnintotheop-amp,theni1(t)=i2(t)wherei1(t)isthe
currentontheinputsideoftheop-ampthroughR1andC,andi2(t)isthecurrentonthe
feedbackloopoftheop-ampthroughR2.
1.1Derivative
Aderivativetermdoesnotconsidertheerror(meaningitcannotbringittozero:apureD
controllercannotbringthesystemtoitssetpoint),buttherateofchangeoferror,tryingto
bringthisratetozero.Itaimsatflatteningtheerrortrajectoryintoahorizontalline,damping
theforceapplied,andsoreducesovershoot(errorontheothersidebecausetoogreatapplied
force).Applyingtoomuchimpetuswhentheerrorissmallandisreducingwillleadto
overshoot.Afterovershooting,ifthecontrollerweretoapplyalargecorrectionintheopposite
directionandrepeatedlyovershootthedesiredposition,theoutputwouldoscillatearoundthe
setpointineitheraconstant,growing,ordecayingsinusoid.Iftheamplitudeoftheoscillations

5
increaseswithtime,thesystemisunstable.Iftheydecrease,thesystemisstable.Ifthe
oscillationsremainataconstantmagnitude,thesystemismarginallystable.
1.2Controldamping
Intheinterestofachievingacontrolledarrivalatthedesiredposition(SP)inatimelyand
accurateway,thecontrolledsystemneedstobecriticallydamped.Awell-tunedposition
controlsystemwillalsoapplythenecessarycurrentstothecontrolledmotorsothatthearm
pushesandpullsasnecessarytoresistexternalforcestryingtomoveitawayfromtherequired
position.Thesetpointitselfmaybegeneratedbyanexternalsystem,suchasaPLCorother
computersystem,sothatitcontinuouslyvariesdependingontheworkthattheroboticarmis
expectedtodo.Awell-tunedPIDcontrolsystemwillenablethearmtomeetthesechanging
requirementstothebestofitscapabilities.
1.3Proportionalterm
Figure2.ResponseofPVtostepchangeofSPvstime,forthreevaluesofKp(KiandKdheldconstant)
Theproportionaltermproducesanoutputvaluethatisproportionaltothecurrenterrorvalue.
TheproportionalresponsecanbeadjustedbymultiplyingtheerrorbyaconstantKp,calledthe
proportionalgainconstant.
Theproportionaltermisgivenby
Pout=Kp*e(t)
Ahighproportionalgainresultsinalargechangeintheoutputforagivenchangeintheerror.If
theproportionalgainistoohigh,thesystemcanbecomeunstable.Incontrast,asmallgain

6
resultsinasmalloutputresponsetoalargeinputerror,andalessresponsiveorlesssensitive
controller.Iftheproportionalgainistoolow,thecontrolactionmaybetoosmallwhen
respondingtosystemdisturbances.Tuningtheoryandindustrialpracticeindicatethatthe
proportionaltermshouldcontributethebulkoftheoutputchange.
1.4Integralterm
Figure3.ResponseofPVtostepchangeofSPvstime,forthreevaluesofKi(KpandKdheldconstant)
Thecontributionfromtheintegraltermisproportionaltoboththemagnitudeoftheerrorand
thedurationoftheerror.TheintegralinaPIDcontrolleristhesumoftheinstantaneouserror
overtimeandgivestheaccumulatedoffsetthatshouldhavebeencorrectedpreviously.The
accumulatederroristhenmultipliedbytheintegralgain(Ki)andaddedtothecontrolleroutput.
Theintegraltermisgivenby
Iout=Ki∫0te(τ)dτ.
1.5PIDcontroller
Aproportional–integral–derivativecontroller(PIDcontrollerorthreetermcontroller)is
acontrolloopfeedbackmechanismwidelyusedinindustrialcontrolsystemsandavarietyof
otherapplicationsrequiringcontinuouslymodulatedcontrol.APIDcontrollercontinuously
calculatesanerrorvalueasthedifferencebetweenadesiredsetpoint(SP)anda
measuredprocessvariable(PV)andappliesacorrectionbasedonproportional,integral,
andderivativeterms(denotedP,I,andDrespectively)whichgivethecontrolleritsname.
Inpracticaltermsitautomaticallyappliesaccurateandresponsivecorrectiontoacontrol
function.Aneverydayexampleisthecruisecontrolonaroadvehicle;whereexternal

7
influencessuchasgradientswouldcausespeedchanges,andthedriverhastheabilitytoalter
thedesiredsetspeed.ThePIDalgorithmrestorestheactualspeedtothedesiredspeedinthe
optimumway,withoutdelayorovershoot,bycontrollingthepoweroutputofthevehicle's
engine.
Thefirsttheoreticalanalysisandpracticalapplicationwasinthefieldofautomaticsteering
systemsforships,developedfromtheearly1920sonwards.Itwasthenusedforautomatic
processcontrolinmanufacturingindustry,whereitwaswidelyimplementedinpneumatic,and
thenelectronic,controllers.TodaythereisuniversaluseofthePIDconceptinapplications
requiringaccurateandoptimizedautomaticcontrol.
2AnalysisoftheCircuit
Figure4.ThecircuitoftheanalogPIDcontroller

8
2.1DifferentialInputOp-Amp
Figure5.Differentialinputamplifier
Thedesiredfunctionistodeterminethedifferencebetweentwosignalsandpossiblymultiplythe
differencewithagain,
whichisusedinclosedloopcontrolcircuitsasthesummingjunctionthatisfindthedifference
betweenacommandsignalandsensorsignal.(Figure5)showsadifferentialinputop-amp
circuit.Initsgeneralform,theinput–outputrelationshipcanbeobtainedusingthe
superpositionprinciple.Theoutputisthesumoftheoutputsduetotheinvertinginputandthe
non-invertinginput.Thesuperpositionprinciplecanbeusedinthederivation:(i)connectV2to
groundandsolveforv’o=K1⋅V1,and(ii)connectV1togroundandsolveforv”o=K2⋅
V2.Then,addthemtogethertogetVo=v’o+v”o.Theoutputduetoinputatitsnon-
invertingterminalis
Andtheoutputduetoinputatitsinvertingterminalis

9
Thetotaloutputis
NotethatwhenR1=R2=R3=R4,theinput–outputrelationshipis
Similarly,whenR1=R3=RandR2=R4=K⋅R,
Oneofthemainusagesofdifferentialop-ampsisinamplifyingnoisesensitivesignals.As
discussedinFigure5,single-endedsignalsarereferencedwithrespecttoground.Anynoise
inducedonthesignalwirecomingintotheop-ampwouldbeamplified.Thisisparticularly
problematicwhenthenoisesignaliscomparabletotheactualsignalmagnitude.Insuchcases,
itisbesttotransmitthesignalvoltageindifferential-endedformat.Thatisusingtwowiresand
thesignalinformationisthevoltagedifferencebetweenthetwowires.Ifanynoiseisinduced
duringthetransmission,itwouldbeinducedonbothlinesandthedifferencebetweenthem
wouldstillbeunaffectedbynoise.
2.2DifferentiatorOp-Amp
Figure6.Differentiatoramplifier
Thedesiredfunctionofaderivativeopamp,showninFigure6,wastoamplifythe
derivativeoftheinputvoltagetooutputvoltagewithagain.

10
Figure6showsanop-ampcircuitfordifferentiation.Usingtheidealop-ampassumptions,
theinput–outputrelationshipisderivedasfollows,
Hence,
Inourexperimentsetting,wemodifiedthederivativeop-amptoreducethenoisefrom
highfrequencygain.WeaddedaresistorR1inseriestothecapacitorasshownincircuit
diagram.Hence,
2.3IntegratorOp-Amp
Figure7.Integratoramplifier

11
TheIntegratorop-ampwasdesignedtoamplifytheintegraloftheinputvoltageoveraperiod
oftimewithagain.Ifwechangethelocationsoftheresistorandcapacitorinthederivativeop-
amp,weobtainanintegratingop-ampcircuit(Figure7).Thedesiredfunctionis,
whereVo(0)istheinitialvoltage.ThederivationoftheI/Orelationshipisstraightforward,
wheretheinitialvoltagevaluesintheintegrationshavebeenneglected.Inpractice,aresistor
wasaddedinparallelwiththecapacitor,shownincircuitdiagram,toreducethephaselagat
lowfrequencycontentandimprovethestabilityofintegratorop-amp.Thus,theinput-output
ofthismodifiedintegratorop-ampwasobtainedasfollowing,
2.4TheRelationshipbetweenInputandOutput
FortheProportionalController,thetransferfunctionwas
ForthemodifiedDifferentiatorController,thetransferfunctionwas
ForthemodifiedIntegratorController,thetransferfunctionwas

12
Therefore,thecompletetransferfunctionforthePIDcontrollerinpracticewas,
LISTOFCOMPONENTS
Component Quantity
LM358Op-AmpIC 5
Resistor220Ω 1
Resistor1kΩ 8
Resistor4.7kΩ 4
Resistor100kΩ 4
Resistor330kΩ 1
Capacitor0.22μF 2
PowerSupply 1
DMM 1
Breadboard 2
Connectorwires 1set
Oscilloscope 1
FunctionGenerator 1

13
Procedures
1.Assemblethecircuitonthebreadboardasshowninpart4CircuitDiagram.Sincethecircuit
isinvolvedwith5op-amps,over15componentsandnumerouswires,webuildthecircuit
on2breadboards.ThePIDcontrollerisbuiltinonebreadboard.Theinputcomparatorand
outputamplifierarebuiltinanotherbreadboard.Inthisway,wecanavoidthetouching
betweencomponentsanditiseasierforustocheckthecircuit.
2.Setupthefunctiongeneratortoproducethesquarewavesignalwithanamplitudeof6V.
Thefrequencyofthewavefunctionscanbeeasilyadjustedonthefunctiongenerator.
ConnectthefunctiongeneratorsignaltoVi(feedbacksignal).ConnecttheVreftotheground.
3.Connecttheoscilloscopetotheinputsignaloftheproportionalop-amp,andtheoutputof
theproportionalop-amp.Then,takeapictureoftheoscilloscopescreen.
4.Connecttheoscilloscopetotheinputsignalofthederivativeop-amp,andtheoutputofthe
derivativeop-amp.Then,takeapictureoftheoscilloscopescreen.
5.Connecttheoscilloscopetotheinputsignaloftheintegratingop-amp,andtheoutputof
theintegratorop-amp.Then,takeapictureoftheoscilloscopescreen.
6.Connecttheoscilloscopechannel1totheinputsignalofthewholePIDcontrollercircuit,
andoscilloscopechannel2totheoutputofthesummingop-amp(whichistheoutputof
thePIDcontrollercircuit).Then,takeapictureoftheoscilloscopescreen.
7.DerivethecompletetransferfunctionofthePIDcontroller.Calculatetheproportional,
derivative,andintegratorgains:KP,KD,KI,andtheadditionalpolelocationofthemodified
derivativeterm,andpolelocationandgainofthemodifiedintegralterm.

14
Results
DifferentialInputOp-Amp
Figure8.Non-InvertedAmplifierAssembly
Gainfordifferential:

L



E


E




F






Simplifying,

L



F



–,
–L
꿘ቩ
L


L





F


=


=


=1
UsingresistorsofonlytΩ,thegainoftheproportionalcontrolleris1.
Figure9showsthesquaregraphsobtainedfromoscilloscopeandcorrespondingpure
differentialoutputs.

15
a. b.
Figure9.Squaregraphsobtainedfromoscilloscopeandcorrespondingpuredifferentialoutputswith1kΩ
resistors.
Fig.9demonstratestheamplificationoftheinputerrorbymultiplicationofthegainofthe
proportionalcontroller,1.
DerivativeOp-Amp
Figure10.InvertingAmplifierAssembly
Gainforpurederivative:

LF⩗

Simplifying,

ቩ⩗L


LF?––F??oΩ⩗L-1.034e-3s

ቩLF?ǤF

16
Gainformodifiedderivative:




LF

–⩗

⩗E
Simplifying,


LF
?––F??oΩ⩗
?––F??oΩ⩗E
LFE-1.034e-3s

ቩLFE-1.034e-3s
Poleformodifiedderivative:
⩗LF



LF

?o??––F
LF?ǤeF


LFE-1.034e-3*F?ǤeFL?ǤǤǤǤǤǤm

ቩN
Thepureandmodifiedgainsandpoleforthederivativeop-ampcanbeseeninTable1.
Table1.DerivativeGainsandPoleResults
PureDerivativeGain,
ቩ F?ǤF
ModifiedDerivativeGain,

Modifiedpole,s F?ǤeF
Figure11showsthesquaregraphsoftheinput-outputsignalrelationshipsforthederivative
op-amp.
a.
Figure11.Squaregraphfromthepurederivativeoutputwitha4.7kΩresistorand.22?i.
Thefiguredemonstrateshighinputandoutputvoltagesatthespikeoutputs.

17
IntegratingOp-Amp
Figure12.InvertingAmplifierAssembly
Gainforpureintegrator:

LF




Simplifying,

⩗L?––F?––ǤΩ⩗LF?Fm⩗

LF?Fm
Gainformodifiedintegrator:




LF


⩗E
Simplifying,




LF

?––F?––ǤΩ⩗E
LF

?Fm⩗E

LF

?Fm⩗E
Poleformodifiedintegrator:
⩗LF



LF

?Fm
LF–––?

18

LF

?Fm–––?E

LǤ?m
TheresultingpureandmodifiedgainsandpolecanbeseeninTable2
Table2.IntegratorGainsandPoleResults
PureIntegratorGain,
F?Fm
ModifiedIntegratorGain,
Ǥ?m
Modifiedpole,s F–––?
Figure13showsthesquaregraphsoftheinput-outputsignalrelationshipsfortheintegrating
op-amp.
Figure13.Squaregraphfromthepurederivativeoutputwitha220Ωresistorand.22?i.
Themodifiedintegratorcreatesasawteethwavewithsomenoisecontainedinthecircuit.
PIDController
Figure14.ThecircuitofanalogPIDcontroller

19
Theproportional–integral–derivativecontrollerutilizesthemodifiedcontrollers.Thevaluesusedforthe
PIDfrompreviousthepreviousmodifiedcircuitscanbeseeninTable3.
Table3.PIDGainValues
ProportionalGain,
1
ModifiedDerivativeGain,

ቩN
Modifiedpole,s F?ǤeF
ModifiedIntegratorGain,
Ǥ?m
Modifiedpole,s F–––?
Figure15showsthesquareandsinewavesforthePIDcontroller.
a.
b. c.
Figure15.Thesquaregraphsareshownina.andb.forthePIDcontroller.Thesinewavecanbeseeninc.

20
Conclusion
Inthislab,webuiltananalogPIDcontrollerwithop-ampsLM358andseveralresistorsand
capacitorsbyputtingthedifferential,proportional,derivativeandintegralop-ampstogether.
Thecontrolsignalisthusasumofthreeterms:aproportionaltermthatisproportionaltothe
error,anintegraltermthatisproportionaltotheintegraloftheerror,andaderivativeterm
thatisproportionaltothederivativeoftheerror.AgoodPIDcontrollershouldhavequickand
stableresponse.AfterbuildingandtestingthePIDcontroller,wefoundthatthere’ssomenoise
beingamplified.Wetriedtochangethecapacitorsandtheop-ampsseveraltimesandfinally
gotprettygoodoutputgraph.