MB08

Embed Size (px)

Citation preview

  • 8/11/2019 MB08

    1/46

    Applying Modular Design Concepts to StructuredMachine Program Development

    For Classroom Use Only!

  • 8/11/2019 MB08

    2/46

    Important User Information

    This documentation, whether, illustrative, printed, online or electronic (hereinafter Documentation) is intended for use only asa learning aid when using Rockwell Automation approved demonstration hardware, software and firmware. The Documentationshould only be used as a learning tool by qualified professionals.

    The variety of uses for the hardware, software and firmware (hereinafter Products) described in this Documentation, mandatesthat those responsible for the application and use of those Products must satisfy themselves that all necessary steps have beentaken to ensure that each application and actual use meets all performance and safety requirements, including any applicablelaws, regulations, codes and standards in addition to any applicable technical documents.

    In no event will Rockwell Automation, Inc., or any of its affiliate or subsidiary companies (hereinafter Rockwell Automation) beresponsible or liable for any indirect or consequential damages resulting from the use or application of the Products described inthis Documentation. Rockwell Automation does not assume responsibility or liability for damages of any kind based on thealleged use of, or reliance on, this Documentation.

    No patent liability is assumed by Rockwell Automation with respect to use of information, circuits, equipment, or softwaredescribed in the Documentation.

    Except as specifically agreed in writing as part of a maintenance or support contract, equipment users are responsible for:

    properly using, calibrating, operating, monitoring and maintaining all Products consistent with all Rockwell Automation

    or third-party provided instructions, warnings, recommendations and documentation;

    ensuring that only properly trained personnel use, operate and maintain the Products at all times;

    staying informed of all Product updates and alerts and implementing all updates and fixes; and

    all other factors affecting the Products that are outside of the direct control of Rockwell Automation.

    Reproduction of the contents of the Documentation, in whole or in part, without written permission of Rockwell Automation isprohibited.

    Throughout this manual we use the following notes to make you aware of safety considerations:

    Identifies information about practices or circumstancesthat can cause an explosion in a hazardous environment,which may lead to personal injury or death, property damage, or economic loss.

    Identifies information that is critical for successful application and understanding of the product.

    Identifies information about practices or circumstances that can lead to personal injury or death, propertydamage, or economic loss. Attentions help you: identify a hazard avoid a hazard recognize the consequence

    Labels may be located on or inside the drive to alert people that dangerous voltage may be present.

    Labels may be located on or inside the drive to alert people that surfaces may be dangerous temperatures.

  • 8/11/2019 MB08

    3/46

    3 of 46

    Applying Modular Design Concepts to Structured Machine Program Development

    Contents

    Before you begin ........................................................................................................................................... 4

    About this lab .................................................................................................................................................................................... 4

    Tools & prerequisites ........................................................................................................................................................................ 4

    Exercise 1 Verify Machine Functionality .................................................................................................... 5

    Operate the Washing Machine ......................................................................................................................................................... 5

    Exercise 2 Modular Ladder ........................................................................................................................ 6

    Washing Machine Logic .................................................................................................................................................................... 6

    Verifying Application Changes ........................................................................................................................................................ 11

    Exercise 3 Structured Ladder .................................................................................................................. 15

    Washing Machine Logic .................................................................................................................................................................. 15

    Verifying Application Changes ........................................................................................................................................................ 19

    Exercise 4 Traditional Ladder .................................................................................................................. 22

    Washing Machine Logic .................................................................................................................................................................. 22

    Simulation Logic .............................................................................................................................................................................. 30

    Verifying Application Changes ........................................................................................................................................................ 31

    Exercise 5 Device Level Modularity ......................................................................................................... 34

    Device Driver Logic ....................................................................................................................................................................... 34

    Verifying Application Changes ........................................................................................................................................................ 43

  • 8/11/2019 MB08

    4/46

    4 of 46

    Before you begin

    It is expected that prior to beginning this lab, users are equipped with a basic knowledge of Programmable Logic Controllers and

    associated programming environments. Users must be familiar with the RSLogix5000 programming software and be able to

    navigate the software as well as edit /create ladder logic utilizing basic ladder instructions. .

    About this lab

    In the following lab exercises, the participant will assume the role of an engineer for a company that designs and produces

    washing machines. The current project is to upgrade an existing model of washer to incorporate a Variable Frequency Drive

    (VFD) in the design. The VFD will replace the existing motor starter, which will result in higher efficiency and reduced wear on

    the motor.

    As engineers with various programming backgrounds were involved in the development of the original programs, there are three

    distinct programs that require updates. While functionally identical, these programs are examples of traditional ladder, structured

    ladder, and modular ladder. Each exercise will guide the participant through the upgrade process to illustrate the efforts required

    to perform program updates to accommodate the new design into each of the programs.

    The final task will require the participant to replace an AOI designed to control a single-acting solenoid valve with an AOI

    developed to operate a double-acting solenoid valve.

    This lab takes approximately 50 minutes to complete.

    Tools & prerequisites

    Required Software

    RSLogix5000 v21

    SoftLogix5800 v21

    FactoryTalk View ME Station v7.0

    Required Files

    Exercise 1-5

    WashingMachine_Start.mer User Interface

    Exercise 2

    WashingMachine_ModularLadder.ACD Start File

    Module_DriveControl_VFD.L5X Import File

    Exercise 3

    WashingMachine_StructuredLadder.ACD Start File Exercise 4

    WashingMachine_TraditionalLadder.ACD Start File

    Exercise 5

    WashingMachine_Modular_DD.ACD Start File

    Sol_SolenoidValve_DA.L5X Import File

  • 8/11/2019 MB08

    5/46

    5 of 46

    Exercise 1 Verify Machine Functionality

    Operate the Washing Machine

    1. Select a wash temperature and cycle type and start the machine.

    Observe the Active Operation perform both Wash cycle and Rinse cycle

    Observe the Active Step in each cycle change as the machine cycles

    Water Temperature SelectionWash / Rinse

    Cycle ControlStart / Stop / Pause

    Cycle Selection Regular / Delicate

    Cycle Status

  • 8/11/2019 MB08

    6/46

    6 of 46

    Exercise 2 Modular Ladder

    Washing Machine Logic

    The Modular Ladder example is a highly organized method of programming designed to provide the programmer(s) a significantamount of flexibility to meet varying application needs and limit the amount of repetitive effort required. The procedural control is

    separated from the device control; and the procedural and device controls are each subdivided further.

    The Cycle Procedure controls the entire machine processing control. It has been divided into two Sub Procedures, a Wash

    Procedure and a Rinse Procedure. This division allows the programmer(s) to build the Cycle Procedure by choosing when to

    call these Sub Procedures. This example only calls each Sub Procedure once, but it could easily be adapted to add a PreWash

    or an Extra Rinse by calling the Wash or Rinse a second time. These Sub Procedures are similarly subdivided into a sequencing

    of Module Procedures to control functions of each Module. These procedural controls use a common interface defined by a

    state model. That model defines a common set of states of the procedure and transition commands, as well as a defined

    transition path to and from each state. The calling procedure simply outputs the desired transition command and monitors the

    state.

    The device control for the machine has been broken into Modules which consist of devices grouped to perform a specific

    machine function. Each device consists of all of the inputs and outputs for the component, and Device Driver logic is written to

    monitor the inputs and manipulate the outputs. An interface of device commands, parameters, and status is defined to allow

    interaction with the Module Procedure(s) for the Module that uses that device. A generic naming convention allows similar

    devices to be interchanged within the Module.

    With a modular approach defining how modules are communicated with, the Import/Exportfeatures in RSLogix5000 can be leveraged to quickly update modules to changefunctionality!

    1. Open the Lab Files folder on the desktop.

    2. Double click on the file WashingMachine_ModularLadder.ACD.

  • 8/11/2019 MB08

    7/46

    7 of 46

    3. In the Controller Organizer, navigate to the program folder Module_DriveControl

    4. Locate the routine called DeviceDriver_MotorControl and double-click to open the routine.

    5. Note the code inside the DeviceDriver_MotorControl routine is written to support the existing motor starter used

    on the washer. (No Edits Required)

  • 8/11/2019 MB08

    8/46

    8 of 46

    6. Importing a new module:

    With the project open, right-click on the MainTask folder and select Import Program

    .

    7. Navigate to the desktop folder Lab Files and locate the *.L5X module import.

  • 8/11/2019 MB08

    9/46

    9 of 46

    8. Because this module supports the new VFD hardware, select Overwrite to overwrite existing module upon

    import.

    Do not s elect OK until Step 11 - Proceed to next step

    9. In the Content List on the left, select Program Tags.

    Note:

    Tagsexisting in bothmoduleswill be overwritten

    Tagsexisting in only the new modulewill be created

    Tagsexisting in only the old modulewill be deleted

  • 8/11/2019 MB08

    10/46

    10 of 46

    10. In the Content List on the left, select Routines.

    Note:

    Routinesexisting in both moduleswill be overwritten

    Routinesexisting in only the new modulewill be created

    11. Select OK to import the module

  • 8/11/2019 MB08

    11/46

    11 of 46

    Verifying Application Changes

    1. In the Controller Organizer, navigate to the program folder Module_DriveControl

    2. Locate the routine called DeviceDriver_MotorControl and double-click to open the routine.

    3. Verify the device driver code is now different to support the VFD control. (No Edits Required)

  • 8/11/2019 MB08

    12/46

    12 of 46

    4. Download the modified application to the SoftLogix5800 controller.

    In RSLogix5000 use the Communication Dropdown menu to select Who Active

    5. Navigate to the 1789-L60/A SoftLogix Controller and select Download

  • 8/11/2019 MB08

    13/46

    13 of 46

    6. If prompted, confirm the download request.

    7. After the download is complete, verify the processor is in Run Mode.

  • 8/11/2019 MB08

    14/46

    14 of 46

    8. Using the HMI, verify the machine cycles properly by starting a cycle and monitoring the status.

    Machine Upgrade Edit Summary:

    Modular Example:

    Number of Rungs Edited 0 of 357, or 0 % of Rungs in the project were modified

    Number of Modules Imported 1, including required tag, rung, and routine adds and edits

    Leveraging the ability to separate code into different program folders in addition to functional separation ofcode using routines and adding a defined mechanism to facilitate communication between modules greatlyreduced the complexity of making changes to the hardware on the washing machine.

    A defined code structure allows for parallel code developments; in this case the ability to engineer hardwarespecific modules that can be imported easily into applications using the import / export capabilities providedby the RSLogix5000 software environment.

  • 8/11/2019 MB08

    15/46

    15 of 46

    Exercise 3 Struct ured Ladder

    The Structured Ladder example is a linear execution method; though it organizes the code into logical function groups for

    initializing, input monitoring, procedural execution, and output manipulation. A method of interface is defined so the inputs are

    used to define the procedure operating parameters and step transitions and the outputs are manipulated based on the active

    step of the procedure. This allows the input and output devices to be changed without requiring change to the procedural logic,

    and the procedure can be changed with minimal changes to the inputs or outputs routines.

    Washing Machine Logic

    1. Open the Lab Files folder on the desktop.

    2. Double click on the file WashingMachine_StructuredLadder.ACD.

    3. With the project open, expand the Main Program program folder and open the program tag database.

    Inputs OutputsCycleProcedure

    Input Devices

    OperatorInputs

    Output Devices

    DisplayOutputs

    Transitions Step Values

    Parameters

  • 8/11/2019 MB08

    16/46

    16 of 46

    4. Add the following tags to the tag database:

    Out_Drive_Start BOOL

    Out_Drive_Stop BOOL

    Par _Drive_HighSpeed DINT

    Par _ Drive_LowSpeed DINT Out_Drive_SpeedReference INT

    5. Return to the Controller Organizer and open the routine R04_Outputs.

  • 8/11/2019 MB08

    17/46

    17 of 46

    6. Edit Rung 3 Drive/Motor Speed Selection

    Replace the existing output with MOV instructions to move High Speed / Low Speed values to the VFD speed reference

    If Cfg_AgitateSpeed Then MOV Par_Drive_HighSpeed / Out_Drive_SpeedReference

    If not Cfg_AgitateSpeed then MOV Par_Drive_LowSpeed / Out_Drive_SpeedReference

    Device Specific Control has been separated into routine R04_Outputs so that changes to h ardwaredevices can be made separate from operational logic

  • 8/11/2019 MB08

    18/46

    18 of 46

    7. Add (insert) new Rung 7 Drive/Motor Start Control

    Add the following rung to provide Start command to the VFD based on appropriate step in the cycle.

    EQU CycleSequence = 30

    EQU CycleSequence = 70

    EQU CycleSequence = 110 EQU CycleSequence = 150

    OTE Out_Drive_Start

    8. Add (insert) new Rung 8 Drive/Motor Stop Control

    Add the following rung to assert a Stop command to the VFD based on appropriate step in the cycle.

    NEQ CycleSequence = 30

    NEQ CycleSequence = 70

    NEQ CycleSequence = 110

    NEQ CycleSequence = 150

    OTE Out_Drive_Stop

  • 8/11/2019 MB08

    19/46

    19 of 46

    Verifying Application Changes

    1. Download the modified application to the SoftLogix5800 controller.

    In RSLogix5000 use the Communication Dropdown menu to select Who Active

    2. Navigate to the 1789-L60/A SoftLogix Controller and select Download

  • 8/11/2019 MB08

    20/46

    20 of 46

    3. If prompted, confirm the download request.

    4. After the download is complete, verify the processor is in Run Mode.

  • 8/11/2019 MB08

    21/46

    21 of 46

    5. Using the HMI, verify the machine cycles properly by starting a cycle and monitoring the status.

    Machine Upgrade Edit Summary:

    Structured Ladder:

    Number of Rungs Edited 1 of 65, or 1.5 % of Rungs in the project were modified

    Number of Rungs added 2

    Simply leveraging the ability to separate code into different routines and adding a minimal amount ofintermediate logic significantly reduced the complexity of making changes to the hardware on the washingmachine.

    Modular Example:

    Number of Rungs Edited 0 of 357, or 0 % of Rungs in the project were modified

    Number of Modules Imported 1, including required tag, rung, and routine adds and edits

    Leveraging the ability to separate code into different program folders in addition to functional separation ofcode using routines and adding a defined mechanism to facilitate communication between modules greatlyreduced the complexity of making changes to the hardware on the washing machine.

    A defined code structure allows for parallel code developments; in this case the ability to engineer hardwarespecific modules that can be imported easily into applications using the import / export capabilities provided

    by the RSLogix5000 software environment.

  • 8/11/2019 MB08

    22/46

    22 of 46

    Exercise 4 Traditional Ladder

    Washing Machine Logic

    The traditional ladder example uses a very linear execution scheme. Much like a true relay panel, each output is set based onBoolean logic evaluations of the state of input devices, intermediate coils, and other output devices. The logic is not separated

    with respect to what the machine is doing as compared to what it is using to do it, so often a simple change in either a given

    device or the order in which the devices are used often results in significant changes throughout the program.

    1. Open the Lab Files folder on the desktop.

    2. Double click on the file WashingMachine_TraditionalLadder.ACD.

    3. With the project open, expand the Main Program program folder and open the program tag database.

    Inputs

    Sequencing

    Outputs

    Timers

    Input Devices

    OperatorInputs Display

    Outputs

    Output Devices

  • 8/11/2019 MB08

    23/46

    23 of 46

    4. Add the following tags to the tag database:

    Inp_Drive_Active BOOL

    Out_Drive_Start BOOL

    Out_Drive_Stop BOOL

    Par _Drive_HighSpeed DINT Par _ Drive_LowSpeed DINT

    Out_Drive_SpeedReference INT

    5. Return to the Controller Organizer and open the Main Routine.

    6. Edit Rung 5 Start / Stop Control

    Add two XIOs to the upper branch of the rung-in condition with the following tags

    XIO - Out_Drive_Start

    XIO - Out_Drive_Stop

  • 8/11/2019 MB08

    24/46

    24 of 46

    7. Edit Rung 6 Cycle Reset Controls

    Add 2 output branches for the VFD controls

    OTU - Out_Drive_Start

    XIC Inp_Drive_Active, OTE Out_Drive_Stop

    8. Edit Rung 9 Cycle Parameters Regular Cycle

    The output to the motor starter must be replaced with the appropriate VFD Speed command

    MOV Par_Drive_HighSpeed / Out_Drive_SpeedReference

  • 8/11/2019 MB08

    25/46

    25 of 46

    9. Edit Rung 10 Cycle Parameters Delicate Cycle

    MOV Par_Drive_LowSpeed / Out_Drive_SpeedReference

    10. Edit Rung 11 Initialize Cycle Controls

    When a cycle begins, cycle data must first be set / reset. Add 2 unlatch bits for drive start / stop.

    OTU - Out_Drive_Start

    OTU - Out_Drive_Stop

  • 8/11/2019 MB08

    26/46

    26 of 46

    11. Edit Rung 15 Agitation Control

    Add a branch to latch the drive start bit when agitation begins.

    OTL - Out_Drive_Start

    12. Edit Rung 17 Agitation Dwell

    Add branch to remove the start command and assert the stop command

    OTL - Out_Drive_Stop

    OTU - Out_Drive_Start

  • 8/11/2019 MB08

    27/46

    27 of 46

    When the Agitation Dwell is complete, the asserted stop command must be removed.

    OTU - Out_Drive_Stop

  • 8/11/2019 MB08

    28/46

    28 of 46

    13. Edit Rung 20 Spin Control

    Like the agitation control, the Spin Control logic must be updated to reflect the hardware change as well.

    OTL - Out_Drive_Start

    14. Edit Rung 22 Spin Dwell

    Add branch to remove the start command and assert the stop command

    OTL - Out_Drive_Stop

    OTU - Out_Drive_Start

  • 8/11/2019 MB08

    29/46

    29 of 46

    When the Spin Dwell is complete, the asserted stop command must be removed.

    OTU - Out_Drive_Stop

    15. Add (insert) New Rung 25 Cycle Pause

    To support the Cycle Pause functionality, an additional rung must be added.

    XIC Cmd_CycleRun

    XIC Inp_PausePB

    OTU Out_Drive_Start

    XIC Inp_Drive_Active

    OTE Out_Drive_Stop

  • 8/11/2019 MB08

    30/46

    30 of 46

    Simulation Logic

    1. In the Controller Organizer, locate and open the Simulation Logic Routine.

    2. Locate Rung 6 and Insert New Rung Simulation LogicTo support the simulation, an additional rung must be added.

    XIC Out_Drive_Start

    XIC Inp_Drive_Active

    XIO S:FS (First Scan)

    XIO Out_Drive_Stop

    OTE Inp_Drive_Active

  • 8/11/2019 MB08

    31/46

    31 of 46

    Verifying Application Changes

    1. Download the modified application to the SoftLogix5800 controller.

    In RSLogix5000 use the Communication Dropdown menu to select Who Active

    2. Navigate to the 1789-L60/A SoftLogix Controller and select Download

  • 8/11/2019 MB08

    32/46

    32 of 46

    3. If prompted, confirm the download request.

    4. After the download is complete, verify the processor is in Run Mode.

  • 8/11/2019 MB08

    33/46

    33 of 46

    5. Using the HMI, verify the machine cycles properly by starting a cycle and monitoring the status.

    Machine Upgrade Edit Summary:

    Traditional Ladder:

    Number of Rungs Edited 10 of 25, or 40 % of Rungs in the project were modified

    Number of Rungs added 1

    Structured Ladder:

    Number of Rungs Edited 1 of 65, or 1.5 % of Rungs in the project were modified

    Number of Rungs added 2

    Leveraging the ability to separate code into different routines and adding a minimal amount of intermediatelogic significantly reduced the complexity of making changes to the hardware on the washing machine.

    Modular Example:

    Number of Rungs Edited 0 of 357, or 0 % of Rungs in the project were modified

    Number of Modules Imported 1, including required tag, rung, and routine adds and edits

    Leveraging the ability to separate code into different program folders in addition to functional separation ofcode using routines and adding a defined mechanism to facilitate communication between modules greatlyreduced the complexity of making changes to the hardware on the washing machine.

    A defined code structure allows for parallel code developments; in this case the ability to engineer hardwarespecific modules that can be imported easily into applications using the import / export capabilities providedby the RSLogix5000 software environment.

  • 8/11/2019 MB08

    34/46

    34 of 46

    Exercise 5 Device Level Modulari ty

    Device Driver Logic

    With multiple valves used on the washing machine, there will be multiple instances of control code. On this washing machine,there are valves for both the hot water control and cold water control. The control code is shown below:

  • 8/11/2019 MB08

    35/46

    35 of 46

    For devices that use common control code, Add-On-Instructions (AOI) can be developed to encapsulate common functionality of

    a device. Below is an AOI that controls a single-acting solenoid valve. By creating the AOI, the developer has now defined the

    programmers interface to the device. Common command / status attributes between AOIs for control of similar valves will

    make the implementation of different hardware an easy task.

    Using Add-On-Instructions simplifies:

    - Adding additional devices

    - Updating existing device control logic when a device changes

  • 8/11/2019 MB08

    36/46

    36 of 46

    1. Open the Lab Files folder on the desktop.

    2. Double click on the file WashingMachine_Modular_DD.ACD.

    3. In the Controller Organizer, navigate to the program folder Module_FillControl.

    4. Locate the routine called DeviceDriver_ColdWaterValve and double-click to open the routine.

  • 8/11/2019 MB08

    37/46

    37 of 46

    5. Note the code inside the DeviceDriver_ColdWaterValve routine. The control code for the single acting solenoid

    valve has been encapsulated in an Add-On-Instruction (AOI).

    6. Changing the Device Driver code to accommodate a change to a double acting valve type:

    With the project open, right-click on the Add-On-Instructions folder and select Import Add-On-Instruction.

    .

    7. Navigate to the desktop folder Lab Files and locate the *.L5X AOI import.

  • 8/11/2019 MB08

    38/46

    38 of 46

    8. Because this AOI does not yet exist in the project, ensure the operation is set to Create and select OK

    9. Once the import is complete, locate the Add-On-Instruction folder in the controller organizer and verify the AOI

    SOL_SolenoidValve_DA has been imported:

  • 8/11/2019 MB08

    39/46

    39 of 46

    10. In the Controller Organizer, navigate to the program folder Module_FillControl.

    11. Locate the routine called DeviceDriver_ColdWaterValve and double-click to open the routine.

    12. Double-Click on the instruction name and change to SOL_SolenoidValve_DA; then hit enter to accept changes.

  • 8/11/2019 MB08

    40/46

    40 of 46

    13. You should now see the double acting solenoid AOI on the rung:

    14. Right-Click the control tag and select Edit.

    15. In the Tag Properties dialogue box, change the data type to SOL_SolenoidValve_DA and select OK.

  • 8/11/2019 MB08

    41/46

    41 of 46

    16. When prompted, click OK to acknowledge the change to the tag data structure.

    17. Note that the description now correctly describes the Add-On-Instruction:

    18. Because the double-acting solenoid will require an output to both open and close the valve, an additional output

    tag must be created for closing the valve. Type in the following text in the field for parameter Out_SV_Close as

    shown below and hit Enter.

  • 8/11/2019 MB08

    42/46

    42 of 46

    19. Right-Click on the text and select New.

    20. When the New Tag dialog box appears select Create.

  • 8/11/2019 MB08

    43/46

    43 of 46

    Verifying Application Changes

    1. Download the updated application to the SoftLogix5800 controller.

    In RSLogix5000 use the Communication Dropdown menu to select Who Active

    2. Navigate to the 1789-L60/A SoftLogix Controller and select Download

  • 8/11/2019 MB08

    44/46

    44 of 46

    3. If prompted, confirm the download request.

    4. After the download is complete, verify the processor is in Run Mode.

  • 8/11/2019 MB08

    45/46

    45 of 46

    5. Using the HMI, verify the machine cycles properly by starting a cycle and monitoring the status.

    When combined with a defined, modular code structure designed to separate physical device controlfrom the specific application p rocedures, encapsulating cod e in an AOI provides signific antadvantages:

    - Simplify machine h ardware changes

    - Accelerate technology adoption

    - Finite in functionality, device control code can be tested separate from machine code

  • 8/11/2019 MB08

    46/46