ABB DCS培训课程T31512 User defined FB TypesRevA.docx
《ABB DCS培训课程T31512 User defined FB TypesRevA.docx》由会员分享,可在线阅读,更多相关《ABB DCS培训课程T31512 User defined FB TypesRevA.docx(16页珍藏版)》请在冰豆网上搜索。
ABBDCS培训课程T31512UserdefinedFBTypesRevA
Chapter12UserdefinedFunctionBlockTypes
TABLEOFCONTENTS
Chapter12UserdefinedFunctionBlockTypes1
12.1GeneralInformation2
12.1.1Objectives2
12.1.2Legend2
12.2Librarymanagement.3
12.2.1Overview3
12.2.2Rules4
12.2.3TypeSolutions5
12.2.4HowtoCreateaLibrary6
12.2.5HowtoConnectaLibrarytoanApplication7
12.3Versioning8
12.3.1LibraryStates8
12.3.2HowtoReleaseaLibary9
12.3.3HowtoCreateaNewVersion9
12.3.4WorkwithDifferentVersions10
12.3.5HowtoUpgradeaLibrary11
12.3.6Protection12
12.4FunctionBlocksTypes13
12.4.1HowtoCreateaFunctionBlockType13
12.4.2FunctionBlockTypeEditor14
12.4.3ParameterorVariable15
12.4.4Protectionofcode16
12.4.5HowtoCopyaFunctionBlockType17
12.5ObjectTypeStructure19
12.5.1ProjectExplorerandEngineeringWorkplace20
12.5.2ObjectTypes21
12.1GeneralInformation
12.1.1Objectives
Oncompletionofthischapteryouwillbeableto:
∙Createandhandleprojectspecificlibraries
∙CreateuserdefinedFBtypes
∙Specifyparameters
∙UseownFBtypesinapplications
∙IdentifyFBtypeinPlantExplorer
12.1.2Legend
<>Indicatesakeyname.
|Indicateswhenyougofromonemenutoasub-menu.
BoldIndicatesamenunameoranoptioninamenu,orfilestructures
““Indicatesdialogboxbuttons,tabs,instructionsetc.
Indicatesstart/explanationofstudentactivity
12.2
Librarymanagement.
12.2.1Overview
System800xAprovidesuswithmanypredefinedlibrarieswhichincludefunctionblocktypesandcontrolmodulestypeslikevalves,motors,PIDetc.forengineeringyourcontrollogicforyourplant.
Fromtheuserpointofview,therearetwomaintypesoflibrary:
∙Standardlibraries,thatareinstalledwiththeproduct.Theseareprotectedandcannotbechanged.
∙Yourownlibraries,inwhichyoucanaddyourowntypesandmodifycopiesoftemplatetypesfromthestandardlibraries.
Thesystemsupportsdevelopment,distributionandmanagementofversionedlibraries.TheAspectDirectoryisthebaseplaceforthelibraryhandling,butsomeoperationsarealsoavailableintheControlBuilder.
TheLibraryHandlingintheAspectDirectoryishandledintwostructures:
∙LibraryStructureisthemainplacewheretodealwiththeoperationsofthelibrarieslikeopen,closeorwheretoconnectdifferentlibrariestothelibrary.
∙ObjectTypeStructureisthestructurewheretobuildtheindividualobjecttypes,likeFunctionBlockTypes,ControlModuleTypesandDataTypes.
Butadditionallythe800xAsystemallowsustocreateourownspecializedlibraries.Hereyoucanusefunctionblocktypesor/andcontrolmoduletypes.
12.2.2
Rules
Whenworkingwithlibraries,itisimportanttobeawareofhowlibrariesareversionhandled,howlibrariesareconnected,andwhathappensifacertainlibraryischanged.
Thefollowingimportantrulesapply:
∙Librariesmayexistindifferentversionsinthesameproject(butnotinthesameapplication).
∙LibraryversionsareindexedusingMajorVersion.MinorVersion-Revision,forexample,BasicLib1.2-3.Anewlibraryhastheinitialversionnumber1.0-0.
∙Librariesmaydependoneachotherinanumberoflayers.
∙Circulardependenciesarenotallowed.ControlBuilderchecksforcirculardependenciesandwillwarnyouifyoutrytoconnectalibrarythatwouldcreateone.
∙LibrariescanbeexportedandimportedusingtheImport/ExporttoolinPlantExplorer.Childlibrariescanbeexcludedorincluded.
∙Standardlibrariescannotbechangedbytheuser.Thisappliestoboththelibraryitselfandthetypesinside.
12.2.3
TypeSolutions
Atypeisusedtocreateinstances,inanobject-orientedmanner.Eachinstancepointstothetypeitisbasedon,whichmeansthatwhenaninstanceisexecuted,itisreallythecodestoredinthetypethatisexecuted,butvariablesandotherdataisinstance-specific.
Thefactthatitisthesamecodethatexecutesinallinstancesisthepointofthewholetypeconcept,fortworeasons:
∙Instances(oftencalledobjects)inheritthepropertiesfromtheirtype.Thisallowsre-useandmakesyourautomationsolutionflexible,sincethebehavioroflargenumbersofinstancescanbechangedbychangingthetype.
∙Thememoryconsumptionforeachinstanceissmaller,comparedtothememoryneededtoexecutethetypeitself.Forexample,aMotorUnifunctionblocktypeconsumesabout40kB,whileeachadditionalinstanceonlyneedsanother7kB.
NOTE!
Thatyoucanusetypesfromanotherlibrarywhenbuildingtypes,aslongasyouconnectthislibrarytoyourapplicationand/orlibrary.
Thismeansthatchangesmadetoatypeaffectallinstances.Thisisaveryimportantconcept!
Ifyoucreatetypesonaveryhighlevel,youmightrunintoproblemswhenyouwanttochangesomethingforaparticularobject,duetothefactthatthischangewillaffectotherobjectsofthesametype.Thiscanpartlybesolvedbyincludingcopiesofcertaintypes,whichcanthenbechangedwithoutaffectingthecorrespondingpartofothertypes.However,thepriceforcopyingcertaintypesisincreasedmemoryconsumption,aswellasanincreasedriskofproblemswhenupgradingtypesandlibraries.
Userdefinedfunctionblocksareusuallycreatedinlibraries.Instancesofthetypemaythenbeusedintheapplicationstowhichthatlibraryisconnected.
12.2.4
HowtoCreateaLibrary
UsetheControlBuildertocreateanewControlLibrary.
1.OpentheControlBuilderwiththeprojectwhereyouwanttocreatealibrary.
2.SelecttheLibraryfolderfromthetreeandopentheContextMenuforit(rightclickontotheobject).Select“NewLibrary…”fromthelist.
3.Typeinthenewlibrarynameandclick“OK”.
4.UsetheControlBuildertoconnectotherlibrariestothenewcreatedlibrary.SelecttheConnectedLibrariesfolderandopentheContextMenuforit.
5.Selectthelibrarywhichshouldbeconnectedfromthelistandclick“OK”.
12.2.5
HowtoConnectaLibrarytoanApplication
Togetaccesstolibraryelements(likeafunctionblocktype)inyourapplicationyouhavetoconnectthelibraryfirst.UsetheControlBuildertoconnectalibrarytoanapplication.
6.OpentheControlBuilderproject.
7.SelecttheApplicationforwhichyouwanttoconnectaControlLibrary.
8.FromtheApplicationfolderselecttheobjectConnectedLibraries.OpentheContextMenuforitandselect“ConnectLibrary”.
9.SelecttheLibraryfromthelistandclick“OK”.TheLibraryisnowconnectedtotheApplication.
12.3
Versioning
12.3.1LibraryStates
ALibraryVersionhasadevelopmentstate.Thisstateisusedtodescribehowalibrary(version)canbeused.Thestatesalibrarycanbeinare:
∙Open
∙Closed
∙Released
IntheopenstatethecontentsoftheLibraryVersionmaybeedited.Wheneditingtemporarilyiscompleted,thelibrarycanbeclosed.
WhenaLibraryisclosedthenitcannotbeeditedbutitcanbereopenedtoallowadditionaledits.
WhenaLibraryVersionhasbeenreleasedthenitcannolongerbechanged.Ifanymodificationsarenecessarythenanewversionofthelibrarymustbecreated.
Notethatalibrarycannotbereleasedunlessalllibrariesitdependsonarereleased.
12.3.2
HowtoReleaseaLibary
UsetheEngineeringWorkplacetoreleasealibrary.
10.OpentheObjectTypeStructureandselectyourlibrary.SelecttheaspectLibraryVersionDefinitionandopentheConfigViewforit.
11.Selectthetabcard“General”fromtheConfigView.ClosethelibrarybyselectingthestateCloseandclick“Apply”tosavethechanges
12.Inthisstateyouareabletoopenthelibraryagain.PleasetrythisandafterthisselecttheClosestatelikebefore.
13.AfteralibrarywassettoclosetheReleasestateisfreetoselect.Afterclicking“Apply”theotherstatesofthislibraryarelockedandwillnotgetactiveagain.
NOTE!
Theonlywaytochangesomethinginthislibraryistocreateanewversionofit.
12.3.3HowtoCreateaNewVersion
UsetheEngineeringWorkplaceandtheLibraryStructuretocreateanewversionofalibrary.
14.OpentheLibraryStructureandselectyourlibraryobject.Createanewobjectforit.IntheNewObject…dialogthenamefieldisgrayedout,becausethesystemknowsthatwewanttocreateanewversionofourlibrary.
15.FillintheVersionfieldanewnumber.Wecanseeontheexampleabovethattheversionwasalreadyincreasedtoversion1.1-0(theoldversionis1.0-0).
16.
Acceptallthisbyclicking“Create”andanewversionwillbecreated.
17.Allversionsarevisible..Ifwecomparetheoldversionwiththenewwecanseethatthenewversionisacopyoftheold.ThedifferenceisthatthenewversiongotthestateOpen.
12.3.4WorkwithDifferentVersions
RightnowwehavetwoversionsofthelibraryProjectLib_ABBconnectedtotheprojectProject_xx.Whatisdifferentnow?
∙ControlApplication
Eachlibrarycanonlybeconnectedtoanapplicationonce(!
!
!
).Therecannotbetwoversionsofalibraryconnectedtooneapplication.
∙Instantiation
Ifyouwanttoinstantiateanobject,e.g.aFunctionBlock,youhavetochoosetheversionofthelibrary,fromwhereyouwanttogetyourFunctionBlockType.
12.3.5
HowtoUpgradeaLibrary
TheobjecttypesofthepreviousandthenewversionscoexistintheObjectTypeStructure.ThecustomerhasapossibilitytocarryoutanupgradeofthechoseninstancesofthepreviousLibraryVersiontothenewone.
Thiscanbedoneusingthe“Library”tabintheConfigViewoftheApplicationaspectofaControlApplicationintheEngineeringWorkplaceorusingtheConnectLibraryfunctionintheControlBuilder.
Theupgradeproces