Вы находитесь на странице: 1из 20

LAB 1: SFC

In this lab we will write a very simple SFC routine to gain familiarity with the SFC editor and operation of SFCs. Key Topics Covered in this Lab: SFC Routines SFC Editor SFC Order of Operation Text Boxes Action Qualifiers

You have been asked by your customer to create a very simple SFC routine that demonstrates how to use the editor and includes some simple steps and transitions. After that is complete, they want you to demonstrate the Action Qualifiers (extra task) for an analog signal.

Background:

One of the big features of RSLogix 5000 Version 11, is that it added both SFC Routines and Structured Text Routines (STX). Rockwells SFCs are an embedded language. What that means is that all software features work with all languages. For example, if you do a search it will search through Ladder, SFC, STX and function block. Another example is when you create a step or a transition, it creates an associated program scoped tags. Those tags are accessible just like any other tag. You can use them in any routine within the same program. Stated another way, there are backing tags for all elements.

1. Open RSLogix 5000 using the icon on your desktop. 2. From the Main Menu select File Open SFCLAB (this is an empty project for a V11 5550 except it already has a few I/O modules configured).

LAB 1: SFC Page 1

3. Take a look at the I/O Configuration. Everything looks good except your OB16D is in Slot 0 and it should be in Slot 4: Right click on it Select Properties Change the slot to 4 Press OK.

Wow that was easy. In fact, if you had already configured tags with that module, they would all be automatically updated. If you have time, try that at the end of the lab. 4. We are now ready to create our SFC Routine. Right click on the MainProgram Select New Routine

5. Fill it out to match the following. Make sure you select Sequential Function Chart as the Type of Routine Then press OK.

LAB 1: SFC Page 2

6. Double click on the routine you just made to open it up. Notice that you are started with one Step and one Transition. Steps are actions that you want taken. Transitions are conditions that you want to wait for before proceeding to the next step. A very simple example would be an action to start three motors, and then the transition might be to check the corresponding Analog Inputs to wait for the motors to come up to full speed before proceeding to the next step.

You can start and stop your logic anywhere on the page. You are not limited to the top left or bottom right. You can move these anywhere you want.

Note: The first step has a double box around it. All the rest that you drop will only have a single box. This signifies where the SFC begins.

7. Right click on the Step and select Edit Step_000 Properties

LAB 1: SFC Page 3

8. Notice it is a program scoped tag and has a Data Type of SFC_Step (data type introduced in Version 11). Press Cancel to close the screen.

9. Right click again on the Step and this time choose Add Action. 10. You have decided to write a simple little Routine: Step 0: Transition 0: Step 1: Transition 1: Step 2: Transition 2: Step 3: Transition 3: Turn on Light 2 and Light 3 (in the ControlLogix Demo Box) Wait for Switch 13 to turn on Turn off Light 2 and Light 3 Wait for Switch 14 to turn on Turn on Light 4 Wait for Switch 15 to turn on Turn off Light 4 Always true so do not wait

LAB 1: SFC Page 4

11. We have just added an Action, so now we need to write code for Light 2 and 3 to turn on. Double click on the question mark in the Action Box and enter logic as shown below: Local:4:O.Data.2:=1; (all lines end with semicolon) Local:4:O.Data.3:=1; (This is an assignment so it is always := not =)

Note: When RSLogix 5000 V11 is released, you will not have to manually type in the existing tags. You will be able to get them from drop downs.

12. Now double click on the question mark under Tran_000 and enter logic as shown below for Local:2:I.Data.13 (You want to wait for switch 13 to turn on).

Transitions need a Boolean tag or expression

13. Save your work under a new name by going to the Main Menu SFCLABa

File

Save As

LAB 1: SFC Page 5

14. You are now ready for your next Step/Transition pair. Press the Step + Transition Icon. 15. Drag them until they are under your original Step/Transition pair and notice that if they get close enough, the pin turns green. While the pin is green, release them and the line will automatically be connected. Note: If you dropped them too soon and they are not connect, just click on the top pin then click on the bottom pin to connect them. 16. Drag your new Step_001 and notice the lines drag with it. You can press Control+Z (undo) if you want to undo your dragging and get it back to where you started.

Remember that we want the following Step 1: Turn off Light 2 and Light 3 Transition 1: Wait for Switch 14 to turn on 17. Add two actions to Step_001 and fill them in as follows. Then follow the suggestion below to hide/unhide the actions. Local:4:O.Data.2:=0; Local:4:O.Data.3:=0; 18. Fill out the Transition: Local:2:I.Data.14
Try clicking here it will hide/unhide the Actions. This is useful if your logic is getting crowded.

LAB 1: SFC Page 6

Note: From the Main Menu you can select Edit then you can select Show or Hide all Actions in a Routine 19. Now that you have created some logic, double click on Program Tags and review the program scoped tags that have been created with the logic. As mentioned before, these tags can be used in any ladder, function block, SFC or Structured Text routines within your program.

20. In the first step we did everything in the same action. In this step we did it in two actions. The choice is up to you. You can even easily change the order of the actions. Go back to your logic and press the three dots inside Step_001. Select the action order tab Change the order using the up/down arrows. Press OK

LAB 1: SFC Page 7

21. Something is puzzling you. Someone had told you that you can add comments to SFCs, but you cannot seem to find the option. You think awhile and remember what they said. From the Main Menu select Edit Add SFC Element (Alt-Ins) Scroll down and select Text Box Press OK Enter the following:

You have just created a free floating text box. 22. Hmm, that seems like a pretty common thing to do so you expect there should be an icon for it on the toolbar.
This arrow always means you have more choices. Use it to scroll and see what they are.

Now grab the right edge of this toolbar to expand it so all your choices are always shown.

Now you can see the icon!

LAB 1: SFC Page 8

23. Use the Text Box Icon to add a comment (you decide what to say) for Step_000. Mouse over the little thumb tack icon and notice it says detached Left click on the thumbtack icon and drag the line around. Notice it turns green when you are over your step Left click inside your step to anchor your comment. You have just created an anchored text box. Notice the thumbtack icon has changed to indicate the text box is anchored. Try moving the step around and notice the text box moves with it.

You can click here to display the line showing where this box is anchored.

24. Save your work under a new name by going to the Main Menu SFCLABb

File

Save As

25. You are getting good at this so instead of just adding another Step/Transition pair, lets get fancy. Lets try to cut and paste Step_000 Left mouse on Step_000 to select it (see how it changes colors to indicate you selected it). From the Main Menu select Edit copy selected element(s) From the Main Menu select Edit paste Drag Step_002 under the last transition and release it when the pin turns green. This will automatically connect them Do the same to copy Tran_000

LAB 1: SFC Page 9

26. Notice you have a problem. Now Step_002 has the double box around it and Step_000 does not. You copied the Initial Step, so you made another Initial Step. You cannot have two, so RSLogix had to pick one. We will fix this a little later after we have a chance to see the error message.

27. For now, correct the logic to match the screen capture shown below: Step 2: Turn on Light 4 (Local:4:O.Data.4:=1;) Transition 2: Wait for Switch 15 to turn on (Local:2:I.Data.15)

28. We are ready for our last Step/Transition Pair. Press the Insert key on your keyboard Select Step + Transition Press OK.

LAB 1: SFC Page 10

29. Connect it below Tran_002 and then make it match the screen capture below: Step 3: Turn off Light 4 (Local:4:O.Data.4:=0;) Transition 3: Always true so do not wait (1;)

Note: If your logic is spaced out, but now Step_003 will be passed (or at least close to) the heavy black line that marks the page break. The dashed lines are just gridline for your reference. A great feature of this editor is you can move between pages by just scrolling. You do not have to jump between pages. There are no limitations on spanning logic between pages, and you do not have to create connectors to connect between pages. However, you have the option of making connectors if you decide the logic would be easier to read by eliminating some of the lines. If you had a printer attached to your computer, the first page would be a zoomed out view showing all the logic. Then the individual pages would print with little arrows on each side indicating which page they match up to. If your office was getting a little drab, you could decorate by taping all the pages together to form mural on your walls. In fact, the only thing that limits the number of steps is the amount of memory available in your controller! This is different from what some people are used to because the PLC-5 had fixed limits. 30. Save your work as SFCLABc

LAB 1: SFC Page 11

31. Try the zoom icons to see more of your logic at one time 32. Now press the verify routine icon and notice the three errors.

To hide the error window, you can right click in window and select Hide

33. The first error is because we must end our logic with a stop. Press the stop icon and attach it to the end of your logic.

LAB 1: SFC Page 12

34. The next error is based on what we noticed before. We accidentally made Step_002 the Initial Step. It is very easy to fix: Go back to Step_000 and notice it only has a single box around it Click on the three dots to bring up the properties page Change the Type to Initial and press OK Notice it now has a double box around it and Step_002 was automatically corrected at the same time (RSLogix 5000 knows there can only be one initial step).

35. Now press the verify routine icon and notice there are not any errors or warnings in this routine (if the error window is not open select View Errors) 36. We have one last thing to do. Since we have more than one routine, we must include a JSR to this routine. Double click on the MainRoutine.

37. Press the insert key on your keyboard, type in JSR and press Enter. 38. Next to the words Routine Name double click on the question mark select MYSFC from the dropdown press Enter left click on the question mark next to Return Par.

LAB 1: SFC Page 13

39. We do not wish to pass any parameters to this routine, so we do not need the line Return Par. The easiest way to get rid of the line is to click on the question mark next to Return Par and press enter twice. Do the same for Input Par so you have the following:

40. Save your work as SFCLABd 41. Turn switches 12, 13, 14 and 15 to the left so they are off, then download to your controller. 42. Place the controller in Run mode and verify lights 2 and 3 are on. View your SFC routine and notice Step_000 is highlighted to show that is the step the logic is on. This is because Tran_000 is waiting for you to Turn on Switch 13.

Step 0: Transition 0: Step 1: Transition 1: Step 2: Transition 2: Step 3: Transition 3:

Turn on Light 2 and Light 3 (in the ControlLogix Demo Box) Wait for Switch 13 to turn on Turn off Light 2 and Light 3 Wait for Switch 14 to turn on Turn on Light 4 Wait for Switch 15 to turn on Turn off Light 4 Always true so do not wait

43. While you are watching your logic, turn on Switch 13. Notice the lights go off, and now Step_001 is highlighted. 44. Turn Switch 14 on and notice light 4 came on. 45. Turn Switch 15 on and notice light 4 goes out and since the transition is always true your SFC has ended. The Stop is now highlighted.

LAB 1: SFC Page 14

If this were a PLC-5, the logic would have automatically have started over at the top. In ControlLogix you have to manually draw a line back up to the first step if that is what you want. Well, that worked exactly as expected. Lets look at a couple more things before moving on. 46. Change your controller to remote program mode and go offline. 47. Press the Controller Properties icon and click on the SFC Execution Tab. Here you decide how you want your SFC to execute: Execute the current active step only Execute until False transition (is reached). If you pick Execute until False transition (is reached), you must keep in mind that once the SFC starts, it will keep executing until it reaches a False transition (or the Stop) or times out. If there are other routines in your program, you might not want them to wait that long. If that is the case, you want to make sure that under Execution Control you have Execute current active steps only. The other options on this screen are explained in the pre-class PowerPoint.

LAB 1: SFC Page 15

48. Press cancel to close this screen and go back to your SFC routine. Press the Routine Overview Button.

Notice you are given a birds eye view of your Routine and the section you are in is marked. 49. Close the overview Select Step_003 drag it to the side a few inches: Right click on the wire connecting Step_003 to the transition above it. Select Hide Wire Notice the Hot Link that was automatically made for you, and it provides coordinates so you can find the other end. Click anywhere in the white space so the Hot Link is no longer selected Mouse over the Hot Link until your cursor turns into a hand. Left click and you will be jumped to the other end. This is a great way to jump around your logic. Right click on the Hot Link and select Show Wire to get your wire back. Your have finished your simple test of SFCs and you are now ready to apply the knowledge to your motion program. When you are finished you can close RSLogix 5000.

You have completed this lab.

LAB 1: SFC Page 16

Extra Task: 1. Creating another Step/Transition Pair. Verify they are in the Program scoped tags. Now delete the Step/Transition Pair and verify the tags have been deleted also. Note: Function Block Routines behave differently. When you drop a function block it creates a program scoped tag. When you delete the function block, the tag remains. 2. Rename some of your Steps and Transitions to tags that make more sense to you. You do not have to leave them as Step_xxx. Take it one step further. Right click on MYSFC Properties Auto Naming. This is where you can set the default names for all future Steps, Transitions, Actions and Stops.

3. Add additional logic to Reset your SFC. The SFR command can reset to any step, but always leaves the SFC paused The SFP command can be used to pause or unpause an SFC

LAB 1: SFC Page 17

4. Explore the Action Qualifiers by creating another Step/Transition Pair and experimenting with different values. Local:7:O.Ch0Data := Local:8:I.Ch0Data; delayed 10 seconds Local:7:O.Ch1Data := Local:8:I.Ch1Data; not delayed

LAB 1: SFC Page 18

LAB 1: SFC Page 19

LAB 1: SFC Page 20

Вам также может понравиться