SRV02 Courseware Sample For MATLAB Users PDF
SRV02 Courseware Sample For MATLAB Users PDF
INSTRUCTOR WORKBOOK
Instructor Workbook: SRV02 Base Unit Experiment for MATLAB /Simulink Users
SRV02 Base Unit Experiment For MATLAB/Simulink Users
Standardized for ABET * Evaluation Criteria
SRV02 Base Unit Flexible Link Inverted Pendulum Ball and Beam Developed by:
Jacob Apkarian, Ph.D., Quanser
Michel Lvis, M.A.Sc., Quanser
Hakan Gurocak, Ph.D., Washington State University
Course material
complies with:
Flexible Joint Gyro/Stable Platform Double Inverted Pendulum 2 DOF Ball Balancer
With the SRV02 Base Unit, you can select from 10 add-on modules to create experiments of varying complexity across a
wide range of topics, disciplines and courses. All of the experiments/workstations are compatible with MATLAB/Simulink.
2012 Quanser Inc. All rights reserved. MATLAB and Simulink are registered trademarks of The MathWorks Inc.
COURSE
MATERIALS SRV02
SAMPLE ROTARY SERVO PLANT
PREFACE
Preparinglaboratoryexperimentscanbetimeconsuming.Quanserunderstandstimeconstraintsofteaching
and research professors. Thats why Quansers control laboratory solutions come with proven practical
exercises.Thecoursematerialsaredesignedtosaveyoutime,givestudentsasolidunderstandingofvarious
controlconceptsandprovidemaximumvalueforyourinvestment.
Quansercoursematerialsaresuppliedintwoformats:
1. Instructor Workbook provides solutions for the prelab assignments and contains typical
experimental results from the laboratory procedure. This version is not intended for the
students.
2. StudentWorkbookcontainsprelabassignmentsandinlabproceduresforstudents.
ThiscoursematerialispreparedforusersofTheMathWorkssMatlab/Simulinksoftware
in conjunction with Quansers QUARC realtime control software. A version of the course
materialsforNationalInstrumentsLabVIEWusersisalsoavailable.
This course material is aligned with the requirements of the Accreditation Board for
Engineering andTechnology(ABET), oneofthe mostrespectedorganizationsspecializingin
accreditationofeducationalprogramsinappliedscience,computing,scienceandtechnology.
TheInstructorWorkbookprovidesprofessorswithasimpleframeworkandsetoftemplatesto
measure and document students achievements of various performance criteria and their
abilityto:
Applyknowledgeofmath,scienceandengineering
Designandconductexperiments,andanalyzeandinterpretdata
Communicateeffectively
Usetechniques,skillsandmodernengineeringtoolsnecessaryforengineeringpractice
Quanser,Inc.wouldliketothankDr.HakanGurocak,fromtheWashingtonStateUniversity
Vancouver,forrewritingtheoriginalmaterialtoincludeembeddedoutcomesassessment.
Thefollowingmaterialprovidesanabbreviatedexampleofprelabassignmentsandinlabproceduresfor
theSRV02RotaryMotionServoPlant.Pleasenotethattheexamplesarenotcompleteastheyareintended
togiveyouabriefoverviewofthestructureandcontentofthecoursematerialsyouwillreceivewiththe
plant.
COURSE
MATERIALS SRV02
SAMPLE ROTARY SERVO PLANT
COURSEMATERIALSSAMPLETABLEOFCONTENTS
PREFACE......................................................................................................................PAGE1
INTRODUCTIONTOQUANSERROTARYSERVOCOURSEMATERIALSSAMPLE.........PAGE3
INSTRUCTORSMANUALTABLEOFCONTENTS..........................................................PAGE4
BACKGROUNDSECTIONSAMPLE............................................................................PAGE7
PRELABQUESTIONSSECTIONSAMPLE...................................................................PAGE9
LABEXPERIMENTSSECTIONSAMPLE....................................................................PAGE10
SYSTEMREQUIREMENTSSECTIONSAMPLE.......................................................PAGE11
COURSE
MATERIALS SRV02
SAMPLE ROTARY SERVO PLANT
1. INTRODUCTIONTOQUANSERROTARYSERVOCOURSEMATERIALSAMPLE
Quansercoursematerialsprovidestepbysteppedagogyforawiderangeofcontrolchallenges.Startingwith
thebasicprinciples,studentscanprogresstomoreadvancedapplicationsandcultivateadeepunderstanding
ofcontroltheories.TheQuanserRotaryServocoursematerialscoverstopics,suchas:
HowtodesignQUARCcontrollersforQuansersSRV02system
HowtofindatransferfunctionthatdescribestherotarymotionsoftheSRV02loadshaft
Howtodevelopafeedbacksystemthatcontrolsthepositionoftherotaryservoloadshaft
Howtodevelopafeedbacksystemthatcontrolsthespeedoftherotaryservoloadshaft
EverylaboratorychapterintheInstructorsManualisorganizedintofoursections:
Background section provides all the necessary theoretical background for the experiments.
StudentsshouldreadthissectionfirsttoprepareforthePreLabquestionsandfortheactuallab
experiments.
PreLab Questions section is not meant to be a comprehensive list of questions to examine
understanding of the entire background material. Rather, it provides targeted questions for
preliminary calculations that need to be done prior to the lab experiments. All or some of the
questionsinthePreLabsectioncanbeassignedtothestudentsashomework.
LabExperimentssectionprovidesstepbystepinstructionstoconductthelabexperimentsand
torecordthecollecteddata.
System Requirements section describes all the details of how to configure the hardware and
software to conduct the experiments. It is assumed that the hardware and software
configuration have been completed by the instructor or the teaching assistant prior to the lab
sessions.However,iftheinstructorchoosesto,thestudentscanalsoconfigurethesystemsby
followingtheinstructionsgiveninthissection.
AssessmentofABEToutcomesisincorporatedintotheInstructorsManuallookforindicatorssuchasA1,A2
Theseindicatorscorrespondtospecificperformancecriteriaforanoutcome.AppendixBoftheInstructors
Manualincludes:
detailsofthetargetedABEToutcomes,
listofperformancecriteriaforeachoutcome,
scoringrubricsandinstructionsonhowtousetheminassessment.
The outcomes targeted by the PreLab questions can be assessed using the student work. The outcomes
targeted by the lab experiments can be assessed from the lab reports submitted by the students. These
reportsshouldfollowthespecifictemplateforcontentgivenattheendofeachlaboratorychapter.Thiswill
provideabasistoassesstheoutcomeseasily.
COURSE
MATERIALS SRV02
SAMPLE ROTARY SERVO PLANT
2. INSTRUCTORSMANUALTABLEOFCONTENTS
ThefullTableofContentsoftheQuanserRotaryServoInstructorsManualisshownhere:
PREFACE
1. LABORATORY1SRV02MODELING
1.1. BACKGROUND
1.1.1. MODELINGUSINGFIRSTPRINCIPLES
1.1.1.1. ELECTRICALEQUATIONS
1.1.1.2. MECHANICALEQUATIONS
1.1.1.3. COMBININGTHEELECTRICALANDMECHANICALEQUATIONS
1.1.2. MODELINGUSINGEXPERIMENTS
1.1.2.1. FREQUENCYRESPONSE
1.1.2.2. BUMPTEST
1.2. PRELABQUESTIONS
1.3. LABEXPERIMENTS
1.3.1. FREQUENCYRESPONSEEXPERIMENT
1.3.1.1. STEADYSTATEGAIN
1.3.1.2. GAINATVARYINGFREQUENCIES
1.3.2. BUMPTESTEXPERIMENT
1.3.3. MODELVALIDATIONEXPERIMENT
1.3.4. RESULTS
1.4. SYSTEMREQUIREMENTS
1.4.1. OVERVIEWOFFILES
1.4.2. CONFIGURINGTHESRV02ANDTHELABFILES
1.5. LABREPORT
1.5.1. TEMPLATEFORCONTENT
1.5.2. TIPSFORREPORTFORMAT
1.6. SCORINGSHEETFORPRELABQUESTIONS
1.7. SCORINGSHEETFORLABREPORT(MODELING)
2. LABORATORY2SRV02POSITIONCONTROL
2.1. BACKGROUND
2.1.1. DESIREDPOSITIONCONTROLRESPONSE
2.1.1.1. PEAKTIMEANDOVERSHOOT
2.1.1.2. STEADYSTATEERROR
2.1.1.3. SRV02POSITIONCONTROLSPECIFICATIONS
2.1.2. PVCONTROLLERDESIGN
2.1.2.1. CLOSEDLOOPTRANSFERFUNCTION
2.1.2.2. CONTROLLERGAINLIMITS
2.1.2.3. RAMPSTEADYSTATEERRORUSINGPV
2.1.3. PIVCONTROLLER
2.1.3.1. RAMPSTEADYSTATEERRORUSINGPIV
2.1.3.2. INTEGRALGAINDESIGN
COURSE
MATERIALS SRV02
SAMPLE ROTARY SERVO PLANT
2.2. PRELABQUESTIONS
2.3. LABEXPERIMENTS
2.3.1. STEPRESPONSEUSINGPVCONTROLLER
2.3.1.1. SIMULATION
2.3.1.2. IMPLEMENTINGSTEPRESPONSEUSINGPVCONTROLLER
2.3.2. RAMPRESPONSEUSINGPVCONTROLLER
2.3.2.1. SIMULATION
2.3.2.2. IMPLEMENTINGRAMPRESPONSEUSINGPVCONTROLLER
2.3.3. RAMPRESPONSEWITHNOSTEADYSTATEERROR
2.3.4. RESULTS
2.4. SYSTEMREQUIREMENTS
2.4.1. OVERVIEWOFFILES
2.4.2. SETUPFORPOSITIONCONTROLSIMULATION
2.4.3. SETUPFORPOSITIONCONTROLIMPLEMENTATION
2.5. LABREPORT
2.5.1. TEMPLATEFORCONTENT(STEPRESPONSEEXPERIMENT)
2.5.2. TEMPLATEFORCONTENT(RAMPRESPONSEWITHPV)
2.5.3. TEMPLATEFORCONTENT(RAMPRESPONSEWITHNOSTEADYSTATEERROR)
2.5.4. TIPSFORREPORTFORMAT
2.6. SCORINGSHEETFORPRELABQUESTIONS
2.7. SCORINGSHEETFORPRELABREPORT(STEP)
2.8. SCORINGSHEETFORPRELABREPORT(RAMPPV)
2.9. SCORINGSHEETFORPRELABREPORT(RAMPRESPONSEWITHNOSTEADYSTATEERROR)
3. LABORATORY3SRV02SPEEDCONTROL
3.1. BACKGROUND
3.1.1. DESIREDRESPONSE
3.1.1.1. SRV02SPEEDCONTROLSPECIFICATIONS
3.1.1.2. OVERSHOOT
3.1.1.3. STEADYSTATEERROR
3.1.2. PIDCONTROLDESIGN
3.1.2.1. CLOSEDLOOPTRANSFERFUNCTION
3.1.2.2. FINDINGPIGAINSTOSATISFYSPECIFICATIONS
3.1.3. LEADCONTROLDESIGN
3.1.3.1. FINDINGLEADCOMPENSATORPARAMETERS
3.1.3.2. LEADCOMPENSATORDESIGNUSINGMATLAB
3.1.4. SENSORNOISE
3.2. PRELABQUESTIONS
3.3. LABEXPERIMENTS
3.3.1. STEPRESPONSEWITHPICONTROL
3.3.1.1. SIMULATION
3.3.1.2. IMPLEMENTINGPISPEEDCONTROL
3.3.2. STEPRESPONSEWITHLEADCONTROL
3.3.2.1. SIMULATION
3.3.2.2. IMPLEMENTINGLEADSPEEDCONTROL
COURSE
MATERIALS SRV02
SAMPLE ROTARY SERVO PLANT
3.3.3. RESULTS
3.4. SYSTEMREQUIREMENTS
3.4.1. OVERVIEWOFFILES
3.4.2. SETUPFORSPEEDCONTROLSIMULATION
3.4.3. SETUPFORSPEEDCONTROLIMPLEMENTATION
3.5. LABREPORT
3.5.1. TEMPLATEFORCONTENT(PICONTROLEXPERIMENT)
3.5.2. TEMPLATEFORCONTENT(LEADCONTROLEXPERIMENTS)
3.5.3. TIPSFORREPORTFORMAT
3.6. SCORINGSHEETFORPRELABQUESTIONS
3.7. SCORINGSHEETFORPRELABREPORT(PI)
3.8. SCORINGSHEETFORPRELABREPORT(LEAD)
A. SRV02QUARCINTEGRATION
A.1. APPLYINGVOLTAGETOSRV02MOTOR
A.1.1 MAKINGTHESIMULINKMODEL
A.1.2 COMPILINGTHEMODEL
A.1.3 RUNNINGQUARCCODE
A.2. READINGPOSITIONUSINGPOTENTIOMETER
A.2.1 READINGTHEPOTENTIOMETERVOLTAGE
A.2.2 MEASURINGPOSITION
A.3. MEASURINGSPEEDUSINGTACHOMETER
A.4. MEASURINGPOSITIONUSINGENCODER
A.5. SAVINGDATA
B. SRV02INSTRUCTORSGUIDE
B.1. PRELABQUESTIONSANDLABEXPERIMENTS
B.1.1 HOWTOUSEPRELABQUESTIONS
B.1.2 HOWTOUSETHELABORATORYEXPERIMENTS
B.2. ASSESSMENTFORABETACCREDITATION
B.2.1 ASSESSMENTINYOURCOURSE
B.2.2 HOWTOSCORETHEPRELABQUESTIONS
B.2.3 HOWTOSCORETHELABREPORTS
B.2.4 ASSESSMENTOFTHEOUTCOMESFORTHECOURSE
B.2.4.1. COURSESCOREFOROUTCOMEA
B.2.4.2. COURSESCORESFOROUTCOMEB,KANDG
B.2.5 ASSESSMENTWORKBOOK
B.3. RUBRICS
COURSE
MATERIALS SRV02
SAMPLE ROTARY SERVO PLANT
3.BACKGROUNDSECTIONSAMPLE
SRV02Modeling
TheangularrateoftheSRV02loadshaftwithrespecttotheinputmotorvoltagecanbedescribedbythe
followingfirstordertransferfunction
l( s ) K
[1.1]
Vm ( s ) s1
wherethel(s)istheLaplacetransformoftheloadshaftratel(t),Vm(s)istheLaplacetransformofmotor
inputvoltagevm(t),Kisthesteadystategain,isthetimeconstant,andsistheLaplaceoperator.
TheSRV02transferfunctionmodelisderivedanalyticallyinSection1.1.1anditsKandparametersare
evaluated.Theseareknownasthenominalmodelparametervalues.Themodelparameterscanalsobe
foundexperimentally.Section1.1.2.1and1.1.2.2describehowtousethefrequencyresponseandbump
testmethodstofindKand.Thesemethodsareusefulwhenthedynamicsofasystemarenotknown,for
exampleinamorecomplexsystem.Afterthelabexperiments,theexperimentalmodelparametersare
comparedwiththenominalvalues.
ModelingUsingFirstPrinciples:ElectricalEquations
TheDCmotorarmaturecircuitschematicandgeartrainisillustratedinFigure1.1.Asspecifiedin[6],recall
thatRmisthemotorresistance,Lmistheinductance,andkmisthebackemfconstant.
2011 Intellectual property of Quanser. Do not reproduce without written permission.
COURSE
MATERIALS SRV02
SAMPLE ROTARY SERVO PLANT
Thebackemf(electromotive)voltageeb(t)dependsonthespeedofthemotorshaftmandtheback
emfconstantofthemotor,km.Itopposesthecurrentflow.Thebackemfvoltageisgivenby:
UsingKirchoff'sVoltageLaw,wecanwritethefollowingequation:
SincetheimotorinductanceLmismuchlessthanitsresistance,itcanbeignored.Then,theequation
becomes:
SolvingforIm(t),themotorcurrentcanbefoundas:
COURSE
MATERIALS SRV02
SAMPLE ROTARY SERVO PLANT
4. PRELABQUESTIONSSECTIONSAMPLE
SRV02PositionControl
BeforeyoustartthelabexperimentsgiveninSection2.3,youshouldstudythebackgroundmaterials
providedinSection2.1andworkthroughthequestionsinthisSection.
1. A2Calculatethemaximumovershootoftheresponse(inradians)givenastepsetpointof45degrees.
Hint:Bysubstitutingymax=(tp)andstepsetpointR0=d(t)intoequation2.6,wecanobtain
Recallthatthedesiredresponsespecificationsinclude20%overshoot.
Answer2.1
Outcome Solution
A2 Substitutingastepreferenceofd(t)=0.785[rad]andPO=20[%]intothisequationgives
themaximumovershootas(tp)=0.823[rad].
2. A1,A2TheSRV02closedlooptransferfunctionwasderivedinequation2.23inSection2.1.2.1.Find
thecontrolgainskpand kvintermsofnand.Hint:Rememberthestandardsecondordersystem
equation.
Answer2.1
Outcome Solution
A1 ThecharacteristicequationoftheSRV02closedlooptransferfunctionin2.7is
and can be re-structured into the form
Equating this with the standard second order system equation gives the expressions
and
A2 Solveforkpand kvtoobtainthecontrolgainsequations
andthevelocitygainis
2011 Intellectual property of Quanser. Do not reproduce without written permission.
COURSE
MATERIALS SRV02
SAMPLE ROTARY SERVO PLANT
5.LABEXPERIMENTSSECTIONSAMPLE
SRV02SpeedControlStepResponsewithLEADControl,Simulation
YouwillsimulatetheclosedloopspeedresponseoftheSRV02withaLeadcontrollertostepinput.Our
goalsaretoconfirmthatthedesiredresponsespecificationsinanidealsituationaresatisfiedandtoverify
thatthemotorisnotsaturated.
AsinthestepresponsewithPIcontrolexperimentinSection3.3.1.1,inthisexperimentyouneedtousethe
q_srv02_spdSIMULINKdiagramshowninFigure3.13again.
1. EntertheKc,a,andTleadcontrolparametersfoundinSection3.1.3.2.
2. IntheSRV02SignalGeneratorblock,settheSignalTypetosquareandtheFrequencyto0.4Hz.
3. IntheSpeedControlSIMULINKmodel,settheAmplitude(rad/s)gainblockto2.5rad/sandtheOffset
(rad/s)constantblockto5.0rad/s.
4. Toengagetheleadcontrol,settheManualSwitchtothedownwardposition.
5. Opentheloadshaftpositionscope,w_l(rad),andthemotorinputvoltagescope,Vm(V).
6. B5Startthesimulation.Bydefault,thesimulationrunsfor5seconds.Thescopesshouldbedisplaying
responsessimilartoFigures3.10and3.11.
7. K1,B9VerifyifthetimedomainspecificationsinSection3.1.1.1aresatisfiedandthatthemotoris
notbeingsaturated.Tocalculatethesteadystateerror,peaktime,andpercentovershoot,usethe
simulatedresponsedatastoredinthedata_spdvariable.
Answer3.12
Outcome Solution
K1 The steady-state error, peak time, and percent overshoot measured fromthesimulated
leadspeedresponseare
and
B9 Notealsothatthesteadystateerror,peaktime,andpercentovershootarefound
automaticallyinthesample_meas_tp_os.mscriptusingtheresponsesavedinthe
data_spdvariable(afterrunnings_srv02_spd).Eventhoughthephasemargin
requirementwasnotmetwiththedesignedleadparameters,theresponsewiththelead
compensatorsatisfiesthespecificationsgiveninSection3.1.1.1whilemaintainingan
inputvoltagelessthan10V,i.e.themotorisnotsaturated.
COURSE
MATERIALS SRV02
SAMPLE ROTARY SERVO PLANT
6.SYSTEMREQUIREMENTSSECTIONSAMPLE
SRV02SpeedControlSetupforSpeedControlSimulation
FollowthesestepstoconfiguretheMATLABsetupscriptandtheSIMULINKdiagramfortheSpeed
Controlsimulationlaboratory:
1. LoadtheMATLABsoftware.
2. BrowsethroughtheCurrentDirectorywindowinMATLABandfindthefolderthatcontainsthe
SRV02speedcontrollerfiles,e.g.s_srv02_spd.mdl.
3. Doubleclickonthes_srv02_spd.mdlfiletoopentheSRV02SpeedControlSimulationSimulink
diagramshowninFigure3.9.
4. Doubleclickonthesetup_srv02_exp03_spd.mfiletoopenthesetupscriptfortheposition
controlSimulinkmodels.
5. Configuresetupscript:ThecontrollerswillberunontheSRV02inthehighgearconfiguration
withthediscload,asinSection1.InordertosimulateSRV02properly,makesurethescriptis
setuptomatchthisconfiguration,i.e.theEXT_GEAR_CONFIGshouldbesettoHIGHandthe
LOAD_TYPEshouldbesettoDISC.Also,ensuretheENCODER_TYPE,TACH_OPTION,K_CABLE,
AMP_TYPE,andVMAX_DACparametersaresetaccordingtotheSRV02systemthatistobe
usedinthelaboratory.Next,setCONTROL_TYPEtoMANUAL.
Answer3.17
SetCONTROL_TYPE=AUTOtoloadthePIandLeadcontrolparametersthatmeetthe
specifications.
6. RunthescriptbyselectingtheDebugRunitemfromthemenubarorclickingontheRun
buttoninthetoolbar.ThemessagesshownbelowshouldbegeneratedintheMATLAB
CommandWindow.Thecorrectmodelparametersareloaded,butthecontrolgainsandrelated
parametersloadedaredefaultvaluesthatneedtobechanged.Thatis,thePIcontrolgainsare
allsettozero,theleadcompensatorparametersaandTarebothsetto1,andthecompensator
proportionalgainKcissettozero.
SRV02 model parameters:
K = 1.53 rad/s/V
tau = 0.0254 s
PI control gains
kp = 0 V/rad
ki = 0 V/rad/s
Lead compensator parameters:
Kc = 0 v/rad/s
1/(a*T) = 1 rad/s
1/T = 1 rad/s
Display message shown in Matlab Command Window after
running setup \_srv02|exp03\_spd.m
INSTRUCTOR WORKBOOK
Instructor Workbook: SRV02 Base Unit Experiment for MATLAB /Simulink Users
SRV02 Base Unit Experiment For MATLAB/Simulink Users
Standardized for ABET * Evaluation Criteria
SRV02 Base Unit Flexible Link Inverted Pendulum Ball and Beam Developed by:
Jacob Apkarian, Ph.D., Quanser
Michel Lvis, M.A.Sc., Quanser
Hakan Gurocak, Ph.D., Washington State University
Course material
complies with:
Flexible Joint Gyro/Stable Platform Double Inverted Pendulum 2 DOF Ball Balancer
With the SRV02 Base Unit, you can select from 10 add-on modules to create experiments of varying complexity across a
wide range of topics, disciplines and courses. All of the experiments/workstations are compatible with MATLAB/Simulink.
2012 Quanser Inc. All rights reserved. MATLAB and Simulink are registered trademarks of The MathWorks Inc.