Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 1 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
Training Manual for Integrated Automation
Solutions
Totally Integrated Automation (TIA)
MODULE M6
Control Engineering
using the
SIMATIC S7-1200 with TIA Portal V10
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 2 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
This manual was prepared for training purposes by Siemens AG for the project Siemens Automation Cooperates with Education (SCE). Siemens AG does not guarantee the contents of this document. Passing on this document as well as copying it, using and communicating its contents is permitted within public training and continued education facilities. Exceptions require the written permission by Siemens AG (Michael Knust [email protected]). Violators are held liable to pay damages. All rights -including translation- reserved, particularly if a patent is granted, or a utility model or design is registered. We wish to thank the Michael Dziallas Engineering corporation and the instructors of vocational schools as well as all those who provided support during the preparation of this manual.
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 3 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
Page
1. Preface .......................................................................................................................................................5 2. Notes on Programming the SIMATIC S7-1200 ..........................................................................................7
2.1 Automation System SIMATIC S7-1200 ......................................................................................................7 2.2 Programming Software STEP 7 Basic V10.5 (TIA Portal V10.5) ...............................................................7
3. Fundamentals of Closed Loop Control .......................................................................................................8 3.1 Closed Loop Control Tasks ........................................................................................................................8 3.2 Components of a Control Loop...................................................................................................................9 3.3 Step Function for Examining Controlled Systems ....................................................................................12 3.4 Controlled Systems with Compensation ...................................................................................................13
3.4.1 Proportional Controlled System without Delay.................................................................................13 3.4.2 Proportional Controlled System without Delay.................................................................................14 3.4.3 Proportional Controlled System with Two Delays ............................................................................15 3.4.4 Proportional Controlled System with n Delays .................................................................................16
3.5 Controlled Systems without Compensation ..............................................................................................17 3.6 Basic Continuous Action Controller Types ...............................................................................................18
3.6.1 Proportional Controller (P-Controller) ..............................................................................................19 3.6.2 Integral Controller (I-Controller) .......................................................................................................21 3.6.3 PI-Controller .....................................................................................................................................22 3.6.4 Differential Controller (D-Controller) ................................................................................................23 3.6.5 PID Controller...................................................................................................................................23
3.7 Objectives of Control System Setting .......................................................................................................24 3.8 Settings for Controlled Systems ...............................................................................................................26
3.8.1 Setting the PI Controller according to Ziegler- Nichols ....................................................................27 3.8.2 Setting the PI Controller according to Chien, Hrones and Reswick.................................................27
3.9 Digital Controllers .....................................................................................................................................29 4. Sample Task: Controlling the Level in a Tank ..........................................................................................31 5. Programming the Level Control for the SIMATIC S7-1200 ......................................................................32
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 4 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
The following symbols serve as a guide through this module:
Information
Installation
Programming
Sample Task
Notes
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 5 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
1. Preface
Regarding its content, Module M6 is part of the instruction unit 'SIMATIC S7- 1200 and TIA Portal’
and describes how a PID controller is programmed with the SIMATIC S7-1200.
Objective
In this module, the reader will learn how to program a PID controller with the SIMATIC S7-1200 using
the programming tool TIA Portal. Module M6 provides the fundamentals and illustrates the steps
involved by using a detailed example.
Preconditions
To successfully work through Module M6, the following knowledge is assumed:
• Knowledge in handling Windows
• Fundamentals of PLC programming with the TIA Portal (for example, Module M1 – 'Startup’
Programming the SIMATIC S7-1200 with TIA Portal V10)
• Blocks for the SIMATIC S7-1200 (for example, Module M2 – Block Types at the
SIMATIC S7-1200)
• Analog value processing with the SIMATIC S7-1200 (for example, Module M5 – Analog Value
Processing with the SIMATIC S7-1200)
Basics of STEP7 Programming
2 to 3 days Modules A
Industrial Fieldbus Systems
2 to 3 days Modules D
Additional Functions of STEP 7 Programming
2 to 3 days Modules B
Process Visualization
2 to 3 days Modules F
Programming Languages
2 to 3 days Modules C
IT Communication with SIMATIC S7
2 to 3 days Modules E
System Simulation
with SIMIT SCE
1 to 2 days Modules G
Frequency Converter
at SIMATIC S7
2 to 3 days Modules H
SIMATIC S7-1200 and TIA Portal
2 to 3 days Modules M
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 6 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
Hardware and software required
1 PC Pentium 4, 1.7 GHz 1 (XP) – 2 (Vista) GB RAM, free disk storage approx. 2 GB;
operating system Windows XP (Home SP3, Professional SP3)/Windows Vista (Home
Premium SP1, Business SP1, Ultimate SP1)
2 Software STEP7 Basic V10.5 SP2 (Totally Integrated Automation (TIA) Portal V10.5)
3 Ethernet connection between PC and CPU 1214C
4 PLC SIMATIC S7-1200 with at least one analog value input and one analog value output and
one analog value output; for example, CPU 1214C with signal board AO1 x 12Bit. The analog
input as well as the analog output have to have connections so that a controlled system can be
connected.
1 PC
2 STEP7 Basic
(TIA Portal)
4 S7-1200 with
CPU 1214C
3 Ethernet connection Verbindung
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 7 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
2. Notes on Programming the SIMATIC S7-1200
2.1 Automation System SIMATIC S7-1200
The automation system SIMATIC S7-1200 is a modular mini-control system for the lower
performance range.
There is a comprehensive module spectrum for optimized adaptation to the automation task.
The S7 control system consists of a CPU that is equipped with inputs and outputs for digital and
analog signals.
Additional input and output modules (IO modules) can be installed if the integrated inputs and outputs
are not sufficient for the desired application.
If needed, communication processors for RS232 or RS485 are added.
An integrated TCP/IP interface is obligatory for all CPUs.
With the S7 program, the PLC monitors and controls a machine or a process.
The IO modules are polled in the S7 program by means of the input addresses (%I) and addressed
by means of output addresses (%Q) <<?>>.
The system is programmed with the software STEP 7 Basic V10.5.
2.2 Programming Software STEP 7 Basic V10.5 (TIA Portal V10.5)
The software STEP 7 Basic V10.5 is the programming tool for the automation system
- SIMATIC S7-1200
With STEP 7 Basic V10.5, the following functions can be utilized for automating a system:
- Configuring and parameterizing the hardware
- Specifying the communication
- Programming
- Test, commissioning and service with the start/diagnostic functions
- Documentation
- Generating visual displays for the SIMATIC basic panels
All functions are supported with detailed online help.
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 8 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
3. Fundamentals of Closed Loop Control
3.1 Closed Loop Control Tasks
"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 generates a
sequence of effects that takes place in a closed loop -the control loop- because the process runs
based on measurements of a variable that is influenced in turn by itself.“
This variable that is to be controlled is measured continuously and compared with another specified
variable of the same type. Depending on the result of this comparison, an adaptation of the variable
to be controlled to the value of the specified variable is performed by the control process.
Diagrammatic Representation of a Closed Loop Control
Comparing element
Controlling Element
Setter Actuator + controlled system
Measuring device
Setpoint temperature
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 9 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
3.2 Components of a Control Loop
Below, the most fundamental terms of closed loop control are explained.
First, an overview based on a diagrammatic representation is provided:
1. Controlled Variable x
Controlled variable x is the actual “objective“ of the closed loop control. That means, it is the purpose
of the entire system to influence this variable or to keep it constant. In our example, this would be the
room temperature. The momentary value of the controlled variable existing at a certain point in time
is called "actual value“ at that point in time.
2. Feedback Variable r
In a controlled loop, the controlled variable is constantly checked in order to respond to unintentional
changes. The measured variable proportional to the controlled variable is called feedback variable.
In the example "Heating“, it would correspond to the measuring circuit voltage of the inside
thermometer.
Loop Controller
Comparing element
Controlling element
Setter Final controlling element
Controlled
system
Measuring device
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 10 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
4. Influencing Quantity z
The influencing quantity is the variable that unintentionally influences the controlled variable and
moves it away from the current setpoint. In the case of a fixed setpoint control it is necessary
because of the existence of the influencing quantity. In the heating system we will be considering, this
would be, for example, the outside temperature or any other variable through which the room
temperature moves away from its ideal value.
5. Setpoint w
The setpoint at a point in time is the value that the controlled variable should adopt at this point in
time. It should be noted that the setpoint value can continuously change under certain circumstances
in the case of a slave value control. The measured value that would be ascertained by the measuring
device used -if the controlled variable were exactly equal to the setpoint- is the momentary value of
the reference variable. In the example, the setpoint would be the room temperature desired at the
moment.
6. Comparing Element
This is the point where the current measured value of the controlled variable and the momentary
value of the reference variable are compared. In most cases, these two variables are measured
circuit voltages. The difference of the two variables if the “control deviation“ e. It is passed on to the
controlling element and evaluated there (see below).
7. Controlling Element
The controlling element is the actual center piece of the closed loop control. It evaluates the control
deviation -that is, the information whether, how and to what extent the controlled variable deviates
from the current setpoint- as input variable, and derives from it the
"controller output balance“ YR, through which the controlled variable is ultimately influenced. In the
example of the heating system, the controller output balance would be the voltage for the mixer
motor.
The manner in which the controlling element determines the controller output balance from the
system deviation is the controller’s main criterion.
In Part II, this topic is discussed in detail.
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 11 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
8. Setter
The setter is the controller’s “executing agent“ so to speak. In the form of the controller output
balance, the controlling element provides information as to how the controlled variable is to be
influenced, and converts it into a change of the "manipulated variable“. In our example, the setter
would be the mixer motor. Depending on the voltage supplied by the controlling element (that is, the
controller output balance), it influences the position of the mixer (which here represents the
manipulated variable).
9. Final Controlling Element
This is the element of the control loop that -in dependence of the manipulated variable Y- influences
the controlled variable (more or less directly). In our example, this would be the combination of
mixer, heating system lines, and heaters. The mixer (manipulated variable) is set by the mixer motor
(setter) and by means of the water temperature influences the room temperature.
10. Controlled System
The controlled system is the system where the variable to be controlled is located; with respect to the
radiator the living room.
11. Delay
Delay refers to the time that passes starting with the change of the controller output balance until a
measurable reaction by the controlled system. In our example, this would be the time between a
voltage change for the mixer motor and a measurable change in the room temperature caused by
this.
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 12 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
3.3 Step Function for Examining Controlled Systems
To examine the performance 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 controlled variable x(t), the
manipulated variable y(t), the reference input variable w(t) or the influencing quantity z(t). For this
reason, the input signal, the step function, is often designated as
xe(t) and the output signal as xa(t).
for t < 0 for t ≥ 0
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 13 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
3.4 Controlled Systems with Compensation
3.4.1 Proportional Controlled System without Delay
The controlled system is called P-system for short
abrupt change of the input variable at
Controlled variable/manipulated variable:
Proportional coefficient for a manipulated variable change:
Controlled variable/influencing variable:
Proportional value for an influencing variable change
Range: Control range:
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 14 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
3.4.2 Proportional Controlled System without Delay
The controlled system is called P-T1 system for short.
Differential equation for a general input signal
The solution of the differential equation for a step function at the input (step response):
Time constant
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 15 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
3.4.3 Proportional Controlled System with Two Delays
The controlled system is called P-T2 system for short.
Figure: Step Response of the P-T2 System
Tu: Delay time Tg: Buildup time <<?>>
The system consists of the reaction-free series connection of two P-T1 systems that have the time
constants TS1 and TS2.
Controllability of P-Tn systems:
With the increasing ratio Tu/Tg, it becomes more and more difficult to control the system.
easily controllable
still controllable
difficult to control
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 16 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
3.4.4 Proportional Controlled System with n Delays
The controlled system is called P-Tn system for short.
The time response is described with a differential equation of the nth order.
The characteristic of the step response is similar to that of the P-T2 system. The time response is
described with Tu and Tg.
Substitute: The controlled system with many delays can be replaced approximately with the series
connection of a P-T1 system with a dead time system.
The following applies: Tt » Tu and TS » Tg.
Substitute step response for the P-Tn system
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 17 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
3.5 Controlled Systems without Compensation
After a disturbance, the controlled variable continues to grow without trying to reach a fixed final
value.
Example: Level control
A container with a drain whose inflow and outflow volume stream is of equal size maintains a
constant level. If the through-flow of the inflow or the outflow changes, the liquid level rises or falls.
The larger the difference between inflow and outflow, the faster the level changes.
The example shows that in practice, the integral action usually has a limit. The controlled variable
rises or falls only so long until it has reached a system dependent limit: the container overflows or is
empty, the pressure reaches the system maximum or minimum, etc..
The figure below shows the response of an I-system with respect to time if the input variable changes
abruptly, and the block diagram derived from this:
If at the input, the step function transitions to any function xe(t), the following happens:
*Figure excerpted from SAMSON Technical Information -L102 – Controllers and Controlled Systems, Edition: August 2000
(http://www.samson.de/pdf_de/l102de.pdf)
Block diagram
integrating controlled system
Integral coefficient of the controlled system
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 18 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
3.6 Basic Continuous Action Controller Types
The discrete controllers discussed above have, as mentioned, the advantage of being simple. The
controller itself as well as the setter and the final controlling element are of a simple nature and thus
less expensive than continuous action controllers. However, discrete controllers have a number of
disadvantages. For example: if large loads such as large electric motors or coolers have to be
switched, high load peaks can occur that may overload the power supply. For this reason, we often
don’t switch between “Off“ and “On“, but between full (“full load“) and the considerably less
performance of the setter or the final controlling element (“basic load“).
But even with these improvements, a continuous action <<should be ‘discrete’?>> controller is unsuitable
for numerous applications. Imagine a car engine whose speed is controlled discretely. There would
be nothing between idle and full throttle. Aside from probably being impossible to transfer the power,
at sudden full throttle suitably via the tires onto the road, such a car would be quite unsuitable for
street traffic.
For that reason, continuous action controllers are used for such applications. In this case,
theoretically there are barely any limits to the mathematical correlation that the controlling element
establishes between the system deviation and the controller outputbalance. However, in practice we
differentiate three classical basic types that are discussed in detail below.
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 19 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
3.6.1 Proportional Controller (P-Controller)
In the case of P-controllers, the manipulated variable y is always proportional to the recorded
system deviation (y ~ e). The result is that a P-controller reacts without a delay to a deviation and
generates a manipulated variable only if the deviation e is present.
The proportional pressure regulator sketched in the figure below compares the power FS of the
setpoint spring with the power FB that the pressure p2 generates in the spring-elastic metal bellows.
If the forces are off balance, the lever rotates around the pivot point D. The valve position ñ changes
and accordingly the pressure p2 to be regulated until a new balance of forces is established.
The behavior of the P-controller if a system deviation suddenly occurs is shown in the figure below.
The amplitude of the manipulated variable jump y depends on the level of the deviation e
and the amount of the proportional coefficient Kp:
To keep the deviation low, a proportionality factor as large as possible has to be selected. Increasing
the factor causes the controller to respond faster. However, a value that is too high may cause
overshooting and a large hunting tendency on the part of the controller.
* Figure excerpted from SAMSON Technical Information - L102 – Controllers and Controlled Systems, Edition: August 2000 (http://www.samson.de/pdf_de/l102de.pdf)
Metal bellows
Setpoint spring
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 20 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
The diagram below shows the behavior of the P-controller:
The advantages of
this type of controller consist on the one hand of its simplicity (electronic implementation can, in the
simplest case, consist of merely a resistor), and on the other hand its prompt response in comparison
to other controller types. The main disadvantage of the P-controller is the continuous deviation; the
setpoint is never completely attained, even long term. This disadvantage as well as the not yet ideal
response speed can be minimized only insufficiently with a larger proportionality factor, since
otherwise the controller will overshoot –which means, it will overreact as it were. In the most
unfavorable case, the controller will enter a state of continuous oscillation. This causes the controlled
variable to be periodically moved away from the setpoint, not by the influencing variable but by the
controller.
The problem of continuous deviation is solved best with an integral controller.
Controlled variable
Setpoint Actual value
Deviation
Time
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 21 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
3.6.2 Integral Controller (I-Controller)
Integrating controllers are used to completely correct system deviations at each operating point.
As long as the deviation is unequal to zero, the amount of the manipulated variable changes. Only
when the reference variable and the controlled variable are of equal size -at the latest, however,
when the manipulated variable reaches its system-dependent limit (Umax, Pmax etc.)- is the control
system in a steady state <<?>>.
The mathematical formulation of this integral behavior is as follows:
The manipulated variable is proportional to the time integral of the system deviation e:
How fast the manipulated variable rises (or falls) depends on the deviation and the integration time.
* Figure excerpted from SAMSON Technical Information - L102 – Controllers and Controlled Systems, Edition: August 2000 (http://www.samson.de/pdf_de/l102de.pdf)
with:
Block diagram
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 22 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
3.6.3 PI-Controller
The PI-controller is a type often used in practice. It results from connecting a P-controller and an I-
controller in parallel. When laid out correctly it unites the advantages of both controller types (stable
and fast, no permanent system deviation), so that their disadvantages are compensated at the same
time.
The behavior with respect to time is identified by the proportional coefficient Kp
and the reset time Tn. Because of the proportional component, the manipulated variable responds
immediately to every system deviation e, while the integral component takes effect only in the course
of time. Tn represents the time that passes until the I-component generates the same amplitude of
flow as occurs immediately because of the P-component (Kp). As in the case of the I-controller, the
reset time Tn has to be decreased if we want to increase the integral component.
Controller Layout
Depending on Kp and Tn dimensioning, the overshoot of the controlled variable can be decreased at
the expense of the dynamic response of the control system.
Applications for the PI-controller: fast control loops that don’t permit permanent system deviation.
Examples: pressure, temperature and ratio controls.
* Figure excerpted from SAMSON Technical Information - L102 – Controllers and Controlled Systems, Edition: August: 2000 (http://www.samson.de/pdf_de/l102de.pdf)
Block diagram
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 23 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
3.6.4 Differential Controller (D-Controller)
The D-controller generates its manipulated variable from the rate of change of the system deviation,
and not, as the P-controller, from its amplitude. For that reason, it responds considerably faster than
the P-controller. Even if the deviation is small, it generates -as if it were looking ahead- large
amplitudes of flow as soon as an amplitude change occurs. However, the D-controller does not
detect permanent deviations, because no matter how large it is, its rate of change equals zero. For
that reason, the D-controller is used only rarely by itself in practice. Rather, it is used jointly with other
control elements, usually in connection with a proportional component.
3.6.5 PID Controller
If we expand the PI controller with a D-component, the universal PID controller is enhanced. As in the
case of the PD controller, adding the D-component has the effect that, if laid out correctly, the
controlled variable reaches its setpoint sooner and its steady state <<?>> faster.
* Figure excerpted from SAMSON Technical Information - L102 – Controllers and Controlled Systems, Edition: August: 2000 (http://www.samson.de/pdf_de/l102de.pdf)
Block diagram
with
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 24 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
3.7 Objectives of Control System Setting
For the control result to be satisfactory, selecting a suitable controller is an important aspect.
However, even more important is setting the suitable controller parameters Kp, Tn and Tv, that have
to be adjusted to the controlled system behavior. Usually, we have to compromise between a very
stable but slow control system or a very dynamic, more unsettled control performance which under
certain circumstances has a tendency to oscillate and can become unstable.
In the case of non-linear systems that are always to process at the same operating point
-such as fixed setpoint control- the controller parameters have to be adjusted to the controlled system
behavior at this working point. If, as in the case of servo controls ñ, a fixed working point can not be
defined, a controller setting has to be found that supplies a sufficiently fast and stable control result
over the entire working range.
In practice, controllers are usually set based on values arrived at through experience.
If these are not available, the controlled system behavior has to be analyzed exactly, in order to
subsequently -with the aid of theoretical or practical layout procedures- specify suitable controller
parameters.
One option to specify this is the oscillation test according to the Ziegler-Nichols method. It provides a
simple layout that is suitable to many cases. However, this setting procedure can be used only for
controlled systems that permit making the controlled variable oscillate automatically. The following
has to be done is this case:
- At the controller, set Kp and Tv to the lowest value, and Tn to the highest value
(least possible effect of the controller).
- Take the controlled system manually to the desired operating point (start controller)
- Set the manipulated variable to the value specified manually, and switch to the automatic mode.
- Increase Kp (decrease Xp) until harmonic oscillations of the controlled variable are recognized. If
possible, the control loop is to be stimulated to oscillate during the Kp reset with the aid of small
sudden setpoint changes.
* Figure excerpted from SAMSON Technical Information - L102 – Controllers and Controlled Systems, Edition: August: 2000 (http://www.samson.de/pdf_de/l102de.pdf)
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 25 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
- Make a note of the Kp value that was set as critical proportional coefficient Kp,krit.
- Determine the duration of an entire oscillation as Tkrit, possibly with a stop watch while
generating the arithmetical average over several oscillations.
- Multiply the values of Kp,krit and Tkrit with the multipliers according to the table below, and set the
values for Kp, Tn and Tv determined in this way at the controller.
* Figure excerpted from SAMSON Technical Information - L102 – Controllers and Controlled Systems, Edition: August: 2000 (http://www.samson.de/pdf_de/l102de.pdf)
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 26 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
3.8 Settings for Controlled Systems
Setting the controlled systems is performed based on the example of a PT2 system.
Tu-Tg Approximation
The basis for the methods according to Ziegler-Nichols and according to Chien, Hrones and Reswick
is the Tu-Tg approximation where, from the system step response, the following parameters are
determined: transfer-coefficient of the controlled system KS, delay time Tu and buildup time Tg.
The rules for the settings that are described below were found experimentally by using analog
computer simulations.
It is possible to describe P-TN systems with sufficient accuracy by using a so-called Tu-Tg
approximation; that is, through approximation by using a P-T1-TL system.
The starting point is the system step response with the input step height K. The required parameters:
transfer-coefficient of the controlled system KS, delay time Tu and buildup time Tg are ascertained as
shown in the figure below.
It is necessary to measure the transition function up to the stationary upper range value (K*Ks) so
that the transfer coefficient of the system KS needed for the calculation can be determined.
The essential advantage of this method is that the approximation can be used also if the controlled
system can not be described analytically.
Figure: Tu-Tg Approximation
Wendepunkt
K*KS
Tg Tu t/sec
x / %
Turning point
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 27 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
3.8.1 Setting the PI Controller according to Ziegler- Nichols
By examining P-T1-TL systems, Ziegler and Nichols discovered the following optimum controller
settings for fixed value control:
KSTu
Tg KPR = 0,9
TN = 3,33 Tu
These settings provide in general quite good disturbance characteristics. [7]
3.8.2 Setting the PI Controller according to Chien, Hrones and Reswick
Regarding this method, the response to setpoint changes as well as the disturbance characteristics
were examined in order to obtain the most favorable parameters. For both cases, different values
result. In addition, two different settings respectively are specified that meet different requirements
for the control quality.
The following settings resulted:
• For disturbance characteristics:
KSTu
Tg KPR = 0,6
TN = 4 Tu
Apriodic transient reaction with the shortest duration
KSTu
Tg KPR = 0,7
TN = 2,3 Tu
20% overshoot Minimum period of oscillation
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 28 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
• For response to setpoint changes:
KSTu
Tg KPR = 0,35
TN = 1,2 Tg
Aperiodic transient reaction with the shortest duration
KSTu
Tg KPR = 0,6
TN = Tg
20% overshoot Minimum period of oscillation
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 29 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
3.9 Digital Controllers
So far, we have primarily discussed analog controllers; i.e., such controllers that derive from the
system deviation -present as analog value- the controller output balance by using the analog method
also. The schematic of such a control loop has become known in the meantime:
However, often it is of advantage to carry out the actual evaluation of the system deviation in the
digital mode. On the one hand, the relationship between system deviation and controller output
balance can be specified much more flexibly if it is defined with an algorithm or a formula with which
a computer can be programmed respectively, rather than having to implement it in the form of an
analog circuit <<?>>. On the other hand, a clearly higher integration of the circuits is possible in digital
engineering, so that several controllers can be accommodated in the smallest space. And finally, by
distributing computing time -if there is sufficient computing capacity- it is even possible to use a single
computer as controlling element of several control loops.
To make digital processing of variables possible, the reference input variable as well as the feedback
variable are first converted in an analog/digital converter (ADC) into digital variables. Then, a digital
comparing element subtracts them from each other, and the difference is transferred to the digital
controlling element. Its controller output balance is then converted again -in a digital/analog
converter (DAC)- into an analog variable. That is, the entity consisting of converters, comparing
element and controlling element appears to the outside like an analog controller.
Comparing element
Analog controller
System
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 30 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
Let’s look at the configuration of a digital controller using a diagram:
In addition to the advantages of the controller’s digital conversion, it also has its problems. For that
reason, some variables in reference to the digital controller have to be selected sufficiently large so
that the accuracy of the controller is not impaired too much. Quality criteria for digital computers are
as follows:
• The quantization resolution of the digital/analog converters.
It indicates how fine the steady value range is digitally rasterized. The resolution has to be selected
large enough so that no resolutions that are important to the controller are lost.
• The sampling rate of the analog/digital converters
This refers to the frequency with which the analog values pending at the converter are measured and
digitized. It has to be high enough so that the controller can respond in time also to sudden changes
of the controlled variable.
• The cycle time.
Every digital computer processes differently than an analog controller in clock cycles.
The speed of the computer used has to be high enough so that during a clock cycle (during which the
output value is calculated and no input value is polled), no significant change of the controlled
variable can occur.
The quality of the digital controller has to be high enough so that toward the outside it responds
comparably prompt and precise as an analog controller does.
ADC Comparing element
Digital Controller
DAC System
ADC
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 31 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
4. Sample Task: Controlling the Level in a Tank
For our program, we are programming a level control.
A sensor measures the level of a tank and converts it into a voltage signal 0 to 10V.
In our case, 0V corresponds to a level of 0 liters and 10V to a level of 1000 liters.
The sensor is connected to the first analog input of the SIMATIC S7-1200.
This level is now to be regulated alternatively to be 0 liters (S1 == 0) or 700 liters (S1 == 1).
To this end, a controller "PID_Compact“ integrated in STEP 7 Basic V10.5 is used. This PID
controller in turn controls a pump as manipulated variable via 0 to 10V.
Assignment list:
Address Symbol Data Type Comment
%IW 64 X_Level_tank1 Int Analog input actual value level Tank1
%OW 80 Y_Level_tank1 Int Analog output manipulated value Pump1
%I 0.0 S1 Bool Setpoint step change 0 (0) or 700 liters (1)
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 32 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
5. Programming the Level Control for the SIMATIC S7-1200
Project management and programming is carried out with the software 'Totally Integrated
Automation Portal’.
Here, under a uniform interface, components such as the controller, visual display and networking of
the automation solution are set up, parameterized and programmed. Online tools are available for
error diagnosis.
With the steps below, a project can be set up for the SIMATIC S7-1200, and the solution of the task
can be programmed:
1. The central tool is the 'Totally Integrated Automation Portal’ that is called here with a double
click (→ Totally Integrated Automation Portal V10)
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 33 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
2. Programs for the SIMATIC S7-1200 are managed in projects. Such a project is now set up in the
portal view (→ Create new project → Tank_PID → Create)
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 34 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
3. Now ’First steps’ for the configuration are recommended. First, we are going to ’Configure a
device’ (→ First steps → Configure a device)
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 35 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
4. Then, we ’Add a new device’ with the ’Device name Control_Tank’. To this end, we select
from the catalog the ’CPU1214C’ with the matching order number (→ Add new device →
Control_Tank → CPU1214C → 6ES7 ……. → Add)
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 36 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
5. The software now changes automatically to the project view with the opened hardware
configuration. Here, additional modules can be added from the hardware catalog (on the right!).
Using drag&drop, we insert from the catalog the signal board for an analog output (→ Catalog →
Signal board → AO1 x 12Bit → 6ES7 232-…)
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 37 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
6. In the ’Device overview’, it is possible to set the addresses of the inputs and outputs. Here, the
integrated analog inputs of the CPU have the addresses %IW64 to %IW66, and the integrated digital
inputs the addresses %I0.0 to %E1.3. The address of the analog output on the signal board is OW80
(→ Device view → AO1 x 12Bit → 80…81)
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 38 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
7. For the software to later access the correct CPU, its IP address and the subnet mask have to be
set (→ Properties → General → PROFINET interface → Ethernet addresses →IP address:
192.168.0.1 → Subnet mask: 255.255.255.0)
(Refer also to: Module M01, Chapter 3 for creating the programming interface)
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 39 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
8. Since for modern programming, variables are used instead of absolute addresses, the global
PLC tags have to be specified here.
These global PLC tags are descriptive names with a comment for those inputs and outputs that are
used in the program. Later, during programming, we can access the global PLC tags with this name.
The global variables can be used in the entire program in all blocks.
To this end, select in product navigation ’Control_tank[CPU1214C DC/DC/DC]’ and then ’PLC
tags’. With a double click, open the table ’PLC tags’ and as shown below, enter the names for the
inputs and outputs (→ Control_tank[CPU1214C DC/DC/DC]’ → PLC tags → PLC tags)
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 40 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
9. To create the function block FC1, in project navigation select ’Control_tank[CPU1214C
DC/DC/DC]’ and then ’Program blocks’. Next, double click on ’Add new block’ (→
Control_tank[CPU1214C DC/DC/DC]’ → Program blocks → Add new block)
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 41 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
10. From the selection, select ’Organization block(OB)’ and as type, select ’Cyclic interrupt’.
’FBD’ is specified as programming language. Numbering is automatic (OB200). We leave the fixed
cycle time at 100ms. Accept your input with ’OK’ (→ Organization block(OB) → Cyclic interrupt →
FBD → Cycle time 100 → OK)
Note: The PID controller must be called with a fixed cycle time (here 100ms), since its
processing is critical with respect to time. It would not be possible to optimize the controller if it would
not be called accordingly.
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 42 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
11. The organization block ’Cyclic interrupt’[OB200]’ will be opened automatically. Before the
program can be written, its local variables have to be specified.
For this block type, only one variable is used:
Type Name Function Available in
Temporary local data Temp
Variables that are used to store temporary intermediate results. Temporary data is retained for only one cycle
Functions, function blocks and organization blocks
12. In our example, only the following local variable is needed.
Temp:
w_filling_tank1 Real This variable stores the setpoint for Tank1 as intermediate value.
In this example, it again is important to use the correct data type Real, since otherwise, it will not be
compatible in the following program with the PID controller block used. For the sake of clarity, all
local variables should also be provided with sufficient comments.
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 43 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
13. After we declared the local variables, the program can now be entered by using the variable
names (variables are identified with the symbol '#’). Here, in the first two networks, either the floating
point number 0.0 (S1 == 0) or 700.0 (S1 == 1) is copied to the local variable #w_fuell_tank1 with a
’MOVE’ instruction respectively (→ Instructions → Move → MOVE)
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 44 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
14. The controller block ’PID_Compact’ is moved to the third network. Since this block does not
have multi-instance capability, it has to be assigned a data block as single instance. It is generated
automatically by STEP7. (→ Extended instructions → PID → PID_Compact → OK)
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 45 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
15. Now, connect this block as shown here to the setpoint (local variable #w_fuell_tank1), the actual
value (global variable "X_Fuell_Tank1“) and the manipulated variable (global variable
"Y_Fuell_Tank1“). Then, the configuration mask ' ’ of the controller block can be opened (→
#w_fuell_tank1 → "X_Fuell_Tank1“ → "Y_Fuell_Tank1“ → )
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 46 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
16. Here, we have to perform the ’Basic settings’ such as control mode and the wiring of the
internal controller structure (→ Basic settings → Control mode Volume → l → Actual value
Input_PER(analog) → Manipulated value: Output_PER)
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 47 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
17. For ’Actual value scaling’ we set the measuring range from 0 liters to 1000 liters. The limits
also have to be adjusted (→ Actual value scaling → Scaled high 1000.0 l → high limit 1000.0 l → Low
limit 0.0 l → Scaled low 0.0 l).
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 48 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
18. At the ’Extended settings’ you will find, for example, also ’Input monitoring’ and the manual
setting of the ’PID parameters’. By clicking on the project is saved. (→ Extended
settings → Input monitoring → PID parameters → )
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 49 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
19. To load your entire project into the CPU, first highlight the folder ’Control_tank’ and then click
on the symbol Load into device. (→Control_tank → )
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 50 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
20. If you omitted to specify the PG/PC interface beforehand (refer to Module M1, Chapter 4), a
window is displayed where you can do it now (→ PG/PC interface for loading → Load)
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 51 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
21. Click again on 'Load’. During loading, the status is displayed in a window (→ Load)
22. Successful loading it is displayed in a window. Click on ’Finish’ (→ Finish)
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 52 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
23. Now, start the CPU by clicking on the symbol (→ )
24. Confirm the question whether you actually want to start the CPU with ’OK’ (→ OK)
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 53 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
25. By clicking on the symbol Monitoring on/off, it is possible to monitor the status of the blocks
and the variables during testing.
When the CPU is started initially, the controller ’PID_Compact’ is not yet activated. To activate it, we
start commissioning by clicking on the symbol ' ’ (→ Cyclic interrupt[OB200] → →
PID_Compact → Commissioning)
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 54 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
26. With ’Measuring On’, the setpoint, the actual value and the manipulated variable can be
displayed on an operating screen.
When the controller is loaded initially into the PLC <<?>>, it is still inactive. This means that the
manipulated variable remains at 0%. Now, first select ’Self optimization Initial start’ and then ’Start
self optimization’. (→ Measurement on → Self optimization initial start → Start of self optimization)
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 55 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
27. Now, self optimization starts. In the field ’Status’, the current operational steps and errors that
occur are displayed. The progress bar shows the progress of the current operational step.
Industry Automation and Drive Technologies - SCE
TIA Training Manual Page 56 of 56 Module
M6 Status: 06/2010 Control Engineering at the SIMATIC S7-1200 with TIA Portal V10
28. If self optimization ran without an error message, the PID parameters are optimized. The PID
controller changes into the automatic mode and uses the optimized parameters. The optimized
parameters are saved at power ON and restart. With the button ' ’ you can load the PID
parameters into your project (→ )
Note:
For faster processes such as speed control, Self optimization in the operating point should be
selected. In this case, in cycle lasting several minutes all PID parameters are ascertained and set.
After being loaded into the project, the parameter values can be monitored in the data block.