The text of a manual · part 5 of 18
Simatic S5 to RSLogix 5000 Application Conversion Guide: Chapter 2: Software Conversions - Program Structure, pages 31 to 38
Pages 31 to 38 of 140, from Simatic S5 to RSLogix 5000 Application Conversion Guide
The original document is the PDF (3.5 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Siemens 6ES5-431-8MA11, Siemens 6ES5-451-8MA11 and Siemens 6ES5-452-8MR11
Page 31
Chapter
2
Software Conversions - Program Structure
Introduction
The Siemens S5 controller is programmed with the Step 5 software package, while Rockwell Automation’s Logix controllers are programmed with the RSLogix 5000 software package. This chapter explains the differences between the structure of a Step 5 PLC program and an RSLogix 5000 project and provides guidance in converting an S5 program to a RSLogix 5000 project. There are two components in an S5 PLC program; the logic contained in modules such as function blocks, and the memory variables that store data related to this logic. The Code Area consists of Program Blocks (PB), Function Blocks (FB), Extension Function Blocks (FX) and Organization Blocks (OB). The Data Storage area consists of Data Blocks (DB), Extended Data Blocks (DX), and Flag Words (FW). This chapter looks at how these two components are implemented in Step 5 and RSLogix 5000 software, and seeks to give an understanding of the optimal method of converting the structure of a Step 5 program to an RSLogix 5000 project.
Organization Blocks/Logix Tasks
This comparison of Step 5 Organization Blocks and RSLogix 5000 tasks is designed to introduce the structure of an RSLogix 5000 project to the S5 user. Step 5 uses Organization Blocks (OBs) as the top level in the hierarchy of program calls. These OBs are called by the controller’s operating system and all user function blocks and program blocks are called from these OBs. In RSLogix 5000 software, the equivalent project elements to these OBs are called Tasks. In Step 5 there are three types of OBs and the table below details the equivalent RSLogix 5000 tasks for each Step 5 OB type.
Publication LOGIX-AP010B-EN-P - May 2010
Step 5 OB
RSLogix 5000 Task
Description
Program Cycle OB
Continuous Task
The code is executed cyclically, recommencing executing the code from the beginning when the last instruction has been executed.
Cyclic Interrupt OB
Periodic Task
The code is executed at defined time intervals.
Hardware Interrupt OB
Event Task
The code is executed in response to a defined event.
31
Page 32
Chapter 2
Software Conversions - Program Structure
The following window shows the layout of tasks in an RSLogix 5000 project and the folder icons used to indicate task types.
Continuous Task In Step 5 there is only one continuously executed Organization Block and it is always designated OB1. This Organization Block determines the sequence by which the program blocks, function blocks and data blocks of the PLC program are processed. The corresponding calls (conditional or unconditional) for the blocks required are written in Organization Block 1 (OB1). In RSLogix 5000 software, the equivalent to the Step 5 OB1 is the continuous task that appears in an RSLogix 5000 project as follows:
Unlike Step 5, the existence of a continuous task is not compulsory in an RSLogix 5000 project. By right-clicking on the Main Task icon and choosing Properties, the configuration menu for the continuous task is displayed.
32
Publication LOGIX-AP010B-EN-P - May 2010
Page 33
Software Conversions - Program Structure
Chapter 2
Periodic Task Step 5 and RSLogix 5000 software allow tasks to be programmed that will execute at defined intervals. In the S5 PLC, the number of tasks and the permitted time intervals is dependent on the model of controller used. For example, in the S5-135U PLC Series, there are up to nine periodic tasks that can be executed. These programs reside in Organization Blocks OB10 to OB18 with each OB being executed, predefined-time intervals from 10 msec to 5 sec. In RSLogix 5000 software, the equivalent to the S5 Periodic Task is indicated in an RSLogix 5000 project as follows:
By right-clicking on this icon and choosing Properties, the following configuration menu for the periodic task is displayed. From this menu, the executed task can be configured including task priority where tasks with lower numbers indicate a higher priority.
Publication LOGIX-AP010B-EN-P - May 2010
33
Page 34
Chapter 2
Software Conversions - Program Structure
Event Task Step 5 and RSLogix 5000 software allow tasks to be programmed that interrupt the normal cyclic sequence and process the logic contained in designated event task on detection of predefined event. In Step 5, the predefined event is restricted to the change of state of an input while RSLogix 5000 permits event tasks to be initiated on the following: • Event Instruction • Module Input Data State Change • Consumed Data • Motion Control Events In Step 5, the code to be executed on detection of an interrupt event is contained in predefined Organization Blocks. The number of event tasks that can be programmed depends on the model of CPU in use. In RSLogix 5000 software, the equivalent to the Event Task is indicated in an RSLogix 5000 project as follows:
By right-clicking on this icon and choosing Properties, the following configuration menu for the event task is displayed. From this menu, the event that initiates the task can be determined and tasks priority can also be defined.
34
Publication LOGIX-AP010B-EN-P - May 2010
Page 35
Software Conversions - Program Structure
Chapter 2
Task Properties The following property settings can be configured for all tasks: • Watchdog - timer that specifies how long a task can run before triggering a fault. • Disable Automatic Output Processing To Reduce Task Overhead – this is an option that allows output processing to be turned off, reducing the elapsed time for that task. Normally at the end of a task the controller performs overhead operations (output processing) for the I/O modules in the system. While not the same as updating the modules, this output processing may affect the update of I/O in the system. • Inhibit Task - this is an option that prevents a task from executing when the task trigger occurs. This option can be useful during testing/commissioning.
RSLogix 5000 Programs
The RSLogix 5000 tasks can be divided into a number of programs. This subdivision does not exist in Step 5, but can be used in RSLogix 5000 software to achieve a more modular software architectural design. When converting Step 5 applications with many individual OBs and PBs, consider separating the application into one or more RSLogix 5000 programs.
Publication LOGIX-AP010B-EN-P - May 2010
35
Page 36
Chapter 2
Software Conversions - Program Structure
The nature of the application will determine how the tasks are divided into programs. On smaller applications it may be suitable to include all the user code in one program. The following example shows how the continuous task is divided into the following three programs with each one containing its own routines. • Process Plant1 • Utilities • Wastewater
Blocks/Routine
This section discusses anomalies involved in converting S5 Program Blocks (PBs) and Function Blocks (FBs) to RSLogix 5000 routines. The next level down from the OB in the Step 5 program structure will usually contain Program Blocks (PBs) and possibly Function Blocks (FBs). Usually OB1 will call a number of PBs and/or FBs with each block executing a distinct function. The nature of the function depends on the particular application, but typically could include functions such as Scaling Analog Inputs, Filling Process Tank, or Controlling Process Temperature. RSLogix 5000 software has a similar structure but uses different terminology. Instead of the term Block, RSLogix 5000 software uses the term Routine.
36
Publication LOGIX-AP010B-EN-P - May 2010
Page 37
Software Conversions - Program Structure
Chapter 2
In Step 5, OB1 is the first code executed. In RSLogix 5000 software, the first routine executed can be selected by the programmer. It is indicated in the project tree by the icon beside the Main Routine. When converting a PLC application from Step 5 to RSLogix 5000 software, function calls originally in S5 OB1, are commonly placed in the designated RSLogix 5000 Main Routine. The following window shows how routines appear under the continuous task in the RSLogix 5000 project tree. The Main Routine designated as the start-up routine is indicated by the icon
.
The following example shows how three PBs called in from OB1 could be converted into RSLogix 5000 software. In S5 the PBs are given symbol names and called from OB1. In RSLogix 5000 software, the routines are called from the Main Routine.
Publication LOGIX-AP010B-EN-P - May 2010
37
Page 38
Chapter 2
Software Conversions - Program Structure
More details on programming in RSLogix 5000 software can be found in the ControlLogix User Manual, publication 1756-UM001.
Function Blocks/Add-On Instructions
RSLogix 5000 software allows programming of Add-On Instructions that can replace and enhance the functionality of Step 5 Function Blocks. The Add-On Instruction functionality allows the combination of commonly used logic into one function that can be called and executed multiple times as required in the program. Add-On Instructions are programmed by Ladder Logic, Structured Text, or Function Block Diagrams. The Add-On Instruction, like the Step 5 Function Block can be assigned input and output parameters. Unlike Step 5, an Add-On Instruction can also have an InOut Parameter to define data used as input and output during instruction execution. An InOut Parameter is passed by reference, meaning the logic deals directly with the tag passed to the instruction. InOut parameters can be any data type because they are passed by reference. Any data structures or arrays that must be passed to an Add-On Instruction can be done with InOut Parameters. The Add-On Instruction will automatically maintain a change history by recording a timestamp and the Windows user name at the time of the change. This is not available with Step 5 Function Blocks. The Add-On Instruction also automatically generates help files.
38
Publication LOGIX-AP010B-EN-P - May 2010