Sei sulla pagina 1di 12

12/27/2016

IntroductoryPLCProgrammingWikibooks,openbooksforanopenworld

IntroductoryPLCProgramming
Contents
1

Introduction

1.1 WhatisaProgrammableLogicController(PLC)?
1.2 PLCusagescenarios
1.3 HistoryofPLCs
1.4 Recentdevelopments

2 BasicConcepts
2.1 HowthePLCoperates
2.1.1 Scancycle
3 Basicinstructions
4 Externallinks

Introduction
https://en.wikibooks.org/wiki/Introductory_PLC_Programming

1/12

12/27/2016

IntroductoryPLCProgrammingWikibooks,openbooksforanopenworld

WhatisaProgrammableLogicController(PLC)?

AProgrammableLogicController,orPLC,ismoreorlessasmallcomputerwithabuiltinoperating
system(OS).ThisOSishighlyspecializedandoptimizedtohandleincomingeventsinrealtime,i.e.,
atthetimeoftheiroccurrence.

sensors

ThePLChasinputlines,towhich
areconnectedtonotifyofevents(suchastemperature
above/belowacertainlevel,liquidlevelreached,etc.),andoutputlines,towhich
are
connectedtoeffectorsignalreactionstotheincomingevents(suchasstartanengine,open/closea
valve,andsoon).

actuators

Thesystemisuserprogrammable.Itusesalanguagecalled"RelayLadder"orRLL(RelayLadder
Logic).Thenameofthislanguageimpliesthatthecontrollogicoftheearlierdays,whichwasbuilt
fromrelays,isbeingsimulated.
Someotherlanguagesusedinclude:
1.SequentialFunctionchart
2.Functionalblockdiagram
3.StructuredText
4.InstructionList
5.Continuousfunctionchart
Aprogrammablelogiccontroller,PLC,orprogrammablecontrollerisadigitalcomputerusedfor
automationoftypicallyindustrialelectromechanicalprocesses,suchascontrolofmachineryon
factoryassemblylines,amusementrides,orlightfixtures.PLCsareusedinmanymachines,inmany
industries.PLCsaredesignedformultiplearrangementsofdigitalandanaloginputsandoutputs,

https://en.wikibooks.org/wiki/Introductory_PLC_Programming

2/12

12/27/2016

IntroductoryPLCProgrammingWikibooks,openbooksforanopenworld

industries.PLCsaredesignedformultiplearrangementsofdigitalandanaloginputsandoutputs,
extendedtemperatureranges,immunitytoelectricalnoise,andresistancetovibrationandimpact.
Programstocontrolmachineoperationaretypicallystoredinbatterybackedupornonvolatile
memory.APLCisanexampleofa"hard"realtimesystemsinceoutputresultsmustbeproducedin
responsetoinputconditionswithinalimitedtime,otherwiseunintendedoperationwillresult.
BeforethePLC,control,sequencing,andsafetyinterlocklogicformanufacturingautomobileswas
mainlycomposedofrelays,camtimers,drumsequencers,anddedicatedclosedloopcontrollers.
Sincethesecouldnumberinthehundredsoreventhousands,theprocessforupdatingsuch
facilitiesfortheyearlymodelchangeoverwasverytimeconsumingandexpensive,aselectricians
neededtoindividuallyrewiretherelaystochangetheiroperationalcharacteristics.
Digitalcomputers,beinggeneralpurposeprogrammabledevices,weresoonappliedtocontrol
industrialprocesses.Earlycomputersrequiredspecialistprogrammers,andstringentoperating
environmentalcontrolfortemperature,cleanliness,andpowerquality.Usingageneralpurpose
computerforprocesscontrolrequiredprotectingthecomputerfromtheplantfloorconditions.An
industrialcontrolcomputerwouldhaveseveralattributes:itwouldtoleratetheshopfloor
environment,itwouldsupportdiscrete(bitform)inputandoutputinaneasilyextensiblemanner,it
wouldnotrequireyearsoftrainingtouse,anditwouldpermititsoperationtobemonitored.The
responsetimeofanycomputersystemmustbefastenoughtobeusefulforcontroltherequired
speedvaryingaccordingtothenatureoftheprocess.[1]Sincemanyindustrialprocesseshave
timescaleseasilyaddressedbymillisecondresponsetimes,modern(fast,small,reliable)electronics
greatlyfacilitatebuildingreliablecontrollers,especiallybecauseperformancecanbetradedofffor
reliability.
In1968GMHydraMatic(theautomatictransmissiondivisionofGeneralMotors)issuedarequest
forproposalsforanelectronicreplacementforhardwiredrelaysystemsbasedonawhitepaper
writtenbyengineerEdwardR.Clark.ThewinningproposalcamefromBedfordAssociatesof
Bedford,Massachusetts.ThefirstPLC,designatedthe084becauseitwasBedfordAssociates'

https://en.wikibooks.org/wiki/Introductory_PLC_Programming

3/12

12/27/2016

IntroductoryPLCProgrammingWikibooks,openbooksforanopenworld

Bedford,Massachusetts.ThefirstPLC,designatedthe084becauseitwasBedfordAssociates'
eightyfourthproject,wastheresult.[2]BedfordAssociatesstartedanewcompanydedicatedto
developing,manufacturing,selling,andservicingthisnewproduct:Modicon,whichstoodfor
MOdularDIgitalCONtroller.OneofthepeoplewhoworkedonthatprojectwasDickMorley,whois
consideredtobethe"father"ofthePLC.[3]TheModiconbrandwassoldin1977toGould
Electronics,lateracquiredbyGermanCompanyAEG,andthenbyFrenchSchneiderElectric,the
currentowner.
Oneoftheveryfirst084modelsbuiltisnowondisplayatModicon'sheadquartersinNorthAndover,
Massachusetts.ItwaspresentedtoModiconbyGM,whentheunitwasretiredafternearlytwenty
yearsofuninterruptedservice.Modiconusedthe84monikerattheendofitsproductrangeuntil
the984madeitsappearance.
TheautomotiveindustryisstilloneofthelargestusersofPLCs.
EarlyPLCsweredesignedtoreplacerelaylogicsystems.ThesePLCswereprogrammedin"ladder
logic",whichstronglyresemblesaschematicdiagramofrelaylogic.Thisprogramnotationwas
chosentoreducetrainingdemandsfortheexistingtechnicians.OtherearlyPLCsusedaformof
instructionlistprogramming,basedonastackbasedlogicsolver.
ModernPLCscanbeprogrammedinavarietyofways,fromtherelayderivedladderlogicto
programminglanguagessuchasspeciallyadapteddialectsofBASICandC.Anothermethodisstate
logic,averyhighlevelprogramminglanguagedesignedtoprogramPLCsbasedonstatetransition
diagrams.
ManyearlyPLCsdidnothaveaccompanyingprogrammingterminalsthatwerecapableofgraphical
representationofthelogic,andsothelogicwasinsteadrepresentedasaseriesoflogicexpressions
insomeversionofBooleanformat,similartoBooleanalgebra.Asprogrammingterminalsevolved,it
becamemorecommonforladderlogictobeused,fortheaforementionedreasonsandbecauseit
https://en.wikibooks.org/wiki/Introductory_PLC_Programming
wasafamiliarformatusedforelectromechanicalcontrolpanels.Newerformatssuchasstatelogic 4/12

12/27/2016

IntroductoryPLCProgrammingWikibooks,openbooksforanopenworld

wasafamiliarformatusedforelectromechanicalcontrolpanels.Newerformatssuchasstatelogic
andFunctionBlock(whichissimilartothewaylogicisdepictedwhenusingdigitalintegratedlogic
circuits)exist,buttheyarestillnotaspopularasladderlogic.AprimaryreasonforthisisthatPLCs
solvethelogicinapredictableandrepeatingsequence,andladderlogicallowstheprogrammer
(thepersonwritingthelogic)toseeanyissueswiththetimingofthelogicsequencemoreeasily
thanwouldbepossibleinotherformats.

PLCusagescenarios
APLCisprimarilyusedtocontrolmachinery.AprogramwrittenforaPLCconsistsbasicallyof
instructionstoturnonandoffoutputsbasedoninputconditionsandtheinternalprogram.Inthis
respect,itissimilartohowastandardcomputerapplicationisused.OnceaPLCprogramis
activated,however,itwilltypicallyruncontinuouslyasaloopforanindefiniteperiod.PLCbased
systemsarefrequentlyusednotonlytocontrolsimpledevicessuchasagaragedooropener,but
alsoforsolvingcomplexapplicationscenarios,suchascontrollingawholehouse,including
switchinglightsonoroffatcertaintimes,monitoringcustombuiltsecuritysystem,andsoon.
Mostcommonly,aPLCisfoundinsideofamachineinanindustrialenvironment.APLCcanrunan
automaticmachineforyearswithlittlehumanintervention.Theyaredesignedtowithstandmost
harshenvironments.

HistoryofPLCs
Whenthefirstelectronicmachinecontrolsweredesigned,theyusedrelaystocontrolthemachine
logic(i.e.press"Start"tostartthemachineandpress"Stop"tostopthemachine).Abasicmachine
mightneedawallcoveredinrelaystocontrolallofitsfunctions.Thereareafewlimitationstothis
typeofcontrol.
https://en.wikibooks.org/wiki/Introductory_PLC_Programming

5/12

12/27/2016

IntroductoryPLCProgrammingWikibooks,openbooksforanopenworld

Relaysfail.
Thedelaywhentherelayturnson/off.
Thereisanentirewallofrelaystodesign/wire/troubleshoot.
APLCovercomestheselimitations,itisamachinecontrolledoperation.

Recentdevelopments
PLCsarebecomingmoreandmoreintelligent.InrecentyearsPLCshavebeenintegratedinto
electricalcommunicationssuchasComputernetwork(s)i.e.,allthePLCsinanindustrial
environmenthavebeenpluggedintoanetworkwhichisusuallyhierarchicallyorganized.ThePLCs
arethensupervisedbyacontrolcentre.Thereexistmanyproprietarytypesofnetworks.Onetype
whichiswidelyknownisSCADA.

BasicConcepts

HowthePLCoperates
ThePLCisapurposebuiltmachinecontrolcomputerdesignedtoreaddigitalandanaloginputs
fromvarioussensors,executeauserdefinedlogicprogram,andwritetheresultingdigitaland
analogoutputvaluestovariousoutputelementslikehydraulicandpneumaticactuators,indication
lamps,solenoidcoils,etc.

Scancycle
Exactdetailsvarybetweenmanufacturers,butmostPLCsfollowa'scancycle'format.PLCscans

https://en.wikibooks.org/wiki/Introductory_PLC_Programming

6/12

12/27/2016

IntroductoryPLCProgrammingWikibooks,openbooksforanopenworld

Exactdetailsvarybetweenmanufacturers,butmostPLCsfollowa'scancycle'format.PLCscans
programmetoptobottom&lefttoright.
OverheadOverheadincludestestingI/Omoduleintegrity,verifyingtheuserprogramlogichasn't
changed,thatthecomputeritselfhasn'tlockedup(viaawatchdogtimer),andanynecessary
communications.CommunicationsmayincludetrafficoverthePLCprogrammerport,remoteI/O
racks,andotherexternaldevicessuchasHMIs(HumanMachineInterfaces).

Inputscan

A'snapshot'ofthedigitalandanalogvaluespresentattheinputcardsissavedtoaninput
memorytable.

Logicexecution

Theuserprogramisscannedelementbyelement,thenrungbyrunguntiltheendofthe
program,andresultingvalueswrittentoanoutputmemorytable.

Diagnosisandcommunication

isusedinmanydifferentdisciplineswithvariationsintheuseoflogics,analytics,and
experiencetodetermine"causeandeffect".Insystemsengineeringandcomputerscience,itis
typicallyusedtodeterminethecausesofsymptoms,mitigations,andsolutions.itis
communicatetoinputmoduleandsendmessagetooutputmoduleforanyincorrectdatafiles
variations.

Outputscan
https://en.wikibooks.org/wiki/Introductory_PLC_Programming

7/12

12/27/2016

IntroductoryPLCProgrammingWikibooks,openbooksforanopenworld

Valuesfromtheresultingoutputmemorytablearewrittentotheoutputmodules.
OncetheoutputscaniscompletetheprocessrepeatsitselfuntilthePLCispowereddown.
Thetimeittakestocompleteascancycleis,appropriatelyenough,the"scancycletime",and
rangesfromhundredsofmilliseconds(onolderPLCs,and/orPLCswithverycomplexprograms)to
onlyafewmillisecondsonnewerPLCs,and/orPLCsexecutingshort,simplecode.

Basicinstructions

BeawarethatspecificnomenclatureandoperationaldetailsvarywidelybetweenPLC
manufacturers,andoftenimplementationdetailsevolvefromgenerationtogeneration.
Oftenthehardestpart,especiallyforaninexperiencedPLCprogrammer,ispracticingthementalju
jitsunecessarytokeepthenomenclaturestraightfrommanufacturertomanufacturer.

PositiveLogic(mostPLCsfollowthisconvention)
True=logic1=inputenergized.

False=logic0=inputNOTenergized.

NegativeLogic

True=logic0=inputNOTenergized
False=logic1=inputenergized.

NormallyOpen
https://en.wikibooks.org/wiki/Introductory_PLC_Programming

8/12

12/27/2016

IntroductoryPLCProgrammingWikibooks,openbooksforanopenworld

(XIC)eXamineIfClosed.
Thisinstructionistrue(logic1)whenthehardwareinput(orinternalrelayequivalent)is
energized.

NormallyClosed

(XIO)eXamineIfOpen.
Thisinstructionistrue(logic1)whenthehardwareinput(orinternalrelayequivalent)isNOT
energized.

OutputEnable

(OTE)OuTputEnable.
Thisinstructionmimicstheactionofaconventionalrelaycoil.

OnTimer

(TON)TimerON.
Generally,ONtimersbegintimingwhentheinput(enable)linegoestrue,andresetifthe
enablelinegoesfalsebeforesetpointhasbeenreached.Ifenableduntilsetpointisreached
thenthetimeroutputgoestrue,andstaystrueuntiltheinput(enable)linegoesfalse.

OffTimer

(TOF)TimerOFF.

https://en.wikibooks.org/wiki/Introductory_PLC_Programming

9/12

12/27/2016

IntroductoryPLCProgrammingWikibooks,openbooksforanopenworld

Generally,OFFtimersbegintimingonatruetofalsetransition,andcontinuetimingaslongas
theprecedinglogicremainsfalse.WhentheaccumulatedtimeequalssetpointtheTOFoutput
goeson,andstaysonuntiltherunggoestrue.

RetentiveTimer

(RTO)RetentiveTimerOn.
ThistypeoftimerdoesNOTresettheaccumulatedtimewhentheinputconditiongoesfalse.

Rather,itkeepsthelastaccumulatedtimeinmemory,and(if/whentheinputgoestrueagain)
continuestimingfromthatpoint.IntheAllenBradleyconstruction,thisinstructiongoestrueonce
setpoint(preset)timehasbeenreached,andstaystrueuntilaRES(RESet)instructionismadetrue
toclearit.

LatchingRelays

(OTL)OuTputLatch.
(OTU)OuTputUnlatch.

Generally,theunlatchoperatortakesprecedence.Thatis,iftheunlatchinstructionistruethenthe
relayoutputisfalseeventhoughthelatchinstructionmayalsobetrue.InAllenBradleyladder
logic,latchandunlatchrelaysareseparateoperators.
However,otherladderdialectsoptforasingleoperatormodeledafterRS(ResetSet)flipflopIC
chiplogic.

JumptoSubroutine
https://en.wikibooks.org/wiki/Introductory_PLC_Programming

10/12

12/27/2016

IntroductoryPLCProgrammingWikibooks,openbooksforanopenworld

(JSR)JumptoSubRoutine
ForjumpingfromonerungtoanothertheJSR(JumptoSubroutine)commandisused.
ProgrammableLogic

Externallinks
Wikipedia:
Programmablelogiccontroller
Ladderlogic
IEC611313PLCprogramminglanguagestandards

SCADA

Wikiversity:
Automationtemplate
byphilip
Retrievedfrom"https://en.wikibooks.org/w/index.php?
title=Introductory_PLC_Programming&oldid=3143969"
https://en.wikibooks.org/wiki/Introductory_PLC_Programming

11/12

12/27/2016

IntroductoryPLCProgrammingWikibooks,openbooksforanopenworld

Thispagewaslastmodifiedon7November2016,at15:54.
TextisavailableundertheCreativeCommonsAttributionShareAlikeLicense.additionalterms
mayapply.Byusingthissite,youagreetotheTermsofUseandPrivacyPolicy.

https://en.wikibooks.org/wiki/Introductory_PLC_Programming

12/12

Potrebbero piacerti anche