OPC Technology.docx
《OPC Technology.docx》由会员分享,可在线阅读,更多相关《OPC Technology.docx(12页珍藏版)》请在冰点文库上搜索。
![OPC Technology.docx](https://file1.bingdoc.com/fileroot1/2023-5/5/017d587d-df37-4f1e-8eab-a1db022cff9e/017d587d-df37-4f1e-8eab-a1db022cff9e1.gif)
OPCTechnology
Contents
∙HistoryofOPC
∙WhydoweneedOPC?
itsBenefits
∙OPCConcepts&Terminology
∙COMInterfaces&ComponentCategories
∙OPCCompliance
∙OPCSpecifications
∙Resources
SchematicofOPCServer.
Figure1.
etc)-->
Introduction
COM/OLEapplicationsarewidelyusedinIndustrialAutomationandProcessControldomains.Sincenotmanyprogrammersareawareofthesetechnologies,IthoughttosharemyexperienceinOPCandmostdeveloperswouldlovetoexpandtheirknowledgeaboutCOM/OLEapplicationareas.
ThisismyfirsteverarticleonCodeProject,soifyoufeelanythingneedstobeimproved,dropmealine.Yoursuggestionsandcommentsaremostwelcome.
Thegoalofarticle:
Give simple&understandable overviewofOPC.MoredetailedinformationandspecificationscanbedownloadedfromOPCFoundationandwebsitesmentionedinResourcessection.
Sofirst,abouttheabovediagram...
TheoryaboutFigure1:
Onleft-bottomisahardwaredevice.Itcouldbea PLC (programmablelogiccontroller),atemperaturesensor,rollerbeltcontroller,orjustaboutanyindustrialdevice.CentralpartistheOPCserver.Rightsideistheclientthatwantsto operatethedevice.TheOPCServergivesoutstandardCOMinterfacessothatanyclientawareofthese OPCInterfaces caninterfacewithserverandoperatethedevice-withoutprogrammingdevicedriverforthathardware.HardwarecanbeasvariedasOPCservercanhandleandclientscanstillreadandwritefromthishardware.
Nowback toourOPCcourse.ThisarticlegivesanoverviewofOPCandcoversfollowingtopics.Sourcecodeisnotavailable,sincemostofservercodeisspecifictohardware.Andclientwouldstillneedaservertoconnectto.Butyes,ifyouwanttoexperimentwithOPC,checkouttheResourcessectionbelow.
HistoryofOPC
In1996,agroupofcompaniesRockwellSoftware,Intellution,et.al.cametogethertoformaconsortiumthatdefinedastandardforprocesscontrol.SCADAandsimilarstandardizationeffortswerebeingmadeatthattimeinprocesscontrolandautomationindustry.ThisgroupcreatedaninitialdraftthatwasbasedonMicrosoft'sObjectLinkingandEmbedding(OLE).Itwascalled OLEfor Process Control(OPC). OPCFoundation publishesspecificationsandmanageseverythingthatgoesintoOPCtechnology.
Todaymorethan300companiesarepartofOPCFoundation.Microsoft,GE,Siemens,Rockwell,ABB,Ford,HoneywellandmorearemembersthatactivelycontributeandconsumeOPCtechnology.
In2005,OPCFoundationreleasedOPCUnifiedArchitecturedraft.Therearepredecessordraftsreleasedbefore-OPCHDA,OPCDX,OPCAE,OPCCommands,OPCSecurity.Wewillbrieflystudytheminthisarticle.
Bynow,youmusthaveaquestioninyourmind.Letmeansweritbelow...
WhydoweneedOPC?
itsBenefits
IwasalsoafirsttimertoOPC(comingfromvariedexperienceinDevTools,eLearning,CAD/PLM,Multimedia),andhadnoclueastowhydoweneedit.Ifoundthatlearningitthroughacasestudywasveryhelpful,soIamgoingtodothesameforyou.Tounderstandtheneedforstandardizationinprocesscontrolindustry,letmegiveyouanactualcasestudyperformedbyagiantorganizationinPetrochemicalsbusiness.
Refertofigure2.Itshowsthedevicesandsoftwareapplicationthatwereinactiononthisparticularpetrochemicalplant.
Figure2.
PLC,Vibrationsensor,andCalculationengineworkondifferentcommunicationprotocols-TSAA,Modbus,andDDE.SothesoftwareapplicationsthatneeddatafromthesedevicesalsoneedtobeawareofTSAA,Modbus,andDDEprotocol.Additionallyeachdeviceneedstoserveallthethreeapplications.Theprocesshistorian,GUIapplicationprovidinghumanmachineinterfaceandthemachineconditionmonitorallcommunicatingwithalldevicesresultsinacomplexity.Thisdeploymenttookthecompanyaround10days.AnditscostwasapproximatelyUS$50,000.
Now,someonelikeme:
)cametothemandsaid,"heyguys,whydon'twethinksmartandimplementasinFigure3?
".Observethereducedcomplexity.NowallsoftwareapplicationstalkonlytotheOPCServers.AndalldevicesalsorespondonlytotheOPCserver.OPCServerprovidesthe BlackBox forsoftwareapplicationsaroundhardware.
Figure3.
Thenewimplementationtookjust2daystodeployandcostincurredwasapproximatelyUS$10,000.Theycouldhaveeliminated2OPCserversaswellandimplementeddevicedriversrightinsideasingleOPCserver.ThisisatradeoffandofftheshelfOPCserversmayhavestandardprotocolssupportlikeDDE,ModbusandTSAA.
Asyouobservedcorrectly,thebenefitsare:
∙Reducedloadondevice.
∙Scalabilityofsystemhasincreased.
∙OPCserverprovidescachingofdata.
∙Clientapplicationsneednotknowhardwareprotocoldetails.
∙Increasedlifefordevice(itneednotservemultipleclientsanymore).
∙Interoperability(Unix/LinuxandWindows-bothplatformsaresupportedbyOPC)
∙Standardization
NowthatyouhavesomeinsightintoOPCbenefitsandhistory,let'stakeonestepaheadtounderstandOPCterminologyandconcepts.
OPCConcepts&Terminology
OPCspecificationdefinesaconsistentterminologytoidentifyvariousentitiesinvolved.ThebestanalogytoOPCwayofdatarepresentationisthatofafilesystemhierarchy.OPCcallsitasOPCAddressSpace.Withinthisaddressspaceeveryentitycanbeuniquelyidentifiedbyits"full-path".Forexample,refertofigure4.
Figure4.
OPCAddressSpace ishierarchical.Itstartswitharoot.Thentherearelogical folders and sub-folders.Leafnodesare OPCItemsorTags.Generallyyoursensorsandactuatorsformtheleafnodes.Thisisanimportantpointtounderstandandwewillspendsometimeonit.Forexample,youhaveadevicethatcansensetemperature,Pressure,andHumidity.Thentheseattributesaregenerallymappedasleafnodesundersomefolder-subfolderhierarchy.Wewillseewhatthathierarchycanbeinamoment.Ifyouhaveanactuator(say,Turn_ON_Boiler),thenthatalsobecomesaleafnode.Youcanwriteto Turn_ON_Boiler valuesof1or0forexample,andnecessaryactionwillbetaken-ofcoursewejustassumedthatyourhardwarecontrolmechanismbehavesthisway.Youcanreadfrom Temperature toknowsensedvalue.
Hopeweareallcleartillthispoint.Nowlet'sunderstandthis"logical"folderstuff.Thelogicalfoldersandsub-foldersareusedtorepresentstateofyourIndustrialAutomationsystem.Thisconfigurationcanactuallymaptosomephysicalconfigurationorevengeographicalsetup.Let'sspendsometimetounderstandthisoneaswell.Forexample,inthisdiagramwehaveanethernetcommunicationchanneltowhichawirelessmeterisconnected.Andwithinwirelessmeter,therearetwoclasses"Average"and"Channel1".Thesefoldersandsub-foldersareveryeffectivemeansofgroupingyourprocesscontrolparametersandvalues.
Thisaddressspaceis"published"toallclientsofOPCserver.TheOPCclientscanbesimplespreadsheetslikeExcel,processhistoriansthatkeeprecordofdatacomingfromvariousindustrialplantentities.Everyclientcancreatealogicalentitycalledas group insideOPCserver.Each OPCGroup cancontainasetofOPCItems.
Synchronous&AsynchronousOPCItemreading
OPCspecificationsupportssynchronousaswellasasynchronousreadingandwritingonhardwaredevices.Sincenotallhardwaredeviceoperationsarefast-enough,theasynchronousmechanismofreadingandwritingtoadevicecomesveryhandy.
COMInterfaces&ComponentCategories
Well,sonowsupposeyouwishtowriteyourfirstOPCclient.Ifyouweredevelopingaclientthatrunsonlocalmachineasthatofserver,andifyouwereawareofallOPCServerProgIDs,thenwewouldnothaveanyworries.Butsincethatisnotpossible,weneedanenumerationmechanism.Followingisanenumerationmechanism.
Collapse
OPCComponentCategories
EnumerationissueisaddressedbyrequiringOPCserverstoimplement
componentcategories.Forexample,allserversthatareOPCDA1.0
(moreaboutthisinlatersections)compliantimplementCOMcategory
withCatID{63D5F430-CFE4-11d1-B2C8-0060083BA1FB}.Similarlythe
serverscompliantwithOPCDataAccess2.0implementcategorywith
CatID{63D5F432-CFE4-11d1-B2C8-0060083BA1FB}.
SoOPCFoundationdistributesaWindowsServicecalledasOPCEnum.
Collapse
EnumeratingOPCServers
OPCEnum.exerunsasaWindowsServiceandprovidesenumeration
functionality.UsingOPCEnum,theclientapplicationscanquery
availableOPCServersonlocalaswellasremotenetworkedmachines.
Nowlet'slookatservercomponentinterfaces.
Figure5.
TherearevariousCOMinterfacesthatOPCServermustsupportaccordingtheOPCSpecificationcompliancerequired.Thesebasicinterfaceshavespecificfunctionality.
IOPCBrowse ThisinterfacehasmethodsthatallowbrowsingOPCAddressSpace.Clientcanquerylevelbylevelfoldersandsubfolderstilltheleafnodes.Thehierarchylookslikeshownin figure4.
IOPCItemIO InterfaceisusedforperformingOPCItemreadandwriteoperations.
Nowlet'sunderstandhowOPCClientinteractswiththeOPCServer.Importantstepsinvolvedaresummarizedinfigure6,below.
Figure6.
Iknowyoumuststillbewonderingaboutthis OPCGroup term.Let'sspendsometimeunderstandingit.EveryclientwhenopensasessionwithOPCServer,needstocreatealogicalgroupofitemsthatitwantstoreadorwrite.Clientcanmaintainmultiplegroups.Eachgroupisgivenauniquenameandhasfollowingattributes:
∙Updaterate[milliseconds]atwhichthevaluesofitemsareread.
∙ActiveorIn-activeFlag[Boolean]onlyifgroupisactivethattheitemsareprocessed.
∙Deadband[%]variationsinsidethisbandareconsideredNULL.
∙IOMode[S