Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Instant PLC Programming with RSLogix 5000

You're reading from  Instant PLC Programming with RSLogix 5000

Product type Book
Published in Oct 2013
Publisher Packt
ISBN-13 9781849698443
Pages 68 pages
Edition 1st Edition
Languages

Building a Sequential Function Chart (Intermediate)


In the following recipe, we will demonstrate the usage of a Sequential Function Chart (SFC) by building a backwash process using a step-by-step guide.

Getting ready

To complete this recipe, you should have completed the previous exercises.

How to do it...

  1. First, we will need to declare our new routine. Right-click on MainProgram of Controller Organizer and select New Routine.

  2. In the New Routine form that appears, enter or select the following:

    • Name: BACKWASH

    • Description: Backwash Sequence

    • Type: Sequential Function Chart

  3. Then click on OK.

  4. In order for our newly created routine to be executed with each scan of the PLC, we will need to add a reference to it in MainRoutine that is executed with each Scan of MainTask. Repeat Steps 3 to 7 of the Building Ladder Diagram programs recipe (or copy and paste the existing JSR), but use the routine name BACKWASH in the JSR element.

  5. Now we will add an Action to Step_000 that was created by default. Right-click on Step_000 and select Add Action.

  6. Now we will add the initialization values for our SFC using ST syntax. Double-click on the box with ? at the bottom of Action_000 and enter the following structured text as shown in the following screenshot:

    BACKWASH_START_PB:=0;
    BACKWASH_FLT:=0;
  7. An icon with a red cross will appear to the side of Action_000, indicating that there is an error with the ST we have added. The error is due to the fact that BACKWASH_START and BACKWASH_FLT do not yet exist in our program.

  8. We can easily add these values by right-clicking on the BACKWASH_START_PB tag in the Action_000 box and selecting the New Tag "BACKWASH_START_PB" option.

  9. The New Tag form will appear, which will allow us to create our new tag as follows:

    • Name: BACKWASH_START_PB

    • Description: START BACKWASH PUSH BUTTON

    • Type: BOOL

    • Scope: FirstController

  10. Repeat the same process for the second new tag by right-clicking on the tag BACKWASH_FLT and the New Tag form and entering the following values:

    • Name: BACKWASH_FLT

    • Description: BACKWASH SEQUENCE FAULT

    • Type: BOOL

    • Scope: FirstController

  11. Next, we will add the Transition conditional value that will start our Backwash sequence. Double-click on the Tran_000 question mark and enter the following logical statement (which is equivalent to BACKWASH_START_PB=1) BACKWASH_START_PB.

  12. Now we can add our backwash sequence step. Select the Transition box Tran_000 and then click on the Step element icon in the SFC element group above our SFC program. The step box, Step_001, will be added and automatically connected to Tran_000 (because we selected it before adding our new step).

  13. Next, we can add an action to Step_001 that will represent our backwash process. Right-click on Step_001 and select Add Action.

  14. Now we will add our action ST to the action element by double-clicking on ? in Action_001 and entering FC1001_SP:=100;.

  15. Let's add a delay to Step_001 in order to give our backwash time to complete. Right-click on Step_001 and select the Step Properties menu option. On the Step Properties form, set the Preset field to 30000 ms (30 seconds). Click on OK.

  16. Next, we will add a Selection Branch Diverge in order to reset our sequence or trigger a fault if there is a problem. Select Step_001 and then click on the Selection Branch Diverge Element icon just above our sequence chart. The icon is shown in the following screenshot:

  17. A Selection Branch Diverge can also allow you to execute one or another sequence, while Simultaneous Branch Diverge will execute two sequences in parallel. Our sequence will automatically reset and await another backwash if the valve has successfully opened, 100 percent. Select Tran_001 and click on the ? icon to set the logical statement that will execute this Selection Branch. Type in the following structured text logical statement: FC1001_PV=100.

  18. We want our sequence to reset after it has completed the backwash, so we will connect a flow line from our transition Tran_001 to the top element in our sequence, Step_001. Click on the connector box under Trans_001 and drag it to the connector box on top of Step_000.

  19. If our valve fails to open, we want to raise a fault before resetting our sequence. Select Tran_002, click on ?, and enter the following structured text logical statement; FC1001_PV<>100.

  20. In order to raise a fault, we will need to add a Step. Select Tran_002 and click on the Step Element icon.

  21. Add an action to our newly created step, Step_002, by right-clicking and selecting Add Action.

  22. Double-click on ? of our newly added action and add the following ST code:

    BACKWASH_FLT:=1;
    BACKWASH_START_PB:=0;
  23. In order to make our sequence easy to understand, let's add a Text Box comment. Click on the Text Box element to add it to the sequence diagram and drag it to the right of the sequence. Enter in the following comment: Backwash fault triggered if valve FC1001 fails to open.

How it works...

The previous programs we have developed are ideal for a single state whereas SFC routines are well suited for more complex processes that require simultaneous operations. SFCs are steps that are connected to transitions. A flow line will connect the step and transition in the sequence. Transitions are the triggers between each step and each step acts as a collection of actions. A Selection Branch Diverge will follow one or the other path and a Simultaneous Branch Diverge will execute two sequences at the same time.

There's more...

More information on SFC can be found in the Rockwell publication Logix5000 Controllers Sequential Function Charts available at http://literature.rockwellautomation.com/idc/groups/literature/documents/pm/1756-pm006_-en-p.pdf. In the interest of saving time in the last exercise, I did not follow the best practice of providing useful names to the steps and transitions.

Renaming sequence steps and transitions

In the previous exercise, we left the default names for our steps, actions, and transitions as they were. It is easy to rename the SFC elements to make the sequence easier to read and maintain. Simply double-click on the SFC name to rename it.

arrow left Previous Chapter
You have been reading a chapter from
Instant PLC Programming with RSLogix 5000
Published in: Oct 2013 Publisher: Packt ISBN-13: 9781849698443
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}