Power Programming V2.1 Kevin Miller, SYD Darryl Jacobs, Rockwell Automation Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 1 What is Power Programming? • Clear and consistent structure Axis Enabled Condition Axis Enabled Command – Easy to follow program example. – Application note to guide you through a program example. • State Model programming – Pack ML State Model as “Behavioral Model for machine” • Standardized Tags – Pack Tags are used to provide raw efficiency data. Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 2 What can Power Programming do for you? • • • • Save time Save money Allow you to reuse modules in future projects Make troubleshooting easier in all machines in which you use modular code -- no matter the customer or application • Provide a quicker return on investment Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 3 So many standards, so little time! ERP Level 4 Business Planning & Logistics Plant Production Scheduling, Operational Management, etc Level 3 MES Manufacturing Operations & Control Dispatching Production, Detailed Production Scheduling, Reliability Assurance, ... Levels 2,1,0 Batch Control Continuous Control Discrete Control Motion Control Equipment Control Automation Adapted from: ISA-95.00.01-2000 ISA 95 ISA 88 IEC 61512 OPC PackML* IEC 61131 Fieldbus Intelligent Devices * PackML Model is in development 4 Copyright © 2005 Rockwell Automation, Inc. All rights reserved. Rockwell Automation has assembled the right tools for the job • The application engineer’s toolbox: – Functional specifications – Program structure examples – State models – Machine control templates – Axis routine module templates We call it: Power Programming Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 5 Power Programming is: • Integrated – Provides interoperability with plant-wide systems through Logix – Provides standard animated diagram showing the various machine states arranged in a flow diagram From shop floor to top floor, you and your applications down the line, will know exactly what is going on with each of your applications, no matter where you are in the plant or which application you’re looking at -- only one play book required Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 6 RA Power Programming Notice the consistent structure, between the Machine program and the Line Program. The Machine Logic is the routine that the Hardware I/O is connected to, E-Stops and permissive. This structure was reused for line connections to individual machines. Machine Logic State Logic The Same State Logic was used, there are NO differences between these routine (Except one is written in ladder and the other is a SFC for illustration of different programming techniques. Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 7 RA Power Programming Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 8 How PhaseManager fits into ISA-88 (S88) batch control model All the instructions to make a product. (For example, Tomato Soup Recipe) Recipe SFC(s) defining the order in which the phases run. Can be collapsed to just a Procedure. Defines product-specific Formula Values recipe values. (Use 200 Procedure gallons water) Consists of Unit Procedures Consist of Operations RSBizWare Batch provides Batch Management for this part for complex batches OR an SFC routine in the controller can be the entire Procedure for a simple batch. Consist of Lowest level of recipe control. (Add Water) Phases Support ISA-88 Phase State Model. PhaseManager in the controller provides the state logic framework for phases and enforces the state model. Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 9 Controller Organizer View • Phases are created and scheduled at the task level (similar to Programs) • Phase state routines are created within a phase – Can be written in any language Equipment Phases added in Task View Phase Scoped Tags Folder and Control Tags are automatically generated. Not all States need to be implemented – only those implemented are shown Phases can be unscheduled Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 10 Programs compared to Phases Program Phase Batch Sequencer Application Code RSBizWare Batch • • • • 1 Main Routine per program Main is called each time task executes Main calls other subroutines based on user Logic Monitor code within routine to determine what is executing • “- ing” routines act like main routines – • • Aborting, Holding, Resetting, Restarting, Running, and Stopping Execution determined by phase sequencer (RSBizWare Batch or application code) Phase monitor tool to see which routine is executing Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 11 Equipment Phase Backing Tag • A controller-scoped equipment phase backing tag is created by RSLogix 5000 automatically • Tag’s name matches equipment phase name Equipment Phase Backing tag – Makes code easier to read • Allows users to debug and monitor equipment phase’s execution • Tag is accessible via HMI screens • Additionally, it provides self-documenting code by leveraging the description pass-through functionality Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 12 Create Phase State Routine • Phase State routines are just like “Normal” routines except: – Have a fixed name – Are executed according to the state machine rules Select equipment phase state • State names chosen from a list of valid states: – – – – – – Restarting Running Holding Resetting Stopping Aborting Select equipment phase state language • Just like “Normal” routines, state routines can be implemented in any available language – – – – Ladder Diagram Sequential Function Chart Function Block Diagram Structured Text Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 13 Physical Model Process Cell Unit Equipment Module Control Module Vertical Form Seal Machine Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 14 OEM benefits • Design efficiencies – Reusability • Standardized, modular code development improves time to market – Improves design quality – Reduces errors – Uses best practices – Training costs can be focused • Scalability – Uses the same straightforward terminology no matter the size of your machine • allows you to easily match what customer is already using because of standardized code • common interface minimizes customer resistance to a different brand of machine (e.g., Siemens can be migrated to A-B easily) • Simplified maintenance – Standardized code allows allows for simplified troubleshooting – Less training required if all of the machines behave the same way Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 15 The right tools for the job • The application engineer’s toolbox: – – – – State models Functional specifications Modular code use examples Machine program structure examples We call it: Power Programming Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 16 Let’s take a lesson • Observe what has taken place in batch with regard to defined standards and powerful tools to model, create, and monitor systems. • Motion Control and Packaging is undergoing some of the same development. • Generally the end customer needs are well defined; – – – – – Access to efficiency information. Maintainable code or a great support contract. Highest performance possible from the machine. Low cost of integration of machine into facility. A clean intuitive HMI. Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 17 Times are Changing The packaging world has gone from (Line shaft) to (some servos) and (Integrated servo motion) machines. increased complexity of the control system required to run these machines compel technology providers to provide a more structured approach to integrating these control systems. In the end we would like to have a method available to integrate our systems with consistent tags, and data. Copyright © 2005 Rockwell Automation, Inc. All rights reserved. Cam 18 What RA is doing to help • Rockwell Automation is continually pursuing and incorporating what you need to be successful – active on industry committees to keep abreast of emerging practices and technology – incorporating new industry technology and trends to provide the right tools Level s 2,1,0 Batch Control Continuous Control Discrete Control Motion Control ISA 88 IEC 61512 OPC *PackML Equipment Control Automation IEC 61131 Fieldbus Intelligent Devices Adapted from: ISA-95.00.01-2000 * PackML Model is in development – creating integrated, modular programming to provide: • • • • A modular format A consistent structure State models Consistent terminology Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 19 PackML • Covers – Auto Mode State Model (S88 derived) – Data Definitions (Pack Tags) • Assists – Derive efficiency information through Pack Tags – Maintenance & Trouble Shooting through common approach in Machine Sequence – Consistent data format makes integration go smoother, adoption of a OEM machine is easier. Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 20 How Power Programming Helps You • Allows you to view HMI using a machine state model Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 21 OEM benefits • Design efficiencies – Reusability • Modular code development improves time to market – Improves design quality, and reduces errors – Uses best practices – Scalability • allows you to easily match what customer is already using because of standardized code • Uses the same straightforward terminology no matter the size of your machine • Common interface minimizes customer resistance to a different brand of machine (e.g., Siemens can be migrated to A-B easily) – Simplified maintenance • Standardized code allows allows for simplified troubleshooting • Less training required Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 22 End user benefits • Simplified maintenance – Easier machine integration. – Quicker upgrades and on-site changes • Less downtime – Standardization means easier troubleshooting – Lower training costs – Reduced changeover time • Production – – – – Greater machine interoperability Higher efficiencies Standardized efficiency reporting Lower operator training costs Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 23 Rapid Application Development When you reuse code multiple times in one program: C Programmers = Instances Automation Desktop = Subsystems ISA S88 = Equipment Modules Machine builders = Sections Reusable code is sometimes referred to as: C Programmers = Classes Automation Desktop = Templates ISA S88 = Equipment Modules Machine builders = Sections Develop quickly Control Applications by reusing libraries of standard Logix program objects that contain all the data and code required to control every device in the plant floor Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 24 Visio Version of state model Auto State Model Diagram From Producing STOPPING 1) Stop Initiated on Master 2) Once Master Stops All axes commanded to stop and disable feedback. State=32 Stop Command Stop Process Complet e Initialize Comman d STOPPED 1) System powered. 2) All Axes Off (Feedback Off) 3) Axes must be homed and repositioned before running. State=1 STARTING 1) Axes faults are cleared 2) Axes are enabled, Homed & moved to start positions 3) Gearing/Cams initialized 4) Master not Started State=2 Stop Command Initialize Process Complet e READY 1) Starting Functions Complete 2) Axes Geared/Cammed 3) Master NOT running Stop Command Start Comman d STANDBY 1) Machine armed for produce conditions to commence motion. State=4 Fault Fault Stop Command Start Command HELD 1) Holding Command Completed 2) Axes Remain active. State=8 State=128 Fault Hold Command Fault Produce Condition s Become False Produce Condition s Met To Stopping Fault Holding Process Complet e Stop Command Stop Command Auto Mode Initiated BY Operator (START AUTO) ABORTED PRODUCING 1) All Axes Off (Feedback Off) 2) Axes must be homed and repositioned before running. 3) Fault indications remain for review by operator State=512 1) Master Started 2) All axes performing auto motion 3) Bars being packaged State=16 HOLDING Hold Comman d 1) Coordinated stop initiated on master. 2) All axes remain geared or cammed State=64 Fault Fault ABORTING Aborting Process Complete State Transitions Initialize Command Start Command Stop Command Hold Command Initialize Process Complete Start Process Complete Stop Process Complete Hold Process Complete Produce Conditions Fault 1) Axes Individually commanded to stop (no coordination) 2) After Stopping Axes Disable Feedback. State=256 Draw ing Title: Auto State Diagram Rev1.0 Creation Date: January 15, 2003 File Name: Copyright © 2005 Rockwell Automation, Inc. All rights reserved. AutoStateModel.vsd 25 States and Transitions For this state Look for Stopped Machine powers up in stopped state, or from pressing the Stop Button Starting Transition Example How is this machine initalzed 1) System powered. 2) All Axes Off (Feedback Off) 3) Axes must be homed before running. Example --> Starting Initilaize push button transition --> Ready --> Stopping --> Aborting Initialize completes successfully Stop PB transition Fault active --> Standby --> Stopping --> Aborting Start PB Transition Stop PB transition Fault active State=1 1) Axes faults are cleared 2) Axes enabled, Homed & moved to start position. 3) Gearing/Cams initialized 4) Master not Started State=2 Ready Automatic transition when all axes have completed starting functions. Standby This means someone has pressed the Start button. Producing Making Product. Stopping Cycle stopping and disabling the machine. Holding Held This is a Pause or Hold command indicating it will cycle stop and servos will remain active. Held with Servos Active 1) Starting Functions Complete 2) Axes Geared/Cammed 3) Master NOT running State=4 1) Machine armed for produce conditions to commence motion. State=8 --> --> --> --> Producing Holding Stopping Aborting State=16 --> --> --> --> Standby Holding Stopping Aborting 1) Master Started 2) All axes performing auto motion 3) Bars being packaged 1) Stop Initiated on Master 2) Once Master Stops All axes commanded to stop and disable feedback. State=32 --> Stopped --> Aborting Stop PB transition Fault active 1) Coordinated stop initiated on master. 2) All axes remain geared or cammed --> Held --> Aborting Holding functions complete Fault active State=64 1) Holding Command Completed 2) Axes Remain active. State=128 Aborting A major fault has occurred, stopping functions comencing. Produce Conditions Met Hold PB transition Stop PB transition Fault active Produce Conditions go away Hold PB transition Stop PB transition Fault active 1) Axes Individually commanded to stop (no coordination) 2) After Stopping Axes Disable Feedback. --> Standby --> Stopping --> Aborting Start PB Transition Stop PB transition Fault active --> Aborted Fault active --> Stopped Stop PB transition State=256 Aborted Machine is stopped axes disabled. Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 26 Program Flow Diagram This example illustrates Initialization operation of this program, because it is the first sequence that is commanded from the stopped state.. Machine.AutoState = Stopped Init PB pressed R02 Machine Conditions R02_Machine_Conditions In our example project, we use the Start pushbutton, twice. If in the Stopped state when pressed, we consider it an st.initialize command. If in the Ready state when pressed, we consider it a st.start command. R04_Auto_State First time through Machine.AutoState = Starting When st.init_pc Machine.AutoState = Ready R04 Auto State When in Stopped state and st.initialize the commanded state will transition into Starting state. st.Init_pc R06_Auto_State_Command R07 Section Conditions R06 Auto State Command sequence command complete EM1...n (machine sections) OR CM1...n (axis, actuator etc) CM1...n (axis, actuator etc) When in Starting state there is a sequence of operations that take place; SectionCommands.Enable when All_enable_Done (meaning all axes within that section are emabled) the next sequence is initiated SectionCommands.Home and so on until all required starting functions are complete. Then st.init_PC is returned (meaning State.Initialize Process Complete) Note: st.xxx instructions are State Transitions, and only used to drive the states of the PackML State model in R04. R07_Section_Conditions This routine gets status from each axis program, or Control Module to validate that the commanded state of each request was reached. These we call conditions, we have issued the command and wait for the conditions to be true before continuing. Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 27 Pseudo Code to Program View R02_Machine_Conditions In our example project, we use the Start pushbutton, twice. If in the Stopped state when pressed, we consider it an st.initialize command. If in the Ready state when pressed, we consider it a st.start command. R04_Auto_State When in Starting state there is a sequence of operations that take place; SectionCommands.Enable when All_enable_Done (meaning all axes within that section are emabled) the next sequence is initiated SectionCommands.Home and so on until all required starting functions are complete. Then st.init_PC is returned (meaning State.Initialize Process Complete) Axis Enabled Condition R06_Auto_State_Command Axis Enabled Command When in Stopped state and st.initialize the commanded state will transition into Starting state. Note: st.xxx instructions are State Transitions, and only used to drive the states of the PackML State model in R04. Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 28 How to integrate using base code Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 29 How to qualify its use 1. Clear Structure – Local tags in main program – Sub routines • • MachineConditions AutoStateCommands, AutoState, SectionConditions 2. State Model 3. Built in data structure • UDT Pack Tags How to know if someone is using Power Programming? If you have these three elements from our program sample you are using it. Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 30 Steps Stepping up in technology and structure. Take a look at where we are today and where we are heading… State Models introduced, use of structure Hand build one of a kind code. Power Programming -PML State Model -Clear Structure -Best Practices -Pack Tags 2.0 Advanced Code -Cam Builder -Higher Performance -Appnotes/Sample Code Artistic code -Generally fast executing -Often difficult to follow -always requires further integrations work Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 31 A walk through Initialization R02_Machine_Conditions Init PB pressed R02 Machine Conditions R04_Auto_State R04 Auto State When in Stopped state and st.initialize the commanded state will transition into Starting state. R06_Auto_State_Command R07 Section Conditions R06 Auto State Command sequence command complete EM1...n (machine sections) OR CM1...n (axis, actuator etc) CM1...n (axis, actuator etc) When in Starting state there is a sequence of operations that take place; SectionCommands.Enable when All_enable_Done (meaning all axes within that section are emabled) the next sequence is initiated SectionCommands.Home and so on until all required starting functions are complete. Then st.init_PC is returned (meaning State.Initialize Process Complete) Axis Enabled Condition This routine gets status from each axis program, or Control Moule to validate that the commanded state of each request was reached. These we call conditions, we have issued the command and wait for the conditions to be true before continuing. Axis Enabled Command R07_Section_Conditions In our example project, we use the Start pushbutton, twice. If in the Stopped state when pressed, we consider it an st.initialize command. If in the Ready state when pressed, we consider it a st.start command. Note: any st.xxx instructions are State Transitions, and only used to drive the states of the PackML State model in R04. Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 32 From a customer • • • • • Q The PACKML automatic mode state model provides an excellent framework or structure for organizing and developing machine control applications. A Consider Power Programming with Pack ML a behavioral model for a machine, or discrete process, ie. Starting= Initialize= do whatever you have to do to get ready. Q I am curious to know if you are aware of any OEMs or users who have adopted the PACKML automatic mode state model in there automation specifications. A I am aware of many of our OEM's that we have had this discussion with, and sometimes it breaks down when we get to adoption, I am working on specifying what "using Power Programming" means. I have pretty much boiled it down to 3 elements, PackML state model, State Transitions routine, Pack Tags 2.0. Beyond those basics the "artistry" of the OEM come back into play. We provide the basic structure, Model, Structure, consistent Data. • Q Also, in your opinion, do you feel or have you seen that the PACKML automatic mode state model & PowerProgramming have lead to significant re-use of code? A I can speak for many of the Rockwell Applications Engineers when I tell you we use it as our "starter code". From and OEM-centric point of view, it would be wise to reuse good structure and proven code for their machines also. I have been evangelizing the benefits of code reuse for some time now, and believe the message is coming across loud and clear. • • Q Do you find that the PACKML automatic mode state model useful for rapid development of machine functional requirements? A Sure, we have used is as the foundation of the behavior model. See the Visio file attached to the examples available at ab.com/powerprogramming. • Q Please let us know what your experience or knowledge is with respect to adoption of the PACKML automatic mode state model in company standards, practices or specifications. A Many of our customers are attempting to specify Pack ML, and we are presenting a more integrated solution with Power Programming as the 3 elements I discussed earlier, and some example code to get them going. This goes far beyond the PackML state model, and goes more into program structure. • Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 33 Resources • Power Programming Website www.ab.com/powerprogramming • PackML OMAC Website www.packml.org Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 34 Thanks for your attention Copyright © 2005 Rockwell Automation, Inc. All rights reserved. 35