ABB DCS 系统 培训课程 系列讲座 Control ModulesWord文件下载.docx
《ABB DCS 系统 培训课程 系列讲座 Control ModulesWord文件下载.docx》由会员分享,可在线阅读,更多相关《ABB DCS 系统 培训课程 系列讲座 Control ModulesWord文件下载.docx(13页珍藏版)》请在冰豆网上搜索。
∙ConnectControlModulestoparameters/variables.
∙UseControlModulesinthegraphics.
∙ModifyaControlModule.
∙CreateControlModulesusingotherControlModules,inanewlibrary.
∙Visualizingtheprogramusinggraphics.
∙Describetheideaofobjectorientation.
∙Describetheadvantages/drawbacksofconnectingtoI/Oindifferentdepths(toglobalvariables,toprogramvariables,toFBvariables,usinganI/O-recordetc.).
∙CreatesimpleinteractionwindowsassociatedtoFunctionBlocksorControlModules.
17.1.3ReferenceDocumentation
Usetheonlinehelp:
Contentstab,ControlModuleDiagramEditor
17.2Lesson1-UsingControlModules
17.2.1Description
ThislessondescribestheadvantagesoftheABBControlModulesandisanintroductiontohowanApplicationcanbeorganizedwhenusingthem.
17.2.2Objectives
Oncompletionofthislessonyouwillbeableto:
17.2.3General
TheControlModuleisthemainstructuringelementforcontrollerapplicationprogramming.Itisaself-executablecontainerforapplicationprogramcodeandgraphics.BecauseaControlModuleinvolvesgraphicalobjects,youcreateitbyusingnotonlythePOUEditor,butalsotheControlModuleeditor.ControlModulesaresuitableforrepresentingcomplexprocessobjectsandcontroloflargeapplications.WorkingwithControlModulesinvolvesthoroughobjectorientedprogramming,asmuchoftheobjectcontrolaspossibleshouldbeencapsulatedintheControlModuleandtheoutwarddependencyshouldbeminimized.Apartfromconventionalprogramming,theControlModuledesignmayinvolveimplementationofgraphicalinteractivity.
ThecompilerdeterminestheapplicationdataflowandexecutionorderofControlModulesautomatically.Therefore,thefinalapplicationgetsflexibleandeasytomaintainasintegrationoffutureadditionalControlModulesaredoneautomatically.ControlModulescanbestructuredhierarchicallyinanumberoflevels.YoucanusethesameControlModuleTypeforseveralControlModules,eachperformingdifferenttasksdependingonparameterconnections.
17.2.4
DifferencebetweenFunctionBlockandControlModule
17.2.4.1GeneralComparison
ThemostimportantdifferencesbetweenControlModulesandFunctionBlocksaresummarizedinthetablebelow.
Property
ControlModule
FunctionBlock
Executionorder*
Automatic;
compilerdetermined,basedondataflow.
Manual;
codestatements,basedonprogramflow.
Executionperscan
Thecodeblocksarealwaysexecutedonceperscanaccordingtodataflowanalysis.
Afunctionblockcanbecalledandexecuted,zero,one,orseveraltimesperscan.
Staticparameterconnections*
Yes.Amostimportantfeature:
Astaticparameterconnectiondoesnotchangeduringexecution;
itcanonlybechangedviacodechangesandrecompilation.Thestaticconnectionsaresetatcompiletimeandyieldsefficientcodegeneration;
powerful,compiler-basedprogramanalysis;
andbetterperformance.
No.ParametersarecopiedeachtimetheFunctionBlockisexecutedaccordingtotheIEC61131-3standard.Fordeepandcomplexhierarchies,theparametercopyingoffunctionblockscostssignificantCPUtime.
Graphics*
Yes,inthreedifferentways;
free-layoutprogramming,supervision,andinteraction.
IndirectlyviainclusionofsubControlModules.
Parameters
In_out,canbeconnectedtographics.Connectionscannotbeinverted:
NOT"
actualparametername"
isinvalid.).
In,Out,orIn_out,onlyIn-andOutparameterscanbeconnectedtosubcontrolmodules.
Together,thepropertiesmarkedwith*facilitatedesignofapplicationlibrariesandre-useofcomplexapplicationbuildingblocks.
17.2.4.2Graphics
YoucandesignaControlModuletoincludeinteractiveandsupervisoryprocesspictures(suchascommandbuttons,inputfieldsandtrendcurves).Inaddition,ControlModulescanberepresentedbycertaininteractiveiconswhichfacilitatestheprocesscontrolandsupervision.
17.2.4.3Executionandcodesorting
ThemaindifferencebetweenControlModulesandFunctionBlocksisthatControlModulesareexecutedinanorderbasedonoptimaldataflow,asdeterminedbythecompiler.TheexecutionorderofFunctionBlocksfollowstheprogramflowasimplementedbytheprogrammer.ControlModulesareonlyexecutedonceperscanwhereasFunctionBlocksmaybeexecutedseveraltimesperscan.
17.2.5WhenisitsuitabletouseControlModules
Beforeyoustarttodesignanapplication,youshoulddecidewhethertousetraditional(sequential)programcodeandfunctionblocksoranobject-orientedsolutionbasedoncontrolmodules.Apartfrompersonalpreferences,thechoicewouldtypicallydependonapplicationsizeandtheneedforre-usableobjects.
Asageneralguideline,traditionalprogrammingistypicallysuitableforsmallapplicationswhereascontrolmodulesarerecommendedforlargeapplications.Controlmodulessupportobject-orientedprogrammingandcodere-usetoagreaterextentandthereforemakealargeapplicationmoreflexibleandeasiertomaintain.
Thesubsequentimplementationwillfollowoneofthebranchesinthefigurebelow.
Thefigureshowsthatalsotheobject-orientedsolutiontypicallyinvolvesfunctionblocks.Thisisbecauseobjectorientationbelowacertaincomplexitylevelisnotjustifiable.Inthiscase,traditionalprogrammingwithfunctionblocksconstitutesthemostrationalalternative.
Insummary,itisrecommendedtousecontrolmodulesratherthanfunctionblocksinthefollowingcases:
∙Forlargeapplications(increasedperformance)
∙Forprocessobjects(codesortingfacilitatesapplicationstructuring)
∙Whenaflexiblesolutionisneeded(objectorientation;
re-useisdesired)
∙Whenthereisaneedtoconcentratethecontrolofacertainobjecttoonecodelocation(facilitatesmaintenance)
17.2.5.1
TheControlModuleeditors
TheControlModuleeditorisacombinedtoolfordrawingandprogramming,itallowsyoutocreateandeditthegraphicalobjectsofaControlModuleandthenconnectvariablestotheseobjects.ItalsogivesyoudirectaccesstothePOUeditor,inwhichyouwritetheControlModulecodeanddeclarevariablesandparameters.
YoucanbothcreatenewControlModulesandeditalreadyexistingoneswiththeControlModuleeditor.Thedrawingfunctionsincludenotonlybasicautoshapes(lines,rectangles,etc.),butalsoreadytouseinteractionobjects(OptionButtons,CheckBoxes,etc.)andcompositeobjects(HistoryGraphs,StringSelectors,etc.).Thegraphicalobjectsaredynamic,thatispointscanmovewithchangingvariablevalues,colorscanchange,numericalvaluescanbepresented,etc.
17.2.6CreatingaControlModule
17.2.6.1Introduction
AControlModulecanbecreatedeitherfromtheProjectExplorerdirectly(textgenerated)orfromaControlModulesWindow(graphicsgenerated).Thefollowinggeneralpropertiesapply:
∙AControlModulealwayshasaparentPOU.ThisPOUTypecanbeaControlModuleType,FunctionBlockType,oranapplication.
∙AControlModulecanbeshowngraphicallyinsidethegraphicoftheparent(iftheparentisamoduletypeoranapplication).
∙AControlModulecanalsobeshown(standalone)inaninteractionwindow(inonlinemodeonly).
17.2.6.2CreateaNew,Graphics-GeneratedControlModule
Right-clickonacontrolmoduletypeintheprojecttreeandselecttheGraphicsentrytoopentheControlModuleTypeWindow.Double-clickinthedrawingareatoactivatethegrid.SelectCreate>
ControlModule...toopenthe"
CreateaControlModule"
dialogboxinwhichyouspecifytheControlModulenameandassociatedType.Exceptforthatagraphics-generatedControlModulebydefaultbecomesgraphicallyvisible,theaboveprinciplesapply.
17.2.7Connections
ControlModulescanbeconnectedtoeachotherintwodifferentways;
viagraphicsandviatext.Youimplementgraphicalconnectionsinthecontrolmoduleswindoworthecontrolmoduletypewindowandtext-basedconnectionsintheConnectionEditor.
YoucanreachtheConnectionEditorviatheConnectionsentry,accessiblewhenacontrolmoduleisselected,choose(Objects>
Connections)orConnectionsfromright-clickpop-upmenu.Acontrolmoduledesignedtobegraphicallyconnectedhavetobebuiltwiththenodesinplace,readyforlaterconnection.Graphicalconnectionsaresuitableforobtainingacomprehensiveviewofmainflows,forexampleinaPIDControllercomprisinganinputcontrolmodule,amaincontrolmodule,andanoutputcontrolmodule.(Yet,observethatabundantuseofgraphicalconnectionsmayslowdownthesystem.)
17.2.7.1Textualconnection
ParameterscanbeconnectedtoactualvariablesintheconnectionlistoftheConnectionEditor.Itisnotpossibletoconnectthesameparameterbothgraphicallyandtextually.TextualconnectionistheonlywaytoconnectparameterswhenthecontrolmoduleissubordinatetoaFunctionBlock,asnosurroundinggraphicsthenexist.
17.2.7.2Graphicalconnection
Graphical