SFC Presentation
SFC Presentation
SFC Presentation
This presentation presents the SFC & ST implementation for the Logix5000 processor.
Copyright 2002 Rockwell Automation Inc., All Rights Reserved
Execution of batch process applications Provide a foundation for motion or robotic applications using the Graphical Motion Language (GML)
Embedded Structured Text Motion commands provide streamlined development environment
Step Description
SFC Elements are automatic aligned to an invisible internal grid to provide clean routine appearance
May 23, 2002 Copyright 2002 Rockwell Automation Inc., All Rights Reserved
Transitional
Stop Element
8
Select and Simultaneous branches are determined automatically by the environment based on where the connections are made
Saves you time when developing the chart You can add them manually if you prefer
If you want more control software can Prompt for Tag Name when element is added to SFC chart
Avoids extra step to create and name tags Provides more effective development workflow
11
Step Elements
Unlimited number of steps in an SFC routine Step uses a tag as a control structure
40 Character name for each step, automatically generated Structure contains step configuration and status attributes Step attributes are accessible from logic
Choice of accessibility / isolation Created at program scope by default Ex: StartupLine1.PRE
12
Built in step diagnostics capabilities eliminates application code commonly added to most SFC programs
Step execution time alarms - User configurable presets or expressions for step underrun (AlarmLow) and overrun (AlarmHigh) Execution count tracks number of times Step is activated - provides immediate feedback on process execution
Datatype SFC_STEP Status : DINT; Status Field containing X,FS,SA...AlarmHi X : BOOL; Step executing bit (FS + SA + LS) FS : BOOL; First scan bit SA : BOOL; Step Active bit (Not FS or LS) LS : BOOL; Last scan bit DN : BOOL; Step Timer done, T=PRE OV : BOOL; Step timer overflow DINT Maximum AlarmEn: BOOL; Enables Hi/Low Alarming AlarmLow : BOOL; Low Step Time Alarm Fault AlarmHi : BOOL; High Step Time Alarm Fault PRE : DINT; Step timer preset, sets DN when T=PRE T : DINT; Length of time step has executed TMax : DINT; Maximum Step Time value detected Count : DINT; Number of times step activated LimitLow : DINT; Low Alarm Step Time LimitHi : DINT; High Alarm Step Time End_Datatype;
May 23, 2002
Initial Step
In-line Expressions
13
Provides flexibility when setting a chart so that you can organize the routine around the application
Does not force the execution to begin at the top
14
Step Actions
Unlimited number of actions per step Three types of actions:
Boolean actions are true when the action is active otherwise false
Action can be reused by multiple steps
using action tag reference State of action is logical OR of all references View Action Attributes Action Qualifier Action Name Indicator Tag
Show/Hide Actions Edit State Multiple Actions per Step Embedded Structured Text Code
Provides a 40 character name for each action, automatically generated Structure contains action configuration and status attributes Action attributes are accessible from logic
Choice of accessibility / isolation Created at program scope by default Ex: Action_001.PRE
Built in Action execution count tracks number of times action is activated - provides immediate feedback on process execution
eliminates application code commonly added to most SFC programs Select any tag available in the local program or controller scope areas Provide run-time data-value updates to assist in debug an maintenance
Datatype SFC_ACTION
Status : DINT; A : BOOL; Q : BOOL; T : DINT; PRE : DINT; Count : DINT;
End_Datatype;
Status field containing A and Q Action is executing Active except for last scan, P0 or P1 Time accumulated based on action qualifier Time qualifier preset Number of times action activated
16
Action Qualifiers
Action qualifiers determine how an action should execute
Following IEC 1131-3 definitions None (no qualifier defaults to Non-Stored) N - Non-Stored (action is active when step is active) S - Stored (Starts running when step active, continues running even after step goes inactive) R - Overriding Reset (stops a stored action) L - Time Limited (starts running when step active, stops when step goes inactive or time expires) D - Time Delayed (waits a period of time after step active and executes if step is still active) P1- Rising Edge Pulse (runs once on step activation) P0 - Falling Edge Pulse (runs once on step deactivation) P - Pulse (runs once on step activation and again on deactivation P1+P0) SL - Stored and Time limited (starts running when step active, stops when time expires) SD - Stored and Time Delayed (waits a period of time after step active runs regardless of step state and continues running even after step goes inactive) DS - Delayed and Stored (waits a period of time after step active, if step is still active, it runs continuously even after step goes inactive)
18
Permits step timer preset to be determined during step operation Provides more control over step execution with minimal effort Reduces need for external code to calculate and set the timer preset value
19
Transition Elements
Unlimited number of transitions in an SFC routine Two types of transitions
Reference another routine in any ControlLogix language Embedded Structured Text
Eliminates need to create separate routines Can use to set always true / false condition
View Transition Attributes Transition Name
Provides a 40 character name for each transition, automatically generated Tag description provides in-line documentation
Can be modified in SFC Editor, tag editor and CSV Import/Export Display of description can be optionally disabled
Connection Points
Stop Element
The Stop Element terminates execution of a path in the SFC chart
Located at the end of the chart or on a branch leg If there are no other steps to execute, control reverts to the predefined initial step Eliminates need to provide directed link looped back to initial step
Unlimited number of stop elements Utilizes a tag to name the element, provide a comment in the chart and store diagnostic information
Activated Bit is set when Stop Element is executed Built in step execution count tracks number of times the stop is activated provides immediate feedback on process execution
22
...
SBR Subroutine
Simultaneous Branches
Executes multiple chart paths at once
Permits multiple steps to be active at one time
Unlimited number of branch legs, elements per leg and nested branches
Branch Force Right Click to Force
24
Select Branches
Executes one of many chart paths
Permits process based decisions to alter the execution flow Unlimited number of branch legs, elements per leg and nested branches
Execution order
Forced Transition
Transition forcing and step through provides select branch debug override
25
Directed Link
Directed link permits you to shift the chart execution forward or backward to another step Optional link visualization setting
Wired to the destination step (default) Hidden wire with source / destination references to reduce wire / chart congestion Gives you control over how the link is displayed in the chart
Visible Wire Source reference
Destination reference
Grid location
26
Embedded ST SFC chart Action and Transition expressions SFC charts embedded ST editor Unlimited Off-line & On-line L5K File Moves with embedded ST code in SFC Element
27
SFC chart editor 64K Characters Off-line L5K File Free-floating or anchored to element
SFC Reports
Both Fit to page report and multi-page formats
Single page table of contents Enlarged view of chart sections
Cross-Reference
Provides a listing of any reference to a tag
Destructive and Non-destructive Direct and alias references Location where tag is accessed
LD Rung/Instruction SFC Element Grid Location FBD Block Grid Location ST Line Number
29
Maintains a list of the last 10 searches to reduce effort reissue the same search Where does search operate?
Language editors Tag editor / Data monitor
Use search to locate individual references or all references at once Replace permits the selective replacement of one string for another
May 23, 2002 Copyright 2002 Rockwell Automation Inc., All Rights Reserved 30
Execute these in a separate LD/ST subroutine called by an Action of a step Provides programmatic control over SFC execution
Develop code to determine machine state and automatically adjust to the appropriate SFC step to facilitate machine startup and recovery Provides consistency for applications developed in PLC-5
31
Restart - Determines chart starting location for processor run mode transition
Initial step - restarts at the step you have configured as Initial Step last active restarts at the step that was active when the chart stopped
32
Gives you full control of step post-scan operations so that your program operates using the most optimal method
Automatic Reset Step Post Scan Method Benefits
Automatically resets when SFC Steps transition evaluates to true CPU Resets outputs, timers and various instructions ST bit or numeric assignments using [:=] are reset to 0 No additional programming required to clear outputs Works similar to PLCs SFC Language
Programmatic Reset
Performs an additional scan of SFC Actions with LS bit set to true Utilize Step.LS bit to programmatically clear values Or utilize a falling edge P0 Action to perform programmatic reset You have control over the reset operation via the Step.LS bit Permits reset of values other than zero Allows you to leave outputs energized across multiple steps
No Reset
No more scans performed utilize a falling edge P0 Action to perform programmatic reset
Operates like programmatic but avoids overhead of Last Scan Permits reset of values other than zero Allows you to leave outputs energized across multiple steps
33
36
CASE <any integer or real expression> OF < selector value 1> : <statements> < selector value 2> : <statements> ELSE < statements> END_CASE; REPEAT <statements> EXIT UNTIL <Boolean expression> END_REPEAT;
37
ST Instruction Set
Instruction set commonality with Ladder Diagram (LD) and Function Block Diagram (FBD)
Reduces learning curve Permits selection of appropriate Language for application
In line operations consistent with common text based programming languages and IEC 61131-3
Assignment operators (retentive := , non-retentive [:=]) Mathematical operations (+,-,*,/,**, Mod) Comparison operations (=, >=, <=,>,<,<>) Logical operations (AND, &, OR, NOT, XOR) Trig Functions
Automatic numeric datatype conversion reduces development time by eliminating need for temporary tags and conversion functions Supports calls to Logix5000s advanced built instruction set
Over 125+ instructions are at your disposal Advanced Motion Instructions FBD Process and Drive control blocks JSR / SBR / RET functions for routine encapsulation
ST Instruction Programming
Multiple ways to develop structured text code to minimize program development time
Using a mouse and the Integrated Instruction Toolbar Keyboard Alt-Ins provides a instruction selection dialog complete with instruction descriptions Simply type the function name to receive formatting tool-tip
Provides instruction parameter configuration
Select the method that best meets your development needs Pop-up tool tips for Instructions and Functions simplify code development
39
40
ST Comments
Both in-line and multi-line comments supported
In-line comments provide a description for a single line of code
Beginning with // and terminate with a CRLF Can also be used to block a single line of code from execution Rockwell Automation extension to IEC61131-3
Multi-line comments provide more descriptive information for how the code performs its function
Two formats available (* comment*) or /* comment */ Can also be used to block a group of code lines from executing
Green context coloring makes comments standout from code All Structured Text comments are loaded into the controller during application download
Available on upload even if you dont have the original source Maintains program white-space, tabs, and line-feeds to preserver presentation Compressed from 70 to 80 % to minimize memory needs
May 23, 2002 Copyright 2002 Rockwell Automation Inc., All Rights Reserved 41
ST Tag Manipulation
Multiple ways to specify tags in your code
Using a mouse you can navigate the context menu to the tag browse tool to select tags Using the keyboard, Ctrl-Space provides a tag selection window with auto-fill / tag lookup
list locates first tag with matching name
Eliminates the need to memorize tag names Reduces program development effort
May 23, 2002 Copyright 2002 Rockwell Automation Inc., All Rights Reserved 42
ST On-Line Monitoring
ST Routine highlighted to show running status
Lets you know the processor is in run mode
Data Values
43
ST Routine Execution
Each time a Structured Text routine is called (either as a subroutine or as the main routine in a program) it begins executing from the beginning of the routine (Similar to Ladder Diagram)
Code within the ST routine is executed based on the constructs used Using IF and CASE you can selectively choose the code you want to execute
Focuses the execution on specific areas of the code Helps reduces routine scan time to optimize CPU performance
Using FOR, DO UNTIL, and DO WHILE you can perform repetitive loops
Useful for processing arrays or tables The CPU watchdog timer continues while ST executes, so infinite loops will be trapped
For timers and one-shot instructions external manipulation is required to initialize and reset
May 23, 2002 Copyright 2002 Rockwell Automation Inc., All Rights Reserved 44
ST Pre-Scan Operation
On power-up the controller performs a pre-scan of each task to initialize instructions (outputs, non-retentive timers)
Select instructions also perform various operations during prescan Example: ONSR one-shot instruction turns off storage bit...
In ST you can use the bracketed assignment operator [:=] to force the value to be reset during pre-scan
Resets Bit tags and forces numeric tags to zero If you want tag left in last state, use the non-bracketed assignment operator := Extension over IEC61131 standard
Minimizes the amount of code you need to write to initialize your application
Provides more control over what you want retained or reset Reduces development time
May 23, 2002 Copyright 2002 Rockwell Automation Inc., All Rights Reserved 45
ST code embedded in an SFC Steps action directly or ST code called via a JSR are also post scanned
Depending on the application you can control what occurs during post-scan Using the bracketed assignment operator [:=] tags are reset to zero (both Boolean and numeric tags) Using non-bracketed assignment operator := tags are left in their last state
The Automatic reset combined with the two ST assignment operators simplify program initialization
May 23, 2002 Copyright 2002 Rockwell Automation Inc., All Rights Reserved 46
47
LD, FBD, SFC, ST routines can co-exist with other routine types in the same controller
A routine of any language can call other SFC, ST, LD or FBD routines
48
Acquiring SFC / ST
The SFC and ST Languages are available in two forms
Add on option for RSLogix 5000 Mini Edition (9324RLD200ENE) and Standard Edition (9324RLD300ENE)
9324-RLDSFCE Sequential Function Chart Language Option 9324-RLDSTXE Structured Text Language Option 9324-RLDMLPE Multi-Language Pack Option (Includes FBD, SFC, and STX) Permits you to purchase just the language(s) you need
Included with RSLogix 5000 Full Edition (9324RLD600ENE) and Professional Edition 9324RLD700NXENE
All languages are included (LD, FBD, SFC, and ST) Purchase all languages from a single catalog number
May 23, 2002 Copyright 2002 Rockwell Automation Inc., All Rights Reserved 49
Targeted SIs and Large End Users needed multiple languages and already own RSNetWorx
Existing users of Mini and Standard can get the same capabilities as the Full Edition by purchasing the separate language options
50
Able to upload and download without option. Must purchase option to view, edit and print routines in this language 9324-RLDMLPE Multi-Language pack includes FBD, SFC, and STX
51