Home
Stage Programming - AutomationDirect
Contents
1. EA Operand Data Type DL430 Range DL440 Range DL450 Range x aaa aaa aaa TT Stage S 0 577 0 1777 0 1777 amp 4 BC The following example is a simple RLLPLYS program This program utilizes the initial 3 Z stage stage and jump instruction to create a structured program 2 DirectSOFT Display Handheld Programmer Keystrokes ISG S SG 0 ISG So STR X IN 0 Ho OUT Y OUT 1 0 eH STR X IN 1 XO Y10 SET s SG 2 OUT STR X IN 5 oH X1 S2 JMP S SG 1 oH SET SG S SG 1 X5 St STR X IN 2 JMP OUT Y OUT 1 1 oH SG S SG 2 SG S1 STR X IN 6 oH OUT Y OUT 1 2 Ho STR X IN 7 m ne AND S SG 1 ump s sq 0 SG S2 X6 Y12 ouT X7 S1 so JMP DL405 User Manual 4th Edition Rev A RLL PLUS D E pan e fe Eos ai o D v 1 09 Initial Stage ISG MEAKA 430 440 450 Jump JMP Viviv 430 440 450 Not Jump NJMP Viviv 430 440 450 RLLPLUS Stage Programming The Initial Stage instruction is normally used as the first segment of an RLLPLYS program Initial stages will be active when the CPU enters the run mode allowing for a sta
2. RLL PLUS Most all instructions work just like they do in standard RLL You can think of a stage just like a miniature RLL program which is either active or inactive Output Coils As expected output coils in active stages will turn on or off outputs according to power flow into the coil However note the following e Outputs work as usual provided each output reference such as Y3 is used in only one stage e Output coils automatically turn off when leaving a stage However Set and Reset instructions are not undone when leaving a stage e An output can be referenced from more than one stage as long as only one of the stages is active at a time e If an output coil is controlled by more than one stage simultaneously the active stage nearest the bottom of the program determines the final output status during each scan So use the OROUT instruction instead when you want multiple stages to have a logical OR control of an output One Shot or PD coils Use care if you must use a Positive Differential coil in a stage Remember that the input to the coil must make a 0 1 transition If the coil is already energized on the first scan when the stage becomes active the PD coil will not work This is because the 0 1 transition did not occur PD coil alternative If there is a task which you wantto do only once on 1 scan itcan be placed in a stage wh
3. SG Executes on next S1 scan after Jmp S1 YO G OUT SG SO XO S1 C MP NOTE Assume we start with Stage 0 active and Stage 1 inactive for both examples DL405 User Manual 4th Edition Rev A 7 8 RLL PLUS D Cc E pan e fe Oo 0 D v 1 09 RLLPLUS Stage Programming Stage Program Example Toggle On Off Lamp Controller A 4 State Process Powerup In the process shown to the right we use Inputs an ordinary momentary pushbutton to control a light bulb The ladder program will latch the switch input so that we will Toggle push and release to turn on the light push and release again to turn it off sometimes called toggle function Sure we could just buy amechanical switch with the alternate on off action built in However this example is educational and also fun Next we draw the state transition diagram A typical first approach is to use XO for both transitions like the example shown to the right However this is incorrect please keep reading Powerup Outputs Ladder yo Program X Cad Output equation YO ON Note that this example differs from the motor example because now we have just one pushbutton When we press the pushbutton both transition conditions are met We would just transition around the state diagram at top speed If implemented in Stage this solution would flash t
4. 0 Program productivity of the lamp process by counting the number of on off cycles which occurs This application will require the addition of a simple counter but the key decision is in where to put the counter Powerup ISG 0p Supervisor Process SO 2 a amp i et GMP En Powerup T Qe S1 Push On gS State s2 3 V Cm i SG S2 ON State New stage programming students will typically SP1 YO try to place the counter inside one of the the OUT stages of the process they are trying to monitor The problem with this approach is that XO P the stage is active only part of the time In order JMP for the counter to count the count input must SG transition from off to on at least one scan after S3 Push Off its stage activates Ensuring this requires extra xo State eG logic that can be tricky GMB In this case we only need to add another x supervisory stage as shown above to watch ISG the main process The counter inside the S4 supervisor stage uses the stage bit S1 of the lg lei main process as its count input Stage bits S1 State ccont crd used as a contact let us monitor a process Ks000 j NOTE Both the Supervisor stage and the OFF stage are initial stages The supervisor stage remains active indefinitely Stage Counter The counter in the above example is a special Stage Counter Note that it does not have a reset input The count is reset by executing a Reset instruction naming the counter bit CTO in this
5. This allows the stages between S10 and xo Y5 OUT the Block End instruction to operate as i scat programmed If the BCALL instruction is turned off or if the stage containing the BLK BCALL instruction is turned off then all co stages between the BLK and BEND instructions are automatically turned off gt Q S10 If you examine S15 you ll notice that X7 Y6 could reset Stage S1 which would ia OUT disable the BCALL thus resetting all a stages within the block BEND Handheld Programmer Keystrokes SG S SG 1 o 15 STR X IN 2 oH ye S1 out yout 5 RST STR X IN 6 oH SHFT B Cc A L L SHFT C CR 0 Ho SHFT B L K SHFT C CR 0 eH SG S SG 1 o oH STR X IN 3 oH OUT Y OUT 6 oH SHFT B E N D eH SG S SG 1 5 STR X IN 7 RST S SG 1 eH Stage View in The Stage View option in DirectSOFT will let you view the ladder program as a flow DirectSOFT chart The figure below shows the symbol convention used in the diagrams You may find the stage view useful as a tool to verify that your stage program has faithfully reproduced the logic of the state transition diagram you intend to realize SG Transition sa reeeo i TEESE gt me lt B gt stag C Output lt gt Reset Stage
6. the right The shaded areas indicate the program additions In the Push UP stage S1 we add the Set Stage Bit S6 instruction When contact XO opens we transition from S1 and go to two new active states S2 and S6 In the Push DOWN state S4 we make the same additions So any time someone presses the door control pushbutton the light turns on Most new stage programmers would be concerned about where to place the Light Stage in the ladder and how to number it The good news is that it doesn t matter e Just choose an unused Stage number and use it for the new stage and as the reference from other stages e Placement in the program is not critical so we place it at the end You might think that each stage has to be directly under the stage that transitions to it While it is good practice it is not required that s good because our two locations for the Set S6 instruction make that impossible Stage numbers and how they are used determines the transition paths In stage S6 we turn on the safety light by energizing Y3 Special relay contact SP1 is always on Timer TO times at 0 1 second per count To achieve 3 minutes time period we calculate 3 min x 60 sec min 0 1 sec count K 1800 counts The timer has power flow whenever stage S6 is active The corresponding timer bit TO is set when the timer expires So three minutes later TO 1 and the instruction Reset S6 causes the stage to be inactive While St
7. ISG S SG 0 STR X IN 0 out your 0 STR X IN 1 JMP S SG 1 JMP S SG 1 0 SG S SG 1 STR X IN 2 JMP S SG 1 1 SHFT c v SHFT S SG 1 0 SHFT c v SHFT S SG 1 1 STR X IN 3 out youT 3 STR X IN 4 SHFT c v SHFT JMP S SG 2 0 SG S SG 2 0 STR X IN 5 JMP S SG 0 DL405 User Manual 4th Edition Rev A RLLPLUS Stage Programming The stage block instructions are used to activate a block of stages The Block Call Block and Block End instructions must be used together Block Call The BCALL instruction is used to activate BCALL a stage block There are several things XI JI dS you need to know about the BCALL x 430 440 450 instruction Boalt Uses CR Numbers The BCALL appears as an output coil but does not actually refer to a Stage number as you might think Instead the block is identified with a Control Relay Caaa This control relay cannot be used as an output anywhere else in the program Must Remain Active The BCALL instruction actually controls all the stages between the BLK and the BEND instructions even after the stages inside the block have started executing The BCALL must remain active or all the stages in the block will automatically be turned off f either the BCALL instruction or the stage that contains the BCALL instruction goes off then the stages in the defined bloc
8. The following diagram is a typical stage view of a ladder program containing stages Note the left to right direction of the flow chart oehr O DEES DA DL405 User Manual 4th Edition Rev A RLLPLUS Stage Programming Questions and Answers about Stage Programming We include the following commonly asked questions about Stage Programming as an aid to new students All question topics are covered in more detail in this chapter Q What does stage programming do that I can t do with standard RLL programs A Stages allow you to identify all the states of your process before you begin programming This approach is more organized because you divide a ladder program into sections As stages these program sections are active only when they are actually needed by the process Most processes can be organized into a sequence of stages connected by event based transitions Q Isn t a stage really just like a software subroutine A No itis very different A subroutine is called by amain program when needed and executes just once before returning to the point from which it was called A stage however is part of the main program It represents a state of the process so an active stage executes on every scan of the CPU until it becomes inactive SM1d 11d 02 2 D a D T fe Co Q D 3 Co Q What are Stage Bits A A stage bit is just a single bit in the CPU s image re
9. case The Stage Counter has the benefit that its count may be globally reset from other stages The standard Counter instruction does not have this global reset capability You may still use a regular Counter instruction inside a stage however the reset input to the counter is the only way to reset it DL405 User Manual 4th Edition Rev A 7 18 RLLPLUS Stage Programming Unconditional As in most example programs in this chapter sg Outputs and Stage 0 to the right your application may SO require a particular output to be ON SP1 unconditionally when a particular stage is a active Until now the examples always use OUT the SP1 special relay contact always on in Unconditional series with the output coils SG S1 Output It s possible to omit the contact as long as you N Yo place any unconditional outputs first at the OUT top of a stage section of ladder The first rung XO v1 of Stage 1 does this Va 1 OUT g ee E WARNING Unconditional outputs placed sG GE YZ elsewhere in a stage do not necessarily S2 e de remain on when the stage is active In a8 O Stage 2 to the right YO is shown as an 20 Y1 J unconditional output but its power flow OUT a g comes from the rung above So YO status Yo will be the same as Y1 is not correct out a hs Power Flow Our discussion of state transitions has shown how the Stage JMP instructio
10. how easy itis to correlate the OFF and fsg ON states of the state transition diagram SO OFF State below to the stage program at the right Now XO S1 we challenge anyone to easily identify the CMP same states in the RLL program on the ne previous page ON State 2 coun EE oo 6 lt EE lt JMP gE a0 Initial Stages At powerup and Program to Run Mode _Powerup in OFF State 2 transitions the PLC always begins with all ISG normal stages SG off So the stage So Initial Stage programs shown so far have actually had no io ee way to get started because rungs are not ar 2 scanned unless their stage is active 1 JMP Assume that we want to always begin in the Off state motor off which is how the RLL program SG works The Initial Stage ISG is defined to be active at powerup In the modified program to SP1 Yo the right we have changed stage S0 to the ISG OUT type This ensures the PLC will scan contact XO x1 SO after powerup because Stage SO is active IMP After powerup an Initial Stage ISG works just like any other stage We can change both programs so that the Powerup in ON State motor is ON at powerup In the RLL below we must add a first scan relay SPO latching CO on SG In the stage example to the right we simply make Stage S1 an initia
11. process design will be mostly sequential with only one stage on at a time However all the processes in the program may be active simultaneously DL405 User Manual 4th Edition Rev A
12. separated from other ladder logic with special beginning and ending instructions In the figure to the BLK right the BLK instruction at the top marks co pan neuen the start of the stage block At the bottom the Block End BEND marks the end of SG the block The stages in between these SO boundary markers SO and S1 in this case and their associated rungs make up the All other rungs in stage block Note that the block instruction has a S1 reference value field set to CO in the example The block instruction borrows All other rungs in stage or uses a control relay contact number so Block End that other parts of the program can control Instruction the block Any control relay number such BEND as C0 used in a BLK instruction is not available for use as a control relay 430 440 450 SM1d 11d 02 he D a D T fe e Q D 3 Co Note that the stages within a block must be regular stages SG or convergence stages CV So they cannot be initial stages The numbering of stages inside stage blocks can be in any order and is completely independent from the numbering of the blocks DL405 User Manual 4th Edition Rev A 7 22 RLLPLUS Stage Programming Block Call The purpose of the Block Call instruction is to activate a stage block At powerup or BCALL upon Program to Run mode transitions all stage bl
13. so stage SO is active When the On pushbutton X0 is pressed a stage transition occurs The JMP S1 instruction executes which simply turns off the Stage bit SO and turns on Stage bit S1 So on the next PLC scan the CPU will not execute Stage SO but will execute stage S1 In the On State Stage S1 we want the motor to always be on The special relay contact SP1 is defined as always on so YO turns the motor on Set Reset Latch X0 X1 YO G A ouT Latch YO SG So OFF State Transition XO S1 E UMP oe ON State Output SP1 Always on Yo Z OUT Transition x1 So E UMP When the Off pushbutton X1 is pressed a transition back to the Off State occurs The JMP SO instruction executes which simply turns off the Stage bit S1 and turns on Stage bit SO On the next PLC scan the CPU will not execute Stage S1 so the motor output YO will turn off The Off state Stage 0 will be ready for the next cycle DL405 User Manual 4th Edition Rev A 7 5 RLL LUS Stage Programming Let s Compare Right now you may be thinking I don t see the big advantage to Stage Programming in fact the stage program is longer than the plain RLL program Well now is the time to exercise a bit of faith As control problems grow in complexity stage programming quickly out performs RLL in simplicity program size etc For example consider the diagram below Notice
14. E Stop and Alarm Monitoring This stage is always active because it is watching for errors that could indicate an alarm condition or require an emergency stop It is common for this stage to reset stages in the main process or elsewhere in order to initialize them after an error condition e Operator Interface this is another task that must always be active and ready to respond to an operator It allows an operator interface to change modes etc independently of the current main process step Although we have separate processes Operator Interface there can be coordination among them For example in an error condition the Contra Status Stage may want to automatically switch the operator interface to the status mode to show error information as shown Set to the right The monitor stage could set Monitor t status the stage bit for Status and Reset the E Stop and stages Control and Recipe Alarm Monitoring DL405 User Manual 4th Edition Rev A 7 16 RLLPLUS Stage Programming How Instructions We can think of states or stages as simply dividing up our ladder program as Work Inside Stages depicted in the figure below Each stage contains only the ladder rungs which are needed for the corresponding state of the process The logic for transitioning out ofa stage is contained within that stage It s easy to choose which ladder rungs are active at powerup by using an initial stage type ISG Stage 0
15. RLL LUS Stage Programming In This Chapter Introduction to Stage Programming Learning to Draw State Transition Diagrams Using the Stage Jump Instruction for State Transitions Stage Program Example Toggle On Off Lamp Controller Four Steps to Writing a Stage Program Stage Program Example a Garage Door Opener Stage Program Design Considerations Parallel Processing Concepts Managing Large Programs RLL YS Instructions Questions and Answers About Stage Programming 7 2 RLLPLUS Stage Programming Introduction to Stage Programming Viviv Stage Programming available in all DL405 CPUs provides a way to organize and 430 440 450 program complex applications with relative ease when compared to purely relay ladder logic RLL solutions Stage programming does not replace or negate the use of traditional boolean ladder programming This is why Stage Programming is also called RLLPLYS You won t have to discard any training or experience you already have Stage programming simply allows you to divide and organize a RLL program into groups of ladder instructions called stages This allows quicker and more intuitive ladder program development than traditional RLL alone provides od E 2E Overcoming Many PLC programmers in the industry LoD Stage Fright have become comfortable using RLL for XO co if every PLC program they write but often RST T r
16. Stage Bit A These instructions are used according to the state diagram topology you have derived e Use a Stage JMP instruction for a state transition moving from one state to another e Use a Set Stage Bit instruction when the current state is spawning a new parallel state or stage sequence or when a supervisory state is starting a state sequence under its command e Use a Reset Stage Bit instruction when the current state is the last state in a sequence and its task is complete or when a supervisory state is ending a state sequence under its command Q What is an initial stage and when do use it A An initial stage ISG is automatically active at powerup Afterwards it works just like any other stage You can have multiple initial stages if required Use an initial stage for ladder that must always be active or as a starting point Q Can I place program ladder rungs outside of the stages so they are always on A It is possible but it s not good software design practice Place ladder that must always be active in an initial stage and do not reset that stage or use a Stage JMP instruction inside it It can start other stage sequences at the proper time by setting the appropriate Stage Bit s Q Can I have more than one active stage at a time A Yes and this is anormal occurrence for many programs However it is important to organize your application into separate processes each made up of stages Anda good
17. Stage Instruction Characteristics Actual Program Appearance SG SO CN ON The inline stage boxes on the left power rail divide the ladder program rungs into stages Some stage rules are Execution Only logic in active stages are executed on any scan Transitions Stage transition instructions take effect on the next occurrence of the stages involved Octal numbering Stages are numbered in octal like I O points etc So S8 is not valid Total Stages The maximum number of stages is CPU dependent No duplicates Each stage number is unique and can be used just once Any order You can skip numbers and sequence the stage numbers in any order Last Stage the last stage in the ladder program includes all rungs from its stage box until the end coil DL405 User Manual 4th Edition Rev A Functionally Equivalent Ladder So C3 Ge includes all rungs in stage SG SO C C SG S1 C C SG S2 C C EnD RLL LUS Stage Programming 1 7 Using the Stage Jump Instruction for State Transitions Stage Jump Set and Reset Instructions The Stage JMP instruction we have used deactivates the stage in which the instruction occurs while activating the stage in the JMP instruction Refer to the state transition shown below When contact X0 energizes the st
18. age S6 is active and the light is on stage transitions in the primary path continue normally and independently of Stage 6 That is the door can go up down or whatever but the light will be on for precisely 3 minutes 7 13 RLL LUS Stage Programming SG DOWN State Xo S1 i Ce oe Push UP State Xo S2 V Ge S6 ae L SET S2 RAISE State SP1 Y1 OUT x1 s3 IMP SG 3 UP State Xo S4 MP a Push DOWN State Xo S5 JMP S6 SET SG D S5 LOWER State SP1 Y2 OUT x2 so IMP SG S6 LIGHT State SP1 Y3 OUT TMR TO K1800 TO S6 RST D m U Z ie Burwwesboig 2681S DL405 User Manual 4th Edition Rev A 7 14 RLL PLUS D Cc E pan e fe Oo 0 D v 1 09 RLLPLUS Stage Programming Add Emergency Stop Feature Exclusive Transitions Some garage door openers today will detect an object under the door This halts further lowering of the door Usually implemented with a photocell electric eye a door in the process of being lowered will halt and begin raising We will define our safety feature to work in this way adding the input from the photocell to the block diagram as shown to the right X3 will be on if an object is in the path of the door Next we make a simple addition to th
19. ate transition from SO to S1 occurs The two stage examples shown below are equivalent So the Stage Jump instruction is equal to a Stage Reset of the current stage plus a Stage Set instruction for the stage to which we want to transition SG SO XO S1 JMP Equivalent ql fev Ko OD SG mojan SO ou eg XO SO S a a D 1 RST 3 S1 a ED Please Read Carefully The jump instruction is easily misunderstood The jump does not occur immediately like a GOTO or GOSUB program control instruction when executed Here s how it works The jump instruction resets the stage bit of the stage in which it occurs All rungs in the stage still finish executing during the current scan even if there are other rungs in the stage below the jump instruction The reset will be in effect on the following scan so the stage that executed the jump instruction previously will be inactive and bypassed The stage bit of the stage named in the Jump instruction will be set immediately so the stage will be executed on its next occurrence In the left program shown below stage S1 executes during the same scan as the JMP S1 occurs in SO In the example on the right Stage S1 executes on the next scan after the JMP S1 executes because stage S1 is located above stage SO SG SO XO S1 MP SG Executes on same S1 scan as Jmp S1 YO 1 Coun
20. can we know whether Stage S2 or S4 will finish last This is an important point because we have to decide how to transition to Stage S5 The solution is to coordinate the transition CV c condition out of convergence stages We s2 Tea accomplish this with a stage type 7 ss designed for this purpose the Convergence Stage type CV In the CV example to the right convergence stages S4 S2 and S4 are required to be grouped a together as shown No logic is permitted r a between CV stages The transition CVuMP condition X3 in this case must be located in the last convergence stage The ae transition condition only has power flow when all convergence stages in the group are active DL405 User Manual 4th Edition Rev A RLLPLUS Stage Programming Convergence Jump Recall that the last convergence stage CV CVJMP only has power flow when all CV stages in s2 Convergence XI JI dJ the group are active To complement the Jump 430 440 450 convergence stage we need a new jump instruction The Convergence Jump CV CVJMP shown to the right will transition S4 to Stage S5 when X3 is active as one might expect but it also automatically je 2 o resets all convergence stages in the 1 CVJMP group This makes the CVJMP jump a very powerful instruction Note that this SC oO instruction may only be used with convergence stage
21. e analysis of an application gives us the best chance at writing efficient bug free programs State diagrams are just a tool to help us draw a picture of our process You ll discover that if we can get the picture right our program will also be right D m U Z Burwwesboig 2681S A 2 State Process Consider the simple process showntothe Inputs Outputs right which controls an industrial motor op We will use a green momentary SPST 5g X0 Motor pushbutton to turn the motor on and a red Ladder yo one to turn it off The machine operator will Off Program press the appropriate pushbutton for justa 5 5 X1 second or so The two states of our process are ON and OFF The next step is to draw a state transition Tonen wondinian diagram as shown to the right It shows State XO the two states OFF and ON with two transition lines in between When the event X0 is true we transition from OFF to X1 ON When X1 is true we transition from Oi ON to OFF Output equation YO ON If you re following along you are very close to grasping the concept and the problem solving power of state transition diagrams The output of our controller is YO which is true any time we are in the ON state In a boolean sense YO ON state Next we will implementthe state diagram first as RLL then as astage program This will help you see the relationship between the two methods in problem solving DL405 User Manual 4th Ed
22. e state transition diagram shown in shaded areas in the figure below Note the new transition path at the top of the LOWER state If we are lowering the door and detect an obstruction X3 we then jump to the Push UP State We do this instead of jumping directly to the RAISE state to give the Lower output Y2 one scan to turn off before the Raise output Y1 energizes X2 and X3 Inputs Outputs Toggle oo 0n Yi gt Raise Up limit Ladder 5 o O0O Program gt Lower Down limit 56 4 LYS e Light Obstruction o o XO It is theoretically possible that the down limit X2 and the obstruction input X3 could energize at the same moment In that case we would jump to the Push UP and DOWN states simultaneously which does not make sense Instead we give priority to the obstruction by changing the transition condition to the DOWN state to X2 AND NOT X3 This ensures the obstruction event has the priority The modifications we must make to the LOWER Stage S5 logic are shown to the right The first rung remains unchanged The second and third rungs implement the transitions we need Note the opposite relay contact usage for X3 which ensures the stage will execute only one of the JMP instructions DL405 User Manual 4th Edition Rev A Me LOWER State SP1 Y2 OUT x2 x3 to Push UP so A IMP X3 to DOWN S2 IMP 7 15 RLL LUS Stage Prog
23. emain skeptical or even fearful of learning Si new techniques such as stage X4 C1 Yo a programming While RLL is great at SET solving boolean logic relationships it has gt L 2 disadvantages as well e Large programs can become almost STAGE unmanageable because of a lack of N structure x3 y2 e In RLL latches must be tediously out created from self latching relays e When a process gets stuck it is difficult to find the rung where the error occurred e Programs become difficult to modify later because they do not intuitively resemble the application problem they are solving It s easy to see that these inefficiencies consume a lot of additional time and time is money Stage programming overcomes these obstacles We believe a few moments of studying the stage concept is one of the greatest investments in programming speed and efficiency a PLC programmer can make So we encourage you to study stage programming and add it to your toolbox of programming techniques This chapter is designed as a self paced tutorial on stage programming For best results e Start at the beginning and do not skip over any sections e Study each stage programing concept by working through each example The examples build progressively on each other e Read the Stage Questions and Answers at the end of the chapter for a quick review DL405 User Manual 4th Edition Rev A 7 3 RLL LUS S
24. gister representing the active inactive status of the stage in real time For example the bit for Stage 0 is referenced as SO If SO 0 then the ladder rungs in Stage 0 are bypassed not executed on each CPU scan If SO 1 then the ladder rungs in Stage 0 are executed on each CPU scan Stage bits when used as contacts allow one part of your program to monitor another part by detecting stage active inactive status Q How does a stage become active A There are three ways e If the Stage is an initial stage ISG it is automatically active at powerup e Another stage can execute a Stage JMP instruction naming this stage which makes it active upon its next occurrence in the program e A program rung can execute a Set Stage Bit instruction such as SET S0 Q How does a stage become inactive A There are three ways e Standard Stages SG are automatically inactive at powerup e A stage can execute a Stage JMP instruction resetting its Stage Bit to 0 e Any rung in the program can execute a Reset Stage Bit instruction such as RST S0 Q What about the power flow technique of stage transitions A The power flow method of connecting adjacent stages directly above or below in the program actually is the same as the Stage Jump instruction executed in the stage above naming the stage below Power flow transitions are more difficult to edit in DirectSOFT we list them separately from two preceding questions DL405 U
25. he light on or off each scan obviously undesirable The solution is to make the push and the release of the pushbutton separate events Refer to the new state transition diagram below At powerup we enter the OFF state When switch XO is pressed we enter the Press ON state When it is released we enter the ON state Note that XO with the bar above it denotes XO NOT Output equation YO ON When in the ON state another push and release cycle similarly takes us back to the OFF state Now we have two unique states OFF and ON used when the pushbutton is released which is what was required to solve the control problem The equivalent stage program is shown to the right The desired powerup state is OFF so we make SO an initial stage ISG In the ON state we add special relay contact SP1 which is always on Note that even as our programs grow more complex it is still easy to correlate the state transition diagram with the stage program DL405 User Manual 4th Edition Rev A ee OFF State XO S1 UMP 36 Push On State XO S2 M UMP ie ON State Output SP1 YO OUT XO S3 JMP SG _ 3 Push Off State X0 SO JMP 7 9 RLL LUS Stage Programming Four Steps to Writing a Stage Program By now you ve probably noticed that we follow the same steps to solve each example problem The steps will probably come to you automatically if you wor
26. ich transitions to the next stage on the same scan Counter In using a counter inside a stage the stage must be active for one scan before the input to the counter makes a 0 1 transition Otherwise there is no real transition and the counter will not count The ordinary Counter instruction does have a restriction inside stages it may not be reset from other stages using the RST instruction for the counter bit However the special Stage Counter provides a solution see next paragraph Stage Counter The Stage Counter has the benefit that its count may be globally reset from other stages by using the RST instruction It has a count input but no reset input This is the only difference from a standard counter instruction Drum Realize that the drum sequencer is its own process and is a different programming method than stage programming If you need to use a drum and stages be sure to place the drum instruction in an ISG stage that is always active D Cc E pan e fe Oo 0 D v 1 09 DL405 User Manual 4th Edition Rev A RLL LUS Stage Programming Using aStage asa You may recall the light bulb on off Supervisory controller example from earlier in this SA Process chapter For the purpose of illustration Toggle Ladder yo suppose we want to monitor the
27. id in regular or initial stages e Convergence Stages or CVJMP instructions may not be used in subroutines or interrupt routines DL405 User Manual 4th Edition Rev A RLL LUS Stage Programming Managing Large Programs Astage may contain a lot of ladder rungs or just one or two program rungs For most applications good program design will ensure the average number of rungs per stage will be small However large application programs will still create a large number of stages We introduce a new construct which will help us organize related stages into groups called blocks So program organization is the main benefit of the use of stage blocks Stage Blocks A block is a section of ladder program which contains stages In the figure below BLK BEND each block has its own reference number Just like stages a stage block may be XIJ I active or inactive Stages inside a block are not limited in how they may transition from one to another Note that the use of stage blocks does not require each stage in a program to reside inside a block shown below by the stages outside blocks DD ad OHO HOD Stages outside blocks ae aoe SOOO A program with 20 or more stages may be considered large enough to use block grouping however their use is not mandatory When used the number of stage blocks should probably be two or higher because the use of one block provides a negligible advantage A block of stages is
28. ition Rev A 7 4 RLL PLUS D Cc E pan e fe Oo 0 D v 1 09 Stage Equivalent RLL Equivalent RLLPLUS Stage Programming The state transition diagram to the right is a picture of the solution we need to create The beauty of it is this it expresses the problem independently of the programming language we may use to realize it In other words by drawing the diagram we have already solved the control problem XO cory Ton Output equation YO ON First we ll translate the state diagram to traditional RLL Then we ll show how easy it is to translate the diagram into a stage programming solution The RLL solution is shown to the right Output YO has a dual purpose When the On momentary pushbutton XO is pressed output coil YO turns on and the YO contact on the second row latches itself on So XO sets the latch YO on and it remains on after the XO contact opens The output YO has power flow on a field device When the Off pushbutton X1 is pressed it opens the normally closed X1 contact which resets the latch and output YO turns off The stage program solution is shown to the right The two inline stage boxes SO and S1 correspond to the two states OFF and ON The ladder rung s below each stage box belong to each respective stage This means that the PLC only has to scan those rungs when the corresponding stage is active For now let s assume we begin in the OFF State
29. ive Still the BCALL may occur on an ordinary ladder rung or it may occur within an active stage as shown below Note that either turning off the BCALL or turning off the stage containing the BCALL will deactivate the corresponding stage block You may also control a stage block with a BCALL in another stage block SG Stage Block SO BLK Co XO Co BCALL SG All other rungs in stage S10 All rungs in stage SG 11 SG 11 322999 All other rungs in stage NOTE Stage Block may come before or after the location of the BCALL instruction BEND in the program The BCALL may be used in many ways or contexts so it can be difficult to find the best usage Just remember that the purpose of stage blocks is to help you organize the application problem by grouping related stages together Remember that initial stages must exist outside stage blocks DL405 User Manual 4th Edition Rev A 7 23 RLL LUS Stage Programming RLLP UYS Instructions Stage The Stage instructions are used to create SG structured RLLPLYS programs Stages are IIS program segments which can be activated ap ab 450 by transitional logic a jump or a set stage SG that is executed from an active stage Saaa Stages are deactivated one scan after transitional logic a jump or a reset stage instruction is executed
30. k through all the examples in this chapter It s helpful to have a checklist to guide us through the problem solving The following steps summarize the stage program design procedure 1 Write a Word Description of the application Describe all functions of the process in your own words Start by listing what happens first then next etc If you find there are too many things happening at once try dividing the problem into more than one process Remember you can still have the processes communicate with each other to coordinate their overall activity 2 Draw the Block Diagram Inputs represent all the information the process needs for decisions and outputs connect to all devices controlled by the process e Make lists of inputs and outputs for the process e Assign I O point numbers X and Y to physical inputs and outputs D m U Z Burwwesboig 2681S 3 Draw the State Transition Diagram The state transition diagram describes the central function of the block diagram reading inputs and generating outputs e Identify and name the states of the process e Identify the event s required for each transition between states e Ensure the process has a way to re start itself or is cyclical e Choose the powerup state for your process e Write the output equations 4 Write the Stage Program Translate the state transition diagram into a stage program e Make each state a stage Remember to number stage
31. k will be turned off automatically Activates First Block Stage When the BCALL is executed it automatically activates the first stage following the BLK instructions SM1d 11d 02 fev co 0 U je co se 3 co Operand Data Type DL440 Range aaa Control Relay C 0 1777 Block BLK The Block instruction is a label which XIJ Vv marks the beginning of a block of stages 430 440 450 that can be activated as a group A Stage instruction must immediately follow the BLK Start Block instruction Initial Stage C aaa instructions are not allowed in a block The control relay Caaa specified in Block instruction must not be used as an output any where else in the program Operand Data Type DL440 Range aaa Control Relay Cc 0 1777 Block End BEND The Block End instruction is a label used X Viv with the Block instruction It marks the 430 440 450 end of a block of stages There is no operand with this instruction BEND DL405 User Manual 4th Edition Rev A 7 28 RLL PLUS D E pan e fe Oo 0 D v 1 09 RLLPLUS Stage Programming In this example the Block Call is executed PirectSOFT Display when stage 1 is active and X6 is on The ae Block Call then automatically activates S1 stage S10 which immediately follows the Block instruction
32. l stage ISG instead of Xo S1 S0 E Qv Powerup in ON State XO x1 co ne Q iti OU Initial Stage v D SP1 a YO Co YO OU C OUD SS D x1 So SPO First Scan MP HE NOTE If the ISG is within the retentive range for stages the ISG will remain in the state it was in before power down and will NOT turn itself on during the first scan DL405 User Manual 4th Edition Rev A 7 6 RLLPLUS Stage Programming We can mark our desired powerup state as shown to the right which helps us remember to use the appropriate Initial Stages when creating a stage program It is permissible to have as many initial stages as the process requires Powerup lt i ae What Stage Bits Do You may recall that a stage is just a section of ladder program which is either active or inactive at a given moment All stage bits SO Sxxx reside in the PLC s image register as individual status bits Each stage bit is either a boolean 0 or 1 at any time Program execution always reads ladder rungs from top to bottom and from left to right The drawing below shows the effect of stage bit status The ladder rungs below the stage instruction continuing until the next stage instruction or the end of program belong to stage 0 Its equivalent operation is shown on the right When SO is true the two rungs have power flow e If Stage bit SO 0 its ladder rungs are not scanned executed e If Stage bit SO 1 its ladder rungs are scanned executed
33. ly raised position the up limit switch X1 activates This takes us to the UP Stage S3 where we wait until another door control command occurs In the UP Stage S3 a push release cycle of the pushbutton will take us to the LOWER Stage S5 where we activate Y2 to command the motor to lower the door This continues until the door reaches the down limit switch X2 When X2 closes we transition from Stage S5 to the DOWN stage SO where we began fer Co OD ISG ar So DOWN State ov a XO si fee i TH SG Push b ush UP State XO s2 IMP SQ RAISE State SP1 Y1 uD x1 S3 MP S85 UP State XO S4 MP so Push DOWN State XO S5 M MP aa LOWER State SP1 Y2 uD x2 So MP NOTE The initial stage ISG is automatically active at powerup afterwards is acts like others DL405 User Manual 4th Edition Rev A 7 12 RLLPLUS Stage Programming Add Safety Next we will add a safety light feature to Light Feature the door opener system It s best to get the main function working first as we have co done then adding the secondary features N N The safety light is standard on many N Safety light commercially available garage door y 19 openers It is shown to the right mounted aa on the motor housing The light turns on upon any door activity remaining on for approximately 3 mi
34. mand To motor Down limit 504 Y2 n Lower DL405 User Manual 4th Edition Rev A Draw the State Diagram Powerup RLL LUS Stage Programming 7 11 Now we are ready to draw the state transition diagram Like the previous light bulb controller example this application also has just one switch for the command input Refer to the figure below e When the door is down DOWN state nothing happens until XO energizes Its push and release brings us to the RAISE state where output Y1 turns on and causes the motor to raise the door e We transition to the UP state when the up limit switch X1 energizes and turns off the motor e Then nothing happens until another XO press release cycle occurs That takes us to the LOWER state turning on output Y2 to command the motor to lower the door We transition back to the DOWN state when the down limit switch X2 energizes Y1 RAISE Y2 LOWER Output equations The equivalent stage program is shown to the right For now we will assume the door is down at powerup so the desired powerup state is DOWN We make SO an initial stage ISG Stage SO remains active until the door control pushbutton activates Then we transition JMP to Push UP stage S1 A push release cycle of the pushbutton takes us through stage S1 to the RAISE stage S2 We use the always on contact SP1 to energize the motor s raise command Y1 When the door reaches the ful
35. n makes Transition the current stage inactive and the next stage named in the JMP active As an Technique alternative way to enter this in DirectSOFT you may use the power flow method for stage transitions The main requirement is that the current stage be located directly above the next jump to stage in the ladder program This arrangement is shown in the diagram below by stages SO and S1 respectively lt gt aa SG SG SO So XO S1 All other rungs in stage IMP Ns XO Equivalent SG Power flow S1 transition SG S1 Recall that the Stage JMP instruction may occur anywhere in the current stage and the result is the same However power flow transitions Shown above must occur as the last rung in a stage All other rungs in the stage will precede it The power flow transition method is also achievable on the handheld programmer by simply following the transition condition with the Stage instruction for the next stage The power flow transition method does eliminate one Stage JMP instruction its only advantage However itis not as easy to make program changes as using the Stage JMP Therefore we advise using Stage JMP transitions for most programmers DL405 User Manual 4th Edition Rev A 7 19 RLL LUS Stage Programming Parallel Processing Concepts Parallel Processes Previously in this chapter we discussed how a state may tra
36. nsition to either one state Converging Processes or another called an exclusive transition In other cases we may need to branch simultaneously to two or more parallel processes as shown below It is acceptable to use all JMP instructions as shown or we could use one JMP and a Set Stage bit instruction s at least one must be a JMP in order to leave S1 Remember that all instructions in a stage execute even when it transitions the JMP is not a GOTO Process oC Push On State KA X0 2 g fia OD EF xT S4 amp v m E 30 Note that if we want Stages S2 and S4 to energize exactly on the same scan both 3 stages must be located below or above Stage S1 in the ladder program see the a explanation at the bottom of page 10 7 Overall parallel branching is easy Now we consider the opposite case of parallel branching which is converging processes This simply means we stop doing multiple things and continue doing one thing at a time In the figure below processes A and B converge when stages S2 and S4 transition to S5 at some point in time So S2 and S4 are Convergence Stages gt Convergence Stage Process A Convergence Stages CV X Viv 430 440 450 Pere Process B While the converging principle is simple enough it brings a new complication As parallel processing completes the multiple processes almost never finish at the same time In other words how
37. nutes afterwards er This part of the exercise will demonstrate 2 the use of parallel states in our state diagram Instead of using the JMP ea 2E instruction we ll use the set and reset LoD commands if me Co Modify the To control the light bulb we add an output Inputs Outputs amp Block Diagram and to our controller block diagram shown to o State Diagram the right Y3 is the light control output Toggle y1 In the diagram below we add an additional Pelee state called LIGHT Whenever the Ladder garage owner presses the door control Up limit x4 Program y switch and releases the RAISE or o o c Lower LOWER state is active and the LIGHT state is simultaneously active The line to Down limit the Light state is dashed because itisnot ___ 2 Y3 the primary path o Light We can think of the Light state as a parallel process to the raise and lower state The paths to the Light state are not a transition Stage JMP but a State Set command In the logic of the Light stage we will place a three minute timer When it expires timer bit TO turns on and resets the Light stage The path out of the Light stage goes nowhere indicating the Light stage just becomes inactive and the light goes out Output equations Y1 RAISE Y2 LOWER Y3 LIGHT DL405 User Manual 4th Edition Rev A Using a Timer Inside a Stage The finished modified program is shown to
38. ocks and the stages within them XIJ J are inactive Shown in the figure below the Block Call instruction is a type of output coil When the X0 contact is closed the BCALL will cause the stage block referenced in the instruction CO to become active When the BCALL is turned off the corresponding stage block and the stages within it become inactive We must avoid confusing block call operation with how a subroutine call works After a BCALL coil executes program execution continues with the next program rung Whenever program execution arrives at the ladder location of the stage block named in the BCALL then logic within the block executes because the block is now active Similarly do not classify the BCALL as type of state transition is nota JMP Block CO 430 440 450 X0 Co G BCALL f l Activate _ e next rung CO RLL PLUS D Cc E pan e fe Oo 0 D v 1 09 When a stage block becomes active the first stage in the block automatically becomes active on the same scan The first stage in a block is the one located immediately under the block BLK instruction in the ladder program So that stage plays a similar role to the initial type stage we discussed earlier The Block Call instruction may be used in several contexts Obviously the first execution of a BCALL must occur outside a stage block since stage blocks are initially inact
39. ramming Stage Program Design Considerations Stage Program Organization CxO ISG Powerup Initialization E Stop and Alarm Monitoring Operator Interface Contrh Recipe The examples so far in this chapter used one self contained state diagram to represent the main process However we can have multiple processes implemented in stages all in the same ladder program New stage programmers sometimes try to turn a stage on and off each scan based on the false assumption that only one stage can be on at a time For ladder rungs that you want to execute each scan just put them in a stage that is always on The following figure shows a typical application During operation the primary manufacturing activity Main Process Powerup Initialization E Stop and Alarm Monitoring and Operator Interface are all running At powerup four initial stages shown begin operation Main Process Cae CAG G C D m U Z ie Burwwesboig 2681S In a typical application the separate stage sequences above operate as follows e Powerup Initialization This stage contains ladder rung tasks done just once at powerup Its last rung resets the stage so this stage is only active for one scan or only as many scans that are required e Main Process this stage sequence controls the heart of the process or machine One pass through the sequence represents one part cycle of the machine or one batch in the process e
40. rting point in the program Initial Stages are also activated by transitional logic a jump or a set stage executed from an active stage Initial Stages are deactivated one scan after transitional logic a jump or a reset stage instruction is executed Multiple Initial Stages are allowed in a program ISG Saaa Operand Data Type DL430 Range DL440 Range DL450 Range aaa aaa aaa Stage S 0 577 0 1777 0 1777 NOTE If the ISG is within the retentive range for stages the ISG will remain in the state it was in before power down and will NOT turn itself on during the first scan The Jump instruction allows the program to transition from an active stage which contains the jump instruction to another which stage is specified in the instruction The jump will occur when the input logic is true The active stage that contains the Jump will be deactivated 1 scan after the Jump instruction is executed S aaa meP Operand Data Type DL430 Range DL440 Range DL450 Range aaa aaa aaa Stage S 0 577 0 1777 0 1777 The Not Jump instruction allows the program to transition from an active stage which contains the jump instruction to another which is specified in the instruction The jump will occur when the input logic is off The active stage that contains the Not Jump will be deactivated 1 scan after the Not Jump inst
41. ruction is executed Operand Data Type DL430 Range DL440 Range DL450 Range aaa aaa aaa Stage S 0 577 0 1777 0 1777 DL405 User Manual 4th Edition Rev A Converge Stage CV and Converge Jump CVJMP XI VsI 430 440 450 7 25 RLL LUS Stage Programming In the following example when the CPU begins program execution only ISG 0 will be active When X1 is on the program execution will jump from Initial Stage 0 to Stage 1 In Stage 1 if X2 is on output Y5 will be turned on If X7 is on program execution will jump from Stage 1 to Stage 2 If X7 is off program execution will jump from Stage 1 to Stage 3 DirectSOFT Display Handheld Programmer Keystrokes ISG S SG o Ho ISG 50 STR X IN 1 JMP S SG 1 Xi s1 SG S SG 1 JMP STR X IN 2 oS out Y OUT 5 oH 2 ico SG S1 STR X IN 7 oy JMP S SG 2 vE 3 m x2 Y5 NOT JMP S SG 3 a U OUT SC 3o 3 S2 5 X7 JWP e s3 NJMP The Converge Stage instruction is used to group certain stages together by defining them as Converge Stages When all of the Converge Stages within a group become active the CVJMP instruction and any additional logic in the final CV stage will be executed All preceding CV stages must be acti
42. s op SE 7 o Convergence The following summarizes the requirements in the use of convergence stages a Stage Guidelines including some tips for their effective application S e Aconvergence stage is to be used as the last stage of a process which is running in parallel to another process or processes A transition to the convergence stage means that a particular process is through and represents a waiting point until all other parallel processes also finish e The maximum number of convergence stages which make up one group is 17 In other words a maximum of 17 stages can converge into one stage e Convergence stages of the same group must be placed together in the program connected on the power rail without any other logic in between e Within a convergence group the stages may occur in any order top to bottom It does not matter which stage is last in the group because all convergence stages have to be active before the last stage has power flow e The last convergence stage of a group may have ladder logic within the stage However this logic will not execute until all convergence stages of the group are active e The convergence jump CVJMP is the intended method to be used to transition from the convergence group of stages to the next stage The CVJMP resets all convergence stages of the group and energizes the stage named in the jump e The CVJMP instruction must only be used in a convergence stage as it is inval
43. s in octal Up to 384 total stages are available in the DL430 CPU numbered 0 to 577 octal Up to 1024 total stages are available in the DL440 DL450 CPUs numbered 0 to 1777 in octal e Put transition logic inside the stage which originates each transition the stage each arrow points away from e Use an initial stage ISG for any states that must be active at powerup e Place the outputs or actions in the appropriate stages You ll notice that Steps 1 through 3 just prepare us to write the stage program in Step 4 However the program virtually writes itself because of the preparation beforehand Soon you ll be able to start with a word description of an application and create a stage program in one easy session DL405 User Manual 4th Edition Rev A 7 10 RLLPLUS Stage Programming Stage Program Example A Garage Door Opener Garage Door In this next stage programming example Opener Example we ll create a garage door opener controller Hopefully most readers are familiar with this application and we can have fun besides JAN The first step we must take is to describe how the door opener works We will start by achieving the basic operation waiting to add extra features later stage programs are very easy to modify Our garage door controller has a motor which raises or lowers the door on command The garage owner pushes and releases a momentary pushbutton once to raise the door After the door is up another push relea
44. se cycle will lower the door In order to identify the inputs and outputs Up limit switch of the system its sometimes helpful to vA sketch its main components as shown in H RLL PLUS D Cc E pan e fe Oo 0 D v 1 09 the door side view to the right The door Motor Raise has an up limit and a down limit switch Lower Each limit switch closes only when the door has reached the end of travel in the corresponding direction In the middle of ep travel neither limit switch is closed The motor has two command inputs raise and lower When neither input is active are Door Cas the motor is stopped omman The door command is just a simple pushbutton Whether wall mounted as Down limit switch ja shown or a radio remote control all door control commands logically OR together as one pair of switch contacts Draw the Block The block diagram of the controller is Inputs Outputs Diagram shown to the right Input XO is from the pushbutton door control Input X1 Toggle energizes when the door reaches the full C 0 up position Input X2 energizes when the ne Ladder door reaches the full down position When Program 44 the door is positioned between fully up or m Raise down both limit switches are open The controller has two outputs to drive the motor Y1 is the up raise the door command and Y2 is the down lower the door com
45. ser Manual 4th Edition Rev A RLLPLUS Stage Programming Q Can I have a stage which is active for only one scan A Yes but this is not the intended use for a stage Instead just make a ladder rung active for 1 scan by including a stage Jump instruction at the bottom of the rung Then the ladder will execute on the last scan before its stage jumps to a new one Q Isn t a Stage JMP just like a regular GOTO instruction used in software A No it is very different A GOTO instruction sends the program execution immediately to the code location named by the GOTO A Stage JMP simply resets the Stage Bit of the current stage while setting the Stage Bit of the stage named in the JMP instruction Stage bits are 0 or 1 determining the inactive active status of the corresponding stages A stage JMP has the following results e When the JMP is executed the remainder of the current stage s rungs are executed even if they reside past under the JMP instruction On the following scan that stage is not executed because it is inactive e The Stage named in the Stage JMP instruction will be executed upon its next occurrence If located past under the current stage it will be executed on the same scan If located before above the current stage it will be executed on the following scan RLL PLUS D Cc E pan e fe Oo 0 D v 1 09 Q How can I know when to use stage JMP versus a Set Stage Bit or Reset
46. tage Programming Learning to Draw State Transition Diagrams Introduction to Those familiar with ladder program Process States execution know that the CPU must scan Inputs Ladder Outputs the ladder program repeatedly over and Program M gt over Its three basic steps are 1 Read the inputs 2 Execute the ladder program PLC Scan 3 Write the outputs 1 Read Execute Write a The benefit is that a change at the inputs 2 Read Execute Write can affect the outputs in just a few 3 Read fete g milliseconds Most manufacturing processes consist of a series of activities or conditions each lasting for several seconds minutes or even hours We might call these process states which are either active or inactive at any particular time A challenge for RLL programs is that a particular input event may last for just a brief instant We typically create latching relays in RLL to preserve the input event in order to maintain a process state for the required duration We can organize and divide ladder logic into sections called stages representing process states But before we describe stages in detail we will reveal the secret to understanding stage programming state transition diagrams The Need for State Sometimes we need to forget about the scan nature of PLCs and focus our thinking Diagrams toward the states of the process we need to identify Clear thinking and concis
47. ve before the final CV stage logic can be executed All Converge Stages are deactivated one scan after the CVJMP instruction is executed Additional logic instructions are only 2 Fs allowed following the last Converge Stage cvume instruction and before the CVJMP instruction Multiple CVJUMP instructions are allowed Converge Stages must be programmed in the main body of the application program This means they cannot be programmed in Subroutines or Interrupt Routines CV S aaa Operand Data Type DL440 Range aaa Stage S 0 1777 DL405 User Manual 4th Edition Rev A 7 26 RLLPLUS Stage Programming In the following example when Converge Stages S10 and S11 are both active the CVJMP instruction will be executed when X4 is on The CVJMP will deactivate S10 and 11 and activate S20 Then if X5 is on the program execution will jump back to the initial stage SO DirectSOFT Display ISG So 2 XO Yo OUT nE 5 S X1 S1 m D JMP e JA S10 Co D JMP wo amp SG S1 Xo S11 __ JMP CV S10 CV Si xa Y3 OUT x4 20 CVJMP SG 20 X5 SO __ JMP Handheld Programmer Keystrokes
Download Pdf Manuals
Related Search
Related Contents
ESD-6300/1862/1704 User`s Manual v1.0 le guide de l`utilisateur Kenwood TK-7180 Stereo System User Manual ESゲートウェイ取扱説明書20150903 LI55 Series Analog Input Display USER MANUAL TREF GB Copyright © All rights reserved.
Failed to retrieve file