1.ࡽ䀰ᵜ᮷ਟԕѪS7-GRAPH㕆〻䈝䀰Ⲵ֯⭘৲㘳䍴ᯉˈᐼᵋ䈫㘵䙊䗷ሩᵜㄐⲴ䰵䈫ˈ㜭ཏᴤᘛᴤྭൠᆖҐS7-GRAPH㕆〻䈝䀰DŽ㾯䰘ᆀᨀҶS7-GRAPH㕆〻䈝䀰Ⲵ䈖ቭˈ൘ᆹ㻵S7-GRAPH䖟Ԧवਾˈ䙊䗷⛩ࠫWindows㨌অᔰ-Simatic-Documentation-Englishਟԕ䰵䈫ࡠ〠Ѫ“S7-GRAPH-ProgrammingSequentialControlSystems”ⲴPDFDŽ↔ޡ࠶Ѫ15њㄐ㢲ˈަ䈖㓶ൠ䇢䀓ҶS7-GRAPH㕆〻䈝䀰DŽа࠷ޣҾS7-GRAPH֯⭘Ⲵ䰞仈䈧ԕ↔Ѫ߶DŽሩҾަᆳ㕆〻䈝䀰ˈS7-GRAPHᴹ⵰ᆳᵜ䓛аӋ⢩ᙗˈаӋ⤜⢩Ⲵᾲᘥҏ∄䖳䳮Ҿ⨶䀓DŽᵜ᮷ѝሶሩS7-GRAPHѝⲴ䜘࠶ᇩࠪ仍ཆᕪ䈳о䇢䀓ˈ㲭❦䘉Ӌ䇢䀓оᴹ䟽ਐѻ༴ˈնᐼᵋ䙊䗷䘉Ӌ䇢䀓㜭ཏ֯⭘ᡧᴤᘛൠᦼᨑS7-GRAPHⲴ֯⭘DŽ൘䇢䀓ᇩѻਾˈࡇѮࠪаӋ⭘ᡧ൘ᇎ䱵֯⭘ᖃѝ㓿ᑨՊ䙷ࡠⲴ䰞仈ˈᐼᵋ㜭ཏሩ⭘ᡧᴹᡰᑞࣙDŽޣൠ൰䘎᧕˖S7-300઼S7-400Ⲵởᖒമ(LAD)㕆〻઼S7-400Ⲵ䈝ਕ㺘(STL)㕆〻֯⭘STEP7V5.3㕆〻://support.automation.siemens.com/CN/view/zh/11376302.䖟ԦⲴสᵜؑ2.1.S7-GRAPHㆰӻS7-GRAPHާᴹԕл⢩⛩˖䘲⭘Ҿ亪ᒿ᧗ࡦ〻ᒿㅖਸഭ䱵ḷ߶IEC61131-3PLCopenส㓗䇔䇱䘲⭘ҾSIMATICS7-300(᧘㦀⭘ҾCPU314ԕкCPU),S7-400,C7andWinACS7-GRAPH䪸ሩ亪ᒿ᧗〻ᒿڊҶᓄՈॆ༴⨶ˈᆳнӵӵާᴹPLCިරⲴݳ㍐˄ֻྲ䗃ޕˋ䗃ࠪˈᇊᰦಘˈ䇑ᮠಘ˅ˈ㘼ф໎࣐Ҷྲлᾲᘥ˖ཊњ亪᧗ಘ˄ᴰཊњ˅↕僔˄⇿њ亪᧗ಘᴰཊ250њ˅⇿њ↕僔Ⲵࣘ˄⇿↕ᴰཊ100њ˅䖜ᦒᶑԦ˄⇿њ亪᧗ಘᴰཊ250њ˅࠶᭟ᶑԦ˄⇿њ亪᧗ಘᴰཊ250њ˅䙫䗁ӂ䬱˄ᴰཊ32њᶑԦ˅ⴁ᧗ᶑԦ˄ᴰཊ32њᶑԦ˅һԦ䀖ਁ࣏㜭࠷ᦒ䘀㹼⁑ᔿ˖ࣘǃ㠚ࣘ৺⛩ࣘ⁑ᔿ2.2.S7-GRAPHоSTL˖S7-GRAPHਟԕ㕆䈁ᡀSTL,㲭❦ަԓ⸱䟿ሩҾSTL㕆〻ᴹᡰ໎࣐ˈնᔰਁӪઈਟԕሶᴤཊⲴ㋮࣋䳶ѝࡠ᧗ࡦԫ࣑кˈᨀ儈Ҷᐕ〻᭸⦷DŽ2.3.S7-GRAPHᆹ㻵о֯⭘˖STEP7ḷ߶⡸ᒦнवᤜS7-GRAPH䖟Ԧव৺ᦸᵳˈ䴰অ⤜䍝ҠˈSTEP7Professional⡸वᤜҶS7-GRAPHⲴ䖟Ԧव৺ᦸᵳˈᆹ㻵ণਟDŽ൘S7〻ᒿѝˈS7-GRAPHඇਟԕоަᆳSTEP7㕆〻䈝䀰⭏ᡀⲴඇ㓴ਸӂ䈳⭘ˈS7-GRAPH⭏ᡀⲴඇҏਟԕѪᓃ᮷Ԧ㻛ަᆳ䈝䀰ᕅ⭘DŽ2.4.S7-GRAPH䖟Ԧެᇩᙗн਼S7-GRAPH䖟Ԧ⡸ᵜоSTEP7৺㌫㔏ѻ䰤Ⲵެᇩᙗ˖മѝⲴX㺘⽪ެᇩˈ-㺘⽪нެᇩ㺘2-1S7-GRAPH䖟Ԧެᇩᙗ⌘˖˅ӵӵS7-GRAPHV5.3+SP1ᡆԕਾ⡸ᵜ᭟ᤱ2.5.S7-GRAPHѝ㤡᮷䇽≷ሩ➗ޣ㌫⭡Ҿᖸཊ㤡᮷Ⲵ、ᢰу⭘䇽≷⋑ᴹ᰾⺞㔏аⲴѝ᮷䇽≷ˈᡰԕ൘ᵜ᮷Ⲵ䇢䀓ᖃѝˈቭ䟿؍ᤱѝⲴ㤡᮷ؑDŽᵜ᮷ѝሶቭ䟿߿ቁ֯⭘ѝ᮷䇽≷ԓᴯ㤡᮷у⭘䇽≷ˈ䴰㾱ԓᴯⲴѝ㤡᮷䇽≷ሩ➗ޣ㌫ྲл˖xSequencer亪᧗ಘxStep↕xBranch࠶᭟xInterlockӂ䬱ᶑԦxSupervisionⴁ᧗ᶑԦxTransition䖜ᦒᶑԦ3.S7-GRAPHสᵜᾲᘥоสᵜ֯⭘3.1.S7〻ᒿᶴᡀѪSTEP7Ⲵ䘹亩वˈS7-GRAPH䖟Ԧ൘ᆹ㻵ਾˈሶ㻛䳶ᡀ൘STEP7ѝ֯⭘DŽS7-GRAPH㕆〻⭼䶒Ѫമᖒ⭼䶒ˈवਜ਼㤕ᒢњ亪᧗ಘDŽᖃ㕆䈁S7-GRAPH〻ᒿᰦˈަ⭏ᡀⲴඇԕFBⲴᖒ࣯ࠪ⧠ˈ↔FBਟԕ㻛ަᆳ〻ᒿ䈳⭘,ֻྲOB1DŽമ3-1:S7〻ᒿᶴᡀ3.2.⭘ᡧ⭼䶒3.2.1.⭏ᡀᯠS7-GRAPH〻ᒿ俆ݸˈ൘STEP7ᖃѝ⭏ᡀањᯠ亩ⴞˈ⭘ਣ䭞⛩ࠫSourc᮷ԦཀྵˈᨂޕањᯠⲴGRAPHSource,ྲлമ˖CALLFB2,DB2INIT_SQ:=M0.0䈳⭘GRAPH⭏ᡀⲴ࣏㜭ඇ䘲⭘㤳ത˖OB/FB/FCGRAPHFBGRAPH㛼ᲟᮠᦞඇDBDB˖ቭ䟿൘㕆䈁ᰦ⭏ᡀˈԕ؍ᤱа㠤ᙗFB˖൘㕆䈁ᰦ⭏ᡀമ3-2:⭏ᡀᯠS7-GRAPH〻ᒿ⌘˖⭘ᡧҏਟԕ൘Block᮷ԦཀྵᨂޕањGRAPHṬᔿⲴFBˈоᨂޕⓀ᮷ԦⲴ४࡛ˈሶ൘ᵜ᮷Ⲵਾ㔝䜘࠶䈖㓶䇢䀓DŽৼࠫᯠ⭏ᡀⲴGRAPHsourceਾˈਟԕᢃᔰ⭘ᡧ⭼䶒ˈྲлമ˖മ3-3:S7-GRAPH⭘ᡧ⭼䶒1.ᐕާᶑ2.ᐕ४1234513.ᾲ㿸デਓ4.䈖㓶デਓ5.⣦ᘱᶑ3.2.2.ᐕާᶑᐕާᶑѝਟԕ࠶Ѫ㊫࣏㜭ˈḷ߶࣏㜭˖ѫ㾱Ѫ᮷Ԧ࣏㜭ˈֻྲᢃᔰˈ؍ᆈˈ༽ࡦˈ㋈䍤ㅹ࣏㜭㿶മ࣏㜭˖䈳ᮤᱮ⽪⭘ˈྲᱟᱮ⽪ㅖਧㅹ亪᧗ಘ˖वਜ਼亪᧗ಘݳ㍐ˈྲ࠶᭟ˈ䐣䖜ˈ↕ㅹDŽLAD/FBD˖ਟԕѪ⇿↕࣐LAD/FBDᤷԔDŽ3.2.3.ᐕ४ᐕ४ᱟS7-GRAPHѝⲴᴰ䟽㾱Ⲵ४ฏˈިරⲴᐕ४㿶മྲл˖മ3-4:S7-GRAPHᐕ४㿶മӂ䬱ᶑԦ˄Interlock˅˖Interlockᱟ⇿↕Ⲵањਟ㕆〻ᶑԦˈᆳሶᖡ૽⇿њঅ⤜↕Ⲵᢗ㹼ᛵߥDŽxྲ᷌ӂ䬱ᶑԦ˄Interlock˅┑䏣ˈࡉоӂ䬱ᶑԦ㓴ਸⲴᤷԔሶ㻛ᢗ㹼˄൘S7-GRAPHѝᴹу䰘оInterlock⣦ᘱޣⲴᤷԔ˅xྲ᷌ӂ䬱ᶑԦ˄Interlock˅н┑䏣ˈࡉ˖oоӂ䬱ᶑԦ㓴ਸⲴᤷԔሶн㻛ᢗ㹼oӂ䬱䭉䈟ؑਧሶѪ˄һԦeventL1˅⇿њӂ䬱ᶑԦ˄Interlock˅ᴰཊਟԕᇩ㓣32њLAD/FBDݳ㍐ˈ൘ᐕ४ѝ⭘ᆇ⇽“C”ᶕ㺘⽪DŽྲ᷌⇿њӂ䬱ᶑԦ˄Interlock˅Ѫオˈণ⋑ᴹ㕆〻ˈ㌫㔏ࡉ䇔Ѫӂ䬱ᶑԦ┑䏣DŽ↕Ⲵ⌘䟺४↕Ⲵӂ䬱ᶑԦ↕Ⲵⴁ᧗ᶑԦ↕Ⲵ䖜ᦒᶑԦ↕Ⲵㅖਧ↕Ⲵࣘࡇ㺘䖜ᦒᶑԦㅖਧֻᆀ˖лമѝⲴⴁ⍻ᓖ䎵䗷Ҷ90ᓖⲴ䇮ᇊ٬ˈণӂ䬱ᶑԦ˄Interlock˅н┑䏣ˈࡉⴁ᧗ᰦӂ䬱䭉䈟ؑਧ㻛䀖ਁDŽമ3-5:ӂ䬱ᶑԦ֯⭘ⴁ᧗ᶑԦ˄Supervision˅˖Supervisionᱟ⇿↕Ⲵањਟ㕆〻ᶑԦˈᆳሶᖡ૽⇿њঅ⤜↕ੁла↕䖜ᦒⲴᢗ㹼ᛵߥDŽxྲ᷌ⴁ᧗ᶑԦ˄Supervision˅┑䏣ˈࡉһԦV1ਁ⭏ˈ亪᧗ಘн䖜ᦒࡠла↕ˈᖃࡽ↕؍ᤱ◰⍫ˈ↕Ⲵ◰⍫ᰦ䰤Si.Uڌ→DŽxྲ᷌ⴁ᧗ᶑԦ˄Supervision˅н┑䏣ˈᒦфᖃࡽ↕ੁла↕Ⲵ䖜ᦒᶑԦ┑䏣ˈ亪᧗ಘሶ䖜ᦒࡠла↕DŽ⇿њⴁ᧗ᶑԦ˄Supervision˅ᴰཊਟԕᇩ㓣32њLAD/FBDݳ㍐ˈ൘ᐕ४ѝ⭘ᆇ⇽“V”ᶕ㺘⽪DŽྲ᷌⇿ⴁ᧗ᶑԦ˄Supervision˅Ѫオˈণ⋑ᴹ㕆〻ˈ㌫㔏ࡉ䇔Ѫⴁ᧗ᶑԦн┑䏣DŽ3.2.4.ᾲ㿸デਓᾲ㿸デਓⲴGraphic㿶മ˖䎵䗷Ҷ90ᓖᓖ∄䖳ˈ䎵䗷Ҷ90ᓖമ3-6:ᾲ㿸デਓⲴGraphic㿶മPermanentinstructions˖㤡᮷Ѫ≨ѵⲴˈപᇊⲴᤷԔDŽਟԕ䙊䗷ਣ䭞⛩ࠫമѝⲴ४ฏˈ൘ᨀ⽪InsertNewElement-PermanentInstructionлˈ䘹ᤙConditionᡆ㘵CallDŽн䇪亪᧗ಘⲴ⣦ᘱྲօˈ䘉ӋᤷԔਟԕ൘⇿⅑ᢛ᧿ᰦ㻛ᢗ㹼DŽਟԕ൘S7-GRAPHⲴFBѝ㕆߉ԫཊⲴᤷԔ˄䍴Ⓚ䏣ཏⲴᛵߥл˅DŽ⌘˖Permanentinstructionsਚ᭟ᤱєṬᔿˈণ˖xLAD/FBDṬᔿⲴAND,OR,∄䖳ᤷԔ˄⇿њNETWORKᴰཊਟԕᇩ㓣32њ˅xCALLᤷԔྲ᷌ᐼᵋPermanentinstructions֯⭘LAD/FBDަᆳṬᔿᤷԔˈ䈧ሶ䘉ӋᤷԔ㕆߉ѪFB,FC,❦ਾ⭘CALLṬᔿ䈳⭘DŽ亪᧗ಘ亪᧗ಘѻਾⲴPermanentinstructions亪᧗ಘѻࡽⲴPermanentinstructionsമ3-7:Permanentinstructions֯⭘ᾲ㿸デਓⲴSequencer㿶മ˖ሩҾ⇿њS7-GRAPHⲴFB〻ᒿˈਟԕवᤜཊњSequencer(亪᧗ಘ)ˈྲ᷌ᐼᵋሩཊњ亪᧗ಘᾲ㿸ሏⴻˈਟԕ䘹ᤙᾲ㿸デਓⲴSequencer㿶മമ3-8:ᾲ㿸デਓⲴSequencer㿶മ࣐ᯠ〻ᒿ㹼ˈᡆCALLFC,FBㅹ࣐LADᤷԔ⌘↔༴ਟԕ֯⭘ⲴᤷԔ㊫රᱟᴹ䲀ࡦⲴᾲ㿸デਓⲴVariables㿶മ˖൘S7-GRAPHⲴFB〻ᒿѝˈਟԕ䙊䗷ᾲ㿸デਓⲴVariables㿶മˈሏⴻᒦ㕆䗁ྲл䍴Ⓚമ3-9:ᾲ㿸デਓⲴVariables㿶മ3.2.5.䈖㓶デਓਟԕḕⴻ㕆䈁ؑˈਈ䟿ⴁ᧗ˈӔ৹৲㘳ㅹ⣦ᘱᶑᱮ⽪൘㓯ˈ㓯ˈCPU⣦ᘱㅹDŽ3.2.6.S7-GRAPHṬᔿⲴFBоSource᮷Ԧ൘⭏ᡀSTEP7亩ⴞਾˈਟԕ䙊䗷єᯩᔿ⭏ᡀS7-GRAPH〻ᒿ˖xS7-GRAPHṬᔿⲴFBˈਣ䭞⛩ࠫ亩ⴞѝⲴBlock᮷ԦཀྵˈInsertNewObject-FunctionBlock-CreatedinLanguage䘹ᤙGRAPHxS7-GRAPHṬᔿⲴSource᮷Ԧਣ䭞⛩ࠫ亩ⴞѝⲴSource᮷ԦཀྵˈInsertNewObject-䘹ᤙGRAPHSourceє㘵ӂ䖜ᦒ˖S7-GRAPHṬᔿⲴFBਟԕ䙊䗷㨌অFile-GenerateSourceFile⭏ᡀS7-GRAPHṬᔿⲴSource᮷Ԧ˗S7-GRAPHṬᔿⲴSource᮷Ԧҏਟԕ䙊䗷㨌অFile-Compile⭏ᡀS7-GRAPHṬᔿⲴFBDŽє㘵Ⲵ४࡛˖S7-GRAPHṬᔿⲴFB؍ᆈᰦՊ㠚ࣘỰḕ䈝⌅䭉䈟ˈྲ᷌ᴹ䈝⌅䭉䈟ˈࡉᰐ⌅؍ᆈ˗S7-GRAPHṬᔿⲴSource᮷Ԧਟԕ䲿ᰦ؍ᆈˈнỰḕ䈝⌅䭉䈟DŽFB؍ᆈਾণѪਟᢗ㹼ԓ⸱ˈਟԕл䖭䈳䈅˗S7-GRAPHṬᔿⲴSource᮷Ԧਚ㜭⭘Ҿ䇠ᖅ⭘ᡧ〻ᒿˈᰐ⌅л䖭䈳䈅DŽഐ↔ˈ㕆〻㘵ྲ᷌н㜭؍䇱а⅑㕆߉ᆼᡀ䈝⌅↓⺞Ⲵ〻ᒿˈᔪ䇞Ⲵ֯⭘Source᮷ԦṬᔿDŽ4.亪᧗ಘ㿴ࡉS7-GRAPHṬᔿⲴFB〻ᒿᱟ䘉ṧᐕⲴ˖x⇿њS7-GRAPHṬᔿⲴFBˈ䜭ਟԕѪањᲞ䙊FB㻛ަᆳ〻ᒿ䈳⭘x⇿њS7-GRAPHṬᔿⲴFBˈ䜭㻛࠶䝽ањ㛼Ჟᮠᦞඇˈ↔ᮠᦞඇ⭘ᶕᆈۘFB৲ᮠ䇮㖞ˈᖃࡽ⣦ᘱㅹㅹx⇿њS7-GRAPHṬᔿⲴFBˈ䜭वᤜйњѫ㾱䜘࠶˖亪᧗ಘѻࡽⲴPermanentinstructionsˈањᡆཊњ亪᧗ಘˈ亪᧗ಘѻਾⲴPermanentinstructions4.1.亪᧗ಘᢗ㹼㿴ࡉ˖䈧⌘л䶒᧿䘠ѝⲴ㤡᮷ޣ䭞ᆇˈ䘉Ӌޣ䭞ᆇሩҾᆖҐᇎ⭘S7-GRAPH䶎ᑨ䟽㾱1.⇿њ亪᧗ಘ䜭ԕྲлᛵߥᔰ˖xањࡍ↕ᡆ㘵xཊњսҾ亪᧗ಘԫս㖞Ⲵࡍ↕ਚ㾱Ḁњ↕ⲴḀњࣘ˄action˅㻛ᢗ㹼ˈࡉ䇔Ѫ↔↕㻛◰⍫˄active˅ྲ᷌ཊњ↕㻛਼ᰦᢗ㹼ˈࡉ䇔Ѫᱟཊњ↕㻛◰⍫˄active˅2.ањ◰⍫Ⲵ↕൘ྲлᛵߥ䘰ࠪ˖xԫ◰⍫Ⲵᒢᢠ˄activedisturbaces˅ˈֻྲӂ䬱ᶑԦᡆⴁ᧗ᶑԦⲴ⎸䲔ᡆ⺞䇔xᒦф㠣ਾ㔝↕Ⲵ䖜ᦒᶑԦ˄transition˅┑䏣3.┑䏣䖜ᦒᶑԦⲴਾ㔝↕㻛◰⍫4.൘亪᧗ಘⲴ㔃ᶏս㖞ྲ᷌ᴹ˖xањ䐣䖜ᤷԔ˄jump˅ˈᤷੁᵜ亪᧗ಘⲴԫ↕ˈᡆ㘵FBⲴަᆳ亪᧗ಘDŽ↔ᤷԔਟԕᇎ⧠亪᧗ಘⲴᗚ⧟x࠶᭟ڌ→ᤷԔDŽ亪᧗ಘⲴ↕ሶڌ→↕˄Step˅൘S7-GRAPH〻ᒿѝˈ᧗ࡦԫ࣑㻛࠶Ѫཊњ⤜・Ⲵ↕DŽ൘䘉Ӌ↕ѝሶ༠᰾аӋࣘˈ䘉Ӌࣘሶ൘ḀӋ⣦ᘱл㻛᧗ࡦಘᢗ㹼˄ֻྲ᧗ࡦ䗃ࠪˈ◰⍫ᡆ䶎◰⍫ḀӋ↕˅◰⍫Ⲵ↕˄ActiveStep˅◰⍫Ⲵ↕ᱟањᖃࡽ㠚䓛Ⲵࣘ↓൘㻛ᢗ㹼Ⲵ↕DŽањ↕൘ྲлԫᛵߥлˈ䜭ਟ㻛◰⍫˖xᖃḀ↕ࡽ䶒Ⲵ䖜ᦒᶑԦ┑䏣xᖃḀ↕㻛ᇊѹѪࡍ↕˄initialstep˅ᒦф亪᧗ಘ㻛ࡍॆxᖃḀ↕㻛ަᆳสҾһԦⲴࣘ䈳⭘˄event-dependentac