Automation and Drives - SCE Training Document for Comprehensive Automation Solutions Totally Integrated Automation (T I A) MODULE B3 Control Engineering with STEP 7 T I A Training Document Issued: 02/2008 Page 1 of 64 Module B3 Control Engineering with STEP 7
Automation and Drives - SCE This document has been written by Siemens AG for training purposes for the project entitled "Siemens Automation Cooperates with Education (SCE)". Siemens AG accepts no responsibility for the correctness of the contents. Transmission, use or reproduction of this document is only permitted within public training and educational facilities. Exceptions require the prior written approval by Siemens AG (Mr. Michael Knust michael.knust@siemens.com).
Automation and Drives - SCE Table of Contents PAGE 1. Preface 2. Fundamentals of Control Engineering 2.2 Components of a Control Loop 2.3. Characteristics 2.4 Step Function for Examining Controlled Systems 2.5. Self-Regulating Processes 2.5.1. Proportional Controlled System without Time Delay 2.5.2. Proportional Controlled System with a Time Delay 2.5.3 Proportional Controlled System with Two Time Delays 2.6 Controlled Systems without Inherent Regulation 2.7 Types of Controllers 2.7.
Automation and Drives - SCE The following symbols provide a guide through this B3 module: Information Programming Exercise Example Notes T I A Training Document Issued: 02/2008 Page 4 of 64 Module B3 Control Engineering with STEP 7
Automation and Drives - SCE 1. PREFACE In terms of its contents, Module B3 is part of the teaching unit entitled "Additional Functions of STEP 7 Programming'.
Automation and Drives - SCE Hardware and software required 1 2 3 4 5 6 PC, operating system Windows 2000 Professional starting with SP4/XP Professional starting with SP1/Server 2003 with 600MHz and 512RAM, free hard disk storage 650 to 900 MB, MS Internet Explorer 6.0 Software STEP7 V 5.
Automation and Drives - SCE 2. FUNDAMENTALS OF CONTROL ENGINEERING 2.1 Tasks of Control Engineering "Closed loop control is a process where the value of a variable is established and maintained continuously through intervention based on measurements of this variable. This creates a sequence that takes place in a controlled loop -the closed loop- because the process is executed based on measurements of a variable that is in turn influenced by itself.
Automation and Drives - SCE 2.2 Components of a Control Loop Below, the basic terminology of control engineering is explained in detail. First, an overview shown in the diagram below: Controller Comparing Element Controlling Element Actuator Final Control Element Controlled System Measuring Device 1. The Controlled Variable x It is the actual “objective“ of the control process: the variable that is to be influenced or kept constant is the purpose of the entire system.
Automation and Drives - SCE 4. The Disturbance Variable z The disturbance variable is the variable that unintentionally influences the controlled variable, and moves it from the current setpoint value. A fixed setpoint control is necessary, for example, because a disturbance variable exists. For the heating system considered here, this would be the outside temperature, for example, or any other variable that changes the room temperature from its ideal value. 5.
Automation and Drives - SCE 8. The Actuator The actuator is the “executing organ“, so to speak, of the control system. In the form of the controller output variable, the controlling element provides the actuator with information as to how the controlled variable is to be influenced, and implements it into a change of the “manipulated variable“. In our example, the actuator would be the mixer motor.
Automation and Drives - SCE 2.3. Characteristics Controlled systems in which a new constant output value sets itself after a certain time has passed are called 'self-regulating process’. The relationship of the output variables to the input variables in the steady state results in a characteristic. Parameter In the environment of an operating point, the characteristic is replaced with a tangent. In the environment of an operating point, the problem is treated as a linear problem.
Automation and Drives - SCE 2.4 Step Function for Examining Controlled Systems To examine the behavior of controlled systems, controllers and control loops, a uniform function is used for the input signal: the step function. Depending on whether a control loop element or the entire control loop is examined, the step function can be assigned to the following: the controlled variable x(t), the manipulated variable y(t), the reference variable w(t) or the disturbance variable z(t).
Automation and Drives - SCE 2.5. Self-Regulating Processes 2.5.1. Proportional Controlled System without Time Delay The controlled system is called P-system for short.
Automation and Drives - SCE 2.5.2. Proportional Controlled System with a Time Delay The controlled system is called P-T1 system for short.
Automation and Drives - SCE 2.5.3 Proportional Controlled System with Two Time Delays The controlled system is called P-T2 system for short. Figure: Jump Response of the P-T2 system Tu: Delay time Tg: Transition time The system consists of the reaction-free series connection of two P-T1 systems that have the time constants TS1 and TS2.
Automation and Drives - SCE 2.5.4 Proportional Controlled System with n Time Delays The controlled system is called P-Tn system for short. The time response is described with a differential equation of the nth degree. The characteristic of the step response is similar to that of the P-T2 system. The time response is described through Tu and Tg. Substitute: The controlled system with many delays can be approximately substituted with the series connection of a P-T1 system with a dead time system.
Automation and Drives - SCE 2.6 Controlled Systems without Inherent Regulation The controlled variable continues to grow after a fault, without aiming for the high range value. Example: Level Control In the case of a container with a drain whose inflow volume stream and outflow volume stream are the same, a constant level is the result. If the flow rate of the inflow or the outflow changes, the liquid level rises or falls.
Automation and Drives - SCE 2.7 Types of Controllers 2.7.1 Two Position Controllers The essential feature of two position controllers consists of their knowing only two modes: “On“ and “Off“ -which makes them the simplest type of controller. Two-position controllers are used primarily when adhering to a setpoint exactly is less important than to keep the control system as simple as possible; or, when the actuator or the final control element does not allow for a continuous control system.
Automation and Drives - SCE The diagram below shows a two position controller: Controlled Variable Switch-Off Value Hysteresis Setpoint Switch-On Value Manipulated Variable Time Time Preface Fundamentals T I A Training Document Issued: 02/2008 Discontinuous Action Controller Controller Block (S)FB41 Setting the System Appendix Page 19 of 64 Module B3 Control Engineering with STEP 7
Automation and Drives - SCE 2.7.2 Three Position Controllers The three position controllers represent the second important class of discrete controllers. The difference regarding the two position controllers consists in the following: The controller output can handle three different values: positive influence, no influence, and negative influence of the controlled variable.
Automation and Drives - SCE 2.7.3 Basic Types of Continuous Controllers The discrete controllers just discussed have, as mentioned before, the advantage of being simple. The controller itself as well as the actuator and the final control element are of a simpler nature and thus less expensive than for continuous controllers. However, discrete controllers have a number of disadvantages.
Automation and Drives - SCE 2.7.3.1 Proportional Controllers (P-Controller) In the case of a P-controller, the controller output y is always proportional to the recorded system deviation (y ~ e). The result is that a P-controller responds to a system deviation without a delay, and generates a controller output only if there is a deviation e.
Automation and Drives - SCE The figure below shows the performance of the P-controller: Controlled Variable Setpoint System Deviation Actual Value Time The advantages of this controller type are, on the one hand, its simplicity (the electronic implementation can, in the simplest case, consist of merely a resistor); on the other hand, in its prompt reaction in comparison to other controller types. The main disadvantage of a P-controller is its lasting system deviation.
Automation and Drives - SCE 2.7.3.2 Integral Action Controllers (I- Controller) Integrating controllers are used to completely correct system deviations at every operating point. As long as the system deviation is not equal to zero, the amount of the controller output changes. Only when the reference variable and the controlled variable are equal -at the latest however, when the controller output reaches its system-dependent limit (Umax, Pmax etc.)- is the controller in a steady state.
Automation and Drives - SCE 2.7.3.3 PI Controllers In practice, the PI controller is a controller type that is used very often. It consists of the parallel connection of a P-controller and an I-controller. When laid out correctly, it combines the advantages of both controller types (stable and fast, no lasting system deviation), so that their disadvantages are compensated for at the same time. Block Diagram The trend is indicated with the proportional coefficient Kp and the reset time Tn.
Automation and Drives - SCE 2.7.3.4 Derivative Action Controllers (D-Controller) The D-controller generates its controller output from the rate of change of the system deviation, and not -like the P-controller- from its amplitude. For that reason, it still responds considerably faster than the P-controller. Even if the system deviation is small, it generates -in anticipation, as it were- large margins of the manipulated variable as soon as the amplitude changes.
Automation and Drives - SCE 2.8 Objectives for Controller Adjustment For a satisfactory control result, selecting a suitable controller is an important aspect. However, even more important is the setting of the suitable controller parameters Kp, Tn and Tv that have to be adjusted to the controlled system behavior.
Automation and Drives - SCE - Note down the Kp value that has been set as the critical proportional coefficient. - Specify the duration of a complete oscillation as Tkrit, perhaps with a stop watch by generating the arithmetical mean over several oscillations. - Multiply the values of Kp,krit and Tkrit with the multipliers according to the table, and thus set the determined values for Kp, Tn and Tv at the controller. 0.50 Preface Fundamentals T I A Training Document Issued: 02/2008 0.45 0.85 0.
Automation and Drives - SCE 2.9 Digital Controllers So far, mainly analog controllers were discussed; that is, such controllers that derive the controller output variable -also in an analog way- from the existing system deviation that exists as analog value. We are already familiar with the diagram of such a control loop: Comparing Element Analog Controller System Often, however, it has its advantages to evaluate the system deviation digitally.
Automation and Drives - SCE The diagram below shows the layout of a digital controller: Comparing Element Digital Controller DAC System ADC However, the digital conversion of the controller has not only advantages; this conversion also entails various problems. For that reason, some variables have to be selected sufficiently large in reference to the digital controller so that the accuracy of the control does not suffer too much on account of digitalization.
Automation and Drives - SCE 3. DISCONTINUOUS ACTION CONTROLLER AS TWO POSITION CONTROLLER 3.1 Function and Problem Description A process value (for example, the level) is to be kept as constant as possible with a discontinuous action controller. The output voltage at a digital output of the PLC generates the manipulated variable y which can be set either to "ON" (voltage =24V) or "OFF" (voltage =0V).
Automation and Drives - SCE Structogram A structogram shows the rough structure of a program plan. The structogram below shows the possible structure of a program for a two position controller. First, a scan is made whether the controller is switched on. If it is switched off, only the program is executed in which the outputs and flags are reset. From the program-engineering view, this is done most simply by means of jump instructions.
Automation and Drives - SCE Assignment List: Symbol: Start Stop Address: I 1.3 I 1.4 Comment Button Start Button Stop AI_Level_Actual AI_Level_Setpoint PEW 128 PEW 130 Analog input for the level sensor Analog input for the setpoint selection AI_Level_Act_Norm MD 20 AI_Level_Setp_Norm MD 24 M_X1 MD 32 M_Xo MD 36 M_Xs MD 28 M_Xu MD 40 Controller_On M 10.
Automation and Drives - SCE 3.
Automation and Drives - SCE Network 4: Calculation of half differential X1 = Xs/2 Network 5: Calculation of the low operating point Xu = w – X1 "AI_Fill_Setp_Norm“ Network 6: ACTUAL VALUE x less than low operating point? D24/AI_Fill_Setp_Norm/Norm.
Automation and Drives - SCE Network 9: Reset values exit: "AI_Fill_Actual_Norm“ "AI_Fill_Setp_Norm "Pump“ "Pump“ "Display_ON“ "Display_ON“ Network 10: Title **************************************************************************************************************** OB1: Title Network 1: Call subroutine: Two position controller "Two Position Controller“ Preface Fundamentals T I A Training Document Issued: 02/2008 Discontinuous Action Controllerr Controller Block (S)FB41 Setting the System
Automation and Drives - SCE 4. CONTROLLER BLOCK (S)FB41 "CONT_C" AS SOFTWARE PID CONTROLLER IN STEP 7 4.1 Task Definition for PID Standard Controller In this B3 module, the startup of a PID controller in SIMATIC S7 is demonstrated. The output value of the controlled system is to be kept constant with a continuous controller. Depending on the setting, the controlled system can simulate a P, PT1, or PT2 system. The transfer coefficients Ks and the time constants can also be set.
Automation and Drives - SCE Assignment List: Symbol: AI_w AI_X Address: PEW 128 PEW 130 Comment Analog input setpoint generator 0…10V Analog input sensor actual value 0…10V AO_Y PAW 128 Analog output manipulated variable 0 … 10V M_w MD40 Internal setpoint (floating point number normalized) Function Diagram of the control system with a PID controller Controller Regler Controller Output y Stellgröße y Regelstrecke Controlled System Final Control Stellglied Element Generation Bildung of der Proc
Automation and Drives - SCE 4.2 (S) FB 41 “CONT_C“ (S)FB 41 "CONT_C“ (continuous controller) is used for controlling technical processes with continuous input and output variables on the PLC SIMATIC S7. By means of parameter assignments, you can switch on or switch off subfunctions of the PID controller, and thus adjust it to the controlled system.
Automation and Drives - SCE Starting Up the Software PID Controller (S)FB41 "CONT_C" with STEP 7 A SIMATIC S7-300 is programmed as a PID controller with the software STEP 7. This provides the user with a uniform configuring tool for central as well as distributed configurations. Here, only the most essential aspects can be pointed out. (Additional information is provided in the STEP7 reference manuals.
Automation and Drives - SCE 3. Generate a new project, select a path and assign a project name (→ User projects → PID_Control → OK) Select 'User Projects’ Enter project name Select storage location (path) Cick 'OK' 4.
Automation and Drives - SCE 5. Highlight 'SIMATIC 300 Station(1)’. Click on 'SIMATIC 300 Station(1)' 6.
Automation and Drives - SCE 7. Open the hardware catalog. Here, all racks, modules, and interface modules for configuring your hardware, are provided arranged in the directories: PROFIBUS-DP, SIMATIC 300, SIMATIC 400 and SIMATIC PC Based Control. Click on the symbol for 'HW catalog’ 8. Insert mounting channel (→ SIMATIC 300 → RACK-300 → Mounting channel). Click on 'Mounting channel' Then a configuration table is displayed automatically for configuring Rack 0.
Automation and Drives - SCE 9. From the hardware catalog, all modules that are plugged inserted in your real rack can now be selected and inserted in the configuration table. To this end, you have to click on the name of the respective module, hold the mouse key and drag the module to a line in the configuration table. Note: Slot 3 is reserved for interface modules, and remains empty for that reason.
Automation and Drives - SCE 10. Note down the addresses of the IO modules (addresses are assigned automatically and tied to the slot). For our example, change the addresses to the values PEW 128 and PAW 128. Save the configuration table and load it to the PLC (key switch on CPU has to be on Stop!) Click on symbol ‘Load to AS’ Click on symbol ‘Save and convert’ Double click on line "AI5/A02, then re-write start addresses to PEW/PAW 128 11.
Automation and Drives - SCE 12. Insert organization block. (→ Insert → S7 Block → Organization block) Click on 'Organization block’ 13. Assign OB35 as name of block.( → OB35 → OK) Note: Preface Fundamentals T I A Training Document Issued: 02/2008 OB35 is a so-called 'Time interrupt OB’ and ensures a constant cycle for calling the PID controller block SFB41.
Automation and Drives - SCE 14. In the hardware configuration, at Properties of the CPU, a fixed cycle time can be set for executing OB35. However, this cycle time should not be selected too short. It has to be ensured that all blocks called from OB35 can be processed within this time, and if OB1 is used at the same time, that there is enough time for it also. (→ Execution) Enter execution time 15.
Automation and Drives - SCE 16. With ‘LAD, STL, and FBD – Program S7 Blocks’, you now have an editor that allows you to edit your STEP7 program accordingly. To this end, OB35 has already been opened with the first network. To generate your first operations, you have to highlight the first network. Now you can write your fist STEP7 program. In STEP 7, individual programs are usually subdivided into networks. You open a new network by clicking on the network symbol.
Automation and Drives - SCE 17. The setpoint value, the actual value and the manipulated variable now have to be wired to process values as follows. Cycle time: Time between the block call. Should correspond to the time that is set in OB 35. SP INT: Setpoint selection through analog input.
Automation and Drives - SCE 18. Save and load OB35 (CPU’s key switch is on Stop!) 19. In ‘SIMATIC Manager’, highlight block DB41 and load to the PLC.
Automation and Drives - SCE 20.
Automation and Drives - SCE 21. Open data block ( → File → Open → Online → Select data block; for example, DB41 → OK).
Automation and Drives - SCE 22. The PID controller can now be parameterized with the tool Parameterize PID Control. Then, the DB is saved (→ Save) and loaded to the PLC (→ Load). Now, a curve plotter can be started in order to monitor the performance of the controlled system. Click on ‘Save’ Click on ‘Load’ Start ‘Curve plotter’ 23. With the curve plotter, the curves for setpoint, actual value and manipulated variable can be recorded. 24. The program is started by setting the key switch to RUN.
Automation and Drives - SCE 5. SETTING CONTROLLED SYSTEMS 5.1 General Below, setting controlled systems is discussed, using a PT2 system as an example. Tu-Tg Approximation The basis for the methods according to Ziegler-Nichols and according to Chien, Hrones and Reswick is the Tu-Tg approximation. With it, the parameters following parameters transfer coefficient of the system KS, delay Tu und transition time Tg can be determined from the system step response.
Automation and Drives - SCE 5.2 Setting the PI-Controller according to Ziegler-Nichols By experimenting with P-T1-TL systems, Ziegler and Nichols have found the following optimum controller settings for fixed setpoint control: Tg KPR =0.9 0,9 K ST u TN = 3.3 3,33 Tu In general, we get disturbance characteristics with these setting values that are quite good. [7] 5.
Automation and Drives - SCE • For setpoint characteristic: aperiodischer Einschwing Apriodical transient reaction mit kürzeste withvorgang the shortest period r Dauer 20% overshoot 20% Überschwingen Minimum period of oscillation r minimale Schwingungsdaue Tg 0.35 KPR = 0,35 KPR = 0.6 0,6 K ST u KSTu TN = 1.
Automation and Drives - SCE 5.4 Exercise Example To accommodate the system step response, a few modifications have to be made in OB 35 and DB41. The following steps have to be performed for this: Save your old project under a new name, and change the wiring of (S)FB 41 as follows: 1. With STEP7, specify the manipulated value directly. The manipulated value is to be specified in the network below in a way that with a switch S1 (I 124.0), a selection can be made between two manipulated values. M001: L 0.
Automation and Drives - SCE Solution of the PLC program: Network 1: Call PID Controller Wiring the manual value to thevalue 0 or 100% of the manipulated value (Refer to NW 2 and NW 3) Preface Network 2: Default Manipulated value 100% Network 3: Default Manipulated value 0% Fundamentals T I A Training Document Issued: 02/2008 Discontinuous Action Controller Controller Block (S)FB41 Setting the System Appendix Page 58 of 64 Module B3 Control Engineering with STEP 7
Automation and Drives - SCE Then, the system step response is recorded with the curve plotter from 0 to 100%. For systems that tend to overshoot, 90% should be assigned as step value. Setpoint Turning Point Tu Tg System step response for Tu-Tg approximation After the inflectional tangent is drawn in the figure, the following values can be read: Tu = 0.7s Tg = 7s 1.0 * KS = 1.0 The result is KS = 1.0 and the ratio Tg/KS = 7s.
Automation and Drives - SCE 6.
Automation and Drives - SCE Input Parameters Parameter Preface Value Range Default Description COM_RST BOOL FALSE COMPLETE RESTART. The block has a complete restart routine that is processed if the input is set to "Complete restart". MAN_ON BOOL TRUE MANUAL VALUE ON / Switch on manual operation. If the input "switch on manual operation" is set, the control loop has been interrupted. A manipulated value is entered as manual value.
Automation and Drives - SCE Parameter Preface Default Description CYCLE TIME >= 1 ms T#1s SP_INT REAL -100.0...+100.0% 0.0 INTERNAL SETPOINT. The input "Internal setpoint" is used to specify the setpoint. PV_IN REAL -100.0...+100.0% 0.0 PROCESS VARIABLE IN / Actual value input. At the input "Actual value input", a startup value can be parameterized, or an external actual value can be wired in the floating point format.
Automation and Drives - SCE Parameter Preface Default Description LMN_HLM REAL LMN_LLM... +100.0 % or phys. variable 2 100.0 MANIPULATED VALUE HIGH LIMIT. The manipulated value is always limited to a high and a low limit. "Manipulated value high limit" indicates the high limit. LMN_LLM REAL -100.0... LMN_HLM % phys. variable 2 0.0 MANIPULATED VALUE LOW LIMIT. The manipulated value is always limited to a high and a low limit. "Manipulated value low limit" indicates the low limit.
Automation and Drives - SCE Output Parameters: Parameter Data Type Value Range Default Description LMN REAL 0.0 LMN_PER WORD W#16#0000 QLMN_HL M BOOL FALSE QLMN_LL M BOOL FALSE LMN_P REAL 0.0 PROPORTIONALITY COMPONENT. The output "Pcomponent" contains the proportional component of the manipulated variable. LMN_I REAL 0.0 INTEGRAL COMPONENT. The output "I-component“ contains the integral component of the manipulated variable. LMN_D REAL 0.0 DERIVATIVE COMPONENT.