ABB DCS 系统 培训课程 系列讲座 Code sorting.docx

上传人:b****5 文档编号:26404856 上传时间:2023-06-19 格式:DOCX 页数:7 大小:61.55KB
下载 相关 举报
ABB DCS 系统 培训课程 系列讲座 Code sorting.docx_第1页
第1页 / 共7页
ABB DCS 系统 培训课程 系列讲座 Code sorting.docx_第2页
第2页 / 共7页
ABB DCS 系统 培训课程 系列讲座 Code sorting.docx_第3页
第3页 / 共7页
ABB DCS 系统 培训课程 系列讲座 Code sorting.docx_第4页
第4页 / 共7页
ABB DCS 系统 培训课程 系列讲座 Code sorting.docx_第5页
第5页 / 共7页
点击查看更多>>
下载资源
资源描述

ABB DCS 系统 培训课程 系列讲座 Code sorting.docx

《ABB DCS 系统 培训课程 系列讲座 Code sorting.docx》由会员分享,可在线阅读,更多相关《ABB DCS 系统 培训课程 系列讲座 Code sorting.docx(7页珍藏版)》请在冰豆网上搜索。

ABB DCS 系统 培训课程 系列讲座 Code sorting.docx

ABBDCS系统培训课程系列讲座Codesorting

Chapter18Codesorting

18.1GeneralInformation

18.1.1Description

Thischapterdescribesthedifferentmethodsofcodesortingandhowtohandleloops.

18.1.2Objectives

Oncompletionofthischapteryouwillbeableto:

∙Describethedifferencesbetweendifferentmethodsofcodesorting

∙Describetheadvantagesofeachmethod

∙Analyzeandsolveloopsintheprogramcode.

18.1.3ReferenceDocumentation

Usetheonlinehelp:

Contentstab,ControlModuleDiagramEditor>WorkingwithControlModules

18.2

Lesson1-Codesorting

18.2.1Description

Thischapterdescribesthedifferentmethodsofcodesortingandhowtohandleloops.

18.2.2Objectives

Oncompletionofthislessonyouwillbeableto:

∙Describethedifferencesbetweendifferentmethodsofcodesorting

∙Describetheadvantagesofeachmethod

∙Analyzeandsolveloopsintheprogramcode.

18.2.3AccordingtoIEC61131-3

Theexecutionorderoffunctionblocksfollowstheprogramflowasimplementedbytheprogrammer.

18.2.4ControlModuleCodeSorting-introduction

ForControlModules,thecompileranalyzeseachcodeblock(ST,IL,FBD,andLD-SFCistreatedsomewhatdifferently,seeremarkbelow)separatelywithrespecttowhichvariablesthatarereadandwritten,respectively,byeachblock.Thecompilerthendeterminestheoptimalexecutionorder.Acodeblockthatassignsavaluetoavariablehastobeexecutedbeforetheblockthatreadsthevariablevalue(comparefigurebelowinwhichthecodeblockincontrolmodule1mustbeexecutedbeforethecodeblockincontrolmodule2).

Thetechniqueiscalledcodesortingandmeansthattheoptimalexecutionorderwillbebasedondataflowinsteadofprogramflow(asisthecaseforfunctionblocks).Codesortingguaranteesthatthecodewillbeexecutedincorrectorder.Codesortingsuppressestime-delaysandresultsinthatanewcontrolmoduleautomaticallybecomescorrectlyplacedintheprocess.

ForanyfromcontrolmodulescalledFunctionBlocks,itisonlytheparameterinterface(In,Out,orIn_out)thataffectsthecode-blocksorting.Thatis,noanalysisismadeonhowtheFunctionBlocksactuallyusetheparameters.Inaddition,FunctionBlockreferencestoexternalvariablesdonotaffecttheexecutionorderofcontrolmodulecodeblocks.

Codesortinghasnoeffectoncontrolmodulesconnectedtodifferenttasks.

WithinaSFCcodeblockonlytheNactionparts(notP1orP2actions)aresorted.

18.2.5Loophandling

However,incaseboththecontrolmodulesusethesamevariableforbothreadingandwriting,thecompilergivesawarningmessagethataloopexists,meaningthattheexecutionordercannotberesolved:

Thiscaseyieldsthefollowingerrorinformation:

Intheexampleabove,theRequestvaluedeterminestheDelivervalue,which,inturn,determinestheRequestvalue.Thisconditionisshownintheautomaticallygeneratedtextfile,wherethefigureswithinparenthesesrefertowhichcodeblocktherespectiveparameterdependson.Providedthatcirculardependenceactuallyexists(andisnotmerelyaresultofaprogrammingerror),theproblemcanbesolvedbyassigningaState-qualifiertotheDeliveredvariableandintroducinganewcodeblockinControlModule1,Code_Block_12:

Theloopdependencyisnoweliminated;Delivered:

oldstoresthevaluefromthepreviousscanandDelivered:

newcontainstheupdatedvaluefromthecurrentscan.Hence,theexecutionorderbecomesCode_Block_11-Code_Block_21-Code_Block_12.Theapproachisparticularlyvaluableforcomplexapplications,whicharedifficulttomonitormanually.

18.2.5.1RemarksonState

Statecanonlybespecifiedforlocalvariablesoftypebool,int,uint,dint,andreal.IfyouforsomereasonwanttooverridethesortingandtherebyavoidtheStateimplications,youcanassignthenosortattributetothevariable.

18.2.5.2RemarksonNoSort

Incorrectlyused,thenosortattributemaycauseimproperexecutionandapplicationfailure.Nosortshouldtypicallybeusedonlywhenthecodeblockconnectionsthemselvesunambiguouslydeterminetheexecutionorder

Usenosortonlyifyouknowthedataflowcharacteristicsindetail.

18.2.6

CodeSortingAdvantages

Theadvantagesofcodesortingarebestillustratedwithacoupleofexamples:

FirstconsideraPIDcascadeloop(usedforupdatingthePIDintegratorsincaseofmanualoperation),inwhichdataflowinbothdirectionsbetweenthemasterandtheslave.Thisishandledbythe"Back"codeblocksattheendofthescan.Thisisnotpossibletodowithfunctionblocksifyouwanttoworkinanobject-orientedwayandavoidtimedelays.

Second,nowconsideranapplicationaccordingtotheillustrationbelow.Let'ssaythatsometimeaftertheapplicationwassetup,theneedforathirdconveyerarises.Becauseofthecodesorting,aControlModulerepresentingthefunctionalityofthenewconveyerbecomesaddedandconnectedintherightplaceintheapplicationlogic(providedthattheapplicationhasbeenproperlydesignedinthespecificationphase).

18.3Exercise18.1–Codesorting

Pleasedoexercise18.1

Dukantagbortdennaosynligatextmenlåt

nedanståendePageBreakliggakvar!

Låtävendenefterföljandesidanliggakvar!

Thispageisintentionallyleftblank

Thispageisintentionallyleftblank

Osynligtext:

NästasidamåstebörjapåUDDAsidnummer

LämnaENellerTVÅtommasidorhärOVANFÖR.

NedanståendeSectionBreakfårINTEtasbort!

Kompletteratomsidavidbehovmednedanståendetext

Thispageisintentionallyleftblank

TABLEOFCONTENTS

Chapter18Codesorting1

18.1GeneralInformation1

18.1.1Description1

18.1.2Objectives1

18.1.3ReferenceDocumentation1

18.2Lesson1-Codesorting2

18.2.1Description2

18.2.2Objectives2

18.2.3AccordingtoIEC61131-32

18.2.4ControlModuleCodeSorting-introduction2

18.2.5Loophandling3

18.2.5.1RemarksonState4

18.2.5.2RemarksonNoSort4

18.2.6CodeSortingAdvantages5

18.3Exercise18.1–Codesorting6

Dukantabortdennaosynligatextmenlåt

nedanståendePageBreakliggakvar!

Låtävendenefterföljandesidanliggakvar!

Thispageisintentionallyleftblank

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > PPT模板 > 其它模板

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1