Introduction to Modular Programming Rev 5058-CO900C Copyright 2012 Rockwell Automation, Inc. All rights reserved.
2 Agenda Why Modular Programming? Architecting Modular Code Machine Example Meeting Code Development Goals Where to Learn More
Why Modular Programming? Copyright 2012 Rockwell Automation, Inc. All rights reserved.
4 Why Modular Programming? Machine development requires Basin Operation: 1. Fill 2. Agitate 3. Drain 4. Spin
5 Why Modular Programming? Machine development requires Adding machine functionality Basin Operation: 1. Fill 2. Agitate 3. Drain 4. Spin Basin Operation: 1. Fill 2. Agitate 3. Drain 4. Fill 5. Agitate 6. Drain 7. Spin
6 Why Modular Programming? Machine development requires Adding machine functionality Adopting new control technology Basin Operation: 1. Fill 2. Agitate 3. Drain 4. Spin Basin Operation: 1. Fill 2. Agitate 3. Drain 4. Fill 5. Agitate 6. Drain 7. Spin
7 Why Modular Programming? All while Reducing development time Increasing machine reliability Fostering collaborative code development Basin Operation: 1. Fill 2. Agitate 3. Drain 4. Spin Basin Operation: 1. Fill 2. Agitate 3. Drain 4. Fill 5. Agitate 6. Drain 7. Spin
Architecting Modular Code What s The Plan?
9 Goals - Reliability Machine Code Reliability Runs Machine meets or exceeds performance specifications Responds predictably to operator requests and process conditions Errors Machine responds appropriately to hardware / software / mechanical exception conditions Annunciates to operator that error occurred at a minimum Recovers Once the machine errors, it recovers from that error once the exception condition is cleared Logic must never exhibit a condition that requires a power cycle to clear
10 Goals - Flexibility Machine Code Flexibility Minimize the time and cost impacts of late cycle design changes And it should also be able to And I want this hardware And it needs to be compatible with And there will be 3 not 2 of those
11 Goals - Reusability Machine Code Reusability Think in terms of a set of building blocks Begin with a set of functional modules Assemble these functional modules as required Allows complex functions to be developed more quickly and with confidence
12 Defining Structure From a functional description of a machine, we can define Machine states to indicate what things can happen Procedures to define when things happen Hardware that makes things happen State Procedure Hardware
13 Defining Structure Moving from basic to specific State Running Stopped Paused Faulted Procedure Step 1 Step 2 Step 3 Hardware Solenoid VFD Servo
14 Adding Functionality As additional is required, the model can be expanded State Running Stopped Paused Faulted Running Stopped Paused Faulted Procedure Step 1 Step 2 Step 3 Step 1 Step 2 Step 3 Step 1 Step 2 Step 3 Step n Step n+1 Hardware Solenoid VFD Servo Solenoid VFD Servo
15 Linking Modules This logical separation creates a need Running Stopped Paused Faulted Linking Layer Separation between machine state and mode specific procedures that are performed Step 1 Step 2 Step 3 Step 1 Step 2 Step 3 Step n Step n+1 Linking Layer Separation between operating procedure and logic to drive the hardware Valve Motor Valve Valve
16 Linking Modules Why is this important? Running Stopped Paused Faulted 1. Machine Mode / State control is independent of mode specific procedure 2. Procedural operation changes are independent of both overall defined operation and hardware carrying out actions Linking Layer Step 1 Step 2 Step 3 Step 1 Step 2 Step 3 Step n Step n+1 Linking Layer Solenoid VFD Servo 1. Hardware is independent of procedure 2. Hardware control is specific to hardware selected
17 Modular Structure Benefits Code Flexibility A modular structure allows device modules, technology modules, and procedural code to be added or removed based on machine requirements Code Reusability Device modules / technology modules developed with specific functionality can be developed and tested independent of specific machine requirements Code Reliability The use of proven device, technology, and procedural modules in a defined framework facilitates rapid development of robust code
18 Machine Example Let s examine a machine we should all be familiar with.
19 Control Needs Operating Requirements: Scrub clothes with water and detergent Rinse out detergent and dirt with water Machine Actions: Fill with water Scrub clothes Drain water Spin out excess water Procedures: Sequence machine actions Interact with control hardware Define operating parameter values when executing Manage responses to exception conditions
20 Procedure Define states for machine: Running Stopped Faulted Define order of machine actions: Fill Water temp and level Agitate Speed and duration Spin Speed and duration Define hardware for control needs: Valve(s) Motor(s) Sensor(s) Procedure Steps Clear Faults Make Ready Wash Fill Agitate Drain Spin Rinse Fill Agitate Drain Spin Pause Resume Stop
21 Structural Overview In terms of machine control Running Stopped Paused Faulted Machine States Procedure - Regular Cycle Fill Agitate Spin Fill Spin Fill Agitate Spin Fill Spin Fill Spin Procedure - Double Rinse Cycle Valve Motor Valve Valve Hardware Control
22 Control Hardware Grouping Control hardware is grouped into modules based on machine actions performed together Hot Water Valve Wash Basin Cold Water Valve Level Full Sensor Module - Fill Control Level Empty Sensor Agitator Drive Motor Drain Pump Module - Drain Control Module - Agitator Control
23 Module Example - Agitator Control The Module for Agitator Control is used to spin or agitate the basin. Three parameters are required: Direction Spin turns one direction and Agitate the other Speed For different cycles Time For amount of soiling Define hardware functions for: Motor control Start, Stop, Direction Speed selector High, Low Duration Analog time value Define procedure steps for executing hardware functions to: Agitate Spin
24 Device Example Motor Starter Device control triggered from procedure and managed through module Device commands are device specific Contacts for Run Forward or Run Reverse Aux Contact provides Running status Module Commands Device Commands Procedure Agitate Basin Run Forward Stop Run Forward Device Motor Starter Module Conditions Device Conditions Running Stopped Running (Aux)
25 Device Example VFD Interface between procedure and module does not change because it is based on the module action VFD uses different commands and conditions from motor starter Module Commands Device Commands Procedure Agitate Basin Run Forward Stop Forward Start Stop Device VFD Module Conditions Device Conditions Running Stopped Faulted Active Running
26 Meeting Code Development Goals Reliability Simple modules for devices like a valve, pump, or motor starter are easily tested and debugged Separating procedures from hardware control makes procedures easier to monitor, test, and step through Flexibility: Motor starter logic easily replaced with VFD logic for Agitator Extra rinse or prewash cycle easily added to procedure with copy and paste of steps. Reusability: Control logic for a VFD can be reused for many applications Separating Agitate procedure from Agitator VFD control frees module from Washing Machine specific requirements
More About Modular Programming Reference ISA-88.00.01 - Batch Control Part 1: Models and Terminology (www.isa.org) ISA-TR88.00.02 - Machine and Unit States: An Implementation Example of ISA-88 (www.isa.org) IA-RM001C-EN-P - Foundations of Modular Programming (www.rockwellautomation.com) 9300-MODPROG - Modular Programming Computer Based Training Sample Code PlantPAx Process Objects Library (Knowledgebase ID# 62682) Power Programming Developers Toolkit (Knowledgebase ID# 66060) Drives & Motion Accelerator Toolkit (www.ab.com/go/iatools) Safety Accelerator Toolkit (www.ab.com/go/iatools) Energy Management Accelerator Toolkit (www.ab.com/go/iatools) On-Machine Accelerator Toolkit (www.ab.com/go/iatools) Connected Components Building Blocks (www.ab.com/go/iatools) Copyright 2012 Rockwell Automation, Inc. All rights reserved. 27
Why Modular Programming? Reduce Development Time Increase Machine Reliability Foster collaborative code development Basin Operation: 1. Fill 2. Agitate 3. Drain 4. Spin Basin Operation: 1. Fill 2. Agitate 3. Drain 4. Fill 5. Agitate 6. Drain 7. Spin Follow ROKAutomation on Facebook & Twitter. Connect with us on LinkedIn. www.rockwellautomation.com Rev 5058-CO900C Copyright 2012 Rockwell Automation, Inc. All rights reserved.