已阅读5页,还剩5页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
翻译部分英文原文ProgrammableLogicControllerAsmentionedpreviously,theprogrammablelogiccontroller(PLCorPC)isbyfarthemostimportantcommerciallyavailablelogiccontroldevice.Itsdevelopmentbeganin1968whenGeneralMotorsCorp.solicitedtheelectronicsindustryforanalternativetotheeletrome-chanicalrelaylogicsystemsusedtocontrolmachining,materialshandling,andassemblyinautomobilemanufacture.Theirrelaysystemshadbecomeverylargeandcomplexandrequiredagreatamountofrewiringandevenoutrightscrappingwhenchangesinmanufacturingprocesseswereneeded.Thisbecameparticularlycriticalduringtheyearsmodelchangeoverstypicaloftheautoindustry.Anumberofmanufacturersrespondedandthesoftware-basedprogrammablecontrollerwasborn.Itcouldduplicateallthelogiccontrolfunctionsofrelaynetworks,butimplementedtheminsoftware(aprogram),justlikeacomputer.Thismeantthatprocessrevisionsorcompletemodelchangeoversdidnotnowrequirescrappingortediousrewiringofrelaysystems,butinsteadneededonlyrelativelyquickandeasychangesinthePLCsprogram.In1969,PLCswerefirstactuallyusedintheautoindustryandby1971theirutilityinotherindustrieswasrecognizedandapplied.By1973“smart”PLCsusingarithmeticoperations,printercontrol,matrixoperations,CRTinterfaceandthelikebegantoappear.Thecapabilitytocontrol“continuous”processesinvolvingsuchthingsaspressure,temperature,andflowfeedbackcontrolloopsusingproportional,integral,andderivativecontrolwasaddedinabout1975,greatlyincreasingpotentialapplications,sinceonemachinecouldnowbeusedtohandlethelogicalandthecontinuousfeedbackaspectsofsystemcontrolinanintegratedfashion.About1976,thecoordinationofseveralindividualPLCsinafactoryintoanintegratedcomputermanagedoverallmanufacturingsystembegan.Tocomplementtheseadvancesint0operationsoflargerandlargerscale,verysmallPLCs(basedonmicroprocessors)werenowdevelopedtoeconomicallyreplacesystemsofonly8or10relays.Systemsnowrangefromthosecostingseveralhundreddollarsandreplacing8or10relaysto$50,000itemsreplacinghundredsofrelaysandaminicomputer.AlthoughunderstandingtheinternaldetailsofPLCsisneithernecessarytousethemnorappropriateforthistext,Fig.Ishowsageneraloverviewofthebasicelements.Allprogrammablecontrollerscontainacentralprocessingunit(CPU),memory(theestablishedprogram),powersupply,input/output(I/O)modules,andprogrammingdeviceforprogramming,editing,andtrouble-shooting.TheCPU,uponreceivinginstructionsfromthememory(togetherwithfeedbackonthestatusoftheinput/outputdevices),generatescommands,totheoutputsbymeansoftheoutputmodule.Thesecommandscontroltheoutputelementsonamachineorprocess.Devicessuchasrelaycoils,solenoidvalves,indicatorlamps,andmotorstartersaretypicalloadstobecontrolled.Themachineorprocessinputdevicestransmitstatussignaltotheinputmodules,whichinturngeneratelogicsignalsforusebytheCPU.InthiswaytheCPUmonitorselementssuchaspushbuttons,selectorswitches,andrelaycontactsonamachineorprocess.TheprogrammingdeviceisoftendetachableandsharedamongseveralPLCssinceitisneededonlywhenaprogramisbeingdevelopedoraltered.Onceanoperatingprogramisinmemory,theprogrammercanberemoved.AlthoughthestructureofFig.Iisstronglyreminiscentofgeneralpurposecomputers,recallthatalthoughthePLCisacomputer-likedevice,itisindustriallyhardenedforthefactory-floorenvironmentandtheprogrammingdevicespeaksahigh-levellanguage(usuallyrelay-ladder-networkdiagrams)makingiteasytousebynoncomputerspecialists.Thesefeatureshavereallybeenthekeytoitssuccess.ThelargerPLCsareusuallysuppliedwithaCRTdisplayfortheprogrammerthatpresentsagraphicpicturewhoseappearancecoselyresemblesatraditionalrelay-ladder-networkdiagram.Onecanthus“draw”thecontroldiagramoneelementatatimeandactuallyseetheelementconnectionsbeingestablishedontheCRTdisplay.AkeyboardthathasakeyforeachneededlogicoperationisusedtoentertheladderdiagramintotheCRTdisplay,oneelementatatime.WhentheCRTdisplayshowthedesiredfinaldiagram,thePLChasbeenprogrammedandcanbeusedtocontrolthesystem.ThePLCprovidesavarietyofinput/outputmodulestowhichtheexternalinputandoutputdevicescanbeconnectedbyordinaryhandwiring.AlthoughIdonotintendtopresentcomprehensiveperformancespecifications,Iwillmentiontheconceptofscantime.APLCsimulatestheactionofrelaysinaserialratherthanparallelfashion.Inanactualrelaynetwork,manyrelayscanbereactingsimultaneously,whereasaPLCmust“scan”throughtheentirenetworktodeterminethestatusofallelementsbeforeitcanperformitsprogrammedfunctionandresetalltheoutputstotheirnewupdatedvalues.Thetimerequiredforthisiscalledscantimeandmighttypicallybe20msfora2Kmemory.Thisisalimitationonresponsespeedthatmustberecognized,ifa10-in.longpartistobephotoelectricallydetectedwhenmovingona100in/secconveyorbelt,wehaveatmost100msto“see”itanda20msscantimeisadequate.AI-inlongpartwouldbeinviewonly10msandcouldbemissedbya20msscantime.WhenPLCsincludecapabilityforanalogprocesscontrolloops,asimilarscanninglimitationwillexist.Typically,aPLCmighttake500mstoscaneightanalogcontrolloops;soeachloopmightbesampledonlytwicepersecond.Iftheprocessvariablesarefastresponding,suchsamplingdelaysareintolerable.Theselimitationsarebeingremovedbyemployingseveralmicroprocessors,eachoptimizedforitsowncontroltask,withinasinglePLC.ArecentdevelopmentforthissortallowsPLClogiccontroltobeintegratedwithhighspeed,servo-motioncontrols,whichrequireevenhigherresponsespeedthanprocesscontrolloops.Themotioncontrollercombinesatypicalmotor,tachometer,andencoderservosystemwithahigh-speedmicroprocessorthatisinturninterfacedwiththePLC,asinFig.2.AlthoughthePLCislimitedbyitsratherslowscantime,themotioncontrolprocessorcanimplementcompletedisplacement,velocity,andaccelerationcommandsathighspeed.PerformanceandBufferingComputers,especiallylargemainframes,havetraditionallybeenveryexpensivemachines.Accordingly,theownersofthesemachineshavewantedtogetasmuchcomputationdoneaspossible.Thesametrueevenfortodayscheapermicrocomputers.Althoughmicrocomputersmaynotbeveryexpensive,itisstilldesirabletogetasmuch(useful)computingdoneaspossible.Theswitchtobatchsystemwithautomaticjobsequencingwasmadetoimproveperformance.Theproblem,quitesimply,isthathumansareextremelyslow(relativetothecomputer,ofcourse).Consequently,itisdesirabletoreplacehumanoperationbyoperatingsystemsoftware.Automaticjobsequencingeliminatestheneedforhumansetuptimeandjobsequencing.Evenwithautomaticjobsequencing,however,themainCPUisoftenidle.TheprobleminvolvesthespeedofthemechanicalI/Odevices,whichareintrinsicallyslowerthanelectronicdevices.EvenaslowCPUworksinthemicrosecondrange,withmillionsofinstructionsexecutedpersecond.Afastcardreader,ontheotherhand,mightread1000cardsperminute.ThusthedifferenceinspeedbetweentheCPUanditsI/Odevicesmaybethreeordersofmagnitudeormore.AnothersolutiontotheslownessofI/Odevicesisbuffering.BufferingattemptstokeepboththeCPUandI/Odevicebusyallthetime.Theideaisquitesimple.AfterdatahasbeenreadandtheCPUisabouttostartoperatingonit,theinputdeviceisinstructedtobeginthenextinputimmediately.TheCPUandinputdevicearethenbothbusy.BythetimethattheCPUisreadyforthenextdataitem,theinputdevicewillhavefinishedreadingit.TheCPUcanthenbeginprocessingthenewlyreaddata,whiletheinputdevicestartstoreadthefollowingdata.Similarbufferingcanbedoneforoutput.Inthiscase,theCPUcreatesdatawhichisputintoabufferuntilanoutputdevicecanacceptit.Arecordisanaturalunitofdata.Itmaybeaphysicalrecord(suchalineimageforaprinteroracharacterfromakeyboardorablockfromatapeordisk),oritmaybealogicalrecord(suchasaninputline,anEnglishword,oranarray).Logicalrecordsaredefinedbytheapplicationproblem;physicalrecordsaredefinedbythenatureoftheI/Odevice.Softwareblockingandunblockingcanconvertbetweenthelogicalrecordsoftheapplicationandthephysicalrecordsofthedevice.Recordsoftheunitsofdatausedforbuffering.Inpractice,bufferingseldomkeepsboththeCPUanditsI/Odevicesbusyallthetime.IftheCPUisworkingononerecordwhileaninputdeviceisworkingonanother,eithertheCPUortheinputdevicewillfinishfirst.IftheCPUfinishesfirst,itmustwait;itcannotproceeduntilthenextrecordisreadandisinmemoryreadytobeprocessed.Notice,however,thattheCPUmaynothavetositidleforlong,andintheworstcase,nolongerthanwithoutbuffering.Iftheinputdevicefinishesfirst,theneitheritmustwaitoritmayproceedwithreadingthenextrecord.Thebuffersthatholdrecordsthathavebeenreadbutnotyetprocessed(orprocessedbutnotyetoutput)areoftenmadelargeenoughtoholdseveralrecords(forexamplea255characterbuffer,ora10cardbuffer).ThusaninputdevicecanreadseveralrecordsaheadoftheCPU.IftheinputdeviceisconsistentlyfasterthantheCPU,however,thebufferwilleventuallybecomefullandtheinputdevicemustwait.Bufferingisatrickybusinessandcanbedifficulttocode.OneproblemistodetectthatanI/Odevicehasfinishedanoperationassoonaspossible.ThenextI/Ooperationcanonlybestartedwhenthepreviousonehasfinished.Interruptssolvethisproblem.AssoonasanI/Odeviceisfinishedwithanoperation,itinterruptstheCPU.WhentheCPUisinterrupted,itstopswhatitisdoingandimmediatelytransfertoafixedlocation.Theinstructionsatthislocationaretypicallyaserviceroutinefortheinterrupt.Theinterruptserviceroutinechecksseeifthebufferisnotfull(foraninputdevice)ornotempty(foranoutputdevice),thenstartsthenextI/Orequest.TheCPUcanthenresumetheinterruptedcomputation.Inthisway,I/OdevicesandtheCPUcanbeoperatedatfullspeed.Interruptsareanimportantpartofacomputerarchitecture.Eachcomputerdesignhasitsowninterruptmechanism,butseveralfunctionsarecommon.Theinterruptmusttransfercontroltotheinterruptserviceroutine.Generally,thisisdonebyreservingasetoflocationsinlowmemory(thefirst100orsolocations)toholdtheaddressesoftheinterruptserviceroutinesforthevariousdevices.Thisarray,ofvector,addressesisthenindexedbythedevicenumbertoprovidetheaddresstheinterruptserviceroutinefortheinterruptingdevice.Theinterruptarchitecturemustalsosavetheaddressoftheinterruptedinstruction.Manyolddesignssimplystoredtheinterruptaddressinafixedlocationorinalocationindexedbythedevicenumber.Morerecentarchitecturesstorethereturnaddressonthesystemstack.Otherregisters,suchasaccumulatorsorindexregisters,mayneedtobeexplicitlysavedandrestoredbytheprogrammeroftheinterruptserviceroutine.Aftertheinterruptisserviced,ajumpbacktotheinterruptaddresswillresumetheinterruptedcomputationasiftheinterrupthadnotoccurred.Sophisticatedinterruptarchitecturesalsodealwithaninterruptarrivingwhileanotherinterruptisbeingserviced,oftenbyapriorityscheme.Forexample,considerasimpleterminaloutputdriver.Whenalineistobedisplayedontheterminal,thefirstcharacterissenttotheterminal.Whentheinterruptrequestfromtheterminalarrives,theCPUwillbeabouttoexecutesomeinstruction.(IftheCPUisinthemiddleofexecutinganinstruction,theinterruptisheldpendinguntiltheinstructionexecutioniscomplete.)Theaddressofthisinterruptedinstructionissaved,andcontrolistransferredtotheinterruptroutinefortheoutputterminal.Theinterruptserviceroutinesavesthecontentsofanyregistersitwillneedtouse.Itchecksforanyerrorconditionswhichmighthaveresultedfromthelastoutputoperation.Itthenchecksthebuffercontainingthosecharacterswhichareyettobedisplayed.Ifthereareanycharactersinthebuffer,oneisremovedfromthebuffer.Pointerandcountervariablesareadjustedappropriately.Thecharacterisoutputtothedisplayandcontrolbitsaresettoallowittointerruptagainwhenthecharacterhasbeenproperlydisplayed.Then,theinterruptserviceroutinerestoresthecontentsofanysavedregistersandtransferscontrolbacktotheinterruptedinstruction.Ifcharactersarebeingoutputtoa1200baudterminal,theterminalcanacceptanddisplayonecharacterapproximatelyevery8milliseconds,or8000microsecondspercharacter,leaving7980microsecondsoutofevery8000forCPUcomputation(andservicingotherinterrupts).Ahighspeeddevice,however,suchasatape,diskorcommunicationsnetwork,maybeabletotransmitinformationatclosetomemoryspeeds;theCPUwouldneed20microsecondstorespondtoeachinterrupt,withinterruptsarrivingevery4microseconds(forexample).Tosolvethisproblem,directmemoryaccess(DMA)isusedforhighspeedI/Odevices.Aftersettingupbuffers,pointers,andcountersfortheI/Odevice,thedevicetransfersanentireblockofdatatoorfrommemorydirectly,withnointerventionbytheCPU.Onlyoneinterruptisgeneratedperblock,ratherthantheoneinterruptperbyte(orword)forlowspeeddevices.ThebasicoperationoftheCPUisthesame.WhenaDMAdeviceinterruptstheCPU,theinterruptserviceroutinefirstchecksforerrorintheprevioustransfers.Thenitfindsabuffer(anemptybufferforputorafullbufferforoutput)fromaqueueofbuffersforthenexttransfer.(Abufferistypically128to4096bytes,dependinguponthedevice.)Deviceregistersaresettothebufferaddressandsize,andtheI/Ooperationisstarted.Thenextinterruptfromthedeviceindicationthattheentireblockhasbeentransferred(oranerrorhasoccurred).Noticethatbufferingisdirectlyrelatedtointerruptprocessing.Thatfact,plusthedifficultyofcorrectlyprogrammingthebufferingroutine(whatifweareinthemiddleofremovingarecordfrombufferandupdatingthebufferpointerswhenaninterruptoccurs?)meansthatbufferingisgenerallyanoperatingsystemfunction.TheresidentmontororthedevicedriversincludesystemI/ObuffersforeachI/Odevice.Subroutinecallstothedevicedriverbyapplicationsprograms(I/Orequest)normallycauseonlyatransfertoorfromasystembuffer.TheactualI/Ooperationhaseitheralreadybeendone,orwillbedonelater,assoonasthedeviceisavailable.Howdoesbufferingaffectperformance?Bufferingmainlyhelpstosmoothovervariationsinthetimeittakestoprocessarecord.Iftheaveragespeeds(inrecordspersecond)oftheCPUandtheI/Odevicesarethesame,thenbufferingallowstheCPUtogetslightlyaheadorbehindtheI/Odevices,withbothstillprocessingeverythingatfullspeed.However,iftheCPUis,ontheaverage,muchfasterthananinputdevice,bufferingisoflittleuse.IftheCPUisalwaysfaster,thenitwillalwaysfindanemptybufferandhavetowaitfortheinputdevice.Foroutput,theCPUcanproceedatfullspeeduntil,eventually,allsystembuffersarefull.ThentheCPUmustwaitfortheoutputdevice.ThissituationoccurswithI/OboundjobswheretheamountofI/O,relativetocomputation,isverygreat.SincetheCPUisfasterthantheI/Odevice,notbythespeedoftheCPU.Ontheotherhand,theamountofcomputationissohighforaCPUboundjobthattheinputbuffersarealwaysfullandtheoutputbuffersalwaysempty;theCPUcannotkeepupwiththeI/Odevices.Consequently,bufferingcanbeofsomehelp,butitisseldomsufficient.Particularlyinearlycomputersystems,mostjobswereI/Obound.Bufferinghelpedsomewhat,buttheI/Odevices(suchascardreaders,lineprinters,andpaperstapereader/punches)weresimplytooslowtokeepupwiththeCPU.中文译文可编程逻辑控制器就象先前提到的那样,可编程逻辑控制器(PLC或PC)是迄今为止最重要的商用逻辑控制设备。它的发展开始于1968年,由通用电气公司通过加强电子工业从而完成了ELETROMECHANICAL到用于控制机器,材料加工和装配汽车的中继系统的转变。他们的中继系统已经完成了非常大而且复杂的系统,而且当要改变制造流程时,需要大量的线路更换工作或者甚至直接抛弃该系统。这变成了那个年代自动化工业的典型的模式转换中备受批评的事。一部分制造商对这样的批评作出了反应,从而基于软件的可编程控制器诞生了。它能实现中继网络的所有的逻辑控制功能,但它们就象计算机一样是在软件(程序)中实现的,这意味着生产流程转变或模式的完全转变现在不再需要抛弃系统或更换大量电线了。而在PLC的程序中的改变相应就快多了而且容易多了。在1969年,PLC第一次被实际应用于自动化工业,而在1971年它们已经被用于别的工业,而且成绩不错。到了1973年,“精致”的PLC在算术运算,打印机控制,矩阵运算,CRT接口和将要出现的一些类似的门类中的到应用。PLC在1975年被加入了在连续处理过程象压力,温度,和使用比例,积分和微分控制的流量反馈控制环中的控制能力。急剧增加的潜在应用,尽管一个机器,现在可以被用来在集成化环境中处理逻辑的和系统连续反馈方面的控制。在1976年,一个工厂中全部的生产由计算机集中管理。于是就开始了几个PLC的协调工作。为了完成规模越来越大的运行的发展,很小的PLC开始向只有8或10个节点的经济可变系统方向发展。从那些价值几百美圆,只有8或10个节点到价值50000美圆有数百个节点和一个微机的产品都是PLC的发展范围。尽管理解PLC的内部细节既不必要使用它们也不是为了欣赏。所有的可编程控制器包含一个中央处理单元,储存器(已存有程序),电源提供,输入/输出部分,和用于编程的编程器,编辑和纠错部分。CPU在从存储器接受命令(和从输入输出设备来的反馈),通用命令之后,从输出部分输出结果。这些命令控制输出元件。象节点,指示灯,和电机启动装置是典型的被控负载设备。机器输入设备传输状态信号到输入部分。该信号随后变成CPU使用的逻辑信号。通过这种方法,CPU监视象按键,选择器转换,节点接通等元件动作。编程设备尽管只有在程序需要变动时才使用,但它可以为几个PLC公用。当存储器中有一个操作程序时,编程器可以消除它,尽管在图1中,这个用于普通目的的计算机在人们的概念中是强有力的,尽管PLC是象计算机一样的设备。运行和缓冲计算机,特别是大的主机,传统上一直都是非常昂贵的机器。因此,机器的主人想让它运行尽可能多的运算。即使对今天较便宜的微机也是一样的,虽然微机可能不太贵,但仍然期望进行尽可能多的运算。为了提高运行效率,制作了有自动工作顺序的批处理系统的开关。这个问题,很简单的说,是人工操作极慢(当然是相对计算机而言)。因此,期望由操作系统软件代替人的操作。自动工作顺序避免了认为建立时间和安排工作顺学的需要。然而,即使有了自动工作顺序,主CPU也经常闲置。这个问题涉及机械I/O设备的速度,机械I/O设备固有的电子设备慢,甚至一个满速CPU能在微秒范围运行,每秒能执行树百万个指令。另一方面,一个快速卡片阅读器每分钟可能阅读一千张卡。因此,CPU和它的I/O设备的速度的差别可能是三个或更多的数量级。解决I/O设备太慢问题的另一个方法是缓冲。缓冲试图使CPU和I/O设备一直都是忙的。这种想法很简单,读完数据之后和CPU就要开始操作时,输入设备被指令立即进行下一个输入,然后,CPU和输入设备都是忙的。当CPU为操作下一个数据项做好准备时,输入设备也将已经读完它。然后,当输入设备开始读其后的数据时,CPU可以开始处理新读的数据。同样的缓冲也可以用于输出。在这种情况下,CPU建立的数据放入缓冲器中,直到输出设备能够接受这些数据。一个记录是一个自然的记录单元,它可以是一个物理记录(如用于打印机的一个行图形或键盘上的一个字符或磁带或磁盘上的一块)。也可以是一个逻辑记录(如一个输入行,或者一个英文单词,或一个数组),逻辑记录由应用问题来定义;物理记录由I/O设备的性质来定义。分块和不分块软件可以在应用的逻辑记录和设备的物理记录之间转换。记录是缓冲的数据单元。实际上,缓冲很少能使CPU及其I/O设备一直都是忙的。如果CPU正在处理一个记录而输入设备正在处理另一个,或者CPU先完成,或输入设备先完成。如果CPU先完成,它就必须等,直到下一个记录被读完并且在内存中准备好它才能继续。然而,要注意,CPU不会闲置很长时间,在最坏的情况下,也不会比没有缓冲的时间长。如果输入设备先完成,它或必须等待,或继续读下一个记录。缓冲器中装有已经读过的但还没有处理的记录(或已经处理过,但还没有打印)。缓冲器通常做的很大,足以容纳几个记录(例如255字符缓冲器,或一个10卡缓冲器)。因此,输入设备可比CPU多读几个记录。然而,如果输入设备不断的比CPU快,缓冲最终将变满并且输入设备必须等待。缓冲是一项需要技巧的工作且很难编码。一个问题是尽快查出I/O设备已经完成操作。下一个问题是,只有上一个操作完成之后,才能开始I/O操作。中断解决了这一问题。I/O设备一完成一个操作,它就中断CPU,当CPU被中断是时,就停下正在进
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
评论
0/150
提交评论