Concept and Application of Pid Control and Implementation of Continuous Pid Controller in Siemens Plcs
Concept and Application of Pid Control and Implementation of Continuous Pid Controller in Siemens Plcs
Indian Journal of Science and Technology, Vol 8(35), DOI: 10.17485/ijst/2015/v8i35/82262, December 2015 ISSN (Online) : 0974-5645
Abstract
Background/Objectives: The main objectives are to define the concept and application of PID control in parallel structure
of PID controller and to describe implementation of the continuous PID controller in SIMATIC STEP 7. Methods/Statistical
Analysis: Various designs of PID controllers in SIMATIC STEP 7 are available for different kinds of feedback control sys-
tems. Parallel structure is used in the algorithm of PID controllers in Siemens PLCs. In this study PID controller with the
continuous control function block FB41 (CONT_C) is analyzed. Programming with PID controller in Siemens PLCs with
continuous Manipulated Variable output and the option of influencing the Manipulated Value manually is thoroughly dis-
cussed. Findings: PID controller is the most common form of feedback control and it can be found in all the areas where
control loops exist. The simplicity of understanding of the PID algorithm is one of its advantages but due to a wide range of
systems and different manufacturers of control systems with various design and tuning methods of PID controllers in their
products, the implementation process gets complicated. This difficulty is reduced by using several kinds of PID controllers
for different types of systems in Siemens control systems. FB41 is a function block of continuous PID controller which was
designed for Siemens PLCs to provide control performance with analog signals; it can function both in a manual and auto-
matic mode.The most important part of FB41 functioning is addressing of the analog Input and Output in this function
block. The results of P, I, D, PI, PD and PID controller implementation in FB41 have been compared. Applications/
Improvements: This continuous control function block can be used in different kinds of control loop systems where analog
input is sensed and analog output is required.
Keywords: Analog Signal, Continuous PID Controller, Control System, FB41 (CONT_C), Feedback Control, Siemens PLCs
proved satisfactory, it still has a wide range of applications in a process produce the output. In closed loop control
in industrial control4. system which is also called a feedback control system
PID controllers in Siemens PLCs are exclusively the output is analyzed and corrected based on feedback.
professional. They are distinguished by their classifica- Feedback is a process in which the past information influ-
tion for using in different kinds of control systems. In ences the present or future. In a feedback control system
step 7 Siemens PLC programming software different information about performance is measured by sensors.
function blocks of PID are designed for various kinds of The comparison of this information with setpoint is used
systems. These function blocks are compatible with their in control algorithms to control the actuators and correct
own control systems. In the following parts of this paper the performance of the system.
continuous PID control with FB41 (CONT_C) func-
tion block, its implementation and performance will be
discussed.
3. PID Control
PID controllers which are applied in around 90% of
industrial loops are the most often used controllers. It is
2. Control System beneficial because of their simplicity, robust nature, ease
Control systems are used to minimize the consequences of implementation and design and less number of tuning
of process variations and environmental influences on parameters7,8. P, I and D are three parameters which have
the quality of process control. Sometimes these variations to be tuned manually or by some tuning techniques to
and influences are so significant that the conventional lin- design a PID controller. The proportional value defines
ear controllers with constant parameters fail to perform the reaction of the current error, the integral value defines
successfully. The primary functions of controllers are con- the reaction based on the sum of recent errors and the
trolling equipment or machines and maintaining stability derivative value defines the reaction based on the rate at
of their performances5. Among different brands of con- which the error has been changing the weighted sum of
trol systems, Siemens control systems being professional these three actions that is used to adjust the process via
have an essential role in this industry. There are differ- the final control element9.
ent kinds of industrial control systems and one of them is Due to successful implementation, wide accessibility
Programmable Logic Controller (PLC). and use of intelligibility PID control became an essential
Improvements of microelectronics and application of tool to control difficult processes. PID controller con-
mathematical methods in control theory contributed to trols the process successfully even with the increased
control systems development. One of these modern con- complexity10.
trol techniques and mathematical based control methods These values have been adjusted in order to achieve a
is Advanced Process Control (APC) technique which is desired constant output from the system. The PID con-
used in control systems and offered by all the PLC man- troller algorithm that operates as a position algorithm is
ufacturers.To increase the process capacity, efficiency, shown in Figure 1.
quality of products and costs savings in APC technique dif- The PID algorithm can function under three basic
ferent kinds of tools for self-tuning, manufacturing costs modes, the Proportional mode, Integral mode and the
and energy savings optimizationare designed. While some Derivative mode. It is necessary to determine which
of the APC techniques are installed directly in the PLC,
most of them are implemented as supervisory functions on
higher level of the control system6. Due to the usage of APC
and microelectronics in PLCs many components, which
were applied in relay logic systems are out of use now and
are replaced by function block diagrams in PLCs.
2 Vol 8(35) December 2015 | www.indjst.org Indian Journal of Science and Technology
Babak Rooholahi and P. Lokender Reddy
controller has to be used for the process, before applying Four main features of the closed-loop step response are:
the algorithm in the system11. Then the parameters or
• Rise time – the time it takes for the Process Variable
settings which are used for each mode can be final-
(PV) to rise above 90% of the SetPoint (SP) for the first
ized11. Sometimes only one or two parameters should be
time,
used to obtain the proper system control which can be
• Overshoot – the maximum swing above the SetPoint
achieved by deactivating the other parameters (setting
(SP),
them to zero); in these cases it will be a P, I, PI, PD and
• Settling time – the time it takes for the Process Variable
PID controller.
(PV) to settle to its steady state,
The Process Variable (PV) is measured by the sensors
• Steady-state error – the difference between the
from the field; the desired value is called SetPoint (SP)
steady-state variable and the SetPoint (SP).
and determined manually set by the operator; the input to
the process and the output of the PID controller are called By tuning the PID gain values, these characteristics
Manipulated Variable (MV), Control Variable (CV) or can be controlled and optimized to achieve a desired
control signal u (t); the difference between the Process system output.
Variable (PV) and the SetPoint (SP) is the error (e(t)) that The Laplace transfer function of a PID controller is
is continuously calculated by a PID controller. expressed in the Equation 3:
PID controller by adjusting the error itself, integral
of the error and the derivative of the error as Control U (s ) 1
GPID ( s ) = = K P 1 + + TD s , (3)
Variable (CV) tries to minimize the error. E (s ) TI s
Where U(s) is the control signal, E(s) is the error signal, s
3.1 Standard Structures of PID Controllers
is the variable of Laplace transfer function, KP is the pro-
Parallel structure, three-term functionality and a typical portional gain, TI and TD are the integral and derivative
structure of a PID control system are shown in Figure 2. A time constants respectively.
mathematical description of the PID controller is shown The PID control signal is a sum of three terms 4:
in the following Equations (1, 2):
1
U ( s ) = K P E ( s ) + K I E ( s ) + K D sE ( s ) = U P ( s ) + U I ( s ) + U D ( s ) ,(4)
t s
1 de (t )
u (t ) = K P e ( t ) + e (t ) dt + TD ,
∫
TI dt (1) Where K I = K P / TI (5) is the integral gain and
0
K D = K PTD (6) is the d
erivative gain.
or
The three-term functionalities include:
t
de (t )
u (t ) = K P e (t ) + K I e (t ) dt + K D
∫ , (2)
dt 3.1.1 Proportional Term
0
Vol 8(35) December 2015 | www.indjst.org Indian Journal of Science and Technology 3
Concept and Application of PID Control and Implementation of Continuous PID Controller in Siemens PLCs
3.1.3 Derivative Term decrease the oscillation. However, too much KD will lead
to overshoot in the system. A quick PID controller loop
The derivative term improves transient response through
normally has a little overshoots to achieve the desired
high-frequency compensation. The rate of error changes
value very fast; but in some systems cannot receive over-
is the contribution of the derivative term. It gives an addi-
shoot. In these systems a KP should be set remarkably less
tional control by predicting errors and future behavior of
than half of the KP setting which provoked oscillation, to
the system.
make over-damped in the closed-loop system.
Due to its variable impact on system stability, derivative
Design and tuning of the controller and selecting of its
action is rarely used in practice. The pure derivative action
static (P component) and dynamic (I and D component)
is never used because of the derivative kick produced in
the control signal for a step input and to the undesirable parameters are dependent on the static behavior (gain)
noise amplification. It is usually replaced by a first-order and the dynamic characteristics (time lag, dead time, reset
low pass filter4,12. time etc.) of the process13. Different methods of PID con-
troller design and tuning are applied for different types of
continuous systems.
3.2 Design and Tuning of PID Controller
The modified auto-tuning PID controller was
Designing and tuning of a PID controller is not easy when implemented in a SIEMENS PLC, product family
stability and short transient of the system are desirable. SIMATIC S7-300 and S7-400. FB50 is a PID Self Tuner in
Repeated changes of initial designs through computer Step 7 TunPID Library by Siemens which can be used for
simulation need to be done to achieve a desired perfor- tuning parameters of PI/PID regulators in function blocks
mance of the system. Control parameters (KP, KI or TI, FB41, FB42, software packages Standard PID Control,
KD, or TD) must be tuned jointly to the optimum values Modular PID control and function modules FM 355C6.
for the desired control response. Although there are indi-
vidual effects of these three parameters on the closed loop
performance of stable plants which are summarized in
4. PID Control in Siemens PLCs
Table 1. For example, while KI and KD are fixed, increas- The Function Blocks (FBs) of the PID control package
ing KP alone can rise time, increase overshoot, slightly consist of controller blocks for Continuous Control FB41
increase settling time, decrease the steady-state error and (CONT_C), for step control FB42 (CONT_S), for Pulse
decrease stability margins12. Duration Modulation FB43 (PULSEGEN), for continu-
For manual tuning in online system one of the methods ous temperature control FB58 (TCONT_CP) and for
is first setting all gains to zero. Increase the KP value until temperature step control FB59 (TCONT_S). A controller
the constant oscillation of the output is obtained, then the created with the FBs consists of a series of sub functions
KP should be set to approximately half of that value for a that you can activate or deactivate. Apart from the actual
quarter amplitude decay type response. After that increase controller with its PID algorithm, integrated functions
KI to minimize the P term offset in a particular time for
can also be used for processing the setpoint, process vari-
the process considering that too much KI can be a cause of
able and adapting the calculated manipulated variable.
instability. Finally, increase KD, if required, until the sys-
Both slow processes (temperatures, tank levels etc.) and
tem becomes acceptably quick to reach the SetPoint and
very fast processes (flow rate, motor speed etc.) can be
controlled without any restrictionin terms of the type of
Table 1. Effects of independent P, I and D tuning on
process. Good control quality can be achieved only if the
closed-loop response.
controller type suits your situation and adapts it to the
Rise Settling Steady-
Parameter Overshoot Stability time response of the process13.
Time Time State Error
Increasing Small
KP
Decrease Increase
Increase
Decrease Degrade 4.1 Analog Signals
Increasing Small Large Continuous signals have an infinite number of states. These
Increase Increase Degrade
KI Decrease Decrease variable signals received from different filed devices (sen-
Increasing Small
Decrease Decrease
Minor
Improve sors) need to be converted to digital signals by an Analog
KD Decrease Change
to Digital converter (A/D) before CPU processing. This
4 Vol 8(35) December 2015 | www.indjst.org Indian Journal of Science and Technology
Babak Rooholahi and P. Lokender Reddy
digitization is performed inside an analog input inter- STEP7. By activating or deactivating the PID parameters
face within the Input/Output (I/O) module. The analog and process variable and adjusting the proper value for it,
device’s current output is often transformed to a voltage the desired PID controller for different kinds of systems
by a built‐in resistor. A common standard used in rep- can be set. Apart from this capability, there is an option for
resenting analog signals is when 4mA corresponds to FB41 to provide continuous manipulated variable output in
the minimum signal level (1V) and 20mA the maximum PID controller process ormanually forcing the manipulated
(5V). Digitized values corresponding to the continuous value by the operator13,16. The FB41 (CONT_C) block
values between 1‐5V are rated by the PLC’s CPU, values diagram, input default mode, number, name and descrip-
ranging above or below are discarded by the CPU. A value tion of each parameter are shown in Figure 3.
< 0,296V is used for detecting cable failure.
Table 2 shows Siemens STEP7 format14,15. 4.2.1 Process Variable Section
The CPU makes decisions and executes control
instructions based on program instructions in memory The Process Variable can be given in PV_IN manually to
to determine what the PLC will do for a specific input. the PID controller when PVPER_ON is in default mode
Control instructions from the CPU are converted into (deactivated). If PVPER_ON is set, the Process Variable
a Digital or Analog signals by output modules to control must be read from the PV_PER which is connected to
different field devices (actuators). This data transforma- peripheral I/O. The choice between Process Variable IN
tion is performed by a Digital‐to‐Analog (D/A) converter. (PV_IN) and Process Variable Peripheral (PV_PER) is
It is the exact opposite of the transformation in an ana- determined by PVPER_ON. The function which converts
log input interface. An analog output interface within the PV_PER to the floating-point format of -100 to +100
the I/O module is used to address devices controlled by a % is CRP_IN and it has calculated by 7:
continuous voltage or current.
Output of CRP_IN = PV_PER ∗ 100 (7)
27648
4.2 Continuous PID Control with FB41
“CONT_C” The output of CRP_IN is normalizedby the following
formula ):
FB41 (CONT_C) is used to implement the PID controller Output of PV_NORM = (output of CRP_IN) * PV_FAC
with continuous analog input and output on SIMATIC
+ PV_OFF (8)
Table 2. SIMATIC STEP7 format, measuring range PV_FAC and PV_OFF are initiallyset to 1 and 0
1‐5V. respectively.
Measuring Decimal (value seen Range
range 1-5 V from the CPU Point 4.2. Manipulated Value Section
of view) It is possible to switch over between Manual and Automatic
>5,704 32767 Overflow Mode (MAN and Manipulated Value (LMN)) by setting/
5,704 32511 Over range resetting the Manual Value On (MAN_ON) (if it is set, the
. . manual value is set as the output in manipulated value).
. .
In the manual mode, the Manipulated Variable (MV) is
5,00014 27649
adjusted to a selected value manually. It means there are no
5,000 27648 Rated range
any sudden changes in the Manipulated Value due to a swi-
4,000 20736 (normal
. . operation range) tchover from the manual mode to the automatic mode.
. . The Manipulated Value is always limited to an upper
1,000 0 and lower limit (LMN_HLM and LMN_LLM).
0,99986 -1 Undershoot “High Limit of Manipulated Value Reached” or “Low
. . range Limit of Manipulated Value Reached” (QLMN_HLM and
. . QLMN_LLM) indicate when the upper or lower limit of
0,296 -4864
the Manipulated Value (LMN_HLM and LMN_LLM) has
<0,296 -32768 Underflow been exceeded.
Vol 8(35) December 2015 | www.indjst.org Indian Journal of Science and Technology 5
Concept and Application of PID Control and Implementation of Continuous PID Controller in Siemens PLCs
6 Vol 8(35) December 2015 | www.indjst.org Indian Journal of Science and Technology
Babak Rooholahi and P. Lokender Reddy
LMNLIMIT can be normalized by LMN_NORM The first step of the programming in STEP7 is
function according to the following formula 9: Hardware Configuration (HW Config). It is required to
determine the hardware which consists of power supply,
LMN = (output of LMNLIMIT) *LMN_FAC +
LMN_OFF (9) PLC CPU model number, all the modules used in the
control system and the network connection type between
LMN_FAC and LMN_OFF have the default 1 and 0 PC and PLC in HW Config.
respectively. The programming will start by opening the first
LMN_PER is the manipulated value in the peripheral Operation Block (OB1) in the SIMATIC Manager window.
format. It is converted from the floating-point value for- The PID block FB41 CONT_C can be found in the program
mat (LMN) to the peripheral value format (LMN_PER) “elements libraries”. It is necessary to determine the proper
by the CRP_OUT function 10: addresses or correct values of 26 inputs and 9 outputs in
PID block FB41 to implement it in the program.
27648
LMN_PER = LMN ∗ (10) Addressing for each parameter of the block should
100
include digital input, digital output, Memory Double
word (MD) or Periphery Input and Output Word (PIW/
4.3 Inputting/Outputting Analog Values in PQW) addresses. VAT (Variable Access Table) should be
STEP 7 made to monitor the word format parameters and to put
Integer and Real types of data have an important function the addresses with their values, modify them in the RUN
in process analog signals for SIMATIC S7. Analog inputs mode and specify the values of Display format. VAT can
are received as real numbers in the format INT for analog specify the address of each value and display the Status
values processing. Because of rounding variables by INT, Value and Modify Value as it is shown in Figure 4.
for an accurate further processing the REAL numbers are Figure 5 shows the performance of P controller in
considered. Analog values are inputted as WORD with the online mode where PV_PER is received from the field
integer (INT) data type format in the PLC. The address and PVPER_ON is set. Here. kp=1.
of these WORD values are accessible with the following Implementation of PID controlleris done by activating
instruction17: the P, I and D parameters. Figure 6 shows PID controller
performance in offline mode where PVPER_ON is FALSE,
L PIW x for ‘Load analog Input Word’ MAN_ON is TRUE and PV_IN has the value of 20.
T PQW x for ‘Transfer analog Output Word’ Comparing the output of P, I, D, PI, PD and PID
The addressing of the input/output WORDs depends controllers and analysis of their response speed to the
on the start address of the module. For the module variation of process variable show that P controller has
installed in slot 4 the default start address will be 256. For the minimum speed and very slow with the specific offset
further analog modules default start address of each slot and I, PI, PD, PID and D controllers respectively have the
will increase by 16. This address can be checked in hard- minimum to maximum speed of response to reach the
ware configuration table for each slot. The address of the maximum manipulated value: D > PID > PD > PI > I > P.
first analog input on slot 6 is PIW 288, the second analog Usually Proportional Integral (PI) controllers required
input is PIW 290 and the first analog output is PQW 288 to meeting the optimal response in linear systems and
etc.17. PID controllers are required to meet desired response in
nonlinear systems18.
Vol 8(35) December 2015 | www.indjst.org Indian Journal of Science and Technology 7
Concept and Application of PID Control and Implementation of Continuous PID Controller in Siemens PLCs
8 Vol 8(35) December 2015 | www.indjst.org Indian Journal of Science and Technology
Babak Rooholahi and P. Lokender Reddy
the nature of a particular system and choosing the proper Mediterranean Conference on Control and Automation
design and tuning of the PID controller. Tuning and (MED 2000); Rio Patras, Greece. 2000 Jan.
design of PID control, which depend on the nature of each 6. Kocian J, Koziorek J. Self tuning techniques on PLC
system, will vary according to the system characteristics. background and control systems with self tuning methods
design. Advances in Electrical and Electronic Engineering.
PID controllers in Siemens PLCs are very efficient and
2010 Jun; 8(2):40– 7.
widely used in industry. They are also common in compli-
7. Er MJ, Lei Y. Hybrid fuzzy proportional – integral plus
cated and professional systems. PID controller in Siemens conventional derivative control of linear and nonlinear
PLCs has different function blocks such as continuous systems. IEEE Transactions on Industrial Electronics. 2002
control FB41 (CONT_C), step control FB42 (CONT_S), Jan; 48(6):1109–17.
continuous temperature control FB58 (TCONT_CP) and 8. Lakshmi Narayana K, Naveen Kumar V, Dhivya M, Prejila
temperature step control FB59 (TCONT_S) to control Raj R. Application of ant colony optimization in tuning a
different kinds of systems. PID controller to a conical tank. Indian Journal of Science
In this paper PID function block with continuous and Technology. 2015 Jan; 8(S2):217–23.
control FB41 (CONT_C) has been discussed as the major 9. Sethuramalingam TK, Nagaraj B. PID controller tun-
ing using soft computing methodologies for industrial
concept of PID controller function block in Siemens
process - A comparative approach. Indian Journal of Science
PLCs which can be used for all kinds of systems by imple-
and Technology. 2014; 7(S7):140–5.
menting the correct design and tune. To implement FB41 10. Meena AR, Senthil Kumar S. Design of GA tuned
specifying the proper addressing and correct values of 26 two-degree freedom of PID controller for an intercon-
inputs and 9 outputs is essential. As the result of apply- nected three area automatic generation control system.
ing the standard structure of PID controller in Siemens Indian Journal of Science and Technology. 2015 Jun;
PLCs by FB41 in online and offline mode, the speed of 8(12):1–10.
response to reach the maximum manipulated value has 11. Pamela D, Premi MSG. TCP/IP based control and automa-
been studied. tion of temperature process. Indian Journal of Science and
Technology. 2015 Jun; 8(11):1–6.
12. Li Y, Ang KH, Chong GCY. PID control system analysis
6. References and design. IEEE Control Systems Magazine. 2006 Feb;
26(1):32–41.
1. Cho J, Kwag DG, Kim BS. Control of chaotic resonance 13. Siemens, SIMATIC, Standard PID Control; 2003. p. 1–256.
phenomena using prototypes in manifold forms. Indian 14. Al Hadawi E. Development of a Continuous Blending
Journal of Science and Technology. 2015 Oct; 8(26):1–7. System (Controlling a blending system). Division of
2. Sabir MM, Khan JA. Optimal design of PID controller Industrial Electrical Engineering and Automation (IEA):
for the speed control of DC motor by using metaheuristic Lund University, Sweden; 2011. p. 1–60.
techniques. Advances in Artificial Neural Systems. 2014, 15. Siemens, SIMATIC, Distributed I/O System’ ET 200S, 2005.
126317. p. 1–274.
3. Namba R, Yamamoto T, Kaneda M. Robust PID control- 16. Training document for comprehensive automation solu-
ler and its application. Proceedings of the 1997 IEEE tions. Totally Integrated Automation (TIA), MODULE B3,
International Conference on Systems, Man and Cybernetics, Control Engineering with STEP 7; 2008. p. 1–64.
Computational Cybernetics and Simulation; Orlando FL. 17. Training document for the company-wide automation
1997. p. 3636–41. solution. Totally Integrated Automation (TIA), MODULE
4. Xue D, Chen YQ, Atherton DP. Linear feedback control B2, Analog value processing; 2002 p. 1–14.
analysis and design with MATLAB. London, UK: Springer- 18. Chakravarthi MK, Vinay PK, Venkatesan N. Design and
Verlag; 2002. simulation of internal model controller for a real time non-
5. Peric N, Branica I, Petrovic I. Modification and application linear process. Indian Journal of Science and Technology.
of autotuning PID controller. Proceedings of the 8th IEEE 2015 Aug; 8(19):1–6.
Vol 8(35) December 2015 | www.indjst.org Indian Journal of Science and Technology 9