Control Engineering
Control Engineering
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
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
[email protected]).
Offenders will be liable for damages. All rights, including the right to translate the document, are reserved,
particularly if a patent is granted or utility model is registered.
We would like to thank the following: Michael Dziallas Engineering, the teachers at vocational schools, and all
others who helped to prepare this document.
T I A Training Document
Issued: 02/2008
Page 2 of 64
Module
B3
Control Engineering with STEP 7
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.1 Two Position Controllers
2.7.2 Three Position Controllers
2.7.3 Basic Types of Continuous Controllers
2.8 Objectives for Controller Adjustment
2.9 Digital Controllers
3. Discontinuous Action Controller as Two Position Controller
3.1 Function and Problem Description
3.2 Possible Solution for the PLC Program:
4. Controller Block (S)FB41 "CONT_C" as Software PID Controller in STEP 7
4.1 Task Definition for PID Standard Controller
4.2 (S) FB 41 CONT_C
4.3 Exercise Example
5. Setting Controlled Systems
5.1 General
5.2 Setting the PI-Controller according to Ziegler-Nichols
5.3 Setting the PID Controller according to Chien, Hrones and Reswick
5.4 Exercise Example
6. Appendix
T I A Training Document
Issued: 02/2008
Page 3 of 64
5
7
8
11
12
13
13
14
15
17
18
18
20
21
27
29
31
31
34
37
37
39
40
54
54
55
55
57
60
Module
B3
Control Engineering with STEP 7
Information
Programming
Exercise Example
Notes
T I A Training Document
Issued: 02/2008
Page 4 of 64
Module
B3
Control Engineering with STEP 7
1. PREFACE
In terms of its contents, Module B3 is part of the teaching unit entitled "Additional Functions of
STEP 7 Programming'.
Basics of
STEP 7 Programming
2 to 3 days
Module A
Additional Functions of
STEP 7 Programming
2 to 3 days Module B
Programming
Languages
2 to 3 days Module C
Industrial
Field Bus Systems
2 to 3 days Module D
Frequency Converter
at SIMATIC S7
2 to 3 days Module H
Process
Visualization
2 to 3 days Module F
IT Communication
with SIMATIC S7
2 to 3 days Module E
Learning Objective:
In module B3, the reader learns the following: how a PID controller is integrated into a STEP7
program, how it is wired to analog process variables, and how it is started. The following steps are
discussed:
Analog Value Processing with STEP 7 (for example, Module B2 Analog Value Processing)
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 5 of 64
Module
B3
Control Engineering with STEP 7
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.4
MPI interface for the PC (for example, PC adapter USB)
PLC SIMATIC S7-300 with at least one analog input/output module to which, at one analog
value input, a potentiometer or another analog signal transmitter is connected. In addition, an
analog value display has to be connected to at least one analog output.
Sample configuration:
- Power supply: PS 307 2A
- CPU: CPU 314C-2DP
Controlled System
Connection lines for connecting the controlled system to analog inputs and outputs of the
PLC
2 STEP 7
1 PC
3 PC Adapter USB
6 Connection Lines
4 S7-300 with
CPU 314C-2DP
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
5 Controlled System
Appendix
Page 6 of 64
Module
B3
Control Engineering with STEP 7
Comparing
Element
Setpoint
Temperature
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Controllg.
Element
Actuator
Measuring
Device
Appendix
Page 7 of 64
Module
B3
Control Engineering with STEP 7
Comparing
Element
Controlling
Element
Actuator
Final
Control
Element
Controlled
System
Measuring
Device
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 8 of 64
Module
B3
Control Engineering with STEP 7
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 9 of 64
Module
B3
Control Engineering with STEP 7
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. Depending on the voltage supplied by the
controlling element (that is, the controller output variable), it influences the position of the mixer
(which here represents the manipulated variable).
9. The Controlling Element
This is the element of the control loop that influences the controlled variable (more or less directly),
depending on the manipulated variable Y. In the example, this would be the combination consisting
of the mixer, the furnace lines, and the heater. The mixer motor (actuator) sets the mixer (the
manipulated variable). By means of the water temperature, the room temperature is influenced.
10. The Controlled System
The controlled system is the plant where the variable to be controlled is located; in the example of
the radiator, the living space.
11. Dead Time
Dead time refers to the time that passes, starting with a change of the controller output variable until
a measurable reaction by the controlled system. In our example, it would be the time between a
change of the voltage for the mixer motor, and the measurable change in room temperature caused
by this.
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 10 of 64
Module
B3
Control Engineering with STEP 7
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.
The zero point of the variables x(t), y(t) and z(t) refers to the operating point A:
:
x = X Xo y = Y - Yo z = Z - Zo
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 11 of 64
Module
B3
Control Engineering with STEP 7
for
for
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 12 of 64
Module
B3
Control Engineering with STEP 7
Controlled Variable/
Manipulated Variable
Proportional coefficient for a
manipulated variable change
Controlled Variable/
Disturbance Variable
Proportional value for a
disturbance variable change
Range:
Control Range:
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 13 of 64
Module
B3
Control Engineering with STEP 7
Solution of the differential equation for a step function at the input (step response)
Time constant
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 14 of 64
Module
B3
Control Engineering with STEP 7
The system consists of the reaction-free series connection of two P-T1 systems that have the time
constants TS1 and TS2.
Can still be
controlled
Easy to
control
Difficult to control
With the rising ratio Tu/Tg, controlling the system becomes more and more difficult.
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 15 of 64
Module
B3
Control Engineering with STEP 7
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 16 of 64
Module
B3
Control Engineering with STEP 7
Block Diagram
If the step function at the input changes into any function xe(t), the following happens:
integrating controlled system
integral coefficient of the controlled system
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 17 of 64
Module
B3
Control Engineering with STEP 7
Since theoretically -to adhere to the setpoint exactly- it would be necessary to switch a system on
and off infinitely fast, the two position controller has a so-called hysteresis. It represents a kind of
environment around the setpoint within which the actual value may fluctuate. That means, we
specify a minimum value that is lower than the setpoint, and a maximum value that is a little higher
than the setpoint. Only if the actual value exceeds the maximum value or drops below the minimum
value does the control system react. In most cases, the minimum and the maximum value are
distanced from the setpoint equally; that is, the hysteresis generates a symmetrical environment
around the set point.
In the case of the boiler water temperature, the burner would be switched on, for example, when the
water temperature drops below the specified setpoint by more than a certain value. The burner
continues to run until a certain value that is above the setpoint is exceeded. Only then will the burner
be switched off. Another typical example is cooling. Usually, a cooler also does not support a
continuous control system, but only knows the states On and Off. It is switched on when the
actual temperature exceeds the setpoint temperature by a few degrees, and is switched off when the
actual temperature is a few degrees too low.
It is therefore typical for the two position controller to periodically fluctuate around the setpoint whose
amplitude is roughly that of the hysteresis. The selection of the hysteresis depends on how exactly
the setpoint has to be adhered to. If we select a large hysteresis, the actual value can deviate more
considerably from the setpoint. If we select a smaller one, the setpoint is adhered to more exactly,
but the system would have to switch more frequently. This again has its disadvantages, such as a
higher wear of the switching devices, and the actuator or the final control element.
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 18 of 64
Module
B3
Control Engineering with STEP 7
Controlled Variable
Switch-Off Value
Hysteresis
Setpoint
Switch-On Value
Manipulated Variable
Time
Time
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 19 of 64
Module
B3
Control Engineering with STEP 7
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 20 of 64
Module
B3
Control Engineering with STEP 7
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 21 of 64
Module
B3
Control Engineering with STEP 7
Metal Bellows
Setpoint Spring
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 22 of 64
Module
B3
Control Engineering with STEP 7
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. The setpoint is never completely reached, even over long periods of
time. This disadvantage as well as a reaction speed that is not yet ideal can be minimized only
insufficiently by using a larger proportional factor, since otherwise, the controller will overshoot; that
is, it will overreact so to speak. In the worst case, the controller oscillates continuously, whereby the
controlled variable is moved by the controller itself away from the setpoint -instead of by the
disturbance variable.
The problem of continuous system deviation is best solved by the integral action controller.
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 23 of 64
Module
B3
Control Engineering with STEP 7
with
How fast the controller output rises (or falls), depends on the system deviation and the integration
time.
Block Diagram
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 24 of 64
Module
B3
Control Engineering with STEP 7
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. Based on the
proportional component, the controller output responds immediately to each system deviation e,
while the integral component has an effect only in the course of time. Tn represents the time that
passes until the I-component generates the same margin of the manipulated variable as it is
generated immediately because of the P-component (Kp). As for the I-controller, the reset time Tn
has to be reduced if you want to increase the integral component.
Controller Layout:
Depending on the Kp and Tn dimensioning, the overshoot of the controlled variable can be reduced
at the expense of control system dynamics.
Applications for the PI controller: fast control loops that dont permit lasting system deviations.
Examples: pressure, temperature, ratio control.
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 25 of 64
Module
B3
Control Engineering with STEP 7
Block Diagram
with
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 26 of 64
Module
B3
Control Engineering with STEP 7
- Set Kp and Tv at the controller to the lowest value, and Tn to the highest value (the lowest possible
controller effect).
- Take the controlled system manually to the desired operating point (start the controller).
- Set the manipulated variable of the controller manually to the specified value, and switch to the
automatic mode.
- Increase Kp (decrease Xp) until harmonic oscillations can be recognized in the controlled variable.
If possible, the control loop should be stimulated to oscillate during the Kp setting by using small,
abrupt setpoint changes.
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 27 of 64
Module
B3
Control Engineering with STEP 7
- 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.59
0.50
0.12
Appendix
Page 28 of 64
Module
B3
Control Engineering with STEP 7
Comparing
Element
Analog
Controller
System
Often, however, it has its advantages to evaluate the system deviation digitally. On the one hand,
the relationship between system deviation and controller output variable has to be specified much
more flexibly if it is defined through an algorithm or a formula with which a computer can be
programmed respectively, as when it has to be implemented with an analog circuit. On the other
hand, a clearly higher integration of circuits is possible in digital engineering, so that several
controllers can be accommodated in the smallest space. And finally, by dividing the computing time it
is even possible -if the computing capacity is sufficiently large- to use a single computer as
controlling elements of several control loops.
To make digital processing of the variables possible, the reference variable as well as the feedback
variable have to first be converted in an analog-digital converter (ADC) into digital variables. These
are then subtracted from each other by a digital comparing element, and the difference is transferred
to the digital controlling element. Its controller output variable is then converted again in a digitalanalog converter (DAC) into an analog variable. The unit consisting of converters, comparing
element, and controlling element appears to the outside like an analog controller.
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 29 of 64
Module
B3
Control Engineering with STEP 7
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. Quality criteria for digital computers are:
It indicates how fine the continuous value range is digitally rasterized. The resolution has to be
selected of a size that no resolutions important to the controller are lost. .
This is the frequency with which the analog values pending at the converter are measured and
digitalized. This has to be high enough that the controller can still respond in time if the controlled
variable suddenly changes.
In clock cycles, every digital computer processes differently than the analog computer. The speed of
the computer used has to be high enough that during a clock cycle (during which the output value is
calculated, and no input value is scanned), the controlled variable can not change significantly.
The quality of the digital controller has to be high enough so that toward the outside, it responds
comparably prompt and precise, like an analog controller does.
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 30 of 64
Module
B3
Control Engineering with STEP 7
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 31 of 64
Module
B3
Control Engineering with STEP 7
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.
If the controller is switched on, the setpoint and actual value are entered, and the calculations for
switching hysteresis, differential and the lower operating point are made.
Then, another scan follows: whether the actual value is below the low operating point.
If this is the case, the controller output is switched on, and a jump is made to the end of the program.
If this is not the case, the high operating point is calculated, and a scan is made whether the actual
value is above the high operating point.
Then, again a jump is made to the end of the program.
Controller switched off?
YES
NO
Outputs
and
Flags
setpoint w
Normalize
Clear
or
Reset
NO
Pump ON
NO
Pump OFF
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 32 of 64
Module
B3
Control Engineering with STEP 7
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
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.0
Pump
Display_ON
A
A
Analog
FC1
Two Pos.Controller FC2
0.0
1.0
Exercise:
Create a project with hardware configuration for a CPU314C-2 DP (refer to Module A05) and change
the addresses according to the assignment list shown above.
There, create a program in an FC1 with the following functionality:
- The analog value for the process variable Level is to be entered, and normalized to the physical
variable "Liter. The normalized value is made available in MD20 as a floating point number.
Note: If the level is 10 liters, the level sensor returns 0V, for 100 liters 10V.
- The analog value for the setpoint is to be entered, and made available normalized as floating point
number in MD24.
Save FC1.
Then, set up the two position controller in an FC2, based on the structogram provided above.
Call FC1 for inputting the setpoint and the actual value.
Save FC2 and call it in OB1. Save OB1 and load the entire station to the PLC.
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 33 of 64
Module
B3
Control Engineering with STEP 7
"AI_Level_Actual_Norm
Network 2:
t i t L
"AI_Level_Setp_Norm
****************************************************************************************************************
Two Position Contoller
Network 1: Controller switched on?? If off, then jump to label "Off
"Start
"Controller_On
"Stop
"Controller_On
"Controller_On
"Ind_ON
exit
Network 2: Call subroutine: enter and normalize analog values
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 34 of 64
Module
B3
Control Engineering with STEP 7
Network 4:
Network 5:
Network 6:
"AI_Fill_Actual_Norm
"Pump
Network 7:
Network 8:
"AI_Level_Actual_Norm
"Pump
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 35 of 64
Module
B3
Control Engineering with STEP 7
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:
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 36 of 64
Module
B3
Control Engineering with STEP 7
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. (refer to the description of the controlled system).
Thus, the PLC is the controller, and is connected to the controlled system by means of analog inputs
and outputs.
The block (S)FB 41 in the PLC SIMATIC S7-300 is used in this task as a continuous digital software
controller. It is to solve the control problem as follows: an analog manipulated variable y is read out
depending on the respective setpoint/actual value w-x. The manipulated variable y is generated
according to the PID algorithm.
The following control parameters can be specified:
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 37 of 64
Module
B3
Control Engineering with STEP 7
Assignment List:
Symbol:
AI_w
AI_X
Address:
PEW 128
PEW 130
Comment
Analog input setpoint generator 010V
Analog input sensor actual value 010V
AO_Y
PAW 128
M_w
MD40
Controller Output y
Stellgre y
Regelstrecke
Controlled
System
Final Control
Stellglied
Element
Generation
Bildung
of
der
Process
Prozess
Control
Function
Regelfunktion
System
Deviatione e==w-x
w-x
Regeldifferenz
Setp./Actual
Value
Soll-IstwertComparison
Vergleich
Contr.
Variablexx
Regelgre
Measuring
Sensor
Messgeber
Transducer
Messumformer
Setpoint Generator
Sollwertgeber
Setpoint
SollwertInt
Int
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 38 of 64
Module
B3
Control Engineering with STEP 7
Setpoint branch
Actual value branch
System deviation generation
PID algorithm
Manual value processing
Manipulated value processing
Feedforward control
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 39 of 64
Module
B3
Control Engineering with STEP 7
The user has to perform the steps below in order to configure the hardware as well as to generate an
S7 program with the functionality of a PID controller, and then load it to a PLC:
1.
2.
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 40 of 64
Module
B3
Control Engineering with STEP 7
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.
Insert the SIMATIC 300 station ( Insert Station SIMATIC 300 Station)
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 41 of 64
Module
B3
Control Engineering with STEP 7
5.
Click on
'SIMATIC 300
Station(1)'
6.
Open configuring tool for the hardware configuration ( Edit Open object)
Click on 'Open
object
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 42 of 64
Module
B3
Control Engineering with STEP 7
7.
Click on the
symbol for 'HW
catalog
8.
Click on 'Mounting
channel'
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 43 of 64
Module
B3
Control Engineering with STEP 7
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.
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 44 of 64
Module
B3
Control Engineering with STEP 7
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 'Blocks'
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 45 of 64
Module
B3
Control Engineering with STEP 7
Click on 'Organization
block
Note:
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 46 of 64
Module
B3
Control Engineering with STEP 7
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
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 47 of 64
Module
B3
Control Engineering with STEP 7
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.
Note: Comments on program documentation are separated from the program commands by the
character sequence//.
Open new
network
The network
Call SFB41,DB41
calls the PID controller block SFB41 together with an instance DB.
Generate instance DB ( Yes)
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 48 of 64
Module
B3
Control Engineering with STEP 7
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.
Has to be normalized to a real format
(refer to NW 2)
PV PER
Actual value
acceptance to
analog input
channel
LMN PER:
Manipulated variable
output at analog
output
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 49 of 64
Module
B3
Control Engineering with STEP 7
19. In SIMATIC Manager, highlight block DB41 and load to the PLC. (CPUs key switch is on
Stop!)
Click on symbol Load to
PLC
Click on DB41
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 50 of 64
Module
B3
Control Engineering with STEP 7
20. Call the tool Assign parameters to the PID control ( Start Simatic STEP 7
Parameterize PID Control)
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 51 of 64
Module
B3
Control Engineering with STEP 7
DB 41 auswhlen
Click on OK
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 52 of 64
Module
B3
Control Engineering with STEP 7
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
23. With the curve plotter, the curves for setpoint, actual value and manipulated variable can be
recorded.
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 53 of 64
Module
B3
Control Engineering with STEP 7
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.
The rules for controller adjustment that are described below were found experimentally, by using
analog computer simulations.
P-TN systems can be described with sufficient accuracy with a so-called Tu-Tg approximation; that
means, through approximation by means of a P-T1-TL system.
Starting point is the system step response with the input step height K. The necessary parameters:
transfer coefficient of the system KS, delay Tu and transition time Tg are ascertained as shown in the
figure below.
This requires measuring the transition function up to the stationary upper range value (K*Ks), so that
the transfer coefficient for system KS, required for the calculation, can be determined.
The essential advantage of these methods is that the approximation can also be used if the system
can not be described analytically.
x/%
K*KS
Turning
Point
Wendepunkt
Tu
Figure:
Preface
Issued: 02/2008
t/sec
Tu-Tg Approximation
Fundamentals
T I A Training Document
Tg
Appendix
Page 54 of 64
Module
B3
Control Engineering with STEP 7
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.3 Setting the PID Controller according to Chien, Hrones and Reswick
For this method, the response to setpoint characteristics as well as disturbance characteristics was
examined, in order to get the most favorable controller parameters. Different values resulted for
both cases.
aperiodischer
EinschwingApriodical
transient
reaction
vorgang
mit krzester
with
the shortest
period Dauer
20%
overshoot
20%
berschwingen
Minimum
period
of oscillation r
minimale
Schwingungsdaue
Tg
KPR = 0.6
0,6
Tg
KPR = 0,7
0.7
KSTu
K ST u
TN = 2.3
2,3 Tu
TN = 4 T u
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 55 of 64
Module
B3
Control Engineering with STEP 7
aperiodischer
Einschwing
Apriodical
transient
reaction mit krzeste
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.2
1,2 Tg
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Tg
TN = Tg
Appendix
Page 56 of 64
Module
B3
Control Engineering with STEP 7
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:
0.000000e+000
UN
I 124.0
//Negation of S1 (I 124.0)
SPB
M001
1.000000e+002
MD 20
Now, for the switch position S1(I 124.0) ON, the manipulated variable y = 100%, and for OFF, the
manipulated variable y = 0%. Consequently, a step of the manipulated value from 0 to 100% can be
brought about with Switch S1. (For systems that tend to overshoot, the high manipulated value
should amount to 90% or less.).
The external analog values and the manipulated value are assigned in OB1 as follows:
MAN
:=
MD 20
PV_PER
:=
PEW 130
//Actual value x
LMN_PER
:=
PAW 128
//Manipulated variable y
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 57 of 64
Module
B3
Control Engineering with STEP 7
Network 1: Call
PID Controller
Preface
Network 2:
Network 3:
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 58 of 64
Module
B3
Control Engineering with STEP 7
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
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.
The following controller parameters result with the values Tu-Tg approximation, and the rules for
controller adjustment according to Ziegler-Nichols:
KPR = 9
TN = 2.3s
These controller parameters are transferred to DB41.
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 59 of 64
Module
B3
Control Engineering with STEP 7
6. APPENDIX
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 60 of 64
Module
B3
Control Engineering with STEP 7
Input Parameters
Parameter
Preface
Value Range
Default
Description
COM_RST
BOOL
FALSE
MAN_ON
BOOL
TRUE
PVPER_ON
BOOL
FALSE
P_SEL
BOOL
TRUE
I_SEL
BOOL
TRUE
INT_HOLD
BOOL
FALSE
INTEGRAL ACTION HOLD / Freeze Icomponent. The output of the integrator can be
frozen. To this end, the input "Freeze Icomponent is set.
I_ITL_ON
BOOL
FALSE
D_SEL
BOOL
FALSE
Fundamentals
T I A Training Document
Issued: 02/2008
Data
Type
Appendix
Page 61 of 64
Module
B3
Control Engineering with STEP 7
Parameter
Preface
Default
Description
CYCLE
TIME
>= 1 ms
T#1s
SP_INT
REAL
-100.0...+100.0%
0.0
PV_IN
REAL
-100.0...+100.0%
0.0
PV_PER
WORD
MAN
REAL
GAIN
REAL
TI
TIME
>= CYCLE
T#20s
TD
TIME
>= CYCLE
T#10s
TM_LAG
TIME
>=CYCLE/2
T#2s
DEADB_W
REAL
>=0.0 %
0.0
Fundamentals
T I A Training Document
Issued: 02/2008
W#16#0000
-100.0...+100.0%
0.0
2.0
Appendix
Page 62 of 64
Module
B3
Control Engineering with STEP 7
Parameter
Preface
Default
Description
LMN_HLM
REAL
LMN_LLM...
+100.0 % or
phys. variable 2
100.0
LMN_LLM
REAL
-100.0...
LMN_HLM %
phys. variable 2
0.0
PV_FAC
REAL
1.0
PV_OFF
REAL
0.0
LMN_FAC
REAL
1.0
LMN_OFF
REAL
0.0
I_ITLVAL
REAL
-100.0...+100.0% or
phys. variable 2
0.0
DISV
REAL
-100.0...+100.0% or
phys. variable 2
0.0
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 63 of 64
Module
B3
Control Engineering with STEP 7
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
LMN_D
REAL
0.0
PV
REAL
0.0
ER
REAL
0.0
Preface
Fundamentals
T I A Training Document
Issued: 02/2008
Appendix
Page 64 of 64
Module
B3
Control Engineering with STEP 7