Topic: DMD0507 Example 4 - Parallel Processing with Stage Programming |
|
|
|
As the previous examples have shown, stage programming is an excellent method for handling sequential operations. But many control processes consist of multiple sequential operations that can operate in parallel. Parallel processing can greatly speed up the total time needed to perform control operations because the various sequential operations can run simultaneously.
|
|
Parallel Processing InstructionsImplementing an SFC-like simultaneous branch in the Do-more controller is done through two stage programming instructions, one that initiates the execution of multiple pathways, and one that brings the multiple pathways back together.
Note: Since this instruction performs a "Jump" operation, it functions with the same constraints as the singular Jump to Stage (JMP) instruction. These constraints were discussed in detail in the Stage Transition Instructions section.
|
|
The Converge Multiple Stages to SG (SGCONVRG) instruction is used to coordinate the transition conditions from multiple stages. This instruction is a Stage that is enabled when all of the stages in the From Stages list are enabled and the Then converge when parameter is non-zero (TRUE, ON).
When all of the From Stages are enabled and the Then converge when parameter is non-zero (TRUE, ON), the SGCONVRG Stage itself is enabled, and at that point all of the stages in the From Stages list will be disabled.
|
|
A Simple Example with TimersAt this point a simple example of implementing a simultaneous branch in a stage program is in order.
The following example has three parallel branches beginning at Stage S10, S20 and S30, and ending at S19, S29 and S39 respectively.
When Input X0 is energized, the Jump to Multiple Stages (SGDIVRG) is executed, which executes the three Jumps to the starting stage of each parallel branch.
Each branch begins with a Stage that contains a self-resetting Timer that begins timing when that stage is enabled. Each Timer has a different preset value so that the branches will complete at different times.
When the Timer Preset is reached, a Jump to the ending stage in that branch is executed.
The Converge Multiple Stages to SG (SGCONVRG) waits until all three branches have completed, that is, they have all executed the Jump to the last stage in their respective branch and the Then converge when parameter is non-zero (ON, TRUE). At that point the instruction effectively Jumps from the ending stages in the three branches to the stage in the SGCONVRG instruction.
The converging stage has a fourth time that begins timing. When it reaches it's preset value it causes a Jump back to the beginning stage and the process starts again. If input X0 is still energized, the whole process will repeat.
|
|
To those familiar with SFC programming it is obvious from this example that stage programming does not offer a true SFC implementation, it can only approximate some of the functionality. But it is also clear that stage programming can provide a reasonable amount of SFC-style functionality with minimal effort.
|
|
|
|
|
|
Stage Programming Concepts
Example 1 - A Simple 2-State Process
Stage Transition Instructions
Example 2 - A Lamp On/Off Controller
Example
3 - A Garage Door Opener Example 4 - Parallel Processing
Review - Steps to Writing Successful Stage Programs Stage Instructions in the Do-more Controller
|
|
|