The text of a manual · part 47 of 68
DL405 User Manual: Chapter 7: RLLPLUS Stage Programming, pages 409 to 418
Pages 409 to 418 of 608, from DL405 User Manual
The original document is the PDF (8.2 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the AutomationDirect D4-08B-1, AutomationDirect D4-08ND3S, AutomationDirect D4-16TA, PLC Direct D4-16TD2, AutomationDirect D4-32ND3-1, Konnect-It D4-08B-1, Koyo D4-08B-1, Konnect-It D4-08ND3S, and 6 more models
Page 409
RLL PLUS Stage Programming Draw the State Diagram
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. S When the door is down (DOWN state), nothing happens until X0 energizes. Its push and release brings us to the RAISE state, where output Y1 turns on and causes the motor to raise the door. S We transition to the UP state when the up limit switch (X1) energizes, and turns off the motor. S Then nothing happens until another X0 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. X0
Push--UP
X0
RAISE
X1
ISG S0
DOWN State S1 JMP
X0
DOWN X2
UP LOWER X0
Push-DOWN
SG S1
X0
Push--UP State S2 JMP
X0
SG S2
Output equations: Y1 = RAISE Y2 = LOWER
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 S0 an initial stage (ISG). Stage S0 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 fully-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 S0, where we began.
RAISE State SP1
Y1 OUT
X1
S3 JMP
SG S3
UP State X0
SG S4
S4 JMP
Push--DOWN State X0
SG S5
S5 JMP
LOWER State SP1
Y2 OUT
X2
S0 JMP
NOTE: The initial stage (ISG) is automatically active at powerup, afterwards, is acts like others.
DL405 User Manual, 4th Edition
RLL PLUS Stage Programming
Powerup
7--11
Page 410
7--12
RLL PLUS Stage Programming
RLL PLUS Stage Programming
Add Safety Light Feature
Next we will add a safety light feature to the door opener system. It’s best to get the main function working first as we have done, then adding the secondary features. The safety light is standard on many commercially-available garage door openers. It is shown to the right, mounted on the motor housing. The light turns on upon any door activity, remaining on for approximately 3 minutes afterwards. This part of the exercise will demonstrate the use of parallel states in our state diagram. Instead of using the JMP instruction, we’ll use the set and reset commands.
Safety light
To control the light bulb, we add an output Inputs Modify the Block Diagram and to our controller block diagram, shown to Toggle the right, Y3 is the light control output. State Diagram X0 In the diagram below, we add an additional state called “LIGHT”. Whenever the garage owner presses the door control Up limit X1 switch and releases, the RAISE or LOWER state is active and the LIGHT state is simultaneously active. The line to Down limit the Light state is dashed, because it is not X2 the primary path.
Outputs Y1
Ladder Program Y2
Y3
Raise
Lower
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 T0 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: X0 X0
RAISE
Push--UP
X1
Y1 = RAISE Y2 = LOWER Y3 = LIGHT
X0
DOWN
LIGHT
UP
T0
X0 X2
LOWER
Push--DOWN
X0
DL405 User Manual, 4th Edition
X0
Page 411
7--13
RLL PLUS Stage Programming Using a Timer Inside a Stage
K=1800 counts The timer has power flow whenever stage S6 is active. The corresponding timer bit T0 is set when the timer expires. So three minutes later, T0=1 and the instruction Reset S6 causes the stage to be inactive. While Stage 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.
ISG S0
DOWN State S1
X0
JMP SG S1
Push--UP State S2
X0
JMP S6 SET
SG S2
RAISE State SP1
Y1 OUT S3
X1
JMP SG S3
UP State S4
X0
JMP SG S4
Push--DOWN State S5
X0
JMP S6 SET
SG S5
LOWER State SP1
Y2 OUT
X2
S0 JMP
SG S6
LIGHT State SP1
Y3 OUT TMR T0 K1800
T0
S6 RST
DL405 User Manual, 4th Edition
RLL PLUS Stage Programming
The finished modified program is shown to 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 X0 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! S Just choose an unused Stage number, and use it for the new stage and as the reference from other stages. S 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 T0 times at 0.1 second per count. To achieve 3 minutes time period, we calculate: 3 min. x 60 sec/min K= 0.1 sec/count
Page 412
7--14
RLL PLUS Stage Programming
RLL PLUS Stage Programming
Add Emergency Stop Feature
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 the 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.
Inputs Toggle
Outputs X0
Y1
X1
Ladder Y2 Program
Lower
Down limit X2
Y3
Light
Up limit
Raise
Obstruction X3
X0 X0
RAISE
Push--UP
X1
X0
DOWN
X2 and X3
X3
LIGHT
UP
T0
X0
LOWER
Push--DOWN
X0
X0
Exclusive Transitions
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 SG LOWER State DOWN state to [X2 AND NOT X3]. This S5 ensures the obstruction event has the SP1 Y2 priority. The modifications we must make OUT to the LOWER Stage (S5) logic are shown to the right. The first rung remains X2 X3 to Push-UP S0 unchanged. The second and third rungs JMP implement the transitions we need. Note S2 X3 to DOWN the opposite relay contact usage for X3, which ensures the stage will execute only JMP one of the JMP instructions.
DL405 User Manual, 4th Edition
Page 413
7--15
RLL PLUS Stage Programming
Stage Program Design Considerations Stage Program Organization
Main Process XXX
= ISG
Idle
Fill
Agitate
Powerup Initialization
E-Stop and Alarm Monitoring
Powerup
Monitor
Rinse
Spin
Operator Interface Recipe
Control
Status
In a typical application, the separate stage sequences above operate as follows: S 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). S 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. S 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. S 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, there can be coordination among them. For example, in an error condition, the Status Stage may want to automatically switch the operator interface to the status mode to show error information as shown to the right. The monitor stage could set the stage bit for Status and Reset the stages Control and Recipe.
Operator Interface Recipe
Control
Monitor
Set
Status
E-Stop and Alarm Monitoring
DL405 User Manual, 4th Edition
RLL PLUS Stage Programming
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.
Page 414
7--16
RLL PLUS Stage Programming
We can think of states or stages as simply dividing up our ladder program as How Instructions 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 of a 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).
RLL PLUS Stage Programming
Stage 0
Stage 1
Stage 2
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: S Outputs work as usual, provided each output reference (such as “Y3”) is used in only one stage. S Output coils automatically turn off when leaving a stage. However, Set and Reset instructions are not “undone” when leaving a stage. S An output can be referenced from more than one stage, as long as only one of the stages is active at a time. S 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 want to do only once (on 1 scan), it can be placed in a stage which 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.
DL405 User Manual, 4th Edition
Page 415
7--17
RLL PLUS Stage Programming Using a Stage as a You may recall the light bulb on-off controller example from earlier in this Supervisory chapter. For the purpose of illustration, Toggle X0 Process suppose we want to monitor the “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.
Ladder Program
Y0
Powerup Supervisor
X0
OFF State
S1 JMP
Powerup
X0
Push--ON
X0
Main Process
OFF X0
Push--OFF
SG S1 X0
ON X0
New stage programming students will typically try to place the counter inside one of the the stages of the process they are trying to monitor. The problem with this approach is that the stage is active only part of the time. In order for the counter to count, the count input must transition from off to on at least one scan after its stage activates. Ensuring this requires extra logic that can be tricky. In this case, we only need to add another supervisory stage as shown above, to “watch” the main process. The counter inside the supervisor stage uses the stage bit S1 of the main process as its count input. Stage bits used as a contact let us monitor a process!
Push--On State
S2 JMP
SG S2
ON State SP1
Y0 OUT S3
X0
JMP SG S3 X0
Push--Off State
S0 JMP
ISG S4 S1
Supervisor State
SGCNT CT0 K5000
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 (CT0 in this 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
RLL PLUS Stage Programming
ISG S0
Supervisor Process
Page 416
7--18
RLL PLUS Stage Programming
RLL PLUS Stage Programming
Unconditional Outputs
As in most example programs in this chapter and Stage 0 to the right, your application may require a particular output to be ON unconditionally when a particular stage is active. Until now, the examples always use the SP1 special relay contact (always on) in series with the output coils. It’s possible to omit the contact, as long as you place any unconditional outputs first (at the top) of a stage section of ladder. The first rung of Stage 1 does this. WARNING: Unconditional outputs placed elsewhere in a stage do not necessarily remain on when the stage is active. In Stage 2 to the right, Y0 is shown as an unconditional output, but its power flow comes from the rung above. So, Y0 status will be the same as Y1 (is not correct).
Power Flow Transition Technique
SG S0 SP1
Y0 OUT
Unconditional Output
SG S1
Y0 OUT
X0
Y1 OUT
X0
Y1 OUT
SG S2
Y0 OUT
Our discussion of state transitions has shown how the Stage JMP instruction makes the current stage inactive and the next stage (named in the JMP) active. As an 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 S0 and S1, respectively. S0
X0
SG S0
S1
SG S0 X0
S1
All other rungs in stage...
JMP SG S1
X0
Equivalent
Power flow 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, it is 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
Page 417
RLL PLUS Stage Programming
7--19
Parallel Processing Concepts Parallel Processes Previously in this chapter we discussed how a state may transition to either one state 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 A
S1
SG S1
S3
JMP
S4
S4
S5
JMP
Note that if we want Stages S2 and S4 to energize exactly on the same scan, both stages must be located below or above Stage S1 in the ladder program (see the 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.
Converging Processes
Process A
S1
S2
= Convergence Stage
S5 Process B
Convergence Stages (CV) X 430 440 450
S2
X0
X0
Process B
Push--On State
S3
S6
S4
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 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 condition out of convergence stages. We accomplish this with a stage type designed for this purpose: the Convergence Stage (type CV). In the example to the right, convergence stages S2 and S4 are required to be grouped together as shown. No logic is permitted between CV stages! The transition condition (X3 in this case) must be located in the last convergence stage. The transition condition only has power flow when all convergence stages in the group are active.
CV S2
Convergence Stages
CV S4 X3
S5 CVJMP
SG S5
DL405 User Manual, 4th Edition
RLL PLUS Stage Programming
S0
S2
Page 418
RLL PLUS Stage Programming
7--20
RLL PLUS Stage Programming
Convergence Jump Recall that the last convergence stage only has power flow when all CV stages in (CVJMP) the group are active. To complement the X convergence stage, we need a new jump 430 440 450 instruction. The Convergence Jump (CVJMP) shown to the right will transition to Stage S5 when X3 is active (as one might expect), but it also automatically resets all convergence stages in the group. This makes the CVJMP jump a very powerful instruction. Note that this instruction may only be used with convergence stages. Convergence Stage Guidelines
CV S2
Convergence Jump
CV S4 X3
S5 CVJMP
SG S5
The following summarizes the requirements in the use of convergence stages, including some tips for their effective application: S
S
S
S
S
S
S S
DL405 User Manual, 4th Edition
A convergence 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. 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. Convergence stages of the same group must be placed together in the program, connected on the power rail without any other logic in between. 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. 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. 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. The CVJMP instruction must only be used in a convergence stage, as it is invalid in regular or initial stages. Convergence Stages or CVJMP instructions may not be used in subroutines or interrupt routines.