s71500 Pid Control Function Manual en-US en-US
s71500 Pid Control Function Manual en-US en-US
FUNCTION MANUAL
SIMATIC
S7-1200, S7-1500
PID control
support.industry.siemens.com
Introduction
1
Safety instructions
2
Function Manual
Using PID_Compact
5
Using PID_3Step
6
Using PID_Temp
7
Auxiliary functions
9
Instructions
10
11/2023
A5E35300227-AG
Legal information
Warning notice system
This manual contains notices you have to observe in order to ensure your personal safety, as well as to prevent
damage to property. The notices referring to your personal safety are highlighted in the manual by a safety alert
symbol, notices referring only to property damage have no safety alert symbol. These notices shown below are
graded according to the degree of danger.
DANGER
indicates that death or severe personal injury will result if proper precautions are not taken.
WARNING
indicates that death or severe personal injury may result if proper precautions are not taken.
CAUTION
indicates that minor personal injury can result if proper precautions are not taken.
NOTICE
indicates that property damage can result if proper precautions are not taken.
If more than one degree of danger is present, the warning notice representing the highest degree of danger will
be used. A notice warning of injury to persons with a safety alert symbol may also include a warning relating to
property damage.
Qualified Personnel
The product/system described in this documentation may be operated only by personnel qualified for the specific
task in accordance with the relevant documentation, in particular its warning notices and safety instructions.
Qualified personnel are those who, based on their training and experience, are capable of identifying risks and
avoiding potential hazards when working with these products/systems.
Proper use of Siemens products
Note the following:
WARNING
Siemens products may only be used for the applications described in the catalog and in the relevant technical
documentation. If products and components from other manufacturers are used, these must be recommended or
approved by Siemens. Proper transport, storage, installation, assembly, commissioning, operation and
maintenance are required to ensure that the products operate safely and without any problems. The permissible
ambient conditions must be complied with. The information in the relevant documentation must be observed.
Trademarks
All names identified by ® are registered trademarks of Siemens AG. The remaining trademarks in this publication
may be trademarks whose use by third parties for their own purposes could violate the rights of the owner.
Disclaimer of Liability
We have reviewed the contents of this publication to ensure consistency with the hardware and software
described. Since variance cannot be precluded entirely, we cannot guarantee full consistency. However, the
information in this publication is reviewed regularly and any necessary corrections are included in subsequent
editions.
1 Introduction........................................................................................................................................ 13
1.1 Purpose, conventions and supplementary information...................................................... 13
1.2 Guide to the Function Manuals documentation................................................................. 14
1.2.1 Information classes Function Manuals............................................................................... 14
1.2.2 Basic tools........................................................................................................................ 16
1.2.3 SIMATIC Technical Documentation.................................................................................... 18
2 Safety instructions.............................................................................................................................. 20
2.1 Cybersecurity information................................................................................................. 20
PID control
4 Function Manual, 11/2023, A5E35300227-AG
Table of contents
5 Using PID_Compact............................................................................................................................. 71
5.1 Technology object PID_Compact....................................................................................... 71
5.2 PID_Compact as of V2....................................................................................................... 72
5.2.1 Configuring PID_Compact as of V2.................................................................................... 72
5.2.1.1 Basic settings as of V2....................................................................................................... 72
5.2.1.2 Process value settings as of V2.......................................................................................... 75
5.2.1.3 Advanced settings as of V2............................................................................................... 75
5.2.2 Commissioning PID_Compact as of V2............................................................................... 86
5.2.2.1 Pretuning as of V2............................................................................................................ 86
5.2.2.2 Fine tuning as of V2.......................................................................................................... 88
5.2.2.3 "Manual" mode as of V2.................................................................................................... 90
5.2.3 Override control with PID_Compact as of V2...................................................................... 90
5.2.4 Simulating PID_Compact as of V2 with PLCSIM.................................................................. 94
5.3 PID_Compact V1............................................................................................................... 95
5.3.1 Configuring PID_Compact V1............................................................................................ 95
5.3.1.1 Basic settings V1............................................................................................................... 95
5.3.1.2 Process value settings V1.................................................................................................. 97
5.3.1.3 Advanced settings V1........................................................................................................ 98
5.3.2 Commissioning PID_Compact V1....................................................................................... 105
5.3.2.1 Commissioning V1............................................................................................................ 105
5.3.2.2 Pretuning V1..................................................................................................................... 106
5.3.2.3 Fine tuning V1.................................................................................................................. 107
5.3.2.4 "Manual" mode V1............................................................................................................ 109
5.3.3 Simulating PID_Compact V1 with PLCSIM.......................................................................... 110
PID control
Function Manual, 11/2023, A5E35300227-AG 5
Table of contents
PID control
6 Function Manual, 11/2023, A5E35300227-AG
Table of contents
PID control
Function Manual, 11/2023, A5E35300227-AG 7
Table of contents
10 Instructions......................................................................................................................................... 224
10.1 PID_Compact.................................................................................................................... 224
10.1.1 New features of PID_Compact........................................................................................... 224
10.1.2 Compatibility with CPU and FW......................................................................................... 227
10.1.3 CPU processing time and memory requirement PID_Compact as of V2............................... 228
10.1.4 PID_Compact as of V2....................................................................................................... 229
10.1.4.1 Description of PID_Compact V3......................................................................................... 229
10.1.4.2 Description of PID_Compact V2......................................................................................... 233
10.1.4.3 PID_Compact as of V2 operating principle......................................................................... 236
10.1.4.4 Input parameters of PID_Compact as of V2........................................................................ 238
10.1.4.5 Output parameters of PID_Compact as of V2..................................................................... 239
10.1.4.6 In/out parameter of PID_Compact as of V2......................................................................... 240
10.1.4.7 Static tags of PID_Compact as of V2................................................................................... 241
10.1.4.8 Changing the interface of PID_Compact as of V2............................................................... 250
10.1.4.9 State and Mode as of V2 parameters................................................................................. 252
10.1.4.10 ErrorBits as of V2 parameter.............................................................................................. 255
10.1.4.11 ActivateRecoverMode tag as of V2.................................................................................... 257
10.1.4.12 Warning tag as of V2......................................................................................................... 258
10.1.4.13 Tag IntegralResetMode as of V2........................................................................................ 259
10.1.4.14 Example program for PID_Compact V2.............................................................................. 260
10.1.5 PID_Compact V1............................................................................................................... 266
10.1.5.1 Description of PID_Compact V1......................................................................................... 266
10.1.5.2 Input parameters of PID_Compact V1................................................................................ 269
10.1.5.3 Output parameters of PID_Compact V1............................................................................. 270
10.1.5.4 Static tags of PID_Compact V1........................................................................................... 271
PID control
8 Function Manual, 11/2023, A5E35300227-AG
Table of contents
PID control
Function Manual, 11/2023, A5E35300227-AG 9
Table of contents
PID control
10 Function Manual, 11/2023, A5E35300227-AG
Table of contents
PID control
Function Manual, 11/2023, A5E35300227-AG 11
Table of contents
Index................................................................................................................................................... 557
PID control
12 Function Manual, 11/2023, A5E35300227-AG
Introduction 1
1.1 Purpose, conventions and supplementary information
Conventions
Observe notes marked as follows:
NOTE
The notes contain important information on the product described in the documentation, on
the handling of the product or on part of the documentation to which particular attention
should be paid.
Industry Mall
The Industry Mall is the Siemens AG catalog and ordering system for automation and drive
solutions based on Totally Integrated Automation (TIA) and Totally Integrated Power (TIP).
Catalogs for all automation and drive technology products can be found on the Internet
(https://mall.industry.siemens.com).
PID control
Function Manual, 11/2023, A5E35300227-AG 13
Introduction
1.2 Guide to the Function Manuals documentation
See also
Topic page "SIMATIC Technology - PID Control: Overview and important links"
https://support.industry.siemens.com/cs/ww/en/view/109751051
(https://support.industry.siemens.com/cs/ww/en/view/109751051)
Basic information
The system manuals and Getting Started describe in detail the configuration, installation,
wiring and commissioning of the SIMATIC S7‑1500, SIMATIC Drive Controller, ET 200MP,
ET 200SP, ET 200AL and ET 200eco PN systems. Use the corresponding operating instructions
for 1513/1516pro-2 PN CPUs.
The STEP 7 online help supports you in the configuration and programming.
Examples:
• Getting Started S7-1500
• System manuals
• Operating instructions ET 200pro and 1516pro-2 PN CPU
• Online help TIA Portal
Device information
Equipment manuals contain a compact description of the module-specific information, such
as properties, wiring diagrams, characteristics and technical specifications.
Examples:
• Equipment manuals for CPUs
• Equipment manuals for interface modules
• Equipment manuals for digital modules
• Equipment manuals for analog modules
• Equipment manuals for communication modules
• Equipment manuals for technology modules
• Equipment manuals for power supply modules
• Equipment manuals for BaseUnits
PID control
14 Function Manual, 11/2023, A5E35300227-AG
Introduction
1.2 Guide to the Function Manuals documentation
General information
The function manuals contain detailed descriptions on general topics relating to the
SIMATIC Drive Controller and the S7-1500 automation system.
Examples:
• Function Manual Diagnostics
• Function Manual Communication
• Function Manuals Motion Control
• Function Manual Web Server
• Function Manual Cycle and Response Times
• PROFINET Function Manual
• PROFIBUS Function Manual
Product Information
Changes and supplements to the manuals are documented in a Product Information. The
Product Information takes precedence over the device and system manuals.
You will find the latest Product Information on the Internet:
• S7-1500/ET 200MP (https://support.industry.siemens.com/cs/de/en/view/68052815)
• SIMATIC Drive Controller
(https://support.industry.siemens.com/cs/de/en/view/109772684/en)
• Motion Control (https://support.industry.siemens.com/cs/de/en/view/109794046/en)
• ET 200SP (https://support.industry.siemens.com/cs/de/en/view/73021864)
• ET 200eco PN (https://support.industry.siemens.com/cs/ww/en/view/109765611)
Manual Collections
The Manual Collections contain the complete documentation of the systems put together in
one file.
You will find the Manual Collections on the Internet:
• S7-1500/ET 200MP/SIMATIC Drive Controller
(https://support.industry.siemens.com/cs/ww/en/view/86140384)
• ET 200SP (https://support.industry.siemens.com/cs/ww/en/view/84133942)
• ET 200AL (https://support.industry.siemens.com/cs/ww/en/view/95242965)
• ET 200eco PN (https://support.industry.siemens.com/cs/ww/en/view/109781058)
PID control
Function Manual, 11/2023, A5E35300227-AG 15
Introduction
1.2 Guide to the Function Manuals documentation
Tools
The tools described below support you in all steps: from planning, over commissioning, all
the way to analysis of your system.
PID control
16 Function Manual, 11/2023, A5E35300227-AG
Introduction
1.2 Guide to the Function Manuals documentation
PRONETA
SIEMENS PRONETA (PROFINET network analysis) is a commissioning and diagnostic tool for
PROFINET networks. PRONETA Basic has two core functions:
• In the network analysis, you get an overview of the PROFINET topology. Compare a real
configuration with a reference installation or make simple parameter changes, e.g. to the
names and IP addresses of the devices.
• The "IO test" is a simple and rapid test of the wiring and the module configuration of a
plant, including documentation of the test results.
You can find SIEMENS PRONETA Basic on the Internet:
(https://support.industry.siemens.com/cs/ww/en/view/67460624)
SIEMENS PRONETA Professional is a licensed product that offers you additional functions. It
offers you simple asset management in PROFINET networks and supports operators of
automation systems in automatic data collection/acquisition of the components used through
various functions:
• The user interface (API) offers an access point to the automation cell to automate the scan
functions using MQTT or a command line.
• With PROFIenergy diagnostics, you can quickly detect the current pause mode or the
readiness for operation of devices that support PROFIenergy and change these as needed.
• The data record wizard supports PROFINET developers in reading and writing acyclic
PROFINET data records quickly and easily without PLC and engineering.
You can find SIEMENS PRONETA Professional on the Internet.
(https://www.siemens.com/proneta-professional)
SINETPLAN
SINETPLAN, the Siemens Network Planner, supports you in planning automation systems and
networks based on PROFINET. The tool facilitates professional and predictive dimensioning of
your PROFINET installation as early as in the planning stage. In addition, SINETPLAN supports
you during network optimization and helps you to exploit network resources optimally and to
plan reserves. This helps to prevent problems in commissioning or failures during productive
operation even in advance of a planned operation. This increases the availability of the
production plant and helps improve operational safety.
The advantages at a glance
• Network optimization thanks to port-specific calculation of the network load
• Increased production availability thanks to online scan and verification of existing systems
• Transparency before commissioning through importing and simulation of existing STEP 7
projects
• Efficiency through securing existing investments in the long term and the optimal use of
resources
You can find SINETPLAN on the Internet
(https://new.siemens.com/global/en/products/automation/industrial-
communication/profinet/sinetplan.html).
PID control
Function Manual, 11/2023, A5E35300227-AG 17
Introduction
1.2 Guide to the Function Manuals documentation
Watch this short video to find out where you can find the overview directly in Siemens
Industry Online Support and how to use Siemens Industry Online Support on your mobile
device:
Quick introduction to the technical documentation of automation products per
video (https://support.industry.siemens.com/cs/us/en/view/109780491)
PID control
18 Function Manual, 11/2023, A5E35300227-AG
Introduction
1.2 Guide to the Function Manuals documentation
mySupport
With "mySupport" you can get the most out of your Industry Online Support.
Registration You must register once to use the full functionality of "mySupport". After registra
tion, you can create filters, favorites and tabs in your personal workspace.
Support requests Your data is already filled out in support requests, and you can get an overview of
your current requests at any time.
Documentation In the Documentation area you can build your personal library.
Favorites You can use the "Add to mySupport favorites" to flag especially interesting or fre
quently needed content. Under "Favorites", you will find a list of your flagged
entries.
Recently viewed The most recently viewed pages in mySupport are available under "Recently viewed
articles articles".
CAx data The CAx data area gives you access to the latest product data for your CAx or CAe
system. You configure your own download package with a few clicks:
• Product images, 2D dimension drawings, 3D models, internal circuit diagrams,
EPLAN macro files
• Manuals, characteristics, operating manuals, certificates
• Product master data
You can find "mySupport" on the Internet. (https://support.industry.siemens.com/My/ww/en)
Application examples
The application examples support you with various tools and examples for solving your
automation tasks. Solutions are shown in interplay with multiple components in the system -
separated from the focus on individual products.
You can find the application examples on the Internet.
(https://support.industry.siemens.com/cs/ww/en/ps/ae)
PID control
Function Manual, 11/2023, A5E35300227-AG 19
Safety instructions 2
2.1 Cybersecurity information
Siemens provides products and solutions with industrial cybersecurity functions that support
the secure operation of plants, systems, machines, and networks.
In order to protect plants, systems, machines, and networks against cyber threats, it is
necessary to implement – and continuously maintain – a holistic, state-of-the-art industrial
cybersecurity concept. Siemens’ products and solutions constitute one element of such a
concept.
Customers are responsible for preventing unauthorized access to their plants, systems,
machines and networks. Such systems, machines and components should only be connected
to an enterprise network or the internet if and to the extent such a connection is necessary
and only when appropriate security measures (e.g. firewalls and/or network segmentation)
are in place.
For more information on protective industrial cybersecurity measures for implementation,
please visit (https://www.siemens.com/global/en/products/automation/topic-areas/industrial-
cybersecurity.html).
Siemens' products and solutions undergo continuous development to make them more
secure. Siemens strongly recommends that product updates are applied as soon as they are
available and that the latest product versions are used. Use of product versions that are no
longer supported, and failure to apply the latest updates may increase customers' exposure to
cyber threats.
To stay informed about product updates at all times, subscribe to the Siemens Industrial
Cybersecurity RSS Feed under
(https://new.siemens.com/global/en/products/services/cert.html).
PID control
20 Function Manual, 11/2023, A5E35300227-AG
Principles for control 3
3.1 Controlled system and actuators
Controlled system
Room temperature control by means of a heating system is a simple example of a controlled
system. A sensor measures the room temperature and transfers the value to a controller. The
controller compares the current room temperature with a setpoint and calculates an output
value (manipulated variable) for heating control.
4FUQPJOU
.BOJQVMBUFE
$POUSPMMFST "DUVBUPS )FBUJOH
1SPDFTTWBMVF WBSJBCMF
5FNQFSBUVSF
4FOTPS
A properly set PID controller reaches this setpoint as quickly as possible and then holds it a
constant value. After a change in the output value, the process value often changes only with
a time delay. The controller has to compensate for this response.
Actuators
The actuator is an element of the controlled system and is influenced by the controller. Its
function modifies mass and energy flows.
The table below provides an overview of actuator applications.
Application Actuator
Liquid and gaseous mass flow Valve, shutter, gate valve
Solid mass flow, e.g., bulk material Articulated baffle, conveyor, vibrator channel
Flow of electrical power Switching contact, contactor, relay, thyristor
Variable resistor, variable transformer, transistor
Actuators are distinguished as follows:
• Proportional actuators with constant actuating signal
These elements set degrees of opening, angular positions or positions in proportion to the
output value. The output value has an analog effect on the process within the control
range.
Actuators in this group include spring-loaded pneumatic drives, as well as motorized
drives with position feedback for which a position control system is formed.
An continuous controller, such as PID_Compact, generates the output value.
PID control
Function Manual, 11/2023, A5E35300227-AG 21
Principles for control
3.2 Controlled systems
PID control
22 Function Manual, 11/2023, A5E35300227-AG
Principles for control
3.2 Controlled systems
PID control
Function Manual, 11/2023, A5E35300227-AG 23
Principles for control
3.3 Characteristic values of the control section
Y U
5H
9NBY
ࢉY
ࢉU
5V U
The time response can be determined by approximation using the variables Delay time Tu,
Recovery time Tg and Maximum value Xmax. The variables are determined by applying
tangents to the maximum value and the inflection point of the step response. In many
situations, it is not possible to record the response characteristic up to the maximum value
because the process value cannot exceed specific values. In this case, the rate of rise vmax is
used to identify the controlled system (vmax = Δx/Δt).
PID control
24 Function Manual, 11/2023, A5E35300227-AG
Principles for control
3.3 Characteristic values of the control section
The controllability of the controlled system can be estimated based on the ratio Tu/Tg, or Tu ×
vmax/Xmax . Rule:
Y
5H
5U 5V
5B
Tt Dead time
Tu Delay time
Tg Recovery time
y Output value
x Process value
The controllability of a self-regulating controlled system with dead time is determined by the
ratio of Tt to Tg. Tt must be small compared to Tg. Rule:
Tt/Tg ≤ 1
PID control
Function Manual, 11/2023, A5E35300227-AG 25
Principles for control
3.3 Characteristic values of the control section
Physical Controlled system Delay time Tu Recovery time Tg Rate of rise vmax
quantity
Temperature Small electrically heated furnace 0.5 to 1 min 5 to 15 min Up to 60 K/min.
Large electrically heated annealing furnace 1 to 5 min 10 to 20 min Up to 20 K/min.
Large gas-heated annealing furnace 0.2 to 5 min 3 to 60 min 1 to 30 K/min
Distillation tower 1 to 7 min 40 to 60 min 0.1 to 0.5° C/s
Autoclaves (2.5 m3) 0.5 to 0.7 min 10 to 20 min Not specified
High-pressure autoclaves 12 to 15 min 200 to 300 min Not specified
Steam superheater 30 s to 2.5 min 1 to 4 min 2°C/s
Injection molding machines 0.5 to 3 min 3 to 30 min 5 to 20 K/min
Extruders 1 to 6 min 5 to 60 min
Packaging machines 0.5 to 4 min 3 to 40 min 2 to 35 K/min
Room heating 1 to 5 min 10 to 60 min 1° C/min
Flow rate Pipeline with gas 0 to 5 s 0.2 to 10 s Not relevant
Pipeline with liquid None None
Pressure Gas pipeline None 0.1 s Not relevant
Drum boiler with gas or oil firing None 150 s Not relevant
Drum boiler with impact grinding mills 1 to 2 min 2 to 5 min Not relevant
Vessel level Drum boiler 0.6 to 1 min Not specified 0.1 to 0.3 cm/s
Speed Small electric drive None 0.2 to 10 s Not relevant
Large electric drive None 5 to 40 s Not relevant
Steam turbine None Not specified 50 min–1
Voltage Small generators None 1 to 5 s Not relevant
Large generators None 5 to 10 s Not relevant
PID control
26 Function Manual, 11/2023, A5E35300227-AG
Principles for control
3.4 Pulse controller
:I
X Y
① ON
② OFF
Yh Control range
w Setpoint
PID control
Function Manual, 11/2023, A5E35300227-AG 27
Principles for control
3.4 Pulse controller
Y 5H
9
4E
U
5V
U
PID control
28 Function Manual, 11/2023, A5E35300227-AG
Principles for control
3.4 Pulse controller
Since the switching pulses can no longer be determined at the output of the controlled
system, results comparable with those of continuous controllers are obtained.
The output value is generated by pulse-width modulation of the output value of a continuous
controller.
Two-step controllers with feedback are used for temperature control in furnaces, at
processing machines in the plastics, textile, paper, rubber and foodstuff industries as well as
for heating and cooling devices.
Three-step controllers
Three-step controllers are used for heating / cooling. These controllers have two switching
points as their output. The control-action results are optimized through electronic feedback
structures. Fields of applications for such controllers are heating, low-temperature, climatic
chambers and tool heating units for plastic-processing machines.
The following diagram shows the characteristic of a three-step controller
Z
Z Z
Z
Y
X
Y 4I
PID control
Function Manual, 11/2023, A5E35300227-AG 29
Principles for control
3.5 Response to setpoint changes and disturbances
x Process value
w Setpoint
Response to disturbances
The setpoint is influenced by disturbance variables. The controller has to eliminate the
resulting control deviations in the shortest time possible. The response to disturbances is
improved by minimizing fluctuation of the process value and the time required to reach the
new setpoint.
Y
x Process value
w Setpoint
① Influencing a disturbance variable
Disturbance variables are corrected by a controller with integral action. A persistent
disturbance variable does not reduce control quality because the control deviation is
relatively constant. Dynamic disturbance variables have a more significant impact on control
PID control
30 Function Manual, 11/2023, A5E35300227-AG
Principles for control
3.5 Response to setpoint changes and disturbances
quality because of control deviation fluctuation. The control deviation is eliminated again
only by means of the slow acting integral action.
A measurable disturbance variable can be included in the controlled system. This inclusion
would significantly accelerated the response of the controller.
PID control
Function Manual, 11/2023, A5E35300227-AG 31
Principles for control
3.6 Control Response at Different Feedback Structures
U
Z
U
① Control deviation
② Output value of a continuous controller
③ Output value of a pulse controller
PID control
32 Function Manual, 11/2023, A5E35300227-AG
Principles for control
3.6 Control Response at Different Feedback Structures
Y
5.@-"(
U
① Control deviation
② Output value of a continuous controller
③ Output value of a pulse controller
TM_LAG Delay of the Derivative action
Equation for PD-action controller
PID control
Function Manual, 11/2023, A5E35300227-AG 33
Principles for control
3.6 Control Response at Different Feedback Structures
The following applies for the step response of the PD-action controller in the time range:
W
7' 70B/$*
\ *$,1Ã;:Ã ÃH
70B/$*
PID control
34 Function Manual, 11/2023, A5E35300227-AG
Principles for control
3.6 Control Response at Different Feedback Structures
Z
U
① Control deviation
② Output value of a continuous controller
③ Output value of a pulse controller
An integral action in the controller adds the control deviation as a function of the time. This
means that the controller corrects the system until the control deviation is eliminated. A
sustained control deviation is generated at controllers with proportional action only. This
effect can be eliminated by means of an integral action in the controller.
In practical experience, a combination of the proportional, integral and derivative actions is
ideal, depending on the requirements placed on the control response. The time response of
the individual components can be described by the controller parameters proportional gain
GAIN, integration time TI (integral action), and derivative action time TD (derivative action).
Equation for PI-action controller
PID control
Function Manual, 11/2023, A5E35300227-AG 35
Principles for control
3.6 Control Response at Different Feedback Structures
The following applies for the step response of the PI-action controller in the time range:
\ *$,1Ã;:Ã
7,ÃW
PID control
36 Function Manual, 11/2023, A5E35300227-AG
Principles for control
3.6 Control Response at Different Feedback Structures
U
5.@-"(
U
5*
Z
① Control deviation
② Output value of a continuous controller
③ Output value of a pulse controller
TM_LAG Delay of the Derivative action
Ti Integration time
Equation for PID controller
PID control
Function Manual, 11/2023, A5E35300227-AG 37
Principles for control
3.6 Control Response at Different Feedback Structures
The following applies for the step response of the PID controller in the time range:
W
7' 70B/$*
\ *$,1Ã;:Ã 70B/$* ÃH
7,ÃW
U
① No controller
② PID controller
③ PD-action controller
w Setpoint
x Process value
Controllers with PI and PID action have the advantage that the process value does not have
any deviation from the setpoint value after settling. The process value oscillates over the
setpoint during approach.
PID control
38 Function Manual, 11/2023, A5E35300227-AG
Principles for control
3.7 Selection of the controller structure for specified controlled systems
PT1 with dead time Unsuitable Unsuitable Well suited Well suited
PT2 with dead time Unsuitable Suited conditionally Well suited Well suited
Not self-regulating Well suited Well suited Well suited Well suited
The table below provides an overview of suitable combinations of a controller structure and
physical quantity.
PID control
Function Manual, 11/2023, A5E35300227-AG 39
Principles for control
3.8 PID parameter settings
PID control
40 Function Manual, 11/2023, A5E35300227-AG
Configuring a software controller 4
4.1 Overview of software controller
For the configuration of a software controller, you need an instruction with the control
algorithm and a technology object. The technology object for a software controller
corresponds with the instance DB of the instruction. The configuration of the controller is
saved in the technology object. In contrast to the instance DBs of other instructions,
technology objects are not stored for the program resources, but rather under CPU >
Technology objects.
PID control
Function Manual, 11/2023, A5E35300227-AG 41
Configuring a software controller
4.1 Overview of software controller
PID control
42 Function Manual, 11/2023, A5E35300227-AG
Configuring a software controller
4.3 Add technology objects
Step Description
1 Add technology object (Page 43)
2 Configure technology object (Page 44)
3 Call instruction in the user program (Page 45)
4 Download technology object to device (Page 46)
5 Commission software controller (Page 47)
6 Save optimized PID parameters in the project (Page 47)
7 Comparing values (Page 51)
8 Display instances of a technology object (Page 70)
Requirement
A project with a CPU has been created.
Procedure
To add a technology object, proceed as follows:
1. Open the CPU folder in the project tree.
2. Open the "Technology objects" folder.
3. Double-click "Add new object".
The "Add new object" dialog box opens.
4. Click on the "PID" button.
All available PID-controllers for this CPU are displayed.
5. Select the instruction for the technology object, for example, PID_Compact.
6. Enter an individual name for the technology object in the "Name" input field.
7. Select the "Manual" option if you want to change the suggested data block number of the
instance DB.
8. Click "Further information" if you want to add own information to the technology object.
9. Confirm with "OK".
PID control
Function Manual, 11/2023, A5E35300227-AG 43
Configuring a software controller
4.4 Configure technology objects
Result
The new technology object has been created and stored in the project tree in the "Technology
objects" folder. The technology object is used if the instruction for this technology object is
called in a cyclic interrupt OB.
NOTE
You can select the "Add new and open" check box at the bottom of the dialog box. This opens
the configuration of the technology object after adding has been completed.
Configuration window
For each technology object, there is a specific configuration window in which you can
configure all properties.
To open the configuration window of the technology object, follow these steps:
1. Open the "Technology objects" folder in the project tree.
2. Open the technology object in the project tree.
3. Double-click the "Configuration" object.
PID control
44 Function Manual, 11/2023, A5E35300227-AG
Configuring a software controller
4.5 Call instruction in the user program
Symbols
Icons in the area navigation of the configuration and in the Inspector window show
additional details about the completeness of the configuration:
Requirement
The cyclic interrupt OB is created and the cycle time of the cyclic interrupt OB is correctly
configured.
Procedure
Proceed as follows to call the instruction in the user program:
1. Open the CPU folder in the project tree.
2. Open the "Program blocks" folder.
3. Double-click the cyclic interrupt OB.
The block is opened in the work area.
4. Open the "Technology" group in the "Instructions" window and the "PID Control" folder.
The folder contains all instructions for software controllers that can be configured on the
CPU.
5. Select the instruction and drag it to your cyclic interrupt OB.
The "Call options" dialog box opens.
6. Select a technology object or type the name for a new technology object from the "Name"
list.
Result
If the technology object does not exist yet, it is added. The instruction is added in the cyclic
interrupt OB. The technology object is assigned to this call of the instruction.
PID control
Function Manual, 11/2023, A5E35300227-AG 45
Configuring a software controller
4.6 Downloading technology objects to device
NOTE
The download and reset of the PLC program during ongoing system operation can result in
serious damages or injuries in the case of malfunctions or program errors.
Make sure that dangerous states cannot occur before you download and reset the PLC
program.
PID control
46 Function Manual, 11/2023, A5E35300227-AG
Configuring a software controller
4.8 Save optimized PID parameter in the project
Result
The complete PLC program is downloaded to the device. Blocks that only exist online in the
device are deleted. By downloading all affected blocks and by deleting any blocks in the
device that are not required, you avoid inconsistencies between the blocks in the user
program.
The messages under "Info > General" in the Inspector window indicate whether the download
was successful.
Procedure
To open the "Commissioning" work area of the technology object, follow these steps:
1. Open the "Technology objects" folder in the project tree.
2. Open the technology object in the project tree.
3. Double-click the "Commissioning" object.
The commissioning functions are specific for each controller and are described there.
Requirement
• An online connection to the CPU is established and the CPU is in "RUN" mode.
• The functions of the commissioning window have been enabled by means of the "Start"
button.
Procedure
1. Open the CPU folder in the project tree.
2. Open the "Technology objects" folder.
3. Open a technology object.
4. Double click on "Commissioning".
5. Click on the icon "Upload PID parameters".
6. Save the project.
Result
The currently active PID parameters are stored in the project data. When reloading the project
data in the CPU, the optimized parameters are used.
PID control
Function Manual, 11/2023, A5E35300227-AG 47
Configuring a software controller
4.9 Working with multi-instance objects
Advantages
The use of multi-instances offers the following advantages:
• Good structuring possibility
• Lower number of instance DBs
• Individually configured FBs as template for a software controller than you can instantiate
as often as you wish
Restrictions
When using multi-instances for PID software controllers, the following restrictions are in place
compared to using a single instance:
• No support of Openness for PID multi-instance objects
• No comparison of PID multi-instance objects in a comparison editor. Comparison is only
possible via the block containing the multi-instance objects.
• No technology object-specific Inspector window of the programming editor for calling the
PID_Compact, PID_3Step and PID_Temp instructions
NOTE
The configuration editor does not offer online functionality for multi-instance objects in an
FB. Instance DBs do not have this restriction.
PID control
48 Function Manual, 11/2023, A5E35300227-AG
Configuring a software controller
4.9 Working with multi-instance objects
NOTE
If PID multi-instance objects are in an array, you can only navigate to these multi-instance
objects in the detail view if the number of array elements does not exceed 100. For arrays
with more than 100 elements, the individual PID multi-instance objects are not displayed and
the editors for configuration and commissioning are not available.
11. Repeat steps 8 to 10 for the other instance DBs with PID multi-instance objects.
12. Compile the program, load it into the device and set up an online connection.
13. Select an instance DB that contains PID multi-instance objects in the project tree and then
open the commissioning editors of the PID multi-instance objects via the "Technology
objects" tab of the detail view.
14. Commission the PID multi-instance objects.
16. Repeat steps 13 to 15 for the other instance DBs with PID multi-instance objects.
PID control
Function Manual, 11/2023, A5E35300227-AG 49
Configuring a software controller
4.10 Comparing values
Icon Function
Start value in PLC matches the configured Start value in project
Start value in PLC does not match the configured Start value in project
The comparison of the Start value in PLC with the configured Start value in project cannot
be performed
At least one of the two comparison values has a process-related or syntax error.
Create snapshot of monitor values and accept setpoints of this snapshot as start values
Boundary conditions
The "Compare values" function is available for S7-1200 and S7-1500 without limitations.
The following limitation applies to S7-300 and S7-400:
In monitoring mode, an S7-300/S7-400 cannot transfer the start values to the CPU. These
values cannot be displayed online with "Compare values".
The actual values of the technology object are displayed and can be changed directly.
PID control
50 Function Manual, 11/2023, A5E35300227-AG
Configuring a software controller
4.10 Comparing values
Requirements
• A project with a software controller is configured.
• The project is downloaded to the CPU.
• The configuration dialog is open in the project navigator.
Procedure
1. Open the desired software controller in the project navigation.
2. Double-click the "Configuration" object.
3. Navigate within the configuration window to the "PID Parameters" dialog.
4. Click the icon to activate monitoring mode.
The icons and operator controls (Page 50) of the "Compare values" function are shown
behind the parameters.
5. Click the desired parameter in the input box and change the parameter values manually by
entering them directly.
– If the background of the input box is gray, this value is a read-only value and cannot be
changed.
– To change the values in the "PID Parameters" dialog, enable manual entry by selecting
the "Enable manual entry" check box beforehand.
6. Click the icon to open the dialog for the start values.
This dialog indicates two values of the parameter:
– Start value in CPU: The start value in the CPU is shown in the top part.
– Start value in the project: The configured start value in the project is shown in the
bottom part.
7. Enter the desired value in the input box for the project.
Error detection
The input of incorrect values is detected. Corrections are suggested in this case.
If you enter a value with incorrect syntax, a rollout containing the corresponding error
message opens below the parameter. The incorrect value is not applied.
If you enter a value that is incorrect for the process, a dialog opens containing the error
message and a suggested correction:
• Click "No" to accept this suggested correction and correct your input.
• Click "OK" to apply the incorrect value.
NOTICE
Malfunctions of the controller
Values incorrect for the process can result in controller malfunctions.
PID control
Function Manual, 11/2023, A5E35300227-AG 51
Configuring a software controller
4.11 Parameter view
CAUTION
Prevent personal injury and property damage!
Downloading and resetting of the user program while the plant is operating may result in
significant property damage and severe personal injuries in the event of malfunctions or
program errors.
Make sure that dangerous states cannot occur before you download and reset the user
program.
PID control
52 Function Manual, 11/2023, A5E35300227-AG
Configuring a software controller
4.11 Parameter view
Function scope
The following functions are available for analyzing the parameters of the technology objects
and for enabling targeted monitoring and modification.
Display functions:
• Display of parameter values in offline and online mode
• Display of status information of the parameters
• Display of value deviations and option for direct correction
• Display of configuration errors
• Display of value changes as a result of parameter dependencies
• Display of all memory values of a parameter: Start value PLC, Start value project, Monitor
value
• Display of the parameter comparison of the memory values of a parameter
Operator control functions:
• Navigation for quickly changing between the parameters and parameter structures.
• Text filter for faster searches for particular parameters.
• Sorting function for customizing the order of parameters and parameter groups to
requirements.
• Memory function for backing up structural settings of the Parameter view.
• Monitoring and modifying of parameter values online.
• Change display format of value.
• Function for saving a snapshot of parameter values of the CPU in order to capture
momentary situations and to respond to them.
• Function for applying a snapshot of parameter values as start values.
• Download of modified start values to the CPU.
• Comparison functions for comparing parameter values with one another.
Validity
The Parameter view described here is available for the following technology objects:
• PID_Compact
• PID_3Step
• PID_Temp
• CONT_C (S7-1500 only)
• CONT_S (S7-1500 only)
• TCONT_CP (S7-1500 only)
• TCONT_S (S7-1500 only)
• TO_Axis_PTO (S7-1200 Motion Control)
• TO_Positioning_Axis (S7-1200 Motion Control)
• TO_CommandTable_PTO (S7-1200 Motion Control)
• TO_CommandTable (S7-1200 Motion Control)
PID control
Function Manual, 11/2023, A5E35300227-AG 53
Configuring a software controller
4.11 Parameter view
4.11.2.1 Toolbar
The following functions can be selected in the toolbar of the parameter view.
Icon Function Explanation
Monitor all Starts the monitoring of visible parameters in the active Parameter
view (online mode).
Create snapshot of monit Applies the current monitor values to the “Snapshot” column and
or values and accept set updates the start values in the project.
points of this snapshot as Only in online mode for PID_Compact, PID_3Step and PID_Temp.
start values
Load start values of set Transfers the start values updated in the project to the CPU.
points as actual values Only in online mode for PID_Compact, PID_3Step and PID_Temp.
(initialize setpoints)
Create snapshot of monit Applies the current monitor values to the “Snapshot” column.
or values Only in online mode.
Modify all selected para This command is executed once and as quickly as possible without ref
meters immediately and erence to any particular point in the user program.
once Only in online mode.
Select navigation struc Toggles between functional navigation and data navigation.
ture
Text filter... After entry of a character string: Display of all parameters containing
the specified string in one of the currently visible columns.
Selection of compare val Selection of parameter values that are to be compared with one anoth
ues er in online mode (Start value in project, Start value in PLC, Snapshot)
Only in online mode.
Save window settings Saves your display settings for the Parameter view (e.g., selected nav
igation structure, activated table columns, etc.)
4.11.2.2 Navigation
Within the "Parameter view" tab, the following alternative navigation structures can be
selected.
Navigation Explanation
Functional naviga In the functional navigation, the structure of the parameters is
tion based on the structure in the configuration dialog ("Functional
view" tab), commissioning dialog, and diagnostics dialog.
The last group "Other parameters" contains all other parameters of
the technology object.
Data navigation In the data navigation, the structure of the parameters is based on
the structure in the instance DB / technology DB.
The last group "Other parameters" contains the parameters that are
not contained in the instance DB / technology DB.
PID control
54 Function Manual, 11/2023, A5E35300227-AG
Configuring a software controller
4.11 Parameter view
You can use the "Select navigation structure" drop-down list to toggle the navigation
structure.
The table below shows the meaning of the individual columns of the parameter table. You
can show or hide the columns as required.
• Column "Offline" = X: Column is visible in offline mode.
• Column "Online" = X: Column is visible in online mode (online connection to the CPU).
PID control
Function Manual, 11/2023, A5E35300227-AG 55
Configuring a software controller
4.11 Parameter view
See also
Comparing values (Page 50)
Requirement
The technology object has been added in the project tree, i.e., the associated instance DB /
technology DB of the instruction has been created.
Procedure
1. Open the "Technology objects" folder in the project tree.
2. Open the technology object in the project tree.
3. Double-click the "Configuration" object.
4. Select the "Parameter view" tab in the top right corner.
Result
The Parameter view opens. Each displayed parameter is represented by one row in the
parameter table.
The displayable parameter properties (table columns) vary depending on whether you are
working with the Parameter view in offline or online mode.
In addition, you can selectively display and hide individual table columns.
PID control
56 Function Manual, 11/2023, A5E35300227-AG
Configuring a software controller
4.11 Parameter view
See also
Default setting of the parameter view (Page 57)
Default settings
To enable you to work efficiently with the Parameter view, you can customize the parameter
display and save your settings.
The following customizations are possible and can be saved:
• Show and hide columns
• Change column width
• Change order of the columns
• Toggle navigation
• Select parameter group in the navigation
• Selection of compare values
PID control
Function Manual, 11/2023, A5E35300227-AG 57
Configuring a software controller
4.11 Parameter view
Toggle navigation
To toggle the display form of the parameters, follow these steps:
1. Select the desired navigation in the “Select navigation structure” drop-down list.
– Data navigation
– Functional navigation
See also Navigation (Page 54).
PID control
58 Function Manual, 11/2023, A5E35300227-AG
Configuring a software controller
4.11 Parameter view
4.11.5.1 Overview
The following table provides an overview of the functions of the Parameter view in online
and offline mode described in the following.
• Column "Offline" = X: This function is possible in offline mode.
• Column "Online" = X: This function is possible in online mode.
You can filter the parameters in the parameter table in the following ways:
• With the text filter
• With the subgroups of the navigation
Both filter methods can be used simultaneously.
PID control
Function Manual, 11/2023, A5E35300227-AG 59
Configuring a software controller
4.11 Parameter view
The values of the parameters are arranged in rows. The parameter table can be sorted by any
displayed column.
• In columns containing numerical values, sorting is based on the magnitude of the
numerical value.
• In text columns, sorting is alphabetical.
Sorting by column
1. Position the cursor in the header cell of the desired column.
The background of this cell turns blue.
2. Click the column header.
Result
The entire parameter table is sorted by the selected column. A triangle with tip facing up
appears in the column header.
Clicking the column header again changes the sorting as follows:
• Symbol “▲”: Parameter table is sorted in ascending order.
• Symbol “▼”: Parameter table is sorted in descending order.
• No symbol: The sorting is removed again. The parameter table assumes the default
display.
The “../“ prefix in the “Name in DB” column is ignored when sorting.
After selecting an entire parameter row of the parameter table, you can use the following:
• Drag-and-drop
• <Ctrl+C>/<Ctrl+V>
• Copy/Paste via shortcut menu
Transfer parameters to the following editors of the TIA Portal:
• Program editor
• Watch table
• Signal table for trace function
The parameter is inserted with its full name: See information in “Full name in DB” column.
PID control
60 Function Manual, 11/2023, A5E35300227-AG
Configuring a software controller
4.11 Parameter view
Error indication
Parameter assignment errors that result in compilation errors (e.g. limit violation) are
indicated in the Parameter view.
Every time a value is input in the Parameter view, a check is made for process-related and
syntax errors and the result is indicated.
Bad values are indicated by:
• Red error symbol in the "Status of configuration" (offline mode) or "Compare result"
(online mode, depending on the selected comparison type) columns
and/or
• Table field with red background
If you click the bad field, a roll-out error message appears with information of the
permissible value range or the required syntax (format)
Compilation error
From the error message of the compiler, you can directly open the Parameter view
(functional navigation) containing the parameter causing the error in situations where the
parameter is not displayed in the configuration dialog.
With the Parameter view, you can edit the start values in the project in offline mode and
online mode.
• You make value changes in the “Start value project” column of the parameter table.
• In the “Status of configuration” column of the parameter table, the progress of the
configuration is indicated by the familiar status symbols from the configuration dialog of
the technology object.
Boundary conditions
• If other parameters depend on the parameter whose start value was changed, the start
value of the dependent parameters are also adapted.
• If a parameter of a technology object is not editable, it is also not editable in the
parameter view. The ability to edit a parameter can also depend on the values of other
parameters.
PID control
Function Manual, 11/2023, A5E35300227-AG 61
Configuring a software controller
4.11 Parameter view
Error indication
When a start value is input, a check is made for process-related and syntax errors and the
result is indicated.
Bad start values are indicated by:
• Red error symbol in the "Status of configuration" (offline mode) or "Compare result"
(online mode, depending on the selected comparison type) columns
and/or
• Red background in the “Start value project” field
If you click on the bad field, a roll-out error message appears with information of the
permissible value range or the necessary syntax (format)
PID control
62 Function Manual, 11/2023, A5E35300227-AG
Configuring a software controller
4.11 Parameter view
Symbol Meaning
The start value of the parameter corresponds to the default value and is valid. A start
value has not yet been defined by the user.
The start value of the parameter contains a value defined by the user or an automatically
adjusted value. The start value is different than the default value. The start value is error-
free and valid.
The start value of the parameter is invalid (syntax or process-related error).
The input box has a red background. When clicked, the roll-out error message indicates
the cause of the error.
Only for S7-1200 Motion Control:
The start value of the parameter is valid but contains warnings.
The input box has a yellow background.
The parameter is not relevant in the current configuration.
PID control
Function Manual, 11/2023, A5E35300227-AG 63
Configuring a software controller
4.11 Parameter view
You can monitor the values currently taken by the parameters of the technology object in the
CPU (monitor values) directly in the Parameter view.
Requirements
• There is an online connection.
• The technology object is downloaded to the CPU.
• The program execution is active (CPU in "RUN").
• The Parameter view of the technology object is open.
Procedure
1. Start the monitoring by clicking .
As soon as the Parameter view is online, the following columns are additionally displayed:
– Compare result
– Start value PLC
– Monitor value
– Modify value
– Selection for transmission
The "Monitor value" column shows the current parameter values on the CPU.
Meaning of the additional columns: see Parameter table (Page 55)
2. Stop the monitoring by clicking again.
Display
All columns that are only available online have an orange background:
• Values in light-orange cells can be changed.
• Values in cells with a dark orange background cannot be changed.
The display format of the value can be selected via the shortcut menu of a table row in the
Parameter view of the technology object.
The display format of the following values can be changed both in online mode and in offline
mode:
• Start value project
• Start value PLC
• Maximum value
• Minimum value
• Snapshot
• Monitor value
• Default value
• Modify value
PID control
64 Function Manual, 11/2023, A5E35300227-AG
Configuring a software controller
4.11 Parameter view
The set display format applies to all values of the table row.
The following display formats of the value can be changed:
• Default
• Hex
• Octal
• Bin
• Dec (+/-)
• DEC
Depending on the parameter selected in the parameter view, only the supported display
formats can be selected.
Requirements
• The Parameter view of the technology object is open.
Procedure
To change the display format of the value, proceed as follows:
1. Select one or more table rows in which you want to change the display format.
2. Select the "Display format" command in the shortcut menu.
3. Select the desired display format.
NOTE
To change the display format of a certain data type in multiple table rows, sort the Parameter
view by this data type. Then select the first and last table row with this data type while
keeping the <Shift> key pressed and change the display format for the selected table rows.
You can back up the current values of the technology object on the CPU (monitor values) and
display them in the Parameter view.
Requirements
• There is an online connection.
• The technology object is downloaded to the CPU.
• The program execution is active (CPU in "RUN").
• The Parameter view of the technology object is open.
• The “Monitor all” button is selected.
Procedure
To show the current parameter values, follow these steps:
1. In the Parameter view, click the “Create snapshot of monitor values" icon .
PID control
Function Manual, 11/2023, A5E35300227-AG 65
Configuring a software controller
4.11 Parameter view
Result
The current monitor values are transferred once to the "Snapshot" column of the parameter
table.
You can analyze the values "frozen" in this way while the monitor values continue to be
updated in the "Monitor values" column.
With the Parameter view, you can modify values of the technology object in the CPU.
You can assign values to the parameter once (Modify value) and modify them immediately.
The modify request is executed as quickly as possible without reference to any particular
point in the user program.
DANGER
Danger when modifying:
Changing the parameter values while the plant is operating may result in severe damage to
property and personal injury in the event of malfunctions or program errors.
Make sure that dangerous states cannot occur before you use the "Modify" function.
Requirements
• There is an online connection.
• The technology object is downloaded to the CPU.
• The program execution is active (CPU in "RUN").
• The Parameter view of the technology object is open.
• The “Monitor all” button is selected.
• The parameter can be modified (associated field in the "Modify value" column has a light-
orange background).
Procedure
To modify parameters immediately, follow these steps:
1. Enter the desired modify values in the “Modify values” column of the parameter table.
2. Check whether the check box for modifying is selected in the "Select for transmission"
column.
The modify values and associated check boxes of dependent parameters are automatically
adapted at the same time.
3. Click the “Modify all selected parameters immediately and once” icon .
The selected parameters are modified once and immediately with the specified values and
can be monitored in the "Monitor values" column. The check boxes for modifying in the
"Selection for transmission" column are automatically cleared after the modify request is
complete.
PID control
66 Function Manual, 11/2023, A5E35300227-AG
Configuring a software controller
4.11 Parameter view
Error indication
When a start value is input, a check is made immediately for process-related and syntax errors
and the result is indicated.
Bad start values are indicated by:
• Red background in the “Modify value” field
and
• If you click the bad field, a roll-out error message appears with information of the
permissible value range or the necessary syntax (format)
You can use comparison functions to compare the following memory values of a parameter:
• Start value project
• Start value PLC
• Snapshot
Requirements
• There is an online connection.
• The technology object is downloaded to the CPU.
• The program execution is active (CPU in "RUN").
• The Parameter view of the technology object is open.
• The “Monitor all” button is selected.
Procedure
To compare the start values on the various target systems, follow these steps:
1. Click the "Selection of comparison values" icon .
A selection list containing the comparison options opens:
– Start value project - Start value PLC (default setting)
– Start value project - Snapshot
– Start value PLC - Snapshot
2. Select the desired comparison option.
The selected comparison option is executed as follows:
– A scales symbol appears in the header cells of the two columns selected for
comparison.
– Symbols are used in the "Compare result" column to indicate the result of the
comparison of the selected columns.
PID control
Function Manual, 11/2023, A5E35300227-AG 67
Configuring a software controller
4.11 Parameter view
Symbol Meaning
The compare values are equal and error-free.
At least one of the two compare values has a process-related or syntax error.
The comparison cannot be performed. At least one of the two comparison values is not
available (e.g. snapshot).
Comparison of the value is inappropriate since it is not relevant in one of the configura
tions.
In order to apply optimized values from the CPU to the project as start values, you create a
snapshot of the monitor values. Values of the snapshot marked as a "Setpoint" are then
applied to the project as start values.
Requirements
• The technology object is of the type "PID_Compact", "PID_3Step" or "PID_Temp".
• There is an online connection.
• The technology object is downloaded to the CPU.
• The program execution is active (CPU in "RUN").
• The Parameter view of the technology object is open.
• The “Monitor all” button is selected.
Procedure
To apply optimized values from the CPU, follow these steps:
1. Click the "Create snapshot of monitor values and accept setpoints of this snapshot as start
values" icon .
PID control
68 Function Manual, 11/2023, A5E35300227-AG
Configuring a software controller
4.11 Parameter view
Result
The current monitor values are applied to the "Snapshot" column and their setpoints are
copied to the "Start value in project" column as new start values.
NOTE
Applying values of individual parameters
You can also apply the values of individual parameters that are not marked as a setpoint from
the "Snapshot" column to the "Start values project" column. To do so, copy the values and
insert them into the "Start value in project" column using the "Copy" and "Paste" commands in
the shortcut menu.
You can initialize all parameters that are marked as a "Setpoint" in the Parameter view with
new values in the CPU in one step. In so doing, the start values are downloaded from the
project to the CPU. The CPU remains in "RUN" mode.
To avoid data loss on the CPU during a cold restart or warm restart, you must also download
the technology object to the CPU.
DANGER
Danger when changing parameter values
Changing the parameter values while the plant is operating may result in severe damage to
property and personal injury in the event of malfunctions or program errors.
Make sure that dangerous states cannot occur before you reinitialize the setpoints.
Requirements
• The technology object is of the type "PID_Compact", "PID_3Step" or "PID_Temp".
• There is an online connection.
• The technology object is downloaded to the CPU.
• The program execution is active (CPU in "RUN").
• The Parameter view of the technology object is open.
• The “Monitor all” button is selected.
• The parameters marked as " have a "Start value in project" that is free of process-related
and syntax errors.
Procedure
To initialize all setpoints, follow these steps:
1. Enter the desired values in the "Start value in project" column.
Ensure that the start values are free of process-related and syntax errors.
2. Click the icon "Load start values of setpoints as actual values".
PID control
Function Manual, 11/2023, A5E35300227-AG 69
Configuring a software controller
4.12 Display instance DB of a technology object.
Result
The setpoints in the CPU are initialized with the start values from the project.
Procedure
To display the instance DB of a technology object, proceed as follows:
1. Open the CPU folder in the project tree.
2. Open the "Technology objects" folder.
3. Highlight a technology object.
4. Select the command "Open DB editor" in the shortcut menu.
PID control
70 Function Manual, 11/2023, A5E35300227-AG
Using PID_Compact 5
5.1 Technology object PID_Compact
The technology object PID_Compact provides a continuous PID controller with integrated
optimization. You can alternatively configure a pulse controller. Both manual and automatic
mode are possible.
PID-Compact continuously acquires the measured process value within a control loop and
compares it with the required setpoint. From the resulting control deviation, the instruction
PID_Compact calculates an output value by which the process value is adapted as quickly and
stable as possible to the setpoint. The output value for the PID controller consists of three
actions:
• Proportional action
The proportional action of the output value increases in proportion to the control
deviation.
• I action
The integral action of the output value increases until the control deviation has been
balanced.
• D action
The derivative action increases with the rate of change of control deviation. The process
value is corrected to the setpoint as quickly as possible. The derivative action will be
reduced again if the rate of change of control deviation drops.
The instruction PID_Compact calculates the proportional, integral and derivative parameters
for your controlled system during pretuning. Fine tuning can be used to tune the parameters
further. You do not need to manually determine the parameters.
Additional information
• Overview of software controller (Page 41)
• Add technology objects (Page 43)
• Configure technology objects (Page 44)
• Configuring PID_Compact as of V2 (Page 72)
• Configuring PID_Compact V1 (Page 95)
FAQ
For more information, see the following FAQs in the Siemens Industry Online Support:
• Entry ID 79047707 (https://support.industry.siemens.com/cs/ww/en/view/79047707)
PID control
Function Manual, 11/2023, A5E35300227-AG 71
Using PID_Compact
5.2 PID_Compact as of V2
5.2 PID_Compact as of V2
Configure the following properties of the "PID_Compact" technology object under "Basic
settings" in the Inspector window or in the configuration window:
• Physical quantity
• Control logic
• Start-up behavior after reset
• Setpoint (only in the Inspector window)
• Process value (only in the Inspector window)
• Output value (only in the Inspector window)
Physical quantity
Select the unit of measurement and physical quantity for the setpoint and the process value
in the "Controller type" group. The setpoint and the process value are displayed in this unit.
Control logic
An increase of the output value is generally intended to cause an increase in the process
value. This is referred to as a normal control logic.
PID_Compact does not work with negative proportional gain. Select the check box "Invert
control logic" to reduce the process value with a higher output value.
Examples
• Opening the drain valve will reduce the level of a container's contents.
• Increasing cooling will reduce the temperature.
PID control
72 Function Manual, 11/2023, A5E35300227-AG
Using PID_Compact
5.2 PID_Compact as of V2
Startup characteristics
1. To switch to "Inactive" mode after CPU restart, clear the "Activate Mode after CPU restart"
check box.
To switch to the operating mode saved in the Mode parameter after CPU restart, select the
"Activate Mode after CPU restart" check box.
2. In the "Set Mode to" drop-down list, select the mode that is to be enabled after a complete
download to the device.
After a complete download to the device, PID_Compact starts in the selected operating
mode. With each additional restart, PID_Compact starts in the mode that was last saved in
Mode.
Example
You have selected the "Activate Mode after CPU restart" check box and the entry "Pretuning"
in the "Set Mode to" list. After a complete download to the device, PID_Compact starts in the
"Pretuning" mode. If pretuning is still active, PID_Compact starts in "Pretuning" mode again
after restart of the CPU. If pretuning was successfully completed and automatic mode is
active, PID_Compact starts in "Automatic mode" after restart of the CPU.
Procedure
Proceed as follows to define a fixed setpoint:
1. Select "Instance DB".
2. Enter a setpoint, e.g. 80° C.
3. Delete any entry in the instruction.
Proceed as follows to define a variable setpoint:
1. Select "Instruction".
2. Enter the name of the REAL variable in which the setpoint is saved.
Program-controlled assignment of various values to the REAL variable is possible, for
example for the time controlled change of the setpoint.
PID_Compact will scale the value of the analog input to the physical quantity if you use the
analog input value directly.
You will need to write a program for processing if you wish first to process the analog input
value. The process value is, for example, not directly proportional to the value at the analog
input. The processed process value must be in floating point format.
Procedure
Proceed as follows to use the analog input value without processing:
1. Select the entry "Input_PER" in the drop-down list "Input".
2. Select "Instruction" as source.
3. Enter the address of the analog input.
Proceed as follows to use the processed process value in floating point format:
1. Select the entry "Input" in the drop-down list "Input".
2. Select "Instruction" as source.
3. Enter the name of the variable in which the processed process value is saved.
PID control
Function Manual, 11/2023, A5E35300227-AG 73
Using PID_Compact
5.2 PID_Compact as of V2
PID_Compact offers three output values. Your actuator will determine which output value you
use.
• Output_PER
The actuator is triggered via an analog output and controlled with a continuous signal,
e.g. 0...10V, 4...20mA.
• Output
The output value needs to be processed by the user program, for example because of non-
linear actuator response.
• Output_PWM
The actuator is controlled via a digital output. Pulse width modulation creates minimum
ON and minimum OFF times.
Procedure
Proceed as follows to use the analog output value:
1. Select the entry "Output_PER (analog)" in the drop-down list "Output".
2. Select "Instruction".
3. Enter the address of the analog output.
Proceed as follows to process the output value using the user program:
1. Select the entry "Output" in the drop-down list "Output".
2. Select "Instance DB".
The calculated output value is saved in the instance data block.
3. For the preparation of the output value, use the output parameter Output.
4. Transfer the processed output value to the actuator via a digital or analog CPU output.
Proceed as follows to use the digital output value:
1. Select the entry "Output_PWM" in the drop-down list "Output".
2. Select "Instruction".
3. Enter the address of the digital output.
PID control
74 Function Manual, 11/2023, A5E35300227-AG
Using PID_Compact
5.2 PID_Compact as of V2
If you have configured the use of Input_PER in the basic setting, you must convert the value
of the analog input to the physical quantity of the process value. The current configuration is
displayed in the Input_PER display.
Input_PER will be scaled using a low and high value pair if the process value is directly
proportional to the value of the analog input.
Procedure
To scale the process value, follow these steps:
1. Enter the low pair of values in the "Scaled low process value" and "Low" input fields.
2. Enter the high pair of values in the "Scaled high process value" and "High" input boxes.
Default settings for the value pairs are stored in the hardware configuration. To use the value
pairs from the hardware configuration, follow these steps:
1. Select the PID_Compact instruction in the programming editor.
2. Interconnect Input_PER with an analog input in the basic settings.
3. Click the "Automatic setting" button in the process value settings.
The existing values will be overwritten with the values from the hardware configuration.
You must specify an appropriate absolute high limit and low limit for the process value as
limit values for your controlled system. As soon as the process value violates these limits, an
error occurs (ErrorBits = 0001h). Tuning is canceled when the process value limits are
violated. You can configure how PID_Compact reacts to an error in automatic mode in the
output value settings.
Configure a warning high and low limit for the process value in the "Process value
monitoring" configuration window. If one of the warning limits is exceeded or undershot
during operation, a warning will be displayed at the PID_Compact instruction:
• At the InputWarning_H output parameter if the warning high limit has been exceeded
• At the InputWarning_L output parameter if the warning low limit has been undershot
The warning limits must be within the process value high and low limits.
The process value high and low limits will be used if you do not enter values.
Example
Process value high limit = 98 °C; warning high limit = 90 °C
Warning low limit = 10 °C; process value low limit = 0 °C
PID_Compact will respond as follows:
PID control
Function Manual, 11/2023, A5E35300227-AG 75
Using PID_Compact
5.2 PID_Compact as of V2
Via pulse width modulation, the value at the output parameter Output is transformed into a
pulse sequence that is output at output parameter Output_PWM.
Output is calculated in the PID algorithm sampling time. The sampling time is used as time
period of the pulse width modulation.
The PID algorithm sampling time is determined during pretuning or fine tuning. If manually
setting the PID parameters, you will also need to configure the PID algorithm sampling time.
Output_PWM is output in the PID_Compact sampling time. The PID_Compact sampling time is
equivalent to the cycle time of the calling OB.
The pulse duration is proportional to the value at Output and is always an integer multiple of
the PID_Compact sampling time.
0VUQVU
U NT
0VUQVU@18.
536&
'"-4&
U NT
PID control
76 Function Manual, 11/2023, A5E35300227-AG
Using PID_Compact
5.2 PID_Compact as of V2
A pulse or a break is never shorter than the minimum ON or OFF time. The inaccuracies this
causes are added up and compensated in the next cycle.
Example
PID_Compact sampling time (equivalent to the cycle time of the calling OB) = 100 ms
PID algorithm sampling time (equivalent to the time period)= 1000 ms
Minimum ON time = 200 ms
Output is a constant 15%. The smallest pulse that PID_Compact can output is 20%. In the first
cycle, no pulse is output. In the second cycle, the pulse not output in the first cycle is added
to the pulse of the second cycle.
0VUQVU
0VUQVU@18. U NT
536&
'"-4&
U NT
NOTE
The minimum ON and OFF times only affect the output parameter Output_PWM and are not
used for any pulse generators integrated in the CPU.
PID control
Function Manual, 11/2023, A5E35300227-AG 77
Using PID_Compact
5.2 PID_Compact as of V2
Reaction to error
NOTICE
Your system may be damaged.
If you output "Current value while error pending " or "Substitute output value while error
pending" in the event of an error, PID_Compact remains in automatic mode. This may cause
a violation of the process value limits and damage your system.
It is essential to configure how your controlled system reacts in the event of an error to
protect your system from damage.
PID_Compact is preset so that the controller stays active in most cases in the event of an
error. If errors occur frequently in controller mode, this default reaction has a negative effect
on the control response. In this case, check the Errorbits parameter and eliminate the cause
of the error.
PID_Compact generates a programmable output value in response to an error:
• Zero (inactive)
PID_Compact outputs 0.0 as output value for all errors and switches to "Inactive" mode.
The controller is only reactivated by a falling edge at Reset or a rising edge at
ModeActivate.
• Current value while error is pending
If the following errors occur in automatic mode, PID_Compact returns to automatic mode
as soon as the errors are no longer pending.
If one or more of the following errors occur, PID_Compact stays in
automatic mode:
– 0001h: The "Input" parameter is outside the process value limits.
– 0800h: Sampling time error
– 40000h: Invalid value at Disturbance parameter.
If one or more of the following errors occur in automatic mode, PID_Compact switches to
"Substitute output value with error monitoring" mode and outputs the last valid output
value:
– 0002h: Invalid value at Input_PER parameter.
– 0200h: Invalid value at Input parameter.
– 0400h: Calculation of output value failed.
– 1000h: Invalid value at Setpoint parameter.
PID control
78 Function Manual, 11/2023, A5E35300227-AG
Using PID_Compact
5.2 PID_Compact as of V2
If an error occurs in manual mode, PID_Compact continues using the manual value as the
output value. If the manual value is invalid, the substitute output value is used. If the
manual value and substitute output value are invalid, the output value low limit is used.
If the following error occurs during a pretuning or fine tuning, PID_Compact remains in
active mode:
– 0020h: Pretuning is not permitted during fine tuning.
When any other error occurs, PID_Compact cancels the tuning and switches to the mode
from which tuning was started.
As soon as no errors are pending, PID_Compact returns to automatic mode.
• Substitute output value while error is pending
PID_Compact outputs the substitute output value.
If the following error occurs, PID_Compact stays in "Substitute output value with error
monitoring" mode and outputs the output value low limit:
– 20000h: Invalid value at SubstituteOutput tag.
For all other errors, PID_Compact reacts as described for "Current value while error is
pending".
See also
State and Mode as of V2 parameters (Page 252)
The PID parameters are displayed in the "PID Parameters" configuration window. The PID
parameters will be adapted to your controlled system during controller tuning. You do not
need to enter the PID parameters manually.
NOTE
The currently active PID parameters are located for PID_Compact V1 in the sRet structure and
as of PID_Compact V2 in the Retain.CtrlParams structure.
Change the currently active PID parameters only in "Inactive" mode online to prevent
malfunction of the PID controller.
If you want to change the PID parameters in "Automatic mode" or "Manual mode" online,
change the PID parameters as follows:
• PID_Compact V1: Change the PID parameters in the sBackUp structure and apply these
changes with sPid_Cmpt.b_LoadBackUp = TRUE to the sRet structure.
• PID_Compact as of V2: Change the PID parameters in the CtrlParamsBackUp structure and
apply these changes with LoadBackUp = TRUE to the Retain.CtrlParams structure.
Online changes to the PID parameters in "Automatic mode" can result in jumps at the output
value.
PID control
Function Manual, 11/2023, A5E35300227-AG 79
Using PID_Compact
5.2 PID_Compact as of V2
Symbol Description
y Output value of the PID algorithm
Kp Proportional gain
s Laplace operator
b Proportional action weighting
w Setpoint
x Process value
TI Integration time
a Derivative delay coefficient (derivative delay T1 = a × TD)
TD Derivative action time
c Derivative action weighting
The diagram below illustrates the integration of the parameters into the PID algorithm:
4FUQPJOU X C
"OUJXJOEVQ
,1
-*.*5 * Z
4DBMFE*OQVU Y %5
All PID parameters are retentive. If you enter the PID parameters manually, you must
completely download PID_Compact.
Downloading technology objects to device (Page 46)
Proportional gain
The value specifies the proportional gain of the controller. PID_Compact does not work with a
negative proportional gain. Control logic is inverted under Basic settings > Controller type.
PID control
80 Function Manual, 11/2023, A5E35300227-AG
Using PID_Compact
5.2 PID_Compact as of V2
Integration time
The integration time determines the time behavior of the integral action. The integral action
is deactivated with integration time = 0.0. When the integration time is changed from a
different value to 0.0 online in "Automatic mode", the previous integral action is deleted and
the output value jumps.
PID control
Function Manual, 11/2023, A5E35300227-AG 81
Using PID_Compact
5.2 PID_Compact as of V2
The PID parameters are displayed in the "PID Parameters" configuration window. During
tuning, the PID parameters are adapted to the controlled system with the exception of the
dead zone width that has to be configured manually.
NOTE
The currently active PID parameters are located in the Retain.CtrlParams structure.
Change the currently active PID parameters only in "Inactive" mode online to prevent
malfunction of the PID controller.
If you want to change the PID parameters in "Automatic mode" or "Manual mode" online,
change the PID parameters in the CtrlParamsBackUp structure and apply these changes with
LoadBackUp = TRUE to the Retain.CtrlParams structure.
Online changes to the PID parameters in "Automatic mode" can result in jumps at the output
value.
PID_Compact is a PIDT1 controller with Anti-Windup and weighting of the proportional and
derivative actions.
PID control
82 Function Manual, 11/2023, A5E35300227-AG
Using PID_Compact
5.2 PID_Compact as of V2
The PID algorithm operates according to the following equation (dead zone disabled):
5%wT
Z,Q < CwXY 5*wT
XY
Bw5%wT
DwXY >
C
$VSSFOU4FUQPJOU X
D %5 ,1
Z
%FBE;POF
"OUJ8JOEVQ
-*.*5 *
4DBMFE*OQVU Y 1*%$USM*OUFHSBM4VN
All PID parameters are retentive. If you enter the PID parameters manually, you must
completely download PID_Compact.
Download technology objects to device
Proportional gain
The value specifies the proportional gain of the controller. PID_Compact does not work with a
negative proportional gain. Control logic is inverted under Basic settings > Controller type.
PID control
Function Manual, 11/2023, A5E35300227-AG 83
Using PID_Compact
5.2 PID_Compact as of V2
Integration time
The integration time determines the time behavior of the integral action. The integral action
is deactivated with integration time = 0.0. When the integration time is changed from a
different value to 0.0 online in "Automatic mode", the previous integral action is deleted and
the output value jumps.
If the output value reaches an output value limit in automatic mode, the integral action is
stopped depending on the direction (Anti-Windup). As of PID_Compact Version 3.0, the
integral component is also actively limited in order to prevent delayed control behavior, e.g.
when the output value limits change. Changes to the following tags can lead to an
adjustment of the integral component in automatic mode:
• Output value limits (Config.OutputLowerLimit and Config.OutputUpperLimit tags)
• Setpoint (Setpoint tag)
• Proportional gain (Retain.CtrlParams.Gain tag)
• Proportional action weighting (Retain.CtrlParams.PWeighting tag)
• Disturbance variable (Disturbance variable)
PID control
84 Function Manual, 11/2023, A5E35300227-AG
Using PID_Compact
5.2 PID_Compact as of V2
3FUBJO$USM1BSBNT
%FBE;POF
PID control
Function Manual, 11/2023, A5E35300227-AG 85
Using PID_Compact
5.2 PID_Compact as of V2
See also
Selection of the controller structure for specified controlled systems (Page 39)
5.2.2.1 Pretuning as of V2
The pretuning determines the process response to a jump change of the output value and
searches for the point of inflection. The PID parameters are calculated from the maximum
rate of rise and dead time of the controlled system. You obtain the best PID parameters when
you perform pretuning and fine tuning.
The more stable the process value is, the easier it is to calculate the PID parameters and the
more precise the result will be. Noise on the process value can be tolerated as long as the rate
of rise of the process value is significantly higher compared to the noise. This is most likely
the case in operating modes "Inactive" and "manual mode". The PID parameters are backed up
before being recalculated.
Requirement
• The "PID_Compact" instruction is called in a cyclic interrupt OB.
• ManualEnable = FALSE
• Reset = FALSE
• PID_Compact is in one of the following modes: "Inactive", "Manual mode", or "Automatic
mode".
• The setpoint and the process value lie within the configured limits (see "Process value
monitoring" configuration).
• The difference between setpoint and process value is greater than 30% of the difference
between process value high limit and process value low limit.
• The distance between the setpoint and the process value is > 50% of the setpoint.
PID control
86 Function Manual, 11/2023, A5E35300227-AG
Using PID_Compact
5.2 PID_Compact as of V2
Procedure
To perform pretuning, follow these steps:
1. Double-click the "PID_Compact > Commissioning" entry in the project tree.
2. Select the entry "Pretuning" in the "Tuning mode" drop-down list.
3. Click the "Start" icon.
– An online connection will be established.
– Value recording is started.
– Pretuning is started.
– The "Status" field displays the current steps and any errors that may have occurred. The
progress bar indicates the progress of the current step.
NOTE
Click the "Stop" icon when the progress bar has reached 100% and it can be assumed
the controller tuning function is blocked. Check the configuration of the technology
object and, if necessary, restart controller tuning.
Result
If pretuning was performed without an error message, the PID parameters have been tuned.
PID_Compact switches to automatic mode and uses the tuned parameters. The tuned PID
parameters will be retained during power OFF and a restart of the CPU.
If pretuning is not possible, PID_Compact responds with the configured reaction to errors.
See also
State and Mode as of V2 parameters (Page 252)
PID control
Function Manual, 11/2023, A5E35300227-AG 87
Using PID_Compact
5.2 PID_Compact as of V2
Fine tuning generates a constant, limited oscillation of the process value. The PID parameters
are tuned for the operating point from the amplitude and frequency of this oscillation. All PID
parameters are recalculated from the results. PID parameters from fine tuning usually have
better master control and disturbance characteristics than PID parameters from pretuning.
You obtain the best PID parameters when you perform pretuning and fine tuning.
PID_Compact automatically attempts to generate an oscillation greater than the noise of the
process value. Fine tuning is only minimally influenced by the stability of the process value.
The PID parameters are backed up before being recalculated.
Requirement
• The PID_Compact instruction is called in a cyclic interrupt OB.
• ManualEnable = FALSE
• Reset = FALSE
• The setpoint and the process value lie within the configured limits.
• The control loop has stabilized at the operating point. The operating point is reached
when the process value corresponds to the setpoint.
• No disturbances are expected.
• PID_Compact is in inactive mode, automatic mode or manual mode.
PID control
88 Function Manual, 11/2023, A5E35300227-AG
Using PID_Compact
5.2 PID_Compact as of V2
Procedure
To perform fine tuning, follow these steps:
1. Select the entry "Fine tuning" in the "Tuning mode" drop-down list.
2. Click the "Start" icon.
– An online connection will be established.
– Value recording is started.
– The process of fine tuning is started.
– The "Status" field displays the current steps and any errors that may have occurred. The
progress bar indicates the progress of the current step.
NOTE
Click the "Stop" icon in the "Tuning mode" group when the progress bar has reached 100%
and it is to be assumed that tuning is blocked. Check the configuration of the technology
object and, if necessary, restart controller tuning.
Result
If fine tuning was performed without errors, the PID parameters have been tuned.
PID_Compact switches to automatic mode and uses the tuned parameters. The tuned PID
parameters will be retained during power OFF and a restart of the CPU.
If errors occurred during "fine tuning", PID_Compact responds with the configured response
to errors.
See also
State and Mode as of V2 parameters (Page 252)
PID control
Function Manual, 11/2023, A5E35300227-AG 89
Using PID_Compact
5.2 PID_Compact as of V2
The following section describes how you can use the "manual mode" operating mode in the
commissioning window of the "PID_Compact" technology object. Manual mode is also
possible when an error is pending.
Requirement
• The "PID_Compact" instruction is called in a cyclic interrupt OB.
• An online connection to the CPU has been established and the CPU is in "RUN" mode.
Procedure
Use "Manual mode" in the commissioning window if you want to test the controlled system
by specifying a manual value. To define a manual value, proceed as follows:
1. Click the "Start" icon.
2. Select the "Manual mode" check box in the "Online status of controller" area.
PID_Compact operates in manual mode. The most recent current output value remains in
effect.
3. Enter the manual value in the "Output" field as a % value.
4. Click the icon.
Result
The manual value is written to the CPU and immediately goes into effect.
Clear the "Manual mode" check box if the output value is to be specified again by the PID
controller. The switchover to automatic mode is bumpless.
See also
State and Mode as of V2 parameters (Page 252)
Override control
In case of override control, two or more controllers share one actuator. Only one controller
has access to the actuator at any time and influences the process.
A logic operation decides which controller has access to the actuator. This decision is often
made based on a comparison of the output values of all controllers, for example, in case of a
maximum selection, the controller with the largest output value gets access to the actuator.
The selection based on the output value requires that all controllers operate in automatic
mode. The controllers that do not have an effect on the actuator are updated. This is
necessary to prevent windup effects and their negative impacts on the control response and
the switchover between the controllers.
PID control
90 Function Manual, 11/2023, A5E35300227-AG
Using PID_Compact
5.2 PID_Compact as of V2
PID_Compact supports override controls as of version 2.3 by offering a simple process for
updating the controllers that are not active:
• By using the OverwriteInitialOutputValue and PIDCtrl.PIDInit tags, you can preassign the
integral action of the controller in automatic mode as though the PID algorithm had
calculated Output = OverwriteInititalOutputValue for the output value in the last cycle.
• To do this, OverwriteInitialOutputValue is interconnected with the output value of the
controller that currently has access to the actuator.
• By setting the bit PIDCtrl.PIDInit, you trigger the pre-assignment of the integral action as
well as the restart of the controller cycle and the PWM period.
• The subsequent calculation of the output value in the current cycle takes place based on
the pre-assigned (and synchronized for all controllers) integral action as well as the
proportional action and integral action from the current control deviation.
• The derivative action is not active during the call with PIDCtrl.PIDInit = TRUE and therefore
does not contribute to the output value.
This procedure ensures that the calculation of the current output value and thus the decision
on which controller is to have access to the actuator is only based on the current process
state and the PI parameters. Windup effects for controllers that are not active and thus
incorrect decisions of the switchover logic are prevented.
Requirements
• PIDCtrl.PIDInit is only effective if the integral action is activated (Retain.CtrlParams.Ti tag >
0.0).
• You must assign PIDCtrl.PIDInit and OverwriteInitialOutputValue in your user program
yourself (see example below). PID_Compact does not automatically change these tags.
• PIDCtrl.PIDInit is only effective when PID_Compact is in automatic mode (parameter State
= 3)
• If possible, select the sampling time of the PID algorithm (Retain.CtrlParams.Cycle tag) in
such a way that it is identical for all controllers, and call all controllers in the same cyclic
interrupt OB. In this way, you ensure that the switchover does not take place within a
controller cycle or a PWM period.
NOTE
Constant adaptation of the output value limits
Instead of the active updating of the controllers without access to the actuator described
here, this is implemented alternatively by constant adaptation of the output value limits in
other controller systems.
This is not possible with PID_Compact, because a change of the output value limits is not
supported in automatic mode.
PID control
Function Manual, 11/2023, A5E35300227-AG 91
Using PID_Compact
5.2 PID_Compact as of V2
*OQVU
1*%@$PNQBDU@
*OQVU
1*%@$PNQBDU@
The valve is controlled with the output value of PID_Compact in I/O format (parameter
Output_PER) by writing the program tag ActuatorInput.
The setpoint for the flow rate is specified at the parameter PID_Compact_1.Setpoint.
The pressure high limit is specified as setpoint at the parameter PID_Compact_2.Setpoint.
*OQVU
1*%@$PNQBDU@
*OQVU 0VUQVU@1&3
"DUVBUPS*OQVU
4FUQPJOU 0VUQVU
1*%$USM1*%*OJU
0WFSXSJUF*OJUJBM
0VUQVU7BMVF
1*%@$PNQBDU@
*OQVU 0VUQVU@1&3
4FUQPJOU 0VUQVU
1*%$USM1*%*OJU
0WFSXSJUF*OJUJBM
0VUQVU7BMVF
*OQVU
PID control
92 Function Manual, 11/2023, A5E35300227-AG
Using PID_Compact
5.2 PID_Compact as of V2
Both controllers must share one valve as shared actuator. The logic that decides which
controller gets access to the actuator is implemented by a maximum selection of the output
value (in Real format, parameter Output) in this case. Because the output value corresponds
to the opening of the valve, the controller that requires the larger valve opening gets the
control.
NOTE
Activate inversion of the control logic
Because a decrease of the actual value (pressure) is to be achieved with the pressure
regulator PID_Compact_2 when the output value increases (valve opening), the inversion of
the control logic must be activated: PID_Compact_2.Config.InvertControl = TRUE.
In normal operation of the plant, the actual value of the flow rate corresponds to the
setpoint. The flow controller PID_Compact_1 has settled on a stationary output value
PID_Compact_1.Output. The actual value of the pressure in normal operation is significantly
below the high limit that is specified as setpoint for PID_Compact_2. The pressure regulator
therefore wants to close the valve even further to increase the pressure, which means it will
calculate an output value PID_Compact_2.Output that is smaller than the output value of the
flow controller PID_Compact_1.Output. The maximum selection of the switchover logic
therefore gives the flow controller PID_Compact_1 continued access to the actuator. In
addition, it is ensured that PID_Compact_2 is updated by means of the assignments
PID_Compact_2.OverwriteInitialOutputValue = PID_Compact_1.Output and
PID_Compact_2.PIDCtrl.PIDInit = TRUE.
If the pressure now approaches the high limit or exceeds it, for example due to a fault, the
pressure regulator PID_Compact_2 calculates a higher output value to open the valve even
further and thus reduce the pressure. If PID_Compact_2.Output is greater than
PID_Compact_1.Output, the pressure regulator PID_Compact_2 receives access to the
actuator through the maximum selection and opens it. It is ensured that PID_Compact_1 is
updated by means of the assignments PID_Compact_1.OverwriteInitialOutputValue =
PID_Compact_2.Output and PID_Compact_1.PIDCtrl.PIDInit = TRUE.
The pressure is reduced while the flow rate increases and can no longer be kept at the
setpoint.
Once the fault has been remedied, the pressure will continue to drop and the opening of the
valve is reduced by the pressure regulator. If the flow controller calculates a larger opening as
output value, the plant returns to normal operation so that the flow controller
PID_Compact_1 once again has access to the actuator.
PID control
Function Manual, 11/2023, A5E35300227-AG 93
Using PID_Compact
5.2 PID_Compact as of V2
This example can be implemented with the following SCL program code:
"PID_Compact_1"(Input := "Input1");
"PID_Compact_2"(Input := "Input2");
IF "PID_Compact_1".Output >= "PID_Compact_2".Output THEN
"ActuatorInput" := "PID_Compact_1".Output_PER;
"PID_Compact_1".PIDCtrl.PIDInit := FALSE;
"PID_Compact_2".PIDCtrl.PIDInit := TRUE;
"PID_Compact_2".OverwriteInitialOutputValue :=
"PID_Compact_1".Output;
ELSE
"ActuatorInput" := "PID_Compact_2".Output_PER;
"PID_Compact_1".PIDCtrl.PIDInit := TRUE;
"PID_Compact_2".PIDCtrl.PIDInit := FALSE;
"PID_Compact_1".OverwriteInitialOutputValue :=
"PID_Compact_2".Output;
END_IF;
NOTE
Simulation with PLCSIM
The simulation of PID_Compact V2.x with PLCSIM for CPU S7-1200 is not supported.
PID_Compact V2.x can only be simulated for CPU S7-1500 with PLCSIM.
For the simulation with PLCSIM, the time behavior of the simulated PLC is not exactly
identical to that of a "real" PLC. The actual cycle clock of a cyclic interrupt OB can have larger
fluctuations with a simulated PLC than with "real" PLCs.
In the standard configuration, PID_Compact determines the time between calls automatically
and monitors them for fluctuations.
For the simulation of PID_Compact with PLCSIM, for example, a sampling time error (ErrorBits
= DW#16#00000800) can therefore be detected.
This results in ongoing tuning being aborted.
The response in automatic mode depends on the value of the ActivateRecoverMode tag.
To prevent this from happening, you should configure PID_Compact for simulation with
PLCSIM as follows:
• CycleTime.EnEstimation = FALSE
• CycleTime.EnMonitoring = FALSE
• CycleTime.Value: Assign the cycle clock of the calling cyclic interrupt OB in seconds to this
tag.
PID control
94 Function Manual, 11/2023, A5E35300227-AG
Using PID_Compact
5.3 PID_Compact V1
5.3 PID_Compact V1
Configure the following properties of the "PID_Compact" technology object under "Basic
settings" in the Inspector window or in the configuration window:
• Physical quantity
• Control logic
• Start-up behavior after reset
• Setpoint (only in the Inspector window)
• Process value (only in the Inspector window)
• Output value (only in the Inspector window)
Physical quantity
Select the unit of measurement and physical quantity for the setpoint and process value in
the "Controller type" group. The setpoint and process value will be displayed in this unit.
Control logic
An increase of the output value is generally intended to cause an increase in the process
value. This is referred to as a normal control logic.
PID_Compact does not work with negative proportional gain. Select the check box "Invert
control logic" to reduce the process value with a higher output value.
Examples
• Opening the drain valve will reduce the level of a container's contents.
• Increasing cooling will reduce the temperature.
PID control
Function Manual, 11/2023, A5E35300227-AG 95
Using PID_Compact
5.3 PID_Compact V1
Procedure
Proceed as follows to define a fixed setpoint:
1. Select "Instance DB".
2. Enter a setpoint, e.g. 80° C.
3. Delete any entry in the instruction.
Proceed as follows to define a variable setpoint:
1. Select "Instruction".
2. Enter the name of the REAL variable in which the setpoint is saved.
Program-controlled assignment of various values to the REAL variable is possible, for
example for the time controlled change of the setpoint.
PID_Compact will scale the value of the analog input to the physical quantity if you use the
analog input value directly.
You will need to write a program for processing if you wish first to process the analog input
value. The process value is, for example, not directly proportional to the value at the analog
input. The processed process value must be in floating point format.
Procedure
Proceed as follows to use the analog input value without processing:
1. Select the entry "Input_PER" in the drop-down list "Input".
2. Select "Instruction" as source.
3. Enter the address of the analog input.
Proceed as follows to use the processed process value in floating point format:
1. Select the entry "Input" in the drop-down list "Input".
2. Select "Instruction" as source.
3. Enter the name of the variable in which the processed process value is saved.
PID_Compact offers three output values. Your actuator will determine which output value you
use.
• Output_PER
The actuator is triggered via an analog output and controlled with a continuous signal,
e.g. 0...10V, 4...20mA.
• Output
The output value needs to be processed by the user program, for example because of non-
linear actuator response.
• Output_PWM
The actuator is controlled via a digital output. Pulse width modulation creates minimum
ON and minimum OFF times.
PID control
96 Function Manual, 11/2023, A5E35300227-AG
Using PID_Compact
5.3 PID_Compact V1
Procedure
Proceed as follows to use the analog output value:
1. Select the entry "Output_PER (analog)" in the drop-down list "Output".
2. Select "Instruction".
3. Enter the address of the analog output.
Proceed as follows to process the output value using the user program:
1. Select the entry "Output" in the drop-down list "Output".
2. Select "Instance DB".
The calculated output value is saved in the instance data block.
3. For the preparation of the output value, use the output parameter Output.
4. Transfer the processed output value to the actuator via a digital or analog CPU output.
Proceed as follows to use the digital output value:
1. Select the entry "Output_PWM" in the drop-down list "Output".
2. Select "Instruction".
3. Enter the address of the digital output.
Configure the scaling of your process value and specify the process value absolute limits In
the "Process value settings" configuration window.
PID control
Function Manual, 11/2023, A5E35300227-AG 97
Using PID_Compact
5.3 PID_Compact V1
WARNING
If you set very high process value limits (for example -3.4*1038...+3.4*1038), process value
monitoring will be disabled. Your system may then be damaged if an error occurs.
See also
Process value monitoring V1 (Page 98)
PWM limits V1 (Page 99)
Output value limits V1 (Page 101)
PID parameters V1 (Page 101)
Configure a warning high and low limit for the process value in the "Process value
monitoring" configuration window. If one of the warning limits is exceeded or undershot
during operation, a warning will be displayed at the PID_Compact instruction:
• At the InputWarning_H output parameter if the warning high limit has been exceeded
• At the InputWarning_L output parameter if the warning low limit has been undershot
The warning limits must be within the process value high and low limits.
The process value high and low limits will be used if you do not enter values.
Example
Process value high limit = 98° C; warning high limit = 90° C
Warning low limit = 10° C; process value low limit = 0° C
PID_Compact will respond as follows:
PID control
98 Function Manual, 11/2023, A5E35300227-AG
Using PID_Compact
5.3 PID_Compact V1
See also
Process value settings V1 (Page 97)
PWM limits V1 (Page 99)
Output value limits V1 (Page 101)
PID parameters V1 (Page 101)
Via pulse width modulation, the value at the output parameter Output is transformed into a
pulse sequence that is output at output parameter Output_PWM.
Output is calculated in the PID algorithm sampling time. The sampling time is used as time
period of the pulse width modulation.
The PID algorithm sampling time is determined during pretuning or fine tuning. If manually
setting the PID parameters, you will also need to configure the PID algorithm sampling time.
Output_PWM is output in the PID_Compact sampling time. The PID_Compact sampling time is
equivalent to the cycle time of the calling OB.
The pulse duration is proportional to the value at Output and is always an integer multiple of
the PID_Compact sampling time.
0VUQVU
U NT
0VUQVU@18.
536&
'"-4&
U NT
PID control
Function Manual, 11/2023, A5E35300227-AG 99
Using PID_Compact
5.3 PID_Compact V1
Output is a constant 15%. The smallest pulse that PID_Compact can output is 20%. In the first
cycle, no pulse is output. In the second cycle, the pulse not output in the first cycle is added
to the pulse of the second cycle.
0VUQVU
0VUQVU@18. U NT
536&
'"-4&
U NT
NOTE
The minimum ON and OFF times only affect the output parameter Output_PWM and are not
used for any pulse generators integrated in the CPU.
See also
Process value settings V1 (Page 97)
Process value monitoring V1 (Page 98)
Output value limits V1 (Page 101)
PID parameters V1 (Page 101)
PID control
100 Function Manual, 11/2023, A5E35300227-AG
Using PID_Compact
5.3 PID_Compact V1
In the "Output value limits" configuration window, configure the absolute limits of your
output value in percent. Absolute output value limits are not violated in neither manual mode
nor in automatic mode. If a output value outside the limits is specified in manual mode, the
effective value is limited in the CPU to the configured limits.
The valid output value limit values depend on the Output used.
The PID parameters are displayed in the "PID Parameters" configuration window. The PID
parameters will be adapted to your controlled system during controller tuning. You do not
need to enter the PID parameters manually.
NOTE
The currently active PID parameters are located for PID_Compact V1 in the sRet structure and
as of PID_Compact V2 in the Retain.CtrlParams structure.
Change the currently active PID parameters only in "Inactive" mode online to prevent
malfunction of the PID controller.
If you want to change the PID parameters in "Automatic mode" or "Manual mode" online,
change the PID parameters as follows:
• PID_Compact V1: Change the PID parameters in the sBackUp structure and apply these
changes with sPid_Cmpt.b_LoadBackUp = TRUE to the sRet structure.
• PID_Compact as of V2: Change the PID parameters in the CtrlParamsBackUp structure and
apply these changes with LoadBackUp = TRUE to the Retain.CtrlParams structure.
Online changes to the PID parameters in "Automatic mode" can result in jumps at the output
value.
PID control
Function Manual, 11/2023, A5E35300227-AG 101
Using PID_Compact
5.3 PID_Compact V1
Symbol Description
y Output value of the PID algorithm
Kp Proportional gain
s Laplace operator
b Proportional action weighting
w Setpoint
x Process value
TI Integration time
a Derivative delay coefficient (derivative delay T1 = a × TD)
TD Derivative action time
c Derivative action weighting
The diagram below illustrates the integration of the parameters into the PID algorithm:
4FUQPJOU X C
"OUJXJOEVQ
,1
-*.*5 * Z
4DBMFE*OQVU Y %5
All PID parameters are retentive. If you enter the PID parameters manually, you must
completely download PID_Compact.
Downloading technology objects to device (Page 46)
Proportional gain
The value specifies the proportional gain of the controller. PID_Compact does not work with a
negative proportional gain. Control logic is inverted under Basic settings > Controller type.
PID control
102 Function Manual, 11/2023, A5E35300227-AG
Using PID_Compact
5.3 PID_Compact V1
Integration time
The integration time determines the time behavior of the integral action. The integral action
is deactivated with integration time = 0.0. When the integration time is changed from a
different value to 0.0 online in "Automatic mode", the previous integral action is deleted and
the output value jumps.
PID control
Function Manual, 11/2023, A5E35300227-AG 103
Using PID_Compact
5.3 PID_Compact V1
PID control
104 Function Manual, 11/2023, A5E35300227-AG
Using PID_Compact
5.3 PID_Compact V1
5.3.2.1 Commissioning V1
The commissioning window helps you commission the PID controller. You can monitor the
values for the setpoint, process value and output value along the time axis in the trend view.
The following functions are supported in the commissioning window:
• Controller pretuning
• Controller fine tuning
Use fine tuning for fine adjustments to the PID parameters.
• Monitoring the current closed-loop control in the trend view
• Testing the controlled system by specifying a manual output value
All functions require an online connection to the CPU to have been established.
Basic handling
• Select the desired sampling time in the "Sampling time" drop-down list.
All values in the commissioning window are updated in the selected update time.
• Click the "Start" icon in the measuring group if you want to use the commissioning
functions.
Value recording is started. The current values for the setpoint, process value and output
value are entered in the trend view. Operation of the commissioning window is enabled.
• Click the "Stop" icon if you want to end the commissioning functions.
The values recorded in the trend view can continue to be analyzed.
Closing the commissioning window will terminate recording in the trend view and delete the
recorded values.
See also
Pretuning V1 (Page 106)
Fine tuning V1 (Page 107)
"Manual" mode V1 (Page %getreference)
PID control
Function Manual, 11/2023, A5E35300227-AG 105
Using PID_Compact
5.3 PID_Compact V1
5.3.2.2 Pretuning V1
The pretuning determines the process response to a jump change of the output value and
searches for the point of inflection. The tuned PID parameters are calculated as a function of
the maximum slope and dead time of the controlled system.
The more stable the process value is, the easier it is to calculate the PID parameters and the
more precise the result will be. Noise on the process value can be tolerated as long as the rate
of rise of the process value is significantly higher compared to the noise. The PID parameters
are backed up before being recalculated.
Requirement
• The "PID_Compact" instruction is called in a cyclic interrupt OB.
• ManualEnable = FALSE
• PID_Compact is in "inactive" or "manual" mode.
• The setpoint may not be changed during controller tuning. PID_Compact will otherwise be
deactivated.
• The setpoint and the process value lie within the configured limits (see "Process value
monitoring" configuration).
• The difference between setpoint and process value is greater than 30% of the difference
between process value high limit and process value low limit.
• The distance between the setpoint and the process value is > 50% of the setpoint.
Procedure
To perform pretuning, follow these steps:
1. Double-click the "PID_Compact > Commissioning" entry in the project tree.
2. Select the entry "Pretuning" in the "Tuning mode" drop-down list.
3. Click the "Start" icon.
– An online connection will be established.
– Value recording is started.
– Pretuning is started.
– The "Status" field displays the current steps and any errors that may have occurred. The
progress bar indicates the progress of the current step.
NOTE
Click the "Stop" icon when the progress bar has reached 100% and it is to be assumed
the controller tuning function is blocked. Check the configuration of the technology
object and, if necessary, restart controller tuning.
Result
If pretuning was performed without an error message, the PID parameters have been tuned.
PID_Compact switches to automatic mode and uses the tuned parameters. The tuned PID
parameters will be retained during power OFF and a restart of the CPU.
If pretuning is not possible, PID_Compact will change to "Inactive" mode.
PID control
106 Function Manual, 11/2023, A5E35300227-AG
Using PID_Compact
5.3 PID_Compact V1
See also
Parameters State and sRet.i_Mode V1 (Page 275)
Commissioning V1 (Page 105)
Fine tuning V1 (Page 107)
"Manual" mode V1 (Page %getreference)
Fine tuning generates a constant, limited oscillation of the process value. The PID parameters
are optimized for the operating point from the amplitude and frequency of this oscillation. All
PID parameters are recalculated on the basis of the findings. PID parameters from fine tuning
usually have better master control and disturbance behavior than PID parameters from
pretuning.
PID_Compact automatically attempts to generate an oscillation greater than the noise of the
process value. Fine tuning is only minimally influenced by the stability of the process value.
The PID parameters are backed up before being recalculated.
Requirement
• The PID_Compact instruction is called in a cyclic interrupt OB.
• ManualEnable = FALSE
• The setpoint and the process value lie within the configured limits (see "Process value
monitoring" configuration).
• The control loop has stabilized at the operating point. The operating point is reached
when the process value corresponds to the setpoint.
• No disturbances are expected.
• The setpoint may not be changed during controller tuning.
• PID_Compact is in inactive mode, automatic mode or manual mode.
PID control
Function Manual, 11/2023, A5E35300227-AG 107
Using PID_Compact
5.3 PID_Compact V1
An attempt is made to reach the setpoint with a minimum or maximum output value if the
process value for pretuning is already too near the setpoint. This can produce increased
overshoot.
Procedure
Proceed as follows to carry out "fine tuning":
1. Select the entry "Fine tuning" in the "Tuning mode" drop-down list.
2. Click the "Start" icon.
– An online connection will be established.
– Value recording is started.
– The process of fine tuning is started.
– The "Status" field displays the current steps and any errors that may have occurred. The
progress bar indicates the progress of the current step.
NOTE
Click the "Stop" icon in the "Tuning mode" group when the progress bar has reached 100%
and it is to be assumed the controller tuning function is blocked. Check the configuration
of the technology object and, if necessary, restart controller tuning.
Result
The PID parameters will have been optimized if fine tuning has been executed without errors.
PID_Compact changes to automatic mode and uses the optimized parameters. The optimized
PID parameters will be retained during power OFF and a restart of the CPU.
If errors occurred during "fine tuning", PID_Compact will change to "inactive" mode.
See also
Parameters State and sRet.i_Mode V1 (Page 275)
Commissioning V1 (Page 105)
Pretuning V1 (Page 106)
"Manual" mode V1 (Page %getreference)
PID control
108 Function Manual, 11/2023, A5E35300227-AG
Using PID_Compact
5.3 PID_Compact V1
The following section describes how you can use the "Manual" operating mode in the
commissioning window of the "PID Compact" technology object.
Requirement
• The "PID_Compact" instruction is called in a cyclic interrupt OB.
• An online connection to the CPU has been established and the CPU is in the "RUN" mode.
• The functions of the commissioning window have been enabled via the "Start" icon.
Procedure
Use "Manual mode" in the commissioning window if you want to test the controlled system
by specifying a manual value. To define a manual value, proceed as follows:
1. Select the "Manual mode" check box in the "Online status of controller" area.
PID_Compact operates in manual mode. The most recent current output value remains in
effect.
2. Enter the manual value in the "Output" field as a % value.
3. Click the control icon .
Result
The manual value is written to the CPU and immediately goes into effect.
NOTE
PID_Compact continues to monitor the process value. If the process value limits are
exceeded, PID_Compact is deactivated.
Clear the "Manual mode" check box if the output value is to be specified again by the PID
controller. The switchover to automatic mode is bumpless.
See also
Parameters State and sRet.i_Mode V1 (Page 275)
Commissioning V1 (Page 105)
Pretuning V1 (Page 106)
Fine tuning V1 (Page 107)
PID control
Function Manual, 11/2023, A5E35300227-AG 109
Using PID_Compact
5.3 PID_Compact V1
NOTE
Simulation with PLCSIM
For the simulation with PLCSIM, the time behavior of the simulated PLC is not exactly
identical to that of a "real" PLC. The actual cycle clock of a cyclic interrupt OB can have larger
fluctuations with a simulated PLC than with "real" PLCs.
In the standard configuration, PID_Compact determines the time between calls automatically
and monitors them for fluctuations.
For a simulation of PID_Compact with PLCSIM, for example, a sampling time error (ErrorBits =
DW#16#00000800) can therefore be detected.
PID_Compact switches to "Inactive" mode (State = 0) in this case.
To prevent this from happening, you should configure PID_Compact for simulation with
PLCSIM as follows:
• sb_EnCyclEstimation = FALSE
• sb_EnCyclMonitoring = FALSE
• sPid_Calc.r_Cycle: Assign the cycle clock of the calling cyclic interrupt OB in seconds to this
tag.
PID control
110 Function Manual, 11/2023, A5E35300227-AG
Using PID_3Step 6
6.1 Technology object PID_3Step
The technology object PID_3Step provides a PID controller with tuning for valves or actuators
with integral response.
You can configure the following controllers:
• Three-point step controller with position feedback
• Three-point step controller without position feedback
• Valve controller with analog output value
PID_3Step continuously acquires the measured process value within a control loop and
compares it with the setpoint. From the resulting control deviation, PID_3Step calculates an
output value through which the process value reaches the setpoint as quickly and steadily as
possible. The output value for the PID controller consists of three actions:
• Proportional action
The proportional action of the output value increases in proportion to the control
deviation.
• I action
The integral action of the output value increases until the control deviation has been
balanced.
• D action
The derivative action increases with the rate of change of control deviation. The process
value is corrected to the setpoint as quickly as possible. The derivative action will be
reduced again if the rate of change of control deviation drops.
The instruction PID_3Step calculates the proportional, integral and derivative parameters for
your controlled system during pretuning. Fine tuning can be used to tune the parameters
further. You do not need to manually determine the parameters.
Additional information
• Overview of software controller (Page 41)
• Add technology objects (Page 43)
• Configure technology objects (Page 44)
• Configuring PID_3Step V2 (Page 112)
• Configuring PID_3Step V1 (Page 129)
Principle
For more information, see the following FAQs in the Siemens Industry Online Support:
• Entry ID 68011827 (https://support.industry.siemens.com/cs/ww/en/view/68011827)
PID control
Function Manual, 11/2023, A5E35300227-AG 111
Using PID_3Step
6.2 PID_3Step V2
6.2 PID_3Step V2
Configure the following properties of the "PID_3Step" technology object under "Basic settings"
in the Inspector window or in the configuration window:
• Physical quantity
• Control logic
• Start-up behavior after reset
• Setpoint (only in the Inspector window)
• Process value (only in the Inspector window)
• Output value (only in the Inspector window)
• Position feedback (only in the Inspector window)
Physical quantity
Select the unit of measurement and physical quantity for the setpoint and the process value
in the "Controller type" group. The setpoint and the process value are displayed in this unit.
Control logic
An increase of the output value is generally intended to cause an increase in the process
value. This is referred to as a normal control logic.
PID_3Step does not work with negative proportional gain. Select the check box "Invert control
logic" to reduce the process value with a higher output value.
Examples
• Opening the drain valve will reduce the level of a container's contents.
• Increasing cooling will reduce the temperature.
PID control
112 Function Manual, 11/2023, A5E35300227-AG
Using PID_3Step
6.2 PID_3Step V2
Startup characteristics
1. To switch to "Inactive" mode after CPU restart, clear the "Activate Mode after CPU restart"
check box.
To switch to the operating mode saved in the Mode parameter after CPU restart, select the
"Activate Mode after CPU restart" check box.
2. In the "Set Mode to" drop-down list, select the mode that is to be enabled after a complete
download to the device.
After a complete download to the device, PID_3Step starts in the selected operating mode.
With each additional restart, PID_3Step starts in the mode that was last saved in Mode.
Example
You have selected the "Activate Mode after CPU restart" check box and the entry "Pretuning"
in the "Set Mode to" list. After a complete download to the device, PID_3Step starts in the
"Pretuning" mode. If pretuning is still active, PID_3Step starts in "Pretuning" mode again after
restart of the CPU. If pretuning was successfully completed and automatic mode is active,
PID_3Step starts in "Automatic mode" after restart of the CPU.
Procedure
Proceed as follows to define a fixed setpoint:
1. Select "Instance DB".
2. Enter a setpoint, e.g. 80° C.
3. Delete any entry in the instruction.
Proceed as follows to define a variable setpoint:
1. Select "Instruction".
2. Enter the name of the REAL variable in which the setpoint is saved.
Program-controlled assignment of various values to the REAL variable is possible, for
example for the time controlled change of the setpoint.
PID_3Step will scale the value of the analog input to the physical quantity if you use the
analog input value directly.
You will need to write a program for processing if you wish first to process the analog input
value. The process value is, for example, not directly proportional to the value at the analog
input. The processed process value must be in floating point format.
Procedure
Proceed as follows to use the analog input value without processing:
1. Select the entry "Input_PER" in the drop-down list "Input".
2. Select "Instruction" as source.
3. Enter the address of the analog input.
Proceed as follows to use the processed process value in floating point format:
1. Select the entry "Input" in the drop-down list "Input".
2. Select "Instruction" as source.
3. Enter the name of the variable in which the processed process value is saved.
PID control
Function Manual, 11/2023, A5E35300227-AG 113
Using PID_3Step
6.2 PID_3Step V2
PID control
114 Function Manual, 11/2023, A5E35300227-AG
Using PID_3Step
6.2 PID_3Step V2
PID_3Step offers an analog output value (Output_PER) and digital output values (Output_UP,
Output_DN). Your actuator will determine which output value you use.
• Output_PER
The actuator has a relevant motor transition time and is triggered via an analog output
and controlled with a continuous signal, e.g. 0...10 V or 4...20 mA. The value at
Output_PER corresponds to the target position of the valve, e.g. Output_PER = 13824,
when the valve is to be opened by 50%.
For auto-tuning and anti windup behavior, for example, PID_3Step takes into
consideration that the analog output value has a delayed effect on the process due to the
motor transition time. If no relevant motor transition time is in effect in your process (e.g.
with solenoid valves), so that the output value has a direct and full effect on the process,
use PID_Compact instead.
• Output_UP, Output_DN
The actuator has a relevant motor transition time and is controlled by two digital outputs.
Output_UP moves the valve in the open state direction.
Output_DN moves the valve in the closed state direction.
The motor transition time is taken into consideration in the calculation of the analog output
value as well as in the calculation of the digital output values. It is mainly required for correct
operation during auto-tuning and the anti-windup behavior. You should therefore configure
the motor transition time under "Actuator settings" with the value that the motor requires to
move the actuator from the closed to the opened state.
Procedure
Proceed as follows to use the analog output value:
1. Select the entry "Output (analog)" in the drop-down list "Output".
2. Select "Instruction".
3. Enter the address of the analog output.
Proceed as follows to use the digital output value:
1. Select the entry "Output (digital)" in the drop-down list "Output".
2. Select "Instruction" for Output_UP and Output_DN.
3. Enter the addresses of the digital outputs.
Proceed as follows to process the output value using the user program:
1. Select the entry corresponding to the actuator in the drop-down list "Output".
2. Select "Instruction".
3. Enter the name of the tag you are using to process the output value.
4. Transfer the processed output value to the actuator by means of an analog or digital CPU
output.
PID control
Function Manual, 11/2023, A5E35300227-AG 115
Using PID_3Step
6.2 PID_3Step V2
If you have configured the use of Input_PER in the basic setting, you must convert the value
of the analog input to the physical quantity of the process value. The current configuration is
displayed in the Input_PER display.
Input_PER will be scaled using a low and high value pair if the process value is directly
proportional to the value of the analog input.
Procedure
To scale the process value, follow these steps:
1. Enter the low pair of values in the "Scaled low process value" and "Low" text boxs.
2. Enter the high pair of values in the "Scaled high process value" and "High" input boxes.
Default settings for the value pairs are stored in the hardware configuration. To use the value
pairs from the hardware configuration, follow these steps:
1. Select the PID_3Step instruction in the programming editor.
2. Interconnect Input_PER with an analog input in the basic settings.
3. Click the "Automatic setting" button in the process value settings.
The existing values will be overwritten with the values from the hardware configuration.
You must specify an appropriate absolute high limit and low limit for the process value as
limit values for your controlled system. As soon as the process value violates these limits, an
error occurs (ErrorBits = 0001h). Tuning is canceled when the process value limits are
violated. You can specify how PID_3Step responds to errors in automatic mode in the
actuator settings.
Actuator-specific times
Configure the motor transition time and the minimum ON and OFF times to prevent damage
to the actuator. You can find the specifications in the actuator data sheet.
The motor transition time is the time in seconds the motor requires to move the actuator
from the closed to the opened state. You can measure the motor transition time during
commissioning.
The motor transition time is taken into consideration in the calculation of the analog output
value as well as in the calculation of the digital output values. It is mainly required for correct
operation during auto-tuning and the anti-windup behavior.
If no relevant motor transition time is in effect in your process (e.g. with solenoid valves), so
that the output value has a direct and full effect on the process, use PID_Compact instead.
The motor transition time is retentive. If you enter the motor transition time manually, you
must completely download PID_3Step.
Downloading technology objects to device (Page 46)
If you are using "Output_UP" or "Output_DN", you can reduce the switching frequency with
the minimum on and minimum OFF time.
The on or off times calculated are totaled in automatic mode and only become effective
when the sum is greater than or equal to the minimum on or OFF time.
Manual_UP = TRUE or Manual_DN = TRUE in manual mode operates the actuator for at least
the minimum ON or OFF time.
PID control
116 Function Manual, 11/2023, A5E35300227-AG
Using PID_3Step
6.2 PID_3Step V2
If you have selected the analog output value Output_PER, the minimum ON time and the
minimum OFF time are not evaluated and cannot be changed.
Reaction to error
PID_3Step is preset so that the controller stays active in most cases in the event of an error. If
errors occur frequently in controller mode, this default reaction has a negative effect on the
control response. In this case, check the Errorbits parameter and eliminate the cause of the
error.
NOTICE
Your system may be damaged.
If you output "Current value while error pending" or "Substitute output value while error
pending" in the event of an error, PID_3Step remains in automatic mode even if the process
value limits are violated. This may damage your system.
It is essential to configure how your controlled system reacts in the event of an error to
protect your system from damage.
PID control
Function Manual, 11/2023, A5E35300227-AG 117
Using PID_3Step
6.2 PID_3Step V2
PID control
118 Function Manual, 11/2023, A5E35300227-AG
Using PID_3Step
6.2 PID_3Step V2
Configure a warning high and low limit for the process value in the "Process value
monitoring" configuration window. If one of the warning limits is exceeded or undershot
during operation, a warning will be displayed at the PID_3Step instruction:
• At the InputWarning_H output parameter if the warning high limit has been exceeded
• At the InputWarning_L output parameter if the warning low limit has been undershot
The warning limits must be within the process value high and low limits.
The process value high and low limits will be used if you do not enter values.
Example
Process value high limit = 98° C; warning high limit = 90° C
Warning low limit = 10° C; process value low limit = 0° C
PID_3Step will respond as follows:
PID control
Function Manual, 11/2023, A5E35300227-AG 119
Using PID_3Step
6.2 PID_3Step V2
The PID parameters are displayed in the "PID Parameters" configuration window. The PID
parameters will be adapted to your controlled system during controller tuning. You do not
need to enter the PID parameters manually.
NOTE
The currently active PID parameters are located in the Retain.CtrlParams structure.
Change the currently active PID parameters only in "Inactive" mode online to prevent
malfunction of the PID controller.
If you want to change the PID parameters in "Automatic mode" or "Manual mode" online,
change the PID parameters in the CtrlParamsBackUp structure and apply these changes to the
Retain.CtrlParams structure as follows:
• PID_3Step V1: Apply the changes with Config.LoadBackUp = TRUE
• PID_3Step V2: Apply the changes with LoadBackUp = TRUE
Online changes to the PID parameters in "Automatic mode" can result in jumps at the output
value.
PID control
120 Function Manual, 11/2023, A5E35300227-AG
Using PID_3Step
6.2 PID_3Step V2
The diagram below illustrates the integration of the parameters into the PID algorithm:
C
4FUQPJOU X
%5 % ,
D 1
ǡZ
%FBE@#
5J *
4DBMFE*OQVU Y
'BD5U "OUJ8JOEVQ
All PID parameters are retentive. If you enter the PID parameters manually, you must
completely download PID_3Step.
Downloading technology objects to device (Page 46)
Proportional gain
The value specifies the proportional gain of the controller. PID_3Step does not work with a
negative proportional gain. Control logic is inverted under Basic settings > Controller type.
Integration time
The integration time determines the time behavior of the integral action. The integral action
is deactivated with integration time = 0.0. When the integration time is changed from a
different value to 0.0 online in "Automatic mode", the previous integral action is deleted and
the output value jumps.
PID control
Function Manual, 11/2023, A5E35300227-AG 121
Using PID_3Step
6.2 PID_3Step V2
PID control
122 Function Manual, 11/2023, A5E35300227-AG
Using PID_3Step
6.2 PID_3Step V2
6.2.2.1 Pretuning V2
The pretuning determines the process response to a pulse of the output value and searches
for the point of inflection. The tuned PID parameters are calculated as a function of the
maximum slope and dead time of the controlled system. You obtain the best PID parameters
when you perform pretuning and fine tuning.
The more stable the process value is, the easier it is to calculate the PID parameters and the
more precise the result will be. Noise on the process value can be tolerated as long as the rate
of rise of the process value is significantly higher compared to the noise. This is most likely
the case in operating modes "Inactive" and "manual mode". The PID parameters are backed up
before being recalculated.
The setpoint is frozen during pretuning.
Requirement
• The PID_3Step instruction is called in a cyclic interrupt OB.
• ManualEnable = FALSE
• Reset = FALSE
• The motor transition time has been configured or measured.
• PID_3Step is in one of the following modes: "Inactive", "Manual mode", or "Automatic
mode".
• The setpoint and the process value lie within the configured limits (see "Process value
settings" configuration).
Procedure
To perform pretuning, follow these steps:
1. Double-click the "PID_3Step > Commissioning" entry in the project tree.
2. Select the entry "Pretuning" in the "Tuning mode" drop-down list in the working area
"Tuning".
3. Click the "Start" icon.
– An online connection will be established.
– Value recording is started.
– Pretuning is started.
– The "Status" field displays the current steps and any errors that may have occurred. The
progress bar indicates the progress of the current step.
NOTE
Click the "Stop" icon when the progress bar has reached 100% and it is to be assumed
the controller tuning function is blocked. Check the configuration of the technology
object and, if necessary, restart controller tuning.
PID control
Function Manual, 11/2023, A5E35300227-AG 123
Using PID_3Step
6.2 PID_3Step V2
Result
If pretuning was performed without an error message, the PID parameters have been tuned.
PID_3Step switches to automatic mode and uses the tuned parameters. The tuned PID
parameters will be retained during power OFF and a restart of the CPU.
If pretuning is not possible, PID_3Step responds with the configured reaction to errors.
Fine tuning generates a constant, limited oscillation of the process value. The PID parameters
are tuned for the operating point from the amplitude and frequency of this oscillation. All PID
parameters are recalculated from the results. PID parameters from fine tuning usually have
better master control and disturbance characteristics than PID parameters from pretuning.
You obtain the best PID parameters when you perform pretuning and fine tuning.
PID_3Step automatically attempts to generate an oscillation greater than the noise of the
process value. Fine tuning is only minimally influenced by the stability of the process value.
The PID parameters are backed up before being recalculated.
The setpoint is frozen during fine tuning.
Requirement
• The PID_3Step instruction is called in a cyclic interrupt OB.
• ManualEnable = FALSE
• Reset = FALSE
• The motor transition time has been configured or measured.
• The setpoint and the process value lie within the configured limits (see "Process value
settings" configuration).
• The control loop has stabilized at the operating point. The operating point is reached
when the process value corresponds to the setpoint.
• No disturbances are expected.
• PID_3Step is in inactive mode, automatic mode or manual mode.
PID control
124 Function Manual, 11/2023, A5E35300227-AG
Using PID_3Step
6.2 PID_3Step V2
Procedure
To perform fine tuning, follow these steps:
1. Select the entry "Fine tuning" in the "Tuning mode" drop-down list.
2. Click the "Start" icon.
– An online connection will be established.
– Value recording is started.
– The process of fine tuning is started.
– The "Status" field displays the current steps and any errors that may have occurred. The
progress bar indicates the progress of the current step.
NOTE
Click the "Stop" icon in the "Tuning mode" group when the progress bar has reached 100%
and it is to be assumed the controller tuning function is blocked. Check the configuration
of the technology object and, if necessary, restart controller tuning.
Result
If no errors occurred during fine tuning, the PID parameters have been tuned. PID_3Step
switches to automatic mode and uses the tuned parameters. The tuned PID parameters will
be retained during power OFF and a restart of the CPU.
If errors occurred during fine tuning, PID_3Step responds with the configured response to
errors.
Requirement
• The PID_3Step instruction is called in a cyclic interrupt OB.
• ManualEnable = FALSE
• Reset = FALSE
• The motor transition time has been configured or measured.
• PID_3Step is in "inactive" mode.
• The setpoint and the process value lie within the configured limits (see "Process value
settings" configuration).
PID control
Function Manual, 11/2023, A5E35300227-AG 125
Using PID_3Step
6.2 PID_3Step V2
Procedure
Proceed as follows to commission PID_3Step with manual PID parameters:
1. Double-click on "PID_3Step > Configuration" in the project tree.
2. Click on "Advanced settings > PID Parameters" in the configuration window.
3. Select the check box "Enable direct input".
4. Enter the PID parameters.
5. Double-click the "PID_3Step > Commissioning" entry in the project tree.
6. Establish an online connection to the CPU.
7. Load the PID parameters to the CPU.
8. Click the "Start PID_3Step" icon.
Result
PID_3Step changes to automatic mode and controls using the current PID parameters.
See also
PID parameters V2 (Page 120)
Introduction
PID_3Step requires the motor transition time to be as accurate as possible for good controller
results. The data in the actuator documentation contains average values for this type of
actuator. The value for the specific actuator used may differ.
You can measure the motor transition time during commissioning if you are using actuators
with position feedback or endstop signals. The output value limits are not taken into
consideration during the motor transition time measurement. The actuator can travel to the
high or the low endstop.
The motor transition time cannot be measured if neither position feedback nor endstop
signals are available.
PID control
126 Function Manual, 11/2023, A5E35300227-AG
Using PID_3Step
6.2 PID_3Step V2
Result
The actuator is moved from the starting position to the target position. Time measurement
starts immediately and ends when the actuator reaches the target position. The motor
transition time is calculated according to the following equation:
Motor transition time = (output value high limit – output value low limit) × Measuring time /
AMOUNT (target position – starting position).
The progress and status of transition time measurement are displayed. The transition time
measured is saved in the instance data block on the CPU and displayed in the "Measured
transition time" field. When the transition time measurement is ended and
ActivateRecoverMode = TRUE, PID_3Step switches to the operating mode from which the
transition time measurement was started. If the transition time measurement is ended and
ActivateRecoverMode = FALSE, PID_3Step changes to "Inactive" mode.
NOTE
Click on the icon "Upload measured transition time" to load the motor transition time
measured to the project.
Result
The actuator is moved in the selected direction. Time measurement will start once the
actuator has reached the first endstop and will end when the actuator reaches this endstop
for the second time. The motor transition time is equal to the time measured divided by two.
The progress and status of transition time measurement are displayed. The transition time
measured is saved in the instance data block on the CPU and displayed in the "Measured
transition time" field. When the transition time measurement is ended and
ActivateRecoverMode = TRUE, PID_3Step switches to the operating mode from which the
transition time measurement was started. If the transition time measurement is ended and
ActivateRecoverMode = FALSE, PID_3Step changes to "Inactive" mode.
PID control
Function Manual, 11/2023, A5E35300227-AG 127
Using PID_3Step
6.2 PID_3Step V2
NOTE
Simulation with PLCSIM
The simulation of PID_3Step V2.x with PLCSIM for CPU S7-1200 is not supported.
PID_3Step V2.x can only be simulated for CPU S7-1500 with PLCSIM.
For the simulation with PLCSIM, the time behavior of the simulated PLC is not exactly
identical to that of a "real" PLC. The actual cycle clock of a cyclic interrupt OB can have larger
fluctuations with a simulated PLC than with "real" PLCs.
In the standard configuration, PID_3Step determines the time between calls automatically
and monitors them for fluctuations.
For a simulation of PID_3Step with PLCSIM, for example, a sampling time error ((ErrorBits =
DW#16#00000800) can therefore be detected.
This results in ongoing tuning being aborted.
The response in automatic mode depends on the value of the ActivateRecoverMode tag.
To prevent this from happening, you should configure PID_3Step for simulation with PLCSIM
as follows:
• CycleTime.EnEstimation = FALSE
• CycleTime.EnMonitoring = FALSE
• CycleTime.Value: Assign the cycle clock of the calling cyclic interrupt OB in seconds to this
tag.
PID control
128 Function Manual, 11/2023, A5E35300227-AG
Using PID_3Step
6.3 PID_3Step V1
6.3 PID_3Step V1
Configure the following properties of the "PID_3Step" technology object under "Basic settings"
in the Inspector window or in the configuration window:
• Physical quantity
• Control logic
• Start-up behavior after reset
• Setpoint (only in the Inspector window)
• Process value (only in the Inspector window)
• Output value (only in the Inspector window)
• Position feedback (only in the Inspector window)
Physical quantity
Select the unit of measurement and physical quantity for the setpoint and process value in
the "Controller type" group. The setpoint and process value will be displayed in this unit.
Control logic
An increase of the output value is generally intended to cause an increase in the process
value. This is referred to as a normal control logic.
PID_3Step does not work with negative proportional gain. Select the check box "Invert control
logic" to reduce the process value with a higher output value.
Examples
• Opening the drain valve will reduce the level of a container's contents.
• Increasing cooling will reduce the temperature.
PID control
Function Manual, 11/2023, A5E35300227-AG 129
Using PID_3Step
6.3 PID_3Step V1
Procedure
Proceed as follows to define a fixed setpoint:
1. Select "Instance DB".
2. Enter a setpoint, e.g. 80° C.
3. Delete any entry in the instruction.
Proceed as follows to define a variable setpoint:
1. Select "Instruction".
2. Enter the name of the REAL variable in which the setpoint is saved.
Program-controlled assignment of various values to the REAL variable is possible, for
example for the time controlled change of the setpoint.
PID_3Step will scale the value of the analog input to the physical quantity if you use the
analog input value directly.
You will need to write a program for processing if you wish first to process the analog input
value. The process value is, for example, not directly proportional to the value at the analog
input. The processed process value must be in floating point format.
Procedure
Proceed as follows to use the analog input value without processing:
1. Select the entry "Input_PER" in the drop-down list "Input".
2. Select "Instruction" as source.
3. Enter the address of the analog input.
Proceed as follows to use the processed process value in floating point format:
1. Select the entry "Input" in the drop-down list "Input".
2. Select "Instruction" as source.
3. Enter the name of the variable in which the processed process value is saved.
PID control
130 Function Manual, 11/2023, A5E35300227-AG
Using PID_3Step
6.3 PID_3Step V1
PID control
Function Manual, 11/2023, A5E35300227-AG 131
Using PID_3Step
6.3 PID_3Step V1
PID_3Step offers an analog output value (Output_PER) and digital output values (Output_UP,
Output_DN). Your actuator will determine which output value you use.
• Output_PER
The actuator has a relevant motor transition time and is triggered via an analog output
and controlled with a continuous signal, e.g. 0...10 V or 4...20 mA. The value at
Output_PER corresponds to the target position of the valve, e.g. Output_PER = 13824,
when the valve is to be opened by 50%.
For auto-tuning and anti windup behavior, for example, PID_3Step takes into
consideration that the analog output value has a delayed effect on the process due to the
motor transition time. If no relevant motor transition time is in effect in your process (e.g.
with solenoid valves), so that the output value has a direct and full effect on the process,
use PID_Compact instead.
• Output_UP, Output_DN
The actuator has a relevant motor transition time and is controlled by two digital outputs.
Output_UP moves the valve in the open state direction.
Output_DN moves the valve in the closed state direction.
The motor transition time is taken into consideration in the calculation of the analog output
value as well as in the calculation of the digital output values. It is mainly required for correct
operation during auto-tuning and the anti-windup behavior. You should therefore configure
the motor transition time under "Actuator settings" with the value that the motor requires to
move the actuator from the closed to the opened state.
Procedure
Proceed as follows to use the analog output value:
1. Select the entry "Output (analog)" in the drop-down list "Output".
2. Select "Instruction".
3. Enter the address of the analog output.
Proceed as follows to use the digital output value:
1. Select the entry "Output (digital)" in the drop-down list "Output".
2. Select "Instruction" for Output_UP and Output_DN.
3. Enter the addresses of the digital outputs.
Proceed as follows to process the output value using the user program:
1. Select the entry corresponding to the actuator in the drop-down list "Output".
2. Select "Instruction".
3. Enter the name of the tag you are using to process the output value.
4. Transfer the processed output value to the actuator by means of an analog or digital CPU
output.
PID control
132 Function Manual, 11/2023, A5E35300227-AG
Using PID_3Step
6.3 PID_3Step V1
Configure the scaling of your process value and specify the process value absolute limits In
the "Process value settings" configuration window.
NOTICE
Your system may be damaged.
If you set very high process value limits (for example -3.4*1038...+3.4*1038), process value
monitoring will be disabled. Your system may then be damaged if an error occurs. You need
to configure useful process value limits for your controlled system.
PID control
Function Manual, 11/2023, A5E35300227-AG 133
Using PID_3Step
6.3 PID_3Step V1
Actuator-specific times
Configure the motor transition time and the minimum ON and OFF times to prevent damage
to the actuator. You can find the specifications in the actuator data sheet.
The motor transition time is the time in seconds the motor requires to move the actuator
from the closed to the opened state. The maximum time that the actuator is moved in one
direction is 110% of the motor transition time. You can measure the motor transition time
during commissioning.
The motor transition time is taken into consideration in the calculation of the analog output
value as well as in the calculation of the digital output values. It is mainly required for correct
operation during auto-tuning and the anti-windup behavior.
If no relevant motor transition time is in effect in your process (e.g. with solenoid valves), so
that the output value has a direct and full effect on the process, use PID_Compact instead.
If you are using "Output_UP" or "Output_DN", you can reduce the switching frequency with
the minimum on and minimum OFF time.
The on or off times calculated are totaled in automatic mode and only become effective
when the sum is greater than or equal to the minimum on or OFF time.
A rising edge at Manual_UP or Manual_DN in manual mode will operate the actuator for at
least the minimum on or OFF time.
If you have selected the analog output value Output_PER, the minimum ON time and the
minimum OFF time are not evaluated and cannot be changed.
Reaction to error
PID_3Step is preset so that the controller stays active in most cases in the event of an error. If
errors occur frequently in controller mode, this default reaction has a negative effect on the
control response. In this case, check the Errorbits parameter and eliminate the cause of the
error.
PID_3Step generates a programmable output value in response to an error:
• Current value
PID_3Step is switched off and no longer modifies the actuator position.
• Current value for error while error is pending
The controller functions of PID_3Step are switched off and the position of the actuator is
no longer changed.
If the following errors occur in automatic mode, PID_3Step returns to automatic mode as
soon as the errors are no longer pending.
– 0002h: Invalid value at Input_PER parameter.
– 0200h: Invalid value at Input parameter.
– 0800h: Sampling time error
– 1000h: Invalid value at Setpoint parameter.
– 2000h: Invalid value at Feedback_PER parameter.
– 4000h: Invalid value at Feedback parameter.
– 8000h: Error during digital position feedback.
If one of these error occurs in manual mode, PID_3Step remains in manual mode.
If an error occurs during the tuning or transition time measurement, PID_3Step is switched
off.
PID control
134 Function Manual, 11/2023, A5E35300227-AG
Using PID_3Step
6.3 PID_3Step V1
Feedback scaling
If you have configured the use of Feedback_PER in the basic settings, you will need to convert
the value of the analog input into %. The current configuration will be displayed in the
"Feedback" display.
Feedback_PER is scaled using a low and high value pair.
1. Enter the low pair of values in the "Low endstop" and "Low" input boxes.
2. Enter the high pair of values in the "High endstop" and "High" input boxes.
"Low endstop" must be less than "High endstop"; "Low" must be less than "High".
The valid values for "High endstop" and "Low endstop" depend upon:
• No Feedback, Feedback, Feedback_PER
• Output (analog), Output (digital)
PID control
Function Manual, 11/2023, A5E35300227-AG 135
Using PID_3Step
6.3 PID_3Step V1
Configure a warning high and low limit for the process value in the "Process value
monitoring" configuration window. If one of the warning limits is exceeded or undershot
during operation, a warning will be displayed at the PID_3Step instruction:
• At the InputWarning_H output parameter if the warning high limit has been exceeded
• At the InputWarning_L output parameter if the warning low limit has been undershot
The warning limits must be within the process value high and low limits.
The process value high and low limits will be used if you do not enter values.
Example
Process value high limit = 98° C; warning high limit = 90° C
Warning low limit = 10° C; process value low limit = 0° C
PID_3Step will respond as follows:
The PID parameters are displayed in the "PID Parameters" configuration window. The PID
parameters will be adapted to your controlled system during controller tuning. You do not
need to enter the PID parameters manually.
NOTE
The currently active PID parameters are located in the Retain.CtrlParams structure.
Change the currently active PID parameters only in "Inactive" mode online to prevent
malfunction of the PID controller.
If you want to change the PID parameters in "Automatic mode" or "Manual mode" online,
change the PID parameters in the CtrlParamsBackUp structure and apply these changes to the
Retain.CtrlParams structure as follows:
• PID_3Step V1: Apply the changes with Config.LoadBackUp = TRUE
• PID_3Step V2: Apply the changes with LoadBackUp = TRUE
Online changes to the PID parameters in "Automatic mode" can result in jumps at the output
value.
PID control
136 Function Manual, 11/2023, A5E35300227-AG
Using PID_3Step
6.3 PID_3Step V1
C
4FUQPJOU X
%5 % ,
D 1
ǡZ
%FBE@#
5J *
4DBMFE*OQVU Y
'BD5U "OUJ8JOEVQ
All PID parameters are retentive. If you enter the PID parameters manually, you must
completely download PID_3Step.
Downloading technology objects to device (Page 46)
Proportional gain
The value specifies the proportional gain of the controller. PID_3Step does not work with a
negative proportional gain. Control logic is inverted under Basic settings > Controller type.
Integration time
The integration time determines the time behavior of the integral action. The integral action
is deactivated with integration time = 0.0. When the integration time is changed from a
different value to 0.0 online in "Automatic mode", the previous integral action is deleted and
the output value jumps.
PID control
Function Manual, 11/2023, A5E35300227-AG 137
Using PID_3Step
6.3 PID_3Step V1
PID control
138 Function Manual, 11/2023, A5E35300227-AG
Using PID_3Step
6.3 PID_3Step V1
6.3.2.1 Commissioning V1
You can monitor the setpoint, process value and output value over time in the "Tuning"
working area. The following commissioning functions are supported in the curve plotter:
• Controller pretuning
• Controller fine tuning
• Monitoring the current closed-loop control in the trend view
All functions require an online connection to the CPU to have been established.
Basic handling
• Select the desired sampling time in the "Sampling time" drop-down list.
All values in the tuning working area are updated in the selected update time.
• Click the "Start" icon in the measuring group if you want to use the commissioning
functions.
Value recording is started. The current values for the setpoint, process value and output
value are entered in the trend view. Operation of the commissioning window is enabled.
• Click the "Stop" icon if you want to end the commissioning functions.
The values recorded in the trend view can continue to be analyzed.
• Closing the commissioning window will terminate recording in the trend view and delete
the recorded values.
PID control
Function Manual, 11/2023, A5E35300227-AG 139
Using PID_3Step
6.3 PID_3Step V1
6.3.2.2 Pretuning V1
The pretuning determines the process response to a pulse of the output value and searches
for the point of inflection. The tuned PID parameters are calculated as a function of the
maximum slope and dead time of the controlled system.
The more stable the process value is, the easier it is to calculate the PID parameters and the
more precise the result will be. Noise on the process value can be tolerated as long as the rate
of rise of the process value is significantly higher compared to the noise. The PID parameters
are backed up before being recalculated.
The setpoint is frozen during pretuning.
Requirement
• The PID_3Step instruction is called in a cyclic interrupt OB.
• ManualEnable = FALSE
• PID_3Step is in "inactive" or "manual" mode.
• The setpoint and the process value lie within the configured limits (see "Process value
settings" configuration).
Procedure
To perform pretuning, follow these steps:
1. Double-click the "PID_3Step > Commissioning" entry in the project tree.
2. Select the entry "Pretuning" in the "Tuning mode" drop-down list in the working area
"Tuning".
3. Click the "Start" icon.
– An online connection will be established.
– Value recording is started.
– Pretuning is started.
– The "Status" field displays the current steps and any errors that may have occurred. The
progress bar indicates the progress of the current step.
NOTE
Click the "Stop" icon when the progress bar has reached 100% and it is to be assumed
the controller tuning function is blocked. Check the configuration of the technology
object and, if necessary, restart controller tuning.
Result
If pretuning was performed without an error message, the PID parameters have been tuned.
PID_3Step switches to automatic mode and uses the tuned parameters. The tuned PID
parameters will be retained during power OFF and a restart of the CPU.
If pretuning is not possible, PID_3Step changes to "Inactive" mode.
PID control
140 Function Manual, 11/2023, A5E35300227-AG
Using PID_3Step
6.3 PID_3Step V1
Fine tuning generates a constant, limited oscillation of the process value. The PID parameters
are optimized for the operating point from the amplitude and frequency of this oscillation. All
PID parameters are recalculated on the basis of the findings. PID parameters from fine tuning
usually have better master control and disturbance behavior than PID parameters from
pretuning.
PID_3Step automatically attempts to generate an oscillation greater than the noise of the
process value. Fine tuning is only minimally influenced by the stability of the process value.
The PID parameters are backed up before being recalculated.
The setpoint is frozen during fine tuning.
Requirement
• The PID_3Step instruction is called in a cyclic interrupt OB.
• ManualEnable = FALSE
• The motor transition time has been configured or measured.
• The setpoint and the process value lie within the configured limits (see "Process value
settings" configuration).
• The control loop has stabilized at the operating point. The operating point is reached
when the process value corresponds to the setpoint.
• No disturbances are expected.
• PID_3Step is in inactive mode, automatic mode or manual mode.
PID control
Function Manual, 11/2023, A5E35300227-AG 141
Using PID_3Step
6.3 PID_3Step V1
Procedure
Proceed as follows to carry out "fine tuning":
1. Select the entry "Fine tuning" in the "Tuning mode" drop-down list.
2. Click the "Start" icon.
– An online connection will be established.
– Value recording is started.
– The process of fine tuning is started.
– The "Status" field displays the current steps and any errors that may have occurred. The
progress bar indicates the progress of the current step.
NOTE
Click the "Stop" icon in the "Tuning mode" group when the progress bar has reached
100% and it is to be assumed the controller tuning function is blocked. Check the
configuration of the technology object and, if necessary, restart controller tuning.
Result
The PID parameters will have been optimized if fine tuning has been executed without errors.
PID_3Step changes to automatic mode and uses the optimized parameters. The optimized PID
parameters will be retained during power OFF and a restart of the CPU.
If errors occurred during fine tuning, PID_3Step will change to "inactive" mode.
Procedure
Proceed as follows to commission PID_3Step with manual PID parameters:
1. Double-click on "PID_3Step > Configuration" in the project tree.
2. Click on "Advanced settings > PID Parameters" in the configuration window.
3. Select the check box "Enable direct input".
4. Enter the PID parameters.
5. Double-click on "PID_3Step > Commissioning" in the project tree.
6. Establish an online connection to the CPU.
7. Load the PID parameters to the CPU.
8. Click on the "Activate controller" icon.
Result
PID_3Step changes to automatic mode and controls using the current PID parameters.
PID control
142 Function Manual, 11/2023, A5E35300227-AG
Using PID_3Step
6.3 PID_3Step V1
Introduction
PID_3Step requires the motor transition time to be as accurate as possible for good controller
results. The data in the actuator documentation contains average values for this type of
actuator. The value for the specific actuator used may differ.
You can measure the motor transition time during commissioning if you are using actuators
with position feedback or endstop signals. The output value limits are not taken into
consideration during the motor transition time measurement. The actuator can travel to the
high or the low endstop.
The motor transition time cannot be measured if neither position feedback nor endstop
signals are available.
Result
The actuator is moved from the starting position to the target position. Time measurement
starts immediately and ends when the actuator reaches the target position. The motor
transition time is calculated according to the following equation:
Motor transition time = (output value high limit – output value low limit) × Measuring time /
AMOUNT (target position – starting position).
The progress and status of transition time measurement are displayed. The transition time
measured is saved in the instance data block on the CPU and displayed in the "Measured
transition time" field. PID_3Step will change to "Inactive" mode once transition time
measurement is complete.
NOTE
Click on the icon "Upload measured transition time" to load the motor transition time
measured to the project.
PID control
Function Manual, 11/2023, A5E35300227-AG 143
Using PID_3Step
6.3 PID_3Step V1
Result
The actuator is moved in the selected direction. Time measurement will start once the
actuator has reached the first endstop and will end when the actuator reaches this endstop
for the second time. The motor transition time is equal to the time measured divided by two.
The progress and status of transition time measurement are displayed. The transition time
measured is saved in the instance data block on the CPU and displayed in the "Measured
transition time" field. PID_3Step will change to "Inactive" mode once transition time
measurement is complete.
PID control
144 Function Manual, 11/2023, A5E35300227-AG
Using PID_3Step
6.3 PID_3Step V1
NOTE
Simulation with PLCSIM
For the simulation with PLCSIM, the time behavior of the simulated PLC is not exactly
identical to that of a "real" PLC. The actual cycle clock of a cyclic interrupt OB can have larger
fluctuations with a simulated PLC than with "real" PLCs.
In the standard configuration, PID_3Step determines the time between calls automatically
and monitors them for fluctuations.
For a simulation of PID_3Step with PLCSIM, for example, a sampling time error (ErrorBits =
DW#16#00000800) can therefore be detected.
This results in ongoing tuning being aborted.
The response in automatic mode depends on the value of the ActivateRecoverMode tag.
To prevent this from happening, you should configure PID_3Step for simulation with PLCSIM
as follows:
• CycleTime.EnEstimation = FALSE
• CycleTime.EnMonitoring = FALSE
• CycleTime.Value: Assign the cycle clock of the calling cyclic interrupt OB in seconds to this
tag.
PID control
Function Manual, 11/2023, A5E35300227-AG 145
Using PID_Temp 7
7.1 Technology object PID_Temp
The PID_Temp technology object provides a continuous PID controller with integrated tuning.
PID_Temp is especially designed for temperature control and is suited for heating or
heating/cooling applications. Two outputs are available for this purpose, one each for heating
and cooling. PID_Temp can also be used for other control tasks. PID_Temp is cascadable and
can be used in manual or automatic mode.
PID_Temp continuously acquires the measured process value within a control loop and
compares it with the set setpoint. From the resulting control deviations, the instruction
PID_Temp calculates the output value for heating and/or cooling which is used to adjust the
process value to the setpoint. The output values for the PID controller consist of three actions:
• Proportional action
The proportional action of the output value increases in proportion to the control
deviation.
• Integral action
The integral action of the output value increases until the control deviation has been
balanced.
• Derivative action
The derivative action increases with the rate of change of control deviation. The process
value is corrected to the setpoint as quickly as possible. The derivative action will be
reduced again if the rate of change of control deviation drops.
The instruction PID_Temp calculates the proportional, integral and derivative parameters for
your controlled system during "pretuning". "Fine tuning" can be used to tune the parameters
further. You do not need to manually determine the parameters.
Either a fixed cooling factor or two PID parameter sets can be used for heating-and-cooling
applications.
Additional information
• Overview of software controller (Page 41)
• Add technology objects (Page 43)
• Configure technology objects (Page 44)
• Configuring PID_Temp (Page 147)
PID control
146 Function Manual, 11/2023, A5E35300227-AG
Using PID_Temp
7.2 Configuring PID_Temp
7.2.1.1 Introduction
Configure the following properties of the "PID_Temp" technology object under "Basic settings"
in the Inspector window or in the configuration window:
• Physical quantity
• Start-up behavior after reset
• Source and input of the setpoint (only in the Inspector window)
• Selection of the process value
• Source and input of the process value (only in the Inspector window)
• Selection of the heating output value
• Source and input of the heating output value (only in the Inspector window)
• Activation and selection of the cooling output value
• Source and input of the cooling output value (only in the Inspector window)
• Activation of PID_Temp as master or slave of a cascade
• Number of slaves
• Selection of the master (only in the Inspector window)
Setpoint, process value, heating output value and cooling output value
You can select the source and enter values or tags for the setpoint, process value, heating
output value and cooling output value in the Inspector window of the programming editor.
Select the source for each value:
• Instance DB:
The value saved in the instance DB is used. The value must be updated by the user
program in the instance DB. There should be no value at the instruction. Can be changed
using HMI.
• Instruction:
The value connected to the instruction is used. The value is written to the instance DB
each time the instruction is called. Cannot be changed using HMI.
PID control
Function Manual, 11/2023, A5E35300227-AG 147
Using PID_Temp
7.2 Configuring PID_Temp
Physical quantity
Select the unit of measurement and physical quantity for the setpoint and the process value
in the "Controller type" group. The setpoint and the process value are displayed in this unit.
Startup characteristics
1. To switch to "Inactive"mode after CPU restart, clear the "Activate Mode after CPU
restart"check box.
To switch to the operating mode saved in the Mode parameter after CPU restart, select the
"Activate Mode after CPU restart" check box.
2. In the "Set Mode to" drop-down list, select the mode that is to be enabled after a complete
download to the device.
After a complete "Download to device", PID_Temp starts in the selected operating mode.
With each additional restart, PID_Temp starts in the mode that was last saved in Mode.
When selecting pretuning or fine tuning, you also have to set or reset the
Heat.EnableTuning and Cool.EnableTuning tags in order to choose between tuning for
heating and tuning for cooling.
Example:
You have selected the "Activate Mode after CPU restart" check box and the "Pretuning" entry
in the "Set Mode to" list. After a complete "Download to device", PID_Temp starts in the
"Pretuning" mode. If pretuning is still active, PID_Temp starts in "Pretuning" mode again after
restart of the CPU (heating/cooling depends on the tags Heat.EnableTuning and
Cool.EnableCooling). If pretuning was successfully completed and automatic mode is active,
PID_Temp starts in "Automatic mode" after restart of the CPU.
7.2.1.3 Setpoint
Procedure
Proceed as follows to define a fixed setpoint:
1. Select "Instance DB".
2. Enter a setpoint, e.g. 80° C.
3. Delete any entry in the instruction.
Proceed as follows to define a variable setpoint:
1. Select "Instruction".
2. Enter the name of the REAL tag in which the setpoint is saved.
Program-controlled assignment of various values to the REAL tag is possible, for example
for the time-controlled change of the setpoint.
PID control
148 Function Manual, 11/2023, A5E35300227-AG
Using PID_Temp
7.2 Configuring PID_Temp
PID_Temp will scale the value of the analog input to the physical quantity if you use the
analog input value directly.
You will need to write a program for processing if you wish first to process the analog input
value. The process value is, for example, not directly proportional to the value at the analog
input. The processed process value must be in floating point format.
Procedure
Proceed as follows to use the analog input value without processing:
1. Select the entry "Input_PER" in the drop-down list "Input".
2. Select "Instruction" as source.
3. Enter the address of the analog input.
Proceed as follows to use the processed process value in floating point format:
1. Select the entry "Input" in the drop-down list "Input".
2. Select "Instruction" as source.
3. Enter the name of the variable in which the processed process value is saved.
The PID_Temp instruction provides a PID controller with integrated tuning for temperature
processes. PID_Temp is suitable for heating or heating-and-cooling applications.
PID_Temp provides the following output values. Your actuator will determine which output
value you use.
• OutputHeat
Heating output value (floating-point format): The output value for heating needs to be
processed by the user program, for example, because of non-linear actuator response.
• OutputHeat_PER
Analog heating output value: The actuator for heating is triggered via an analog output
and controlled with a continuous signal, e.g. 0...10 V, 4...20 mA.
• OutputHeat_PWM
Pulse-width modulated heating output value: The actuator for heating is controlled via a
digital output. Pulse width modulation creates variable ON and OFF times.
• OutputCool
Cooling output value (floating-point format): The output value for cooling needs to be
processed by the user program, for example because of non-linear actuator response.
• OutputCool_PER
Analog cooling output value: The actuator for cooling is triggered via an analog output
and controlled with a continuous signal, e.g. 0...10 V, 4...20 mA.
• OutputCool_PWM
Pulse-width modulated cooling output value: The actuator for cooling is controlled via a
digital output. Pulse width modulation creates variable ON and OFF times.
PID control
Function Manual, 11/2023, A5E35300227-AG 149
Using PID_Temp
7.2 Configuring PID_Temp
The cooling output is only available if it was activated via the "Activate cooling" check box.
• If the check box is cleared, the output value of the PID algorithm (PidOutputSum) is scaled
and output at the outputs for heating.
• If the check box is selected, positive output values of the PID algorithm (PidOutputSum)
are scaled and output at the outputs for heating. Negative output values of the PID
algorithm are scaled and output at the outputs for cooling. You can choose between two
methods for output value calculation at the output settings.
NOTE
Note:
• The OutputHeat_PWM, OutputHeat_PER, OutputCool_PWM, OutputCool_PER outputs are
only calculated if you select these correspondingly from the drop-down list.
• The OutputHeat output is always calculated.
• The OutputCool output is calculated if the check box for cooling is selected.
• The "Activate cooling" check box is only available if the controller is not configured as a
master in a cascade.
Procedure
Proceed as follows to use the analog output value:
1. Select the entry "OutputHeat_PER" or "OutputCool_PER" in the drop-down list "OutputHeat"
or "OutputCool".
2. Select "Instruction".
3. Enter the address of the analog output.
Proceed as follows to use the pulse-width modulated output value:
1. Select the entry "OutputHeat_PWM" or "OutputCool_PWM" in the drop-down list
"OutputHeat" or "OutputCool".
2. Select "Instruction".
3. Enter the address of the digital output.
Proceed as follows to process the output value using the user program:
1. Select the entry "OutputHeat" or "OutputCool" in the drop-down list "OutputHeat" or
"OutpuCool".
2. Select "Instruction".
3. Enter the name of the variable you are using to process the output value.
4. Transfer the processed output value to the actuator by means of an analog or digital CPU
output.
PID control
150 Function Manual, 11/2023, A5E35300227-AG
Using PID_Temp
7.2 Configuring PID_Temp
7.2.1.6 Cascade
If a PID_Temp instance receives its setpoint from a higher-level master controller and outputs
its output value in turn to a subordinate slave controller, this PID_Temp instance is both a
master controller and a slave controller simultaneously. Both configurations listed below then
have to be carried out for such a PID_Temp instance. This is the case, for example, for the
middle PID_Temp instance in a cascade control system with three concatenated measured
variables and three PID_Temp instances.
Additional information
Additional information about program creation, configuration and commissioning when
PID_Temp is used in cascade control systems is available under Cascade control with
PID_Temp (Page 177).
PID control
Function Manual, 11/2023, A5E35300227-AG 151
Using PID_Temp
7.2 Configuring PID_Temp
You must specify an appropriate absolute high limit and low limit for the process value as
limit values for your controlled system. As soon as the process value violates these limits, an
error occurs (ErrorBits = 0001h). Tuning is canceled when the process value limits are
violated. You can specify how PID_Temp responds to errors in automatic mode in the output
settings.
If you have configured the use of Input_PER in the basic settings, you will need to convert the
value of the analog input into the physical quantity of the process value. The current
configuration is displayed in the Input_PER display.
Input_PER is scaled using a low and high value pair if the process value is directly proportional
to the value of the analog input.
Procedure
To scale the process value, follow these steps:
1. Enter the low pair of values in the "Scaled low process value" and "Low" input fields.
2. Enter the high pair of values in the "Scaled high process value" and "High" input fields.
Default settings for the value pairs are saved in the hardware configuration. Proceed as
follows to use the value pairs from the hardware configuration:
1. Select the instruction PID_Temp in the programming editor.
2. Interconnect Input_PER with an analog input in the basic settings.
3. Click on the "Automatic setting" button in the process value settings.
The existing values are overwritten with the values from the hardware configuration.
PID control
152 Function Manual, 11/2023, A5E35300227-AG
Using PID_Temp
7.2 Configuring PID_Temp
Cooling factor
If the cooling factor is selected as the method for heating/cooling, this factor is used in the
calculation of the output value for cooling. This allows different gains of heating and cooling
actuators to be taken into account.
The cooling factor is not set automatically or adjusted during tuning. You have to configure
the correct cooling factor manually by using the ratio "Heating actuator gain/Cooling actuator
gain".
Example: Cooling factor = 2.0 means that the heating actuator gain is twice as high as the
cooling actuator gain.
The cooling factor is only effective and can only be changed if "Cooling factor" is selected as
the method for heating/cooling.
Reaction to error
NOTICE
Your system may be damaged.
If you output "Current value while error is pending " or "Substitute output value while error is
pending" in the event of an error, PID_Temp remains in automatic mode or in manual mode.
This may cause a violation of the process value limits and damage your system.
It is essential to configure how your controlled system reacts in the event of an error to
protect your system from damage.
PID_Temp is preset so that the controller stays active in most cases in the event of an error.
PID control
Function Manual, 11/2023, A5E35300227-AG 153
Using PID_Temp
7.2 Configuring PID_Temp
If errors occur frequently in controller mode, this default reaction has a negative effect on the
control response. In this case, check the ErrorBits parameter and eliminate the cause of the
error.
PID_Temp generates a programmable output value in response to an error:
• Zero (inactive)
At all errors, PID_Temp switches to the "Inactive" operating mode and outputs the
following:
– 0.0 as PID output value (PidOutputSum)
– 0.0 as output value for heating (OutputHeat) and output value for cooling
(OutputCool)
– 0 as analog output value for heating (OutputHeat_PER) and analog output value for
cooling (OutputCool_PER)
– FALSE as PWM output value for heating (OutputHeat_PWM) and PWM output value for
cooling (OutputCool_PWM)
This is independent of the configured output value limits and the scaling. The controller is
only reactivated by a falling edge at Reset or a rising edge at ModeActivate.
• Current value while error is pending
The error response depends on the error occurring and the operating mode.
If one or more of the following errors occur in automatic mode, PID_Temp stays in
automatic mode:
– 0000001h: The Input parameter is outside the process value limits.
– 0000800h: Sampling time error
– 0040000h: Invalid value at Disturbance parameter.
– 8000000h: Error during the calculation of the PID parameters.
If one or more of the following errors occur in automatic mode, PID_Temp switches to
"Substitute output value with error monitoring" mode and outputs the last valid PID output
value (PidOutputSum):
– 0000002h: Invalid value at Input_PER parameter.
– 0000200h: Invalid value at Input parameter.
– 0000400h: Calculation of output value failed.
– 0001000h: Invalid value at Setpoint or SubstituteSetpoint parameter.
The values at the outputs for heating and cooling resulting from the PID output value are
produced by the configured output scaling.
As soon as the errors are no longer pending, PID_Temp switches back to automatic mode.
If an error occurs during manual mode, PID_Temp remains in manual mode and continues
to use the manual value as the PID output value.
If the manual value is invalid, the configured substitute output value is used.
If the manual value and substitute output value are invalid, the low limit of the PID output
value for heating (Config.Output.Heat.PidLowerLimit) is used.
If the following error occurs during pretuning or fine tuning, PID_Temp remains in active
mode:
– 0000020h: Pretuning is not permitted during fine tuning.
When any other error occurs, PID_Temp cancels the tuning and switches to the mode from
which tuning was started.
PID control
154 Function Manual, 11/2023, A5E35300227-AG
Using PID_Temp
7.2 Configuring PID_Temp
Depending on the operating mode, the PID output value (PidOutputSum) is calculated
automatically by the PID algorithm or by the manual value (ManualValue) or the configured
substitute output value (SubstituteOutput).
The PID output value is limited depending on the configuration:
• If the cooling is deactivated in the basic settings (Config.ActivateCooling = FALSE), the
value is limited to the high limit of the PID output value (heating)
(Config.Output.Heat.PidUpperLimit) and the low limit of the PID output value (heating)
(Config.Output.Heat.PidLowerLimit).
You can configure both limits at the horizontal axis of the scaling characteristic line in the
"OutputHeat / OutputCool" section. These are displayed in the "OutputHeat_PWM /
OutputCool_PWM" and "OutputHeat_PER / OutputCool_PER" sections, but cannot be
changed.
• If the cooling is activated in the basic settings (Config.ActivateCooling = TRUE), the value
is limited to the high limit of the PID output value (Config.Output.Heat.PidUpperLimit) and
the low limit of the PID output value (cooling) (Config.Output.Cool.PidLowerLimit).
You can configure both limits at the horizontal axis of the scaling characteristic line in the
"OutputHeat / OutputCool" section. These are displayed in the "OutputHeat_PWM /
OutputCool_PWM" and "OutputHeat_PER / OutputCool_PER" sections, but cannot be
changed.
The low limit of the PID output value (heating) (Config.Output.Heat.PidLowerLimit) and
the high limit of the PID output value (cooling) (Config.Output.Cool.PidUpperLimit) cannot
be changed and have to be assigned the value 0.0.
PID control
Function Manual, 11/2023, A5E35300227-AG 155
Using PID_Temp
7.2 Configuring PID_Temp
The PID output value is scaled and output at the outputs for heating and cooling. Scaling can
be specified separately for each output and is specified across 2 value pairs each, consisting
of a limit value of the PID output value and a scaling value:
PID control
156 Function Manual, 11/2023, A5E35300227-AG
Using PID_Temp
7.2 Configuring PID_Temp
Example:
Output scaling when the OutputHeat output is used (cooling deactivated. The low limit of PID
output value (heating) (Config.Output.Heat.PidLowerLimit) may be unequal to 0.0):
0VUQVU)FBU
$POH0VUQVU)FBU
6QQFS4DBMJOH
$POH0VUQVU)FBU
-PXFS4DBMJOH
1JE0VUQVU4VN
$POH0VUQVU)FBU $POH0VUQVU)FBU
1JE-PXFS-JNJU 1JE6QQFS-JNJU
Example:
Output scaling when the OutputHeat_PWM and OutputCool_PER outputs are used (cooling
activated. The low limit of PID output value (heating) (Config.Output.Heat.PidLowerLimit)
must be 0.0):
0VUQVU$PPM@1&3 0VUQVU)FBU@18.
$POH0VUQVU$PPM
1FS6QQFS4DBMJOH $POH0VUQVU)FBU
1XN6QQFS4DBMJOH
$POH0VUQVU)FBU
1XN-PXFS4DBMJOH
$POH0VUQVU$PPM
1FS-PXFS4DBMJOH 1JE0VUQVU4VN
$POH0VUQVU)FBU
$POH0VUQVU$PPM 1JE-PXFS-JNJU $POH0VUQVU)FBU
1JE-PXFS-JNJU $POH0VUQVU$PPM 1JE6QQFS-JNJU
1JE6QQFS-JNJU
With the exception of the "Inactive" operating mode, the value at an output always lies
between its scaled high output value and the scaled low output value, for example for
OutputHeat always between the scaled high output value (heating)
(Config.Output.Heat.UpperScaling) and the scaled low output value (heating)
(Config.Output.Heat.LowerScaling).
PID control
Function Manual, 11/2023, A5E35300227-AG 157
Using PID_Temp
7.2 Configuring PID_Temp
If you want to limit the value at the associated output, you therefore have to adapt these
scaling values as well.
You can configure the scaling values of an output at the vertical axes of the scaling
characteristic line. Each output has two separate scaling values. These can only be changed
for OutputHeat_PWM, OutputCool_PWM, OutputHeat_PER and OutputCool_PER if the
corresponding output is selected in the basic settings. The cooling has to be activated
additionally in the basic settings at all the outputs for cooling.
The trend view in the commissioning dialog box only records the values of OutputHeat and
OutputCool, irrespective of the selected output in the basic settings. Therefore, if necessary,
adapt the scaling values for OutputHeat or OutputCool if you use OutputHeat_PWM or
OutputHeat_PER or OutputCool_PWM or OutputCool_PER and want to use the trend view in
the commissioning dialog.
Configure a warning high and low limit for the process value in the "Process value
monitoring" configuration window. If one of the warning limits is exceeded or undershot
during operation, a warning is displayed at the PID_Temp instruction:
• At the InputWarning_H output parameter if the warning high limit has been exceeded
• At the InputWarning_L output parameter if the warning low limit has been undershot
The warning limits must be within the process value high and low limits.
The process value high and low limits are used if you do not enter values.
Example
Process value high limit = 98° C; warning high limit = 90° C
Warning low limit = 10° C; process value low limit = 0° C
PID_Temp will respond as follows:
PID control
158 Function Manual, 11/2023, A5E35300227-AG
Using PID_Temp
7.2 Configuring PID_Temp
The PID output value PidOutputSum is scaled and transformed via a pulse width modulation
into a pulse train that is output at the output parameter OutputHeat_PWM or
OutputCool_PWM.
The "Sampling time of PID algorithm" represents the time between two calculations of the PID
output value. The sampling time is used as time period of the pulse width modulation.
During heating, the PID output value is always calculated in the "Sampling time of PID
algorithm for heating".
Calculation of the PID output value during cooling depends on the type of cooling selected in
"Basic settings Output":
• If the cooling factor is used, the "Sampling time of PID algorithm for heating" applies.
• If the PID parameter switching is used, the "Sampling time of PID algorithm for cooling"
applies.
The PID algorithm sampling time for heating or cooling is determined during pretuning or
fine tuning. If you set the PID parameters manually, you will also need to configure the PID
algorithm sampling time for heating or cooling.
OutputHeat_PWM and OutputCool_PWM are output in the PID_Temp sampling time. The
PID_Temp sampling time is equivalent to the cycle time of the calling OB.
The pulse duration is proportional to the PID output value and is always an integer multiple of
the PID_Temp sampling time.
U NT
0VUQVU)FBU@18.
536&
'"-4&
U NT
PID control
Function Manual, 11/2023, A5E35300227-AG 159
Using PID_Temp
7.2 Configuring PID_Temp
A pulse or a break is never shorter than the minimum ON or OFF time. The inaccuracies this
causes are added up and compensated in the next cycle.
0VUQVU)FBU@18. U NT
536&
'"-4&
U NT
NOTE
The minimum ON and OFF times only affect the output parameters OutputHeat_PWM or
OutputCool_PWM and are not used for any pulse generators integrated in the CPU.
PID control
160 Function Manual, 11/2023, A5E35300227-AG
Using PID_Temp
7.2 Configuring PID_Temp
The PID parameters are displayed in the "PID Parameters" configuration window.
If cooling is activated in the basic settings and PID parameter switching is selected as the
method for heating/cooling in the output settings, two parameter sets are available: One for
heating and one for cooling.
In this case, the PID algorithm decides on the basis of the calculated output value and the
control deviation whether the PID parameters for heating or cooling are used.
If cooling is deactivated or the cooling factor is selected as the method for heating/cooling,
the parameter set for heating is always used.
During tuning, the PID parameters are adapted to the controlled system with the exception of
the dead zone width that has to be configured manually.
NOTE
The currently active PID parameters are located in the Retain.CtrlParams structure.
Change the currently active PID parameters only in "Inactive" mode online to prevent
malfunction of the PID controller.
If you want to change the PID parameters in "Automatic mode" or "Manual mode" online,
change the PID parameters in the CtrlParamsBackUp structure and apply these changes with
LoadBackUp = TRUE to the Retain.CtrlParams structure.
Online changes to the PID parameters in "Automatic mode" can result in jumps at the output
value.
PID_Temp is a PIDT1 controller with anti-windup and weighting of the proportional and
derivative actions.
The PID algorithm operates according to the following equation (control zone and dead zone
deactivated):
5%wT
Z,Q < CwXY 5*wT
XY
Bw5%wT
DwXY >
PID control
Function Manual, 11/2023, A5E35300227-AG 161
Using PID_Temp
7.2 Configuring PID_Temp
The diagram below illustrates the integration of the parameters into the PID algorithm:
$VSSFOU4FUQPJOU X C
$POH0VUQVU
)FBU1JE6QQFS-JNJU
D %5 ,Q
Z
%FBE;POF
$POH0VUQVU
)FBU1JE-PXFS-JNJU
$POH0VUQVU
$PPM1JE-PXFS-JNJU
"OUJ8JOEVQ
4DBMFE*OQVU Y -JNJU *
$POUSPM;POF
All PID parameters are retentive. If you enter the PID parameters manually, you must
completely download PID_Temp (Downloading technology objects to device (Page 46)).
PID control
162 Function Manual, 11/2023, A5E35300227-AG
Using PID_Temp
7.2 Configuring PID_Temp
*OQVU
[ THO
$USM1BSBNT
)FBU(BJO
)FBU5Jܵ
$PPM(BJO
$PPM5J
4VCTUJUVUF4FUQPJOU0O 4DBMFE*OQVU
4FUQPJOU
-JNJU 1*%5
$VSSFOU4FUQPJOU
4VCTUJUVUF4FUQPJOU "OUJ
8JOEVQ
%JTUVSCBODF
4UBUF
-JNJU
.BOVBM7BMVF 1JE0VUQVU4VN
4DBMF
0VUQVU)FBU
1JE0VUQVU $POH0VUQVU)FBU4FMFDU
4DBMF 18.
0TFU)FBU
1*%4FMG5VOF
'"-4& 0VUQVU)FBU@18.
5*30VUQVU0TFU)FBU
ࣣ
0VUQVU)FBU@1&3
ࣣ
$POH"DUJWBUF$PPMJOH
4QMJU -JNJU 4DBMF
0VUQVU$PPM
1*%4FMG5VOF $POH0VUQVU$PPM4FMFDU
4DBMF 18.
5*30VUQVU0TFU$PPM
1JE0VUQVU
'"-4& '"-4& 0VUQVU$PPM@18.
0TFU$PPM
ࣣ
4DBMF
0VUQVU$PPM@1&3
ࣣ
Proportional gain
The value specifies the proportional gain of the controller. PID_Temp does not operate with a
negative proportional gain and only supports the normal control direction, meaning that an
increase in the process value is achieved by an increase in the PID output value
(PidOutputSum).
PID control
Function Manual, 11/2023, A5E35300227-AG 163
Using PID_Temp
7.2 Configuring PID_Temp
Integration time
The integration time determines the time behavior of the integral action. The integral action
is deactivated with integration time = 0.0. When the integration time is changed from a
different value to 0.0 online in "Automatic mode", the previous integral action is deleted and
the output value jumps.
PID control
164 Function Manual, 11/2023, A5E35300227-AG
Using PID_Temp
7.2 Configuring PID_Temp
PID control
Function Manual, 11/2023, A5E35300227-AG 165
Using PID_Temp
7.2 Configuring PID_Temp
If values not equal to 1.0 are configured for the proportional action weighting or the
derivative action weighting, setpoint changes even within the dead zone affect the output
value.
Process value changes within the dead zone do not affect the output value, regardless of the
weighting.
5HWDLQ&WUO3DUDPV
5HWDLQ&WUO3DUDPV
3FUBJO$USM1BSBNT +HDW'HDG=RQH
&RRO'HDG=RQH
)FBU%FBE;POF
Dead zone with deactivated cooling or cooling factor (left) or activated cooling and PID
parameter switching (right). The x / horizontal axis displays the control deviation = setpoint -
process value. The y / vertical axis shows the output signal of the dead zone that is passed to
the PID algorithm.
1JE0VUQVU4VN 4FUQPJOU
$POH0VUQVU)FBU1JE-PXFS-JNJU 3FUBJO$USM1BSBNT
1JE0VUQVU4VN )FBU$POUSPM;POF
$POH0VUQVU$PPM1JE-PXFS-JNJU
4FUQPJOU
4FUQPJOU
3FUBJO$USM1BSBNT
)FBU$POUSPM;POF
1JE0VUQVU4VN
$POH0VUQVU)FBU1JE6QQFS-JNJU
PID control
166 Function Manual, 11/2023, A5E35300227-AG
Using PID_Temp
7.2 Configuring PID_Temp
1JE0VUQVU4VN
4FUQPJOU
$POH0VUQVU$PPM1JE-PXFS-JNJU
3FUBJO$USM1BSBNT
$PPM$POUSPM;POF
4FUQPJOU
4FUQPJOU
3FUBJO$USM1BSBNT
1JE0VUQVU4VN )FBU$POUSPM;POF
$POH0VUQVU)FBU1JE6QQFS-JNJU
PID control
Function Manual, 11/2023, A5E35300227-AG 167
Using PID_Temp
7.3 Commissioning PID_Temp
7.3.1 Commissioning
The commissioning window helps you commission the PID controller. You can monitor the
values for the setpoint, process value and the output values for heating and cooling along the
time axis in the trend view. The following functions are supported in the commissioning
window:
• Controller pretuning
• Controller fine tuning
Use fine tuning for fine adjustments to the PID parameters.
• Monitoring the current closed-loop control in the trend view
• Testing the controlled system by specifying a manual PID output value and a substitute
setpoint
• Saving the actual values of the PID parameters to an offline project.
All functions require an online connection to the CPU.
The online connection to the CPU is established, if it does not exist already, and operation of
the commissioning window is enabled by means of the "Monitor all" or "Start" buttons of
the trend view.
PID control
168 Function Manual, 11/2023, A5E35300227-AG
Using PID_Temp
7.3 Commissioning PID_Temp
7.3.2 Pretuning
The pretuning determines the process response to a jump change of the output value and
searches for the point of inflection. The tuned PID parameters are calculated as a function of
the maximum slope and dead time of the controlled system. You obtain the best PID
parameters when you perform pretuning and fine tuning.
The more stable the process value is, the easier it is to calculate the PID parameters and the
more precise the result will be. Noise on the process value can be tolerated as long as the rate
of rise of the process value is significantly higher compared to the noise. This is most likely
the case in operating modes "Inactive" or "Manual mode". The PID parameters are backed up
before being recalculated.
PID_Temp offers different pretuning types depending on the configuration:
• Pretuning heating
A jump is output at the output value heating, the PID parameters for heating are
calculated and then the setpoint is used as the control variable in automatic mode.
• Pretuning heating and cooling
A jump is output at the output value heating.
As soon as the process value is close to the setpoint, a jump change is output at the
output value cooling.
The PID parameters for heating (Retain.CtrlParams.Heat structure) and cooling
(Retain.CtrlParams.Cool structure) are calculated and then the setpoint is used as the
control variable in automatic mode.
• Pretuning cooling
A jump is output at the output value cooling.
The PID parameters for cooling are calculated and then the setpoint is used as the control
variable in automatic mode.
If you want to tune the PID parameters for heating and cooling, you can expect a better
control response with "Pretuning heating" followed by "Pretuning cooling" rather than with
"Pretuning heating and cooling". However, carrying out pretuning in two steps takes more
time.
General requirements
• The PID_Temp instruction is called in a cyclic interrupt OB.
• ManualEnable = FALSE
• Reset = FALSE
• PID_Temp is in one of the following modes: "Inactive", "Manual mode", or "Automatic
mode".
• The setpoint and the process value lie within the configured limits (see Process value
monitoring (Page 158) configuration).
PID control
Function Manual, 11/2023, A5E35300227-AG 169
Using PID_Temp
7.3 Commissioning PID_Temp
Procedure
To perform pretuning, follow these steps:
1. Double-click the "PID_Temp > Commissioning" entry in the project tree.
2. Activate the "Monitor all" button or start the trend view.
An online connection will be established.
3. Select the desired pretuning entry from the "Tuning mode" drop-down list.
4. Click the "Start" icon.
– Pretuning is started.
– The "Status" field displays the current steps and any errors that may have occurred. The
progress bar indicates the progress of the current step.
NOTE
Click the "Stop" icon when the progress bar ("Progress" tag) has not changed for a long
period and it is to be assumed that the tuning function is blocked. Check the
configuration of the technology object and, if necessary, restart controller tuning.
Result
If pretuning was performed without an error message, the PID parameters have been tuned.
PID_Temp switches to automatic mode and uses the tuned parameters. The tuned PID
parameters will be retained during power OFF and a restart of the CPU.
If pretuning is not possible, PID_Temp responds with the configured responses in the event of
an error.
PID control
170 Function Manual, 11/2023, A5E35300227-AG
Using PID_Temp
7.3 Commissioning PID_Temp
PID control
Function Manual, 11/2023, A5E35300227-AG 171
Using PID_Temp
7.3 Commissioning PID_Temp
General requirements
• The PID_Temp instruction is called in a cyclic interrupt OB.
• ManualEnable = FALSE
• Reset = FALSE
• The setpoint and the process value lie within the configured limits (see "Process value
settings" configuration).
• The control loop has stabilized at the operating point. The operating point is reached
when the process value corresponds to the setpoint.
When the dead zone is switched on, the result can be a permanent control deviation
(deviation between setpoint and actual value). This can have a negative effect on fine
tuning.
• No disturbances are expected.
• PID_Temp is in inactive mode, automatic mode or manual mode.
PID control
172 Function Manual, 11/2023, A5E35300227-AG
Using PID_Temp
7.3 Commissioning PID_Temp
PID control
Function Manual, 11/2023, A5E35300227-AG 173
Using PID_Temp
7.3 Commissioning PID_Temp
Procedure
To perform fine tuning, follow these steps:
1. Double-click the "PID_Temp > Commissioning" entry in the project tree.
2. Activate the "Monitor all" button or start the trend view.
An online connection will be established.
3. Select the desired fine tuning entry from the "Tuning mode" drop-down list.
4. If required (see tuning offset), specify a tuning offset and wait until the stationary state is
reached again.
5. Click the "Start" icon.
– The process of fine tuning is started.
– The "Status" field displays the current steps and any errors that may have occurred.
The progress bar indicates the progress of the current step.
NOTE
Click the "Stop" icon in the "Tuning mode" group if the progress bar ("Progress" tag) has
not changed for a long period and it is to be assumed that the tuning function is blocked.
Check the configuration of the technology object and, if necessary, restart controller
tuning.
In the following phases in particular, tuning is not aborted automatically if the setpoint
cannot be reached.
– "Attempting to reach setpoint for heating with two-point control."
– "Attempting to reach setpoint for cooling with two-point control."
Result
If fine tuning was performed without errors, the PID parameters have been tuned. PID_Temp
switches to automatic mode and uses the tuned parameters. The tuned PID parameters will
be retained during power OFF and a restart of the CPU.
If errors occurred during fine tuning, PID_Temp responds with the configured response to
errors.
PID control
174 Function Manual, 11/2023, A5E35300227-AG
Using PID_Temp
7.3 Commissioning PID_Temp
Requirement
• The "PID_Temp" instruction is called in a cyclic interrupt OB.
• An online connection to the CPU has been established.
• The CPU is in "RUN" mode.
Procedure
If you want to test the controlled system by specifying a manual value, use "Manual mode" in
the commissioning window.
To define a manual value, follow these steps:
1. Double-click the "PID_Temp > Commissioning" entry in the project tree.
2. Activate the "Monitor all" button or start the trend view.
An online connection will be established.
3. Select the "Manual mode" check box in the "Online status of controller" area.
PID_Temp operates in manual mode. The most recent current output value remains in
effect.
4. Enter the manual value in the editable field as a % value.
If cooling is activated in the basic settings, enter the manual value as follows:
– Enter a positive manual value to output the value at the outputs for heating.
– Enter a negative manual value to output the value at the outputs for cooling.
5. Click the icon.
Result
The manual value is written to the CPU and immediately goes into effect.
Clear the "Manual mode" check box if the output value is to be specified again by the PID
controller.
The switchover to automatic mode is bumpless.
PID control
Function Manual, 11/2023, A5E35300227-AG 175
Using PID_Temp
7.3 Commissioning PID_Temp
Requirement
• The "PID_Temp" instruction is called in a cyclic interrupt OB.
• An online connection to the CPU has been established.
• The CPU is in "RUN" mode.
Procedure
If you want to use a different value as the setpoint than that specified at the "Setpoint"
parameter (for example to tune a slave in a cascade), use the substitute setpoint in the
commissioning window.
Proceed as follows to specify a substitute setpoint:
1. Double-click the "PID_Temp > Commissioning" entry in the project tree.
2. Activate the "Monitor all" button or start the trend view.
An online connection will be established.
3. Select the "Subst.Setpoint" check box in the "Online status of controller" section.
The substitute setpoint (SubstituteSetpoint tag) is initialized with the most recently
updated setpoint and now used.
4. Enter the substitute setpoint in the editable field.
5. Click the icon.
Result
The substitute setpoint is written to the CPU and immediately goes into effect.
Clear the "Subst.Setpoint" check box if the value at the "Setpoint" parameter is to be used
again as setpoint.
The switchover is not bumpless.
PID control
176 Function Manual, 11/2023, A5E35300227-AG
Using PID_Temp
7.4 Cascade control with PID_Temp
7.4.1 Introduction
In cascade control, several control loops are nested within each other. In the process, slaves
receive their setpoint (Setpoint) from the output value (OutputHeat) of the respective higher-
level master.
A prerequisite for establishing a cascade control system is that the controlled system can be
divided into subsystems, each with its own measured variable.
Setpoint specification for the controlled variable is carried out at the outmost master.
The output value of the innermost slave is applied to the actuator and thus acts on the
controlled system.
The following major advantages result from the use of a cascade control system in
comparison with a single-loop control system:
• Thanks to the additional subordinate control loops, disturbances which occur there are
corrected quickly. Their influence on the controlled variable is reduced considerably. The
disturbance behavior is thus improved.
• The subordinate control loops act in linearizing form. The negative effects of such non-
linearities on the controlled variable are thus moderated.
PID_Temp offers the following functionality especially for use in cascade control systems:
• Specification of a substitute setpoint
• Exchange of status information between master and slave (for example, current operating
mode)
• Different Anti-Wind-Up modes (response of the master to limitation of its slave)
PID control
Function Manual, 11/2023, A5E35300227-AG 177
Using PID_Temp
7.4 Cascade control with PID_Temp
Example
The following block diagram shows a cascade control system with PID_Temp using the
simplified example of a chocolate melting unit:
5FNQ$IPDPMBUF
5FNQ8BUFS
1*%@5FNQ@ 1*%@5FNQ@
1*%@5FNQ@ 8BUFS
.BTUFS .BTUFS
4MBWF
4MBWF 4MBWF
The PID_Temp_1 master compares the process value of the chocolate temperature
(TempChocolate) with the setpoint specification by the user at the Setpoint parameter. Its
output value OutputHeat forms the setpoint of the slave PID_Temp_2.
PID_Temp_2 attempts to regulate the process value of the water-bath temperature
(TempWater) to this setpoint. The output value of PID_Temp_2 acts directly on the actuator of
the controlled system (heating of the water bath) and thus influences the water-bath
temperature. The water-bath temperature in turn has an effect on the chocolate
temperature.
FAQ
For more information, see the following FAQs in the Siemens Industry Online Support:
• Entry ID 103526819 (https://support.industry.siemens.com/cs/ww/en/view/103526819)
See also
Program creation (Page 179)
PID control
178 Function Manual, 11/2023, A5E35300227-AG
Using PID_Temp
7.4 Cascade control with PID_Temp
PID control
Function Manual, 11/2023, A5E35300227-AG 179
Using PID_Temp
7.4 Cascade control with PID_Temp
See also
PID_Temp ActivateRecoverMode tag (Page 392)
7.4.3 Configuration
You can carry out the configuration via your user program, the configuration editor or the
Inspector window of the PID_Temp call.
When using PID_Temp in a cascade control system, ensure the correct configuration of the
settings specified below.
If a PID_Temp instance receives its setpoint from a superior master controller and outputs its
output value in turn to a subordinate slave controller, this PID_Temp instance is both a master
controller and a slave controller simultaneously. Both configurations listed below have to be
carried out for such a PID_Temp instance. This is the case, for example, for the middle
PID_Temp instance in a cascade control system with three concatenated measured variables
and three PID_Temp instances.
Configuration of a master
PID control
180 Function Manual, 11/2023, A5E35300227-AG
Using PID_Temp
7.4 Cascade control with PID_Temp
Configuration of a slave
7.4.4 Commissioning
After compiling and loading of the program, you can start commissioning of the cascade
control system.
Begin with the innermost slave at commissioning (implementation of tuning or change to
automatic mode with existing PID parameters) and continue outwards until the outermost
master has been reached.
In the above example, commissioning starts with PID_Temp_2 and is continued with
PID_Temp_1.
PID control
Function Manual, 11/2023, A5E35300227-AG 181
Using PID_Temp
7.4 Cascade control with PID_Temp
If pretuning or fine tuning is started for a master, PID_Temp aborts tuning in the following
cases and displays an error with ErrorBits = DW#16#0200000:
• One or more slaves are not in automatic mode (AllSlaveAutomaticState = FALSE)
• One or more slaves have activated the substitute setpoint (NoSlaveSubstituteSetpoint =
FALSE).
The subsequent operating mode changeover depends on ActivateRecoverMode.
PID control
182 Function Manual, 11/2023, A5E35300227-AG
Using PID_Temp
7.5 Multi-zone controlling with PID_Temp
Introduction
In a multi-zone control system, several sections, so-called zones, of a plant are controlled
simultaneously to different temperatures. A multi-zone control system is characterized by the
mutual influence of the temperature zones through thermal coupling, i.e. the process value
of one zone can influence the process value of a different zone through thermal coupling.
The strength that this influence has depends on the structure of the plant and the selected
operating points of the zones.
Example: Extrusion plant as it is used, for example, in plastics processing.
The substance mixture that passes through the extruder has to be controlled to different
temperatures for optimal processing. For example, different temperatures can be required at
the filling point of the extruder than at the outlet nozzle. The individual temperature zones
mutually influence each other through thermal coupling.
When PID_Temp is used in multi-zone control systems, each temperature zone is controlled
by a separate PID_Temp instance.
Observe the following explanations if you want to use the PID_Temp in a multi-zone control
system.
PID control
Function Manual, 11/2023, A5E35300227-AG 183
Using PID_Temp
7.5 Multi-zone controlling with PID_Temp
Procedure
You can proceed as follows during the commissioning of multi-zone control systems with
relevant thermal couplings:
1. Set DisableCooling = TRUE for all controllers with activated cooling.
2. Set PIDSelfTune.SUT.AdaptDelayTime = 0 for all controllers.
3. Specify the desired setpoints (Setpoint parameter) and start pretuning for heating (Mode
= 1, Heat.EnableTuning = TRUE, Cool.EnableTuning = FALSE) simultaneously for all
controllers.
4. Wait until all the controllers have completed pretuning for heating.
5. Set DisableCooling = FALSE for all controllers with activated cooling.
PID control
184 Function Manual, 11/2023, A5E35300227-AG
Using PID_Temp
7.5 Multi-zone controlling with PID_Temp
6. Wait until the process values of all the zones are steady and close to the respective
setpoint.
If the setpoint cannot be reached permanently for a zone, the heating or cooling actuator
is too weak.
7. Start pretuning for cooling (Mode = 1, Heat.EnableTuning = FALSE, Cool.EnableTuning =
TRUE) for all controllers with activated cooling.
NOTE
Limit violation of the process value
If the cooling is deactivated in automatic mode with DisableCooling = TRUE, this can cause
the process value to exceed the setpoint and the process value limits while DisableCooling =
TRUE. Observe the process values and intervene, if appropriate, if you use DisableCooling.
NOTE
Multi-zone control systems
For multi-zone control systems, the thermal couplings between the zones can result in
increased overshoots, permanent or temporary violation of limits and permanent or
temporary control deviations during commissioning or operation. Observe the process values
and be ready to intervene. Depending on the system, it can be necessary to deviate from the
procedure described above.
Procedure
This ensures that all the controllers have reached their setpoint when the actual tuning steps
start. This reduces mutual influencing through thermal coupling between the zones during
tuning.
Proceed as follows for controllers for whose zones you want to carry out fine tuning
simultaneously:
1. Set PIDSelfTune.TIR.WaitForControlIn = TRUE for all controllers.
These controllers have to be in automatic mode with PIDSelfTune.TIR.RunIn = FALSE.
2. Specify the desired setpoints (Setpoint parameters) and start fine tuning for all controllers.
3. Wait until PIDSelfTune.TIR.ControlInReady = TRUE at all controllers.
4. Set PIDSelfTune.TIR.FinishControlIn = TRUE for all controllers.
All controllers then start the actual tuning simultaneously.
PID control
Function Manual, 11/2023, A5E35300227-AG 185
Using PID_Temp
7.6 Override control with PID_Temp
Override control
In case of override control, two or more controllers share one actuator. Only one controller
has access to the actuator at any time and influences the process.
A logic operation decides which controller has access to the actuator. This decision is often
made based on a comparison of the output values of all controllers, for example, in case of a
maximum selection, the controller with the largest output value gets access to the actuator.
The selection based on the output value requires that all controllers operate in automatic
mode. The controllers that do not have an effect on the actuator are updated. This is
necessary to prevent windup effects and their negative impacts on the control response and
the switchover between the controllers.
PID_Temp supports override controls as of version 1.1 by offering a simple process for
updating the controllers that are not active: By using the tags OverwriteInitialOutputValue
and PIDCtrl.PIDInit, you can pre-assign the integral action of the controller in automatic mode
as though the PID algorithm had calculated PidOutputSum = OverwriteInititalOutputValue for
the PID output value in the last cycle. To do this, OverwriteInitialOutputValue is
interconnected with the PID output value of the controller that currently has access to the
actuator. By setting the bit PIDCtrl.PIDInit, you trigger the preassignment of the integral
action as well as the restart of the controller cycle and the PWM period. The subsequent
calculation of the PID output value in the current cycle takes place based on the preassigned
(and synchronized for all controllers) integral action as well as the proportional action and
integral action from the current control deviation. The derivative action is not active during
the call with PIDCtrl.PIDInit = TRUE and therefore does not contribute to the output value.
This procedure ensures that the calculation of the current PID output value and thus the
decision on which controller is to have access to the actuator is only based on the current
process state and the PI parameters. Windup effects for controllers that are not active and
thus incorrect decisions of the switchover logic are prevented.
PID control
186 Function Manual, 11/2023, A5E35300227-AG
Using PID_Temp
7.6 Override control with PID_Temp
Requirement
• PIDCtrl.PIDInit is only effective if the integral action is activated (tags
Retain.CtrlParams.Heat.Ti and Retain.CtrlParams.Cool.Ti > 0.0).
• You must assign PIDCtrl.PIDInit and OverwriteInitialOutputValue in your user program
yourself (see example below). PID_Temp does not automatically change these tags.
• PIDCtrl.PIDInit is only effective when PID_Temp is in automatic mode (parameter State =
3).
• If possible, select the sampling time of the PID algorithm ( Retain.CtrlParams.Heat.Cycle
and Retain.CtrlParams.Cool.Cycle tags) so that it is identical for all controllers, and call all
controllers in the same cyclic interrupt OB. In this way, you ensure that the switchover
does not take place within a controller cycle or a PWM period.
NOTE
Constant adaptation of the output value limits
Instead of the active updating of the controllers without access to the actuator described
here, this is implemented alternatively by constant adaptation of the output value limits in
other controller systems.
This is not possible with PID_Temp, because a change of the output value limits is not
supported in automatic mode.
*OQVU
1*%@5FNQ@
*OQVU
1*%@5FNQ@
PID control
Function Manual, 11/2023, A5E35300227-AG 187
Using PID_Temp
7.6 Override control with PID_Temp
The heater is controlled with the pulse-width modulated output value of PID_Temp
(parameter OutputHeat_PWM) by writing the program tag ActuatorInput. The setpoint for the
temperature Input1 is specified at the parameter PID_Temp_1.Setpoint. The temperature high
limit for the additional measuring point is specified as setpoint at the parameter
PID_Temp_2.Setpoint.
*OQVU
1*%@5FNQ@
*OQVU 0VUQVU)FBU@18.
"DUVBUPS*OQVU
4FUQPJOU 1JE0VUQVU4VN
1*%$USM1*%*OJU
0WFSXSJUF*OJUJBM
0VUQVU7BMVF
1*%@5FNQ@
*OQVU 0VUQVU)FBU@18.
4FUQPJOU 1JE0VUQVU4VN
1*%$USM1*%*OJU
0WFSXSJUF*OJUJBM
0VUQVU7BMVF
*OQVU
Both controllers must share one heater as shared actuator. The logic that decides which
controller gets access to the actuator is implemented by a minimum selection of the PID
output value (in Real format, parameter PidOutputSum) in this case. Because the PID output
value corresponds to the heating power, the controller that requires lower heating power
gets the control.
In normal operation of the plant, the process value of the main controlled variable
corresponds to the setpoint. The main controller PID_Temp_1 has settled on a stationary PID
output value PID_Temp_1.PidOutputSum. The process value of the limiting controller Input2
in normal operation is significantly below the high limit that is specified as setpoint for
PID_Temp_2. The limiting controller therefore wants to increase the heating power to
increase its process value, which means it will calculate a PID output value
PID_Temp_2.PidOutputSum that is greater than the output value of the main controller
PID_Temp_1.PidOutputSum. The minimum selection of the switchover logic therefore gives
the main controller PID_Temp_1 continued access to the actuator. In addition, it is ensured
that PID_Temp_2 is updated by means of the assignments
PID_Temp_2.OverwriteInitialOutputValue = PID_Temp_1.PidOutputSum and
PID_Temp_2.PIDCtrl.PIDInit = TRUE.
If Input2 now approaches the high limit or exceeds it, for example due to a fault, the limiting
controller PID_Temp_2 calculates a smaller PID output value to restrict the heating power and
thus reduce Input2. If PID_Temp_2.PidOutputSum is smaller than
PID_Temp_1.PidOutputSum, the limiting controller PID_Temp_2 receives access to the
actuator through the minimum selection and reduces the heating power. It is ensured that
PID_Temp_1 is updated by means of the assignments
PID_Temp_1.OverwriteInitialOutputValue = PID_Temp_2.PidOutputSum and
PID_Temp_1.PIDCtrl.PIDInit = TRUE.
The temperature at the additional measuring point Input2 drops. The temperature of the
main controlled variable Input1 drops as well and cannot be held at the setpoint any longer.
PID control
188 Function Manual, 11/2023, A5E35300227-AG
Using PID_Temp
7.7 Simulating PID_Temp with PLCSIM
Once the fault has been remedied, the Input2 will continue to drop and the heating power is
further increased by the limiting controller. As soon as the main controller has calculated a
lower heating power as output value, the plant returns to normal operation so that the main
controller PID_Temp_1 once again has access to the actuator. This example can be
implemented with the following SCL program code:
"PID_Temp_1"(Input := "Input1");
"PID_Temp_2"(Input := "Input2");
IF "PID_Temp_1".PidOutputSum <= "PID_Temp_2".PidOutputSum THEN
"ActuatorInput" := "PID_Temp_1".OutputHeat_PWM;
"PID_Temp_1".PIDCtrl.PIDInit := FALSE;
"PID_Temp_2".PIDCtrl.PIDInit := TRUE;
"PID_Temp_2".OverwriteInitialOutputValue := "PID_Temp_1".PidOutputSum;
ELSE
"ActuatorInput" := "PID_Temp_2".OutputHeat_PWM;
"PID_Temp_1".PIDCtrl.PIDInit := TRUE;
"PID_Temp_2".PIDCtrl.PIDInit := FALSE;
"PID_Temp_1".OverwriteInitialOutputValue := "PID_Temp_2".PidOutputSum;
END_IF;
NOTE
Simulation with PLCSIM
The simulation of PID_Temp with PLCSIM for CPU S7-1200 is not supported.
PID_TEMP can be simulated only for CPU S7-1500 with PLCSIM.
For the simulation with PLCSIM, the time behavior of the simulated PLC is not exactly
identical to that of a "real" PLC. The actual cycle clock of a cyclic interrupt OB can have larger
fluctuations with a simulated PLC than with "real" PLCs.
In the standard configuration, PID_Temp determines the time between calls automatically
and monitors them for fluctuations.
For the simulation of PID_Temp with PLCSIM, for example, a sampling time error (ErrorBits =
DW#16#00000800) can therefore be detected.
This results in ongoing tuning being aborted.
The response in automatic mode depends on the value of the ActivateRecoverMode tag.
To prevent this from happening, you should configure PID_Temp for simulation with PLCSIM
as follows:
• CycleTime.EnEstimation = FALSE
• CycleTime.EnMonitoring = FALSE
• CycleTime.Value: Assign the cycle clock of the calling cyclic interrupt OB in seconds to this
tag.
PID control
Function Manual, 11/2023, A5E35300227-AG 189
Using PID basic functions 8
8.1 CONT_C
PID control
190 Function Manual, 11/2023, A5E35300227-AG
Using PID basic functions
8.1 CONT_C
Control deviation
Set a dead zone range under the following requirement:
• The process value signal is noisy.
• The controller gain is high.
• The derivative action is activated.
The noise component of the process value causes strong deviations of the output value in this
case. The dead zone suppresses the noise component in the steady controller state. The dead
zone range specifies the size of the dead zone. With a dead zone range of 0.0, the dead zone
is turned off.
See also
How CONT_C works (Page 399)
General
To determine which components of the control algorithm are activated, proceed as follows:
1. Select an entry from the "Controller structure" list.
You can only specify required parameters for the selected controller structure.
Proportional action
1. If the controller structure contains a proportional action, enter the "proportional gain".
Integral action
1. If the controller structure contains an integral action, enter the integral action time.
2. To give the integral action an initialization value, select the check box "Initialize integral
action" and enter the initialization value.
3. In order to permanently set the integral action to this initialization value, select the
"Integral action hold" check box.
Derivative action
1. If the controller structure contains a derivative action, enter the derivative action time, the
derivative action weighting and the delay time.
PID control
Function Manual, 11/2023, A5E35300227-AG 191
Using PID basic functions
8.1 CONT_C
See also
How CONT_C works (Page 399)
General
You can set CONT_C in the manual or automatic mode.
1. To set a manual manipulated value, activate the option "Activate manual mode" option
check box.
You can specify a manual manipulated value on the input parameter MAN.
Scaling
The manipulated value can be scaled for output as a floating point and periphery value
through a factor and an offset according to the following formula.
Scaled manipulated value = manipulated value x factor + offset
Default is a factor of 1.0 and an offset of 0.0.
1. Enter a value for the factor and offset.
See also
How CONT_C works (Page 399)
PID control
192 Function Manual, 11/2023, A5E35300227-AG
Using PID basic functions
8.1 CONT_C
$0/5@$ 16-4&(&/
17@1&3
'LVWDQFHZLWK
VZLWFKLQJRXWSXW
The continuous controller CONT_C forms the output value LMN that is converted by the pulse
shaper PULSEGEN into pulse/break signals QPOS_P or QNEG_P.
See also
PULSEGEN (Page 408)
Requirements
• The instruction and the technology object have been loaded to the CPU.
Procedure
To manually determine the optimal PID parameters, proceed as follows:
1. Click the "Start" icon.
If there is no online connection, this will be established. The current values for the
setpoint, process value and output value are recorded.
2. Enter new PID parameters in the "P", "I", "D" and "Delay time" fields.
3. Click on the icon "Send parameter to CPU" in the "Tuning" group.
4. Select the "Change setpoint" check box in the "Current values" group.
5. Enter a new setpoint and click the icon in the "Current values" group.
6. Clear the "Manual mode" check box.
The controller works with the new PID parameters and controls the new setpoint.
7. Check the quality of the PID parameter to check the curve points.
8. Repeat steps 2 to 6 until you are satisfied with the controller results.
PID control
Function Manual, 11/2023, A5E35300227-AG 193
Using PID basic functions
8.2 CONT_S
8.2 CONT_S
PID control
194 Function Manual, 11/2023, A5E35300227-AG
Using PID basic functions
8.2 CONT_S
Control deviation
Set a deadband range under the following requirement:
• The process value signal is noisy.
• The controller gain is high.
• The derivative action is activated.
The noise component of the process value causes strong deviations of the manipulated
variable in this case. The deadband suppresses the noise component in the steady controller
state. The deadband range specifies the size of the deadband. With a deadband range of 0.0,
the deadband is turned off.
See also
Mode of operation CONT_S (Page 403)
PID algorithm
1. Enter the "proportional amplification" for the P-component.
2. Enter the integration time for the time behavior of the I-component.
With an integration time of 0.0, the I-component is switched off.
See also
Mode of operation CONT_S (Page 403)
General
You can set CONT_S in the manual or automatic mode.
1. To set a manual manipulated value, activate the "Activate manual mode" option check
box.
Enter a manual manipulated value for the input parameters LMNUP and LMNDN.
Pulse generator
1. Enter the minimum impulse duration and minimum pause duration.
The values must be greater than or equal to the cycle time for the input parameter CYCLE.
The frequency of operation is reduced through this.
2. Enter the motor setting time.
The value must be greater than or equal to the cycle time of the input parameter CYCLE.
PID control
Function Manual, 11/2023, A5E35300227-AG 195
Using PID basic functions
8.2 CONT_S
See also
Mode of operation CONT_S (Page 403)
Requirements
• The instruction and the technology object have been loaded to the CPU.
Procedure
To manually determine the optimal PID parameters, proceed as follows:
1. Click the "Start" icon.
If there is no online connection, this will be established. The current values for the
setpoint, process value and output value are recorded.
2. In the fields "P" and "I", enter a new proportional value and a new integration time.
3. Click on the icon "Send parameter to CPU" in the "Tuning" group.
4. Select the "Change setpoint" check box in the "Current values" group.
5. Enter a new setpoint and click the icon in the "Current values" group.
6. Clear the "Manual mode" check box.
The controller works with the new parameters and controls the new setpoint.
7. Check the quality of the PID parameter to check the curve points.
8. Repeat steps 2 to 6 until you are satisfied with the controller results.
PID control
196 Function Manual, 11/2023, A5E35300227-AG
Using PID basic functions
8.3 TCONT_CP
8.3 TCONT_CP
PID control
Function Manual, 11/2023, A5E35300227-AG 197
Using PID basic functions
8.3 TCONT_CP
Control deviation
Set a deadband range under the following requirement:
• The process value signal is noisy.
• The controller gain is high.
• The derivative action is activated.
The noise component of the process value causes strong deviations of the manipulated
variable in this case. The deadband suppresses the noise component in the steady controller
state. The deadband range specifies the size of the deadband. With a deadband range of 0.0,
the deadband is turned off.
See also
Mode of operation TCONT_CP (Page 417)
General
1. Enter the "Sampling time PID algorithm".
A controller sampling time should not exceed 10 % of the determined integratl action time
of the controller (TI).
2. If the controller structure contains a proportional action, enter the "proportional gain".
A negative proportional gain inverts the rule meaning.
Proportional action
For changes of the setpoint, it may lead to overshooting of the proportional action. Through
the weighting of the proportional action, you can select how strongly the proportional action
should react when setpoint changes are made. The weakening of the proportional action is
reached through a compensation of the integral action.
1. To weaken the proportional action for setpoint changes, enter a "Proportional action
weighting".
– 1.0: Proportional action for setpoint change is fully effective
– 0.0: Proportional action for setpoint change is not effective
Integral action
With a limitation of the manipulated value, the integral action is stopped. With a control
deviation that moves the integral action in the direction of an internal setting range, the
integral action is released again.
1. If the controller structure contains an integral action, enter the "integral action time".
With an integral action time of 0.0, the integral action is switched off.
2. To give the integral action an initialization value, select the "Initialize integral action"
check box and enter the "Initialization value".
Upon restart or COM_RST = TRUE, the integral action is set to this value.
PID control
198 Function Manual, 11/2023, A5E35300227-AG
Using PID basic functions
8.3 TCONT_CP
Derivative action
1. If the controller structure contains a derivative action, enter the derivative action time (TD)
and the coefficients DT1 (D_F).
With switched derivative action, the following equation should be maintained:
TD = 0.5 × CYCLE× D_F.
The delay time is calculated from this according to the formula:
delay time = TD/D_F
Control zone
The control zone limits the value range of the control deviation. If the control deviation is
outside of this value range, the manipulated value limits are used.
With an occurrence in the control zone, the derivative action leads to a very quick reduction
of the manipulated variable. Thus, the control zone only makes sense for switched on
derivative actions. Without control zone, only the reducing proportional action would reduce
the manipulated value. The control zone leads to a quick oscillation without over/under
shooting if the emitted minimum or maximum manipulated values are removed from the
manipulated value required for the new operating point.
1. Activate the "Activate" check box in the "control zone" group.
2. Enter a setpoint value in the "Width" input field from which the process value may deviate
above or below.
See also
Mode of operation TCONT_CP (Page 417)
PID control
Function Manual, 11/2023, A5E35300227-AG 199
Using PID basic functions
8.3 TCONT_CP
Scaling
The manipulated value can be scaled for output as a floating point and periphery value
through a factor and an offset according to the following formula.
Scaled manipulated value = manipulated value x factor + offset
Default is a factor of 1.0 and an offset of 0.0.
1. Enter a value for the factor and offset.
Pulse generator
The pulse generator must be turned on for a continual controller.
1. Disable the "Activate" option check box in the "Pulse generator" group.
See also
Mode of operation TCONT_CP (Page 417)
PID control
200 Function Manual, 11/2023, A5E35300227-AG
Using PID basic functions
8.3 TCONT_CP
Pulse generator
The analog manipulated value (LmnN) can be emitted through pulse-duration modulation on
the output parameter QPULSE as an impulse sequence.
To use the pulse generator, proceed as follows:
1. Activate the "Activate" option check box in the "pulse generator" group.
2. Enter the "sampling time pulse generator", the "minimum impulse/break duration" and the
"period duration".
The following graphics clarify the connection between the "sampling pulse generator"
(CYCLE_P), the "minimum impulse/break duration" (P_B_TM) and the "period duration"
(PER_TM):
-NO/
U
216-4&
U
$:$-&@1
1&3@5.
1@#@5. 1@#@5.
PID control
Function Manual, 11/2023, A5E35300227-AG 201
Using PID basic functions
8.3 TCONT_CP
Period duration
The period duration should not exceed 20% of the determined integration time of the
controller (TI):
PER_TM ≤ TI/5
Example for the effect of the parameter CYCLE_P, CYCLE and PER_TM:
Period duration PER_TM = 10 s
Sampling time PID-algorithm CYCLE = 1 s
Sampling time pulse generator CYCLE_P = 100 ms.
Every second, a new manipulated value, every 100 ms the comparison of the manipulated
value occurs with the previously emitted impulse length and break length.
• If an impulse is emitted, there are 2 possibilities:
– The calculated manipulated value is larger than the previous impulse length/PER_TM.
Then the impulse is extended.
– The calculated manipulated value is less than or equal to the previous impulse
length/PER_TM. Then no impulse signal will be emitted.
• If no impulse is emitted, there are also 2 possibilities:
– The value (100 % - calculated manipulated value) is greater than the previous break
length / PER_TM. Then the break is extended.
– The value (100 % - calculated manipulated value) is less than or equal to the previous
break length / PER_TM. Then an impulse signal will be emitted.
See also
Mode of operation TCONT_CP (Page 417)
Operating principle of the pulse generator (Page 426)
PID control
202 Function Manual, 11/2023, A5E35300227-AG
Using PID basic functions
8.3 TCONT_CP
Application possibilities
The controller optimization for heating or cooling processes from process type I is applicable.
But you can use the block for processes with higher levels like process type II or III.
The PI/PID parameters are automatically determined and set. The controller draft is designed
for an optimal disruption behavior The "precise" parameters resulting from this lead to
overshooting of 10% to 40% of the jump height for setpoint jump heights.
PHASE = 0
No tuning is running. TCONT_CP works in automatic or manual mode.
During PHASE = 0, you can make sure that the controlled system fulfills the requirements for
an optimization.
At the end of the optimization, TCONT_CP changes back into PHASE = 0.
PHASE = 1
TCONT_CP is prepared for optimization. PHASE = 1 may only be started if the requirements
for an optimization are fulfilled.
During PHASE = 1, the following values are determined:
• Process value noise NOISE_PV
• Initial slope PVDT0
• Average of the manipulated variable
• Sampling time PID algorithm CYCLE
• Sampling time pulse generator CYCLE_P
PID control
Function Manual, 11/2023, A5E35300227-AG 203
Using PID basic functions
8.3 TCONT_CP
PHASE = 2
In phase 2, the process value attempts to detect the point of inflection with a constant
manipulated variable. This method prevents the point of inflection from being found too
early as a result of process variable noise.
With the pulse controller, the process variable is averaged over N pulse cycles and then made
available to the controller stage. There is a further averaging of the process variable in the
controller stage: Initially, this averaging is inactive; in other words, averaging always takes
place over 1 cycle. As long as the noise exceeds a certain level, the number of cycles is
doubled.
The period and amplitude of the noise are calculated. The search for the point of inflection is
canceled and phase 2 is exited only when the gradient is always smaller than the maximum
rise during the estimated period. TU and T_P_INF are, however, calculated at the actual point
of inflection.
Tuning, however, is only ended when the following two conditions are met:
1. The process value is more than 2*NOISE_PV away from the point of inflection.
2. The process value has exceeded the point of inflection by 20%.
NOTE
When exciting the process using a setpoint step change, tuning is ended at the latest
when the process value exceeds 75% of the setpoint step change (SP_INT-PV0) (see
below).
PHASE = 3, 4, 5
The phases 3, 4 and 5 last 1 cycle each.
In Phase 3, the valid PI/PID parameters are saved before the optimization and the process
parameter is calculated.
In Phase 4, the new PI/PID parameters are calculated.
In Phase 5, the new manipulated variable is calculated and the controlled system is given.
PHASE = 7
The process type is inspected in Phase 7, because TCONT_CP always changes to automatic
mode after optimization. The automatic mode starts with LMN = LMN0 + 0.75*TUN_DLMN as
a manipulated variable. The testing of the process type occurs in the automatic mode with
the recently recalculated controller parameters and ends at the latest 0.35*TA (equilibrium
time) after the point of inflection. If the process order deviates strongly from the estimated
value, the controller parameters are newly calculated and STATUS_D is counted up by 1,
otherwise, the controller parameters remain unchanged.
Then the optimization mode is complete and TCONT_CP is back in PHASE = 0. At the
STATUS_H parameter, you can identify whether the tuning was successfully completed.
PID control
204 Function Manual, 11/2023, A5E35300227-AG
Using PID basic functions
8.3 TCONT_CP
Transient response
The process must have a stable, asymptotic transient response with time lag.
The process value must settle to steady state after a step change of the manipulated variable.
This therefore excludes processes that already show an oscillating response without control,
as well as processes with no recovery (integrator in the control system).
WARNING
This may result in death, severe injury or considerable property damage.
During an tuning, the parameter MAN_ON is ineffective. Through this, the output value or
process value may take on undesired - even extreme - values.
The output value is defined through the tuning. To cancel the tuning, you first have to set
TUN_ON = FALSE. This makes MAN_ON effective again.
NOTE
Avoid changing the manipulated variable shortly before starting the tuning. A change of the
manipulated variable can occur in an unintended manner through the establishment of the
test conditions (for example, closing an oven door)! If this does happen, you have to at least
wait until the process value has an asymptotic transient oscillation in a stationary state again.
Better controller parameters can be reached if you wait until the transient effect has
completely subsided.
PID control
Function Manual, 11/2023, A5E35300227-AG 205
Using PID basic functions
8.3 TCONT_CP
In the following image, the transient oscillation is illustrated in the stationary state:
17
3URFHVVYDOXH
3+$6( 3+$6(
6WLOOSHUPLVVLEOH 6WDELOL]HGVWDWLRQDU\
,PSHUPLVVLEOH TXDVLVWDWLRQDU\VWDWH VWDWHLVEHWWHU
TXDVLVWDWLRQDU\VWDWH
17
0DQLSXODWHGYDULDEOH
-./
0DQLSXODWHGYDULDEOHSXOVH
-./
PID control
206 Function Manual, 11/2023, A5E35300227-AG
Using PID basic functions
8.3 TCONT_CP
Pretuning
During this tuning, the working point is approached from the cold state through a setpoint
jump.
With TUN_ON = TRUE, you can establish the tuning readiness. The controller switches from
PHASE = 0 to PHASE = 1.
1)"4& 1)"4& 1)"4& 1)"4& 1)"4&
p$ 41
-./
8BSNQSPDFTT
TUBUF PQFSBUJOH
QPJOU
17
56/@%-./
1PJOUPG -./
JOFDUJPO
$PME1SPDFTT
TUBUF
U
56/@0/
PID control
Function Manual, 11/2023, A5E35300227-AG 207
Using PID basic functions
8.3 TCONT_CP
Remedy: Reduce the setpoint value during the inflection point search.
NOTE
If processes are extremely sluggish, it is advisable during tuning to specify a target setpoint
that is somewhat lower than the desired operating point and to monitor the status bits and
PV closely (risk of overshooting).
Tuning only in the linear range:
The signals of certain processes (e.g., zinc or magnesium smelters) will pass a non-linear area
at the approach of the operating range (change in the state of aggregation).
By selecting a suitable setpoint step change, tuning can be limited to the linear range. When
the process value has passed 75% of the setpoint step change (SP_INT-PV0), tuning is ended.
At the same time, TUN_DLMN should be reduced to the extent that the point of inflection is
guaranteed to be found before 75% of the setpoint step change is reached.
Fine tuning
During this tuning, the process with a constant setpoint is activated through a output value
jump.
1)"4& 1)"4& 1)" 1)"4& 1)"4&
p$ 4&
-./
17
1PJOUPG 0QFSBUJOHQPJOUBDUVBMWBMVF
JOFDUJPO
41
-./ 0QFSBUJOHQPJOUNBOJQVMBUFE
56/@%-./ WBSJBCMF
JTBVUPNBUJDBMMZ U
56/@0/ SFTFU
U
56/@45
The tuning manipulated variable (LMN0 + TUN_DLMN) is activated by setting the start bit
TUN_ST (transition from phase 1 -> 2). When you modify the setpoint value, the new value
will not take effect until the point of inflection has been reached (automatic mode will not be
enabled until this point has been reached).
The user is responsible for defining the output excitation delta (TUN_DLMN) according to the
permitted process value change. The sign of TUN_DLMN must be set depending on the
PID control
208 Function Manual, 11/2023, A5E35300227-AG
Using PID basic functions
8.3 TCONT_CP
intended process value change (take into account the direction in which the control is
operating).
NOTICE
Safety off at 75% is not available when you excite the process via TUN_ST. Tuning is ended
when the point of inflection is reached. However, in noisy processes the point of inflection
may be significantly exceeded.
STATUS_H Result
0 Default or new controller parameters have not yet been found.
10000 Suitable control parameters found.
2xxxx Control parameters have been found via estimated values; check the control
response or check the STATUS_H diagnostic message and repeat controller tun
ing.
3xxxx An operator error has occurred; check the STATUS_H diagnostic message and
repeat controller tuning.
The CYCLE and CYCLE_P sampling times were already checked in phase 1.
The following controller parameters are updated on TCONT_CP:
• P (proportional GAIN)
• I (integration time TI)
• D (derivative time TD)
• Weighting of the proportional action PFAC_SP
• Coefficient DT1 (D_F)
• Control zone on/off CONZ_ON
• Control zone width CON_ZONE
The control zone is only activated if the process type is suitable (process type I and II) and a
PID controller is used (CONZ_ON = TRUE).
Depending on PID_ON, control is implemented either with a PI or a PID controller. The old
controller parameters are saved and can be retrieved with UNDO_PAR. A PI parameter record
and a PID parameter record are saved additionally in the PI_CON and PID_CON structures.
Using LOAD_PID and making a suitable setting for PID_ON, it is also possible to switch later
between the tuned PI or PID parameters.
PID control
Function Manual, 11/2023, A5E35300227-AG 209
Using PID basic functions
8.3 TCONT_CP
5$0/5@$1 %#@5$0/5@$1
56/@,&&1
256/@36/
ࣨ
5$0/5@$1 %#@5$0/5@$1
56/@,&&1
256/@36/
Advantage:
Both controllers output LMN0 + TUN_DLMN until both controllers have left phase 2. This
prevents the controller that completes tuning first from falsifying the tuning result of the
other controller due to the change in its manipulated variable.
NOTICE
Reaching 75% of the setpoint step change causes an exiting of phase 2 and resetting of
output QTUN_RUN. However, automatic mode does not start until TUN_KEEP is also 0.
PID control
210 Function Manual, 11/2023, A5E35300227-AG
Using PID basic functions
8.3 TCONT_CP
PID control
Function Manual, 11/2023, A5E35300227-AG 211
Using PID basic functions
8.3 TCONT_CP
The following schematic illustrates the overshoot of the process variable when the excitation
is too strong (process type III):
1)"4& 1)"4& 1)"4& 1)"4& 1)"4&
r& -./
-./
17UIBUXPVMEIBWF
-./ 56/@%-./ SFTVMUFEJGUIF-./IBE
SFNBJOFEVODIBOHFE
56/@%-./
1PJOUPGJOFDUJPO
8BSNQSPDFTTTUBUF
17 PQFSBUJOHQPJOU
41
$PMEQSPDFTT
TUBUF
41
56/@0/
In typical temperature processes, cancelation shortly before reaching the point of inflection is
not critical in terms of the controller parameters.
If you repeat the attempt, reduce TUN_DLMN or increase the setpoint step change.
Principle: The value of the manipulated variable used for tuning must be suitable for the
setpoint step change.
NOTE
The special case of a PT1-only process is also indicated by STATUS_H = 2x1xx (TU <=
3*CYCLE). In this case, it is not necessary to repeat the attempt. Reduce the controller
parameters if the control oscillates.
PID control
212 Function Manual, 11/2023, A5E35300227-AG
Using PID basic functions
8.3 TCONT_CP
Overshoot
Overshoot can occur in the following situations:
PID control
Function Manual, 11/2023, A5E35300227-AG 213
Using PID basic functions
8.3 TCONT_CP
Requirements
• The instruction and the technology object have been loaded to the CPU.
Procedure
To manually determine the optimum PID parameters for initial commissioning, follow these
steps:
1. Click the "Start" icon.
If there is no online connection, this will be established. The current values for the
setpoint, process value and output value are recorded.
2. Select "Pretuning" from the "Mode" drop-down list.
TCONT_CP is ready for tuning.
3. In the "Output value jump" field, specify how much the output value should be increased.
4. Enter a setpoint in the "Setpoint" field. The output value jump only takes effect when
another setpoint is entered.
5. Click the "Start tuning" icon.
The pretuning starts. The status of the tuning is displayed.
Requirements
• The instruction and the technology object have been loaded to the CPU.
Procedure
To determine the optimal PID parameters at the operating point, follow these steps:
1. Click the "Start" icon.
If there is no online connection, this will be established. The current values for the
setpoint, process value and output value are recorded.
2. Select "Fine tuning" from the "Mode" drop-down list.
TCONT_CP is ready for tuning.
3. In the "Output value jump" field, specify how much the output value should be increased.
4. Click the "Start tuning" icon.
Fine tuning starts. The status of the tuning is displayed.
PID control
214 Function Manual, 11/2023, A5E35300227-AG
Using PID basic functions
8.3 TCONT_CP
NOTE
Activating the control zone with higher-order processes (process type III) does not normally
provide any benefit since the control zone is then larger than the control range that can be
achieved with a 100% manipulated variable. There is also no advantage in activating the
control zone for PI controllers.
Before you switch on the control zone manually, make sure that the control zone is not too
narrow. If the control zone is set too narrow, oscillations occur in the manipulated variable
and the process value.
PID control
Function Manual, 11/2023, A5E35300227-AG 215
Using PID basic functions
8.3 TCONT_CP
Requirements
• The instruction and the technology object have been loaded to the CPU.
Procedure
To manually determine the optimal PID parameters, proceed as follows:
1. Click the "Start" icon.
If there is no online connection, this will be established. The current values for the
setpoint, process value and output value are recorded.
2. Select "Manual" from the "Mode" drop-down list.
3. Enter the new PID parameters.
4. Click on the icon "Send parameter to CPU" in the "Tuning" group.
5. Select the "Change setpoint" check box in the "Current values" group.
6. Enter a new setpoint and click the icon in the "Current values" group.
7. Clear the "Manual mode" check box.
The controller works with the new PID parameters and controls the new setpoint.
8. Check the quality of the PID parameter to check the curve points.
9. Repeat steps 3 to 8 until you are satisfied with the controller results.
PID control
216 Function Manual, 11/2023, A5E35300227-AG
Using PID basic functions
8.4 TCONT_S
8.4 TCONT_S
PID control
Function Manual, 11/2023, A5E35300227-AG 217
Using PID basic functions
8.4 TCONT_S
Control deviation
Set a dead zone range under the following requirement:
• The process value signal is noisy.
• The controller gain is high.
• The derivative action is activated.
The noise component of the process value causes strong deviations of the output value in this
case. The dead zone suppresses the noise component in the steady controller state. The dead
zone range specifies the size of the dead zone. With a dead zone range of 0.0, the dead zone
is turned off.
See also
Mode of operation TCONT_S (Page 439)
General
1. Enter the "Sampling time PID algorithm".
A controller sampling time should not exceed 10 % of the determined integral action time
of the controller (TI).
2. If the controller structure contains a proportional action, enter the "proportional gain".
A negative proportional gain inverts the rule meaning.
Proportional action
For changes of the setpoint, it may lead to overshooting of the proportional action. Through
the weighting of the proportional action, you can select how strongly the proportional action
should react when setpoint changes are made. The weakening of the proportional action is
reached through a compensation of the integral action.
1. To weaken the proportional action for setpoint changes, enter a "Proportional action
weighting".
– 1.0: Proportional action for setpoint change is fully effective
– 0.0: Proportional action for setpoint change is not effective
Integral action
1. If the controller structure contains an integral action, enter the "integral action time".
With an integral action time of 0.0, the integral action is switched off.
PID control
218 Function Manual, 11/2023, A5E35300227-AG
Using PID basic functions
8.4 TCONT_S
See also
Mode of operation TCONT_S (Page 439)
Pulse generator
1. Enter the minimum impulse duration and minimum pause duration.
The values must be greater than or equal to the cycle time for the input parameter CYCLE.
The frequency of operation is reduced through this.
2. Enter the motor setting time.
The value must be greater than or equal to the cycle time of the input parameter CYCLE.
See also
Mode of operation TCONT_S (Page 439)
Requirements
• The instruction and the technology object have been loaded to the CPU.
Procedure
To manually determine the optimal PID parameters, proceed as follows:
1. Click the "Start" icon.
If there is no online connection, this will be established. The current values for the
setpoint, process value and output value are recorded.
2. Enter new PID parameters in the "P", "I" and weighting proportional action fields.
3. Click on the icon "Send parameter to CPU" in the "Tuning" group.
4. Select the "Change setpoint" check box in the "Current values" group.
5. Enter a new setpoint and click the icon in the "Current values" group.
6. Clear the "Manual mode" check box.
The controller works with the new parameters and controls the new setpoint.
7. Check the quality of the PID parameter to check the curve points.
8. Repeat steps 2 to 6 until you are satisfied with the controller results.
PID control
Function Manual, 11/2023, A5E35300227-AG 219
Auxiliary functions 9
9.1 Polyline
Polyline
The Polyline instruction provides a function with the characteristic curve of the polyline
whose points can be used, for example, to linearize the behavior of non-linear sensors.
The Polyline instruction can be used with an S7-1500 CPU Firmware 2.0 and higher and an
S7-1200 CPU Firmware 4.2 and higher.
Additional information
Description Polyline (Page 449)
Operating principle Polyline (Page 451)
Input parameters of Polyline (Page 454)
Output parameters of Polyline (Page 454)
Static tags of Polyline (Page 455)
ErrorBits parameter (Page 456)
9.2 SplitRange
SplitRange
The SplitRange instruction splits the output value range of the PID controller into multiple
subranges. These subranges enable control of a process that is influenced by multiple
actuators.
The SplitRange instruction can be used with an S7-1500 CPU Firmware 2.0 and higher and an
S7-1200 CPU Firmware 4.2 and higher.
Additional information
SplitRange description (Page 459)
SplitRange input parameters (Page 462)
SplitRange static tags (Page 462)
SplitRange output parameters (Page 462)
ErrorBits parameter (Page 463)
PID control
220 Function Manual, 11/2023, A5E35300227-AG
Auxiliary functions
9.4 RampSoak
9.3 RampFunction
RampFunction
The RampFunction instruction limits the slew rate of a signal. A signal jump at the input is
output as ramp function of the output value, to achieve a smoother response, for example,
without influencing the disturbance reaction.
The RampFunction instruction can be used with an S7-1500 CPU Firmware 2.0 and higher
and an S7-1200 CPU Firmware 4.2 and higher.
Additional information
RampFunction description (Page 465)
RampFunction mode of operation (Page 469)
RampFunction input parameters (Page 472)
RampFunction output parameters (Page 472)
RampFunction static tags (Page 473)
ErrorBits parameter (Page 474)
9.4 RampSoak
RampSoak
You can use this instruction to generate an output value that follows a configurable profile on
a time-dependent basis. Every point of this profile has a target value and a time value. When
the profile is executed, the target value of the current point is reached within the time value.
The instruction can be used, for example, to provide a setpoint value profile for regulating a
temperature process.
The RampSoak instruction can be used with S7-1500 CPU firmware 2.0 and higher and
S7-1200 CPU firmware 4.2 and higher.
More information
Description of RampSoak (Page 477)
Operating principle RampSoak (Page 479)
Input parameter RampSoak (Page 492)
Output parameter RampSoak (Page 493)
In-out parameter RampSoak (Page 493)
Static tags RampSoak (Page 494)
ErrorBits parameter (Page 496)
PID control
Function Manual, 11/2023, A5E35300227-AG 221
Auxiliary functions
9.6 Filter_PT2
9.5 Filter_PT1
Filter_PT1
The instruction Filter_PT1 is a proportional transfer element with a first-order lag. You can use
Filter_PT1 as a low-pass filter, delay element or process simulation block.
The Filter_PT1 instruction can be used with an S7-1500 CPU firmware 2.0 and higher and an
S7-1200 CPU firmware 4.2 and higher.
Additional information
Description of Filter_PT1 (Page 500)
Mode of operation of Filter_PT1 (Page 506)
Input parameter Filter_PT1 (Page 508)
Output parameter Filter_PT1 (Page 508)
Static tags Filter_PT1 (Page 508)
Parameter ErrorBits (Page 509)
9.6 Filter_PT2
Filter_PT2
The instruction Filter_PT2 is a proportional transfer element with a second-order lag. You can
use Filter_PT2 as a low-pass filter, delay element or process simulation block.
The Filter_PT2 instruction can be used with S7-1500 CPU firmware 2.0 and higher and
S7-1200 CPU firmware 4.2 and higher.
More information
Description of Filter_PT2 (Page 513)
Mode of operation of Filter_PT2 (Page 519)
Input parameter Filter_PT2 (Page 521)
Output parameter Filter_PT2 (Page 521)
Static tags Filter_PT2 (Page 521)
Parameter ErrorBits (Page 522)
PID control
222 Function Manual, 11/2023, A5E35300227-AG
Auxiliary functions
9.8 Filter_Universal
9.7 Filter_DT1
Filter_DT1
The instruction Filter_DT1 is a differentiator with a first-order lag. You can use Filter_DT1 as a
high-pass filter, differentiator, or feed-forward control.
The Filter_DT1 instruction can be used with S7-1500 CPU firmware 2.0 and higher and
S7-1200 CPU firmware 4.2 and higher.
More information
Description of Filter_DT1 (Page 526)
Mode of operation of Filter_DT1 (Page 533)
Input parameter Filter_DT1 (Page 534)
Output parameter Filter_DT1 (Page 534)
Static tags Filter_DT2 (Page 535)
Parameter ErrorBits (Page 536)
9.8 Filter_Universal
Filter_Universal
The Filter_Universal instruction is a configurable digital filter of the order 1 to 10. You can use
Filter_Universal as a high-pass, low-pass, band-pass or band-stop filter.
The Filter_Universal instruction can be used with S7-1500 CPU as of firmware 2.0.
More information
Description Filter_Universal
Filter_Universal operating principle
Input parameter Filter_Universal
Output parameter Filter_Universal
Static tags Filter_Universal
ErrorBits parameter
PID control
Function Manual, 11/2023, A5E35300227-AG 223
10
Instructions
10.1 PID_Compact
PID_Compact V3.0
• Dead zone
If the process value is noisy, unnecessary fluctuations in the output value can be reduced
by manually setting a dead zone width.
• Active limitation of the integral part and change of the output value limits in
automatic mode
In addition to the direction-dependent stopping of the integral component, this is now
actively limited.
This allows the change of the output value limits in automatic mode
• New tags Config.OutputSelect and Retain.CtrlParams.SetByUser
The tags Config.OutputSelect and Retain.CtrlParams.SetByUser replace the previous tags
_Config.OutputSelect and _Retain.CtrlParams.SetByUser, which are only available via the
Openness API.
The tags Config.OutputSelect and Retain.CtrlParams.SetByUser are available both in the
instance data block and via the Openness API.
The existing values for the new tags Config.OutputSelect and Retain.CtrlParams.SetByUser
are transferred to individual instances after switching to V3. For multi-instances, the new
tags will have the default value after switching to V3. You restore the associated settings
manually.
If you have been using _Config.OutputSelect or _Retain.CtrlParams.SetByUser in your
Openness application so far, replace them with the tags Config.OutputSelect and
Retain.CtrlParams.SetByUser when you switch to PID_Compact V3.
PID_Compact V2.4
• Initialization of the integral action
PID_Compact now initializes the integral action if you use OverwriteInitialOutputValue
together with inverted control logic.
If you have been using OverwriteInitialOutputValue together with inverted control logic
up to now, please note that the sign of the output value changes with PID_Compact V2.4.
PID control
224 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.1 PID_Compact
PID_Compact V2.3
• Response of the output value when switching from "Inactive" operating mode to
"Automatic mode"
The new option IntegralResetMode = 4 was added and defined as default. With
IntegralResetMode = 4, the integral action is automatically preassigned when switching
from "Inactive" operating mode to "Automatic mode" so that a control deviation results in
a jump of the output value with identical sign.
• Initialization of the integral action in automatic mode
The integral action can be initialized in automatic mode with the tags
OverwriteInitialOutputValue and PIDCtrl.PIDInit. This simplifies the use of PID_Compact for
override controls.
PID_Compact V2.2
• Use with S7-1200
As of PID_Compact V2.2, the instruction with V2 functionality can also be used on
S7-1200 with firmware version as of 4.0.
PID_Compact V2.0
• Responses in the event of an error
The response in the event of an error has been completely overhauled. PID_Compact now
responds in a more fault-tolerant manner in the default setting. This reaction is set when
copying PID_Compact V1.X from an S7-1200 CPU to an S7-1500 CPU.
NOTICE
Your system may be damaged.
If you use the default setting, PID_Compact remains in automatic mode when the process
value limits are exceeded. This may damage your system.
It is essential to configure how your controlled system responds in the event of an error
to protect your system from damage.
The Error parameter indicates if an error is pending. When the error is no longer pending,
Error = FALSE. The ErrorBits parameter shows which errors have occurred. Use ErrorAck to
acknowledge the errors and warnings without restarting the controller or clearing the
integral action. Switching operating modes no longer clears errors that are no longer
pending.
You can configure the responses in the event of an error with SetSubstituteOutput and
ActivateRecoverMode.
• Substitute output value
You can configure a substitute output value that is to be output if an error occurs.
• Switching the operating mode
You specify the operating mode at the Mode in/out parameter and use a positive edge at
ModeActivate to start the operating mode. The sRet.i_Mode tag has been omitted.
• Multi-instance capability
You can call up PID_Compact as multi-instance DB.
PID control
Function Manual, 11/2023, A5E35300227-AG 225
Instructions
10.1 PID_Compact
• Startup characteristics
The operating mode specified at the Mode parameter is also started on a falling edge at
Reset and during a CPU cold restart, if RunModeByStartup = TRUE.
• ENO characteristics
ENO is set depending on the operating mode.
If State = 0, then ENO = FALSE.
If State ≠ 0, then ENO = TRUE.
• Setpoint value specification during tuning
You configure the permitted fluctuation of the setpoint during tuning at the
CancelTuningLevel tag.
• Value range for output value limits
The value 0.0 no longer has to fall within the output value limits.
• Preassigning the integral action
Using the tags IntegralResetMode and OverwriteInitialOutputValue, you can determine
the preassignment of the integral action when switching from "Inactive" operating mode
to "Automatic mode".
• Switching a disturbance variable on
You can switch a disturbance variable on at the Disturbance parameter.
• Default value of PID parameters
The following default settings have been changed:
– Proportional action weighting (PWeighting) from 0.0 to 1.0
– Derivative action weighting (DWeighting) from 0.0 to 1.0
– Coefficient for derivative delay (TdFiltRatio) from 0.0 to 0.2
• Renaming tags
The static tags have been given new names that are compatible with PID_3Step.
PID_Compact V1.2
• Manual mode on CPU startup
If ManualEnable = TRUE when the CPU starts, PID_Compact starts in manual mode. A
rising edge at ManualEnable is not necessary.
• Pretuning
If the CPU is switched off during pretuning, pretuning starts again when the CPU is
switched back on.
PID_Compact V1.1
• Manual mode on CPU startup
When the CPU starts up, PID_Compact only switches to manual mode with a rising edge at
ManualEnable. Without rising edge, PID_Compact starts in the last operating mode in
which ManualEnable was FALSE.
• Reaction to reset
A rising edge at Reset resets the errors and warnings and clears the integral action. A
falling edge at Reset triggers a switchover to the most recently active operating mode.
• Default of process value high limit
The default value of r_Pv_Hlm has been changed to 120.0.
PID control
226 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.1 PID_Compact
CPU FW PID_Compact
S7-1200 as of V4.2 V2.3
V2.2
V1.2
V4.0 to V4.1 V2.2
V1.2
V3.x V1.2
V1.1
V2.x V1.2
V1.1
V1.x V1.0
S7-1500 as of V3.1 V3.0
V2.4
V3.0 V2.4
V2.5 to V2.9 V2.4
V2.3
V2.2
V2.1
V2.0
V2.0 and V2.1 V2.3
V2.2
V2.1
V2.0
V1.5 to V1.8 V2.2
V2.1
V2.0
V1.1 V2.1
V2.0
V1.0 V2.0
PID control
Function Manual, 11/2023, A5E35300227-AG 227
Instructions
10.1 PID_Compact
CPU FW Typ. CPU processing time Typ. CPU processing time pre-
Automatic mode tuning and fine tuning
CPU 1211 ≥ V4.0 190 µs 270 µs
CPU 1212
CPU 1214
CPU 1215
CPU 1217
CPU 1510SP ≤ V2.9 65 µs 80 µs
CPU 1511
CPU 1511C
CPU 1512C
CPU 1512SP
CPU 1513
CPU 1515 50 µs 65 µs
CPU 1516
CPU 1517 Every 8 µs 12 µs
CPU 1518 4 µs 6 µs
CPU 1510SP ≥ V3.0 55 µs 70 µs
CPU 1511
CPU 1511C
CPU 1512C
CPU 1512SP
CPU 1513
CPU 1514SP
CPU 1515 40 µs 55 µs
CPU 1516
Typical CPU processing times of the PID_Compact technology object as of Version V2.0,
depending on the CPU type and operating mode for R-CPUs in the RUN-Redundant system
state.
CPU FW Typ. CPU processing time Typ. CPU processing time pre-
Automatic mode tuning and fine tuning
CPU 1513R ≥ V3.0 90 µs 140 µs
CPU 1515R 70 µs 90 µs
PID control
228 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.1 PID_Compact
Memory requirement
Memory requirement of an instance DB of the PID_Compact technology object as of Version
V2.0.
10.1.4 PID_Compact as of V2
Description
The PID_Compact instruction provides a PID controller with integrated tuning for actuators
with proportional action.
The following operating modes are possible:
• Inactive
• Pretuning
• Fine tuning
• Automatic mode
• Manual mode
• Substitute output value with error monitoring
For a more detailed description of the operating modes, see the State parameter.
PID control
Function Manual, 11/2023, A5E35300227-AG 229
Instructions
10.1 PID_Compact
PID algorithm
PID_Compact is a PIDT1 controller with anti-windup and weighting of the proportional and
derivative actions. The PID algorithm operates according to the following equation (dead
zone disabled):
5%wT
Z,Q CwXY XY DwXY
5*wT Bw5%wT
PID control
230 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.1 PID_Compact
*OQVU1FS0O
$31@*/ 4DBMF 17@"-3. *OQVU8BSOJOH@)
*OQVU@1&3
*OQVU8BSOJOH@-
*OQVU
1*%5
"OUJ8JOEVQ
-JNJU
4FUQPJOU
*/7 *OWFSU$POUSPM
%JTUVSCBODF 0VUQVU
4UBUF
-JNJU $31@065
.BOVBM7BMVF ࣣ 0VUQVU@1&3
18.
0VUQVU@18.
C
$VSSFOU4FUQPJOU X
D %5 ,1
Z
%FBE;POF
"OUJ8JOEVQ
-*.*5 *
4DBMFE*OQVU Y 1*%$USM*OUFHSBM4VN
PID control
Function Manual, 11/2023, A5E35300227-AG 231
Instructions
10.1 PID_Compact
Call
PID_Compact is called in the constant time scale of a cyclic interrupt OB.
Download to device
The actual values of retentive variables are only updated when you download PID_Compact
completely.
Download technology object to device
Startup
When the CPU starts up, PID_Compact starts in the operating mode that is saved in the Mode
in/out parameter. To switch to "Inactive" operating mode during startup, set
RunModeByStartup = FALSE.
PID control
232 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.1 PID_Compact
Description
The PID_Compact instruction provides a PID controller with integrated tuning for actuators
with proportional action.
The following operating modes are possible:
• Inactive
• Pretuning
• Fine tuning
• Automatic mode
• Manual mode
• Substitute output value with error monitoring
For a more detailed description of the operating modes, see the State parameter.
PID algorithm
PID_Compact is a PIDT1 controller with anti-windup and weighting of the proportional and
derivative actions. The PID algorithm operates according to the following equation:
5%wT
Z,Q CwXY XY DwXY
5*wT Bw5%wT
PID control
Function Manual, 11/2023, A5E35300227-AG 233
Instructions
10.1 PID_Compact
*OQVU1FS0O
$31@*/ 4DBMF 17@"-3. *OQVU8BSOJOH@)
*OQVU@1&3
*OQVU8BSOJOH@-
*OQVU
1*%5
"OUJ8JOEVQ
-JNJU
4FUQPJOU
*/7 *OWFSU$POUSPM
%JTUVSCBODF 0VUQVU
4UBUF
-JNJU $31@065
.BOVBM7BMVF ࣣ 0VUQVU@1&3
18.
0VUQVU@18.
4FUQPJOU X C
"OUJXJOEVQ
,1
-*.*5 * Z
4DBMFE*OQVU Y %5
PID control
234 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.1 PID_Compact
Call
PID_Compact is called in the constant time scale of a cyclic interrupt OB.
Download to device
The actual values of retentive variables are only updated when you download PID_Compact
completely.
Downloading technology objects to device (Page 46)
Startup
When the CPU starts up, PID_Compact starts in the operating mode that is saved in the Mode
in/out parameter. To switch to "Inactive" operating mode during startup, set
RunModeByStartup = FALSE.
PID control
Function Manual, 11/2023, A5E35300227-AG 235
Instructions
10.1 PID_Compact
NOTE
Use with two or more actuators
PID_Compact is not suitable for use with two or more actuators (for example, in
heating/cooling applications), because different actuators need different PID parameters to
achieve a good control response. Use PID_Temp for applications with two actuators acting in
opposite directions.
PID control
236 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.1 PID_Compact
PID control
Function Manual, 11/2023, A5E35300227-AG 237
Instructions
10.1 PID_Compact
Control logic
An increase of the output value is generally intended to cause an increase in the process
value. This is referred to as a normal control logic. For cooling and discharge control systems,
it may be necessary to invert the control logic. PID_Compact does not work with negative
proportional gain. If InvertControl = TRUE, an increasing control deviation causes a reduction
in the output value. The control logic is also taken into account during pretuning and fine
tuning.
The names of the following parameters apply both to the data block and to access via the
Openness API.
Table 10-1
Parameter Data type Default Description
Setpoint REAL 0.0 Setpoint of the PID controller in automatic mode
Input REAL 0.0 A tag of the user program is used as source for the pro
cess value.
If you are using parameter Input, then
Config.InputPerOn = FALSE must be set.
Input_PER INT 0 An analog input is used as the source of the process
value.
If you are using parameter Input_PER, then
Config.InputPerOn = TRUE must be set.
Disturbance REAL 0.0 Disturbance variable or precontrol value
ManualEnable BOOL FALSE • A FALSE -> TRUE edge activates "manual mode",
while State = 4, Mode remains unchanged.
As long as ManualEnable = TRUE, you cannot
change the operating mode via a rising edge at
ModeActivate or use the commissioning dialog.
• A TRUE -> FALSE edge activates the operating mode
that is specified by Mode.
We recommend that you change the operating mode
using ModeActivate only.
ManualValue REAL 0.0 Manual value
This value is used as the output value in manual mode.
Values from Config.OutputLowerLimit to
Config.OutputUpperLimit are permitted.
ErrorAck BOOL FALSE • FALSE -> TRUE edge
ErrorBits and Warning are reset.
Reset BOOL FALSE Restarts the controller.
PID control
238 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.1 PID_Compact
The names of the following parameters apply both to the data block and to access via the
Openness API.
Table 10-2
Parameter Data type Default Description
ScaledInput REAL 0.0 Scaled process value
The "Output", "Output_PER", and "Output_PWM" outputs can be used concurrently.
Output REAL 0.0 Output value in REAL format
Output_PER INT 0 Analog output value
Output_PWM BOOL FALSE Pulse-width-modulated output value
The output value is formed by variable On and Off times.
SetpointLimit_H BOOL FALSE If SetpointLimit_H = TRUE, the absolute setpoint high limit is
reached (Setpoint ≥ Config.SetpointUpperLimit).
The setpoint is limited to Config.SetpointUpperLimit .
SetpointLimit_L BOOL FALSE If SetpointLimit_L = TRUE, the absolute setpoint low limit has
been reached (Setpoint ≤ Config.SetpointLowerLimit).
The setpoint is limited to Config.SetpointLowerLimit .
InputWarning_H BOOL FALSE If InputWarning_H = TRUE, the process value has reached or
exceeded the warning high limit.
InputWarning_L BOOL FALSE If InputWarning_L = TRUE, the process value has reached or
fallen below the warning low limit.
State INT 0 The State parameter (Page 252) shows the current operating
mode of the PID controller. You can change the operating
mode using the input parameter Mode and a rising edge at
ModeActivate.
PID control
Function Manual, 11/2023, A5E35300227-AG 239
Instructions
10.1 PID_Compact
The names of the following parameters apply both to the data block and to access via the
Openness API.
Table 10-3
Parameter Data type Default Description
Mode INT 4 At Mode, specify the operating mode to
which PID_Compact is to switch. Options are:
• Mode = 0: Inactive
• Mode = 1: Pretuning
• Mode = 2: Fine tuning
• Mode = 3: Automatic mode
• Mode = 4: Manual mode
The operating mode is activated by:
• Rising edge at ModeActivate
• Falling edge at Reset
• Falling edge at ManualEnable
• Cold restart of CPU if
RunModeByStartup = TRUE
Mode is retentive.
A detailed description of the operating modes
can be found in State and Mode as of V2
parameters (Page 252).
See also
State and Mode as of V2 parameters (Page 252)
PID control
240 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.1 PID_Compact
NOTE
Change the tags identified with (1) only in "Inactive" mode to prevent malfunction of the PID
controller.
Unless otherwise specified, the names of the following variables apply both to the data block
and to access via the Openness API.
Tag Data type Default Description
IntegralResetMode INT Up to V2.2: 1, The Tag IntegralResetMode as of V2 (Page 259) determ
as of V2.3: 4 ines how the integral action PIDCtrl.IntegralSum is pre
assigned when switching from "Inactive" operating
mode to "Automatic mode". This setting only works for
one cycle.
Options are:
• IntegralResetMode = 0: Smooth
• IntegralResetMode = 1: Delete
• IntegralResetMode = 2: Hold
• IntegralResetMode = 3: Pre-assign
• IntegralResetMode = 4: Like setpoint change (only
for PID_Compact with version ≥ 2.3)
OverwriteInitialOutputValue REAL 0.0 If one of the following conditions is met, the integral
action PIDCtrl.IntegralSum is preassigned automatically
as if Output = OverwriteInitialOutputValue in the previ
ous cycle:
• IntegralResetMode = 3 when switching from
"Inactive" operating mode to "Automatic mode"
• IntegralResetMode = 3, TRUE -> FALSE edge at para
meter Reset and parameter Mode = 3
• PIDCtrl.PIDInit = TRUE in "Automatic mode" (available
as of PID_Compact version 2.3)
RunModeByStartup BOOL TRUE Activate operating mode at Mode parameter after CPU
restart
If RunModeByStartup = TRUE, PID_Compact starts in the
operating mode saved in the Mode parameter after CPU
startup.
If RunModeByStartup = FALSE, PID_Compact remains in
"Inactive" mode after CPU startup.
LoadBackUp BOOL FALSE If LoadBackUp = TRUE, the last set of PID parameters is
reloaded from the CtrlParamsBackUp structure. The set
was saved prior to the last tuning. LoadBackUp is auto
matically set back to FALSE.
PhysicalUnit INT 0 Unit of measurement of the process value and setpoint,
e.g., ºC, or ºF.
PhysicalUnit serves the display in the editors and has no
influence on the behavior of the control algorithm in the
CPU.
When importing PID_Compact up to Version 2.4 via the
Openness API, PhysicalUnit is reset to the default value.
As of Version 3.0, the value of PhysicalUnit is retained
when importing.
PID control
Function Manual, 11/2023, A5E35300227-AG 241
Instructions
10.1 PID_Compact
PID control
242 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.1 PID_Compact
PID control
Function Manual, 11/2023, A5E35300227-AG 243
Instructions
10.1 PID_Compact
PID control
244 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.1 PID_Compact
PID control
Function Manual, 11/2023, A5E35300227-AG 245
Instructions
10.1 PID_Compact
PID control
246 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.1 PID_Compact
PID control
Function Manual, 11/2023, A5E35300227-AG 247
Instructions
10.1 PID_Compact
PID control
248 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.1 PID_Compact
PID control
Function Manual, 11/2023, A5E35300227-AG 249
Instructions
10.1 PID_Compact
See also
ActivateRecoverMode tag as of V2 (Page 257)
Warning tag as of V2 (Page 258)
Downloading technology objects to device (Page 46)
The following table shows what has changed in the PID_Compact instruction interface.
PID control
250 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.1 PID_Compact
PID control
Function Manual, 11/2023, A5E35300227-AG 251
Instructions
10.1 PID_Compact
Meaning of values
PID control
252 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.1 PID_Compact
PID control
Function Manual, 11/2023, A5E35300227-AG 253
Instructions
10.1 PID_Compact
ENO characteristics
If State = 0, then ENO = FALSE.
If State ≠ 0, then ENO = TRUE.
PID control
254 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.1 PID_Compact
If several errors are pending simultaneously, the values of the ErrorBits are displayed with
binary addition. The display of ErrorBits = 16#0000_0003, for example, indicates that the
errors 16#0000_0001 and 16#0000_0002 are pending simultaneously.
In manual mode, PID_Compact uses ManualValue as output value. The exception is Errorbits
= 16#0001_0000.
ErrorBits Description
(DW#16#...)
0000_0000 There is no error.
0000_0001 The "Input" parameter is outside the process value limits.
• Input > Config.InputUpperLimit or
• Input < Config.InputLowerLimit
If automatic mode was active before the error occurred and ActivateRecoverMode = TRUE, PID_Compact
remains in automatic mode.
If pretuning or fine tuning mode was active before the error occurred and ActivateRecoverMode = TRUE,
PID_Compact switches to the operating mode that is saved in the Mode parameter.
0000_0002 Invalid value at "Input_PER" parameter. Check whether an error is pending at the analog input.
If automatic mode was active before the error occurred and ActivateRecoverMode = TRUE, PID_Compact
outputs the configured substitute output value. As soon as the error is no longer pending, PID_Compact
switches back to automatic mode.
If pretuning or fine tuning mode was active before the error occurred and ActivateRecoverMode = TRUE,
PID_Compact switches to the operating mode that is saved in the Mode parameter.
0000_0004 Error during fine tuning. The oscillation of the process value could not be maintained.
If ActivateRecoverMode = TRUE before the error occurred, PID_Compact cancels the tuning and switches
to the operating mode that is saved in the Mode parameter.
0000_0008 Error at start of pretuning. The process value is too close to the setpoint. Start fine tuning.
If ActivateRecoverMode = TRUE before the error occurred, PID_Compact cancels the tuning and switches
to the operating mode that is saved in the Mode parameter.
0000_0010 The setpoint was changed during tuning.
You can set the permitted fluctuation of the setpoint at the CancelTuningLevel tag.
If ActivateRecoverMode = TRUE before the error occurred, PID_Compact cancels the tuning and switches
to the operating mode that is saved in the Mode parameter.
0000_0020 Pretuning is not permitted during fine tuning.
If ActivateRecoverMode = TRUE before the error occurred, PID_Compact remains in fine tuning mode.
0000_0080 Error during pretuning. The output value limits are not configured correctly or the process value is not
reacting as expected.
Make sure that:
• The limits of the output value are configured correctly and match the control logic.
• It is possible to change the output value so that the process value approaches the setpoint. The output
value is not already limited by the corresponding output value limit before the pretuning.
Example: With normal control logic and a process value that is below the setpoint, the output value
must not have reached the high limit before the start of the pretuning.
• The process value does not show a strong oscillation before the start of the pretuning.
For starting a pretuning in automatic mode, it is recommended to perform the required setpoint change
simultaneously with the rising edge at ModeActivate. This prevents the output value from running into
the limitation between the setpoint change and the start of the pretuning. Alternatively, this can also be
achieved by starting from manual mode or "Inactive" mode.
If ActivateRecoverMode = TRUE before the error occurred, PID_Compact cancels the tuning and switches
to the operating mode that is saved in the Mode parameter.
PID control
Function Manual, 11/2023, A5E35300227-AG 255
Instructions
10.1 PID_Compact
ErrorBits Description
(DW#16#...)
0000_0100 Error during fine tuning resulted in invalid parameters.
If ActivateRecoverMode = TRUE before the error occurred, PID_Compact cancels the tuning and switches
to the operating mode that is saved in the Mode parameter.
0000_0200 Invalid value at "Input" parameter: Value has an invalid number format.
If automatic mode was active before the error occurred and ActivateRecoverMode = TRUE, PID_Compact
outputs the configured substitute output value. As soon as the error is no longer pending, PID_Compact
switches back to automatic mode.
If pretuning or fine tuning mode was active before the error occurred and ActivateRecoverMode = TRUE,
PID_Compact switches to the operating mode that is saved in the Mode parameter.
0000_0400 Calculation of output value failed. Check the PID parameters.
If automatic mode was active before the error occurred and ActivateRecoverMode = TRUE, PID_Compact
outputs the configured substitute output value. As soon as the error is no longer pending, PID_Compact
switches back to automatic mode.
If pretuning or fine tuning mode was active before the error occurred and ActivateRecoverMode = TRUE,
PID_Compact switches to the operating mode that is saved in the Mode parameter.
0000_0800 Sampling time error: PID_Compact is not called within the sampling time of the cyclic interrupt OB.
It is recommended to call PID_Compact in a cyclic interrupt OB without conditions and to activate or deac
tivate it via the operating mode at the Mode parameter. Conditional calls or the call in OB1 can have a
negative effect on the control quality.
Monitoring of the sampling time can be disabled with CycleTime.EnMonitoring = FALSE.
If automatic mode was active before the error occurred and ActivateRecoverMode = TRUE, PID_Compact
remains in automatic mode.
If pretuning or fine tuning mode was active before the error occurred and ActivateRecoverMode = TRUE,
PID_Compact switches to the operating mode that is saved in the Mode parameter.
If this error occurred during simulation with PLCSIM, see the notes under Simulating PID_Compact as of
V2 with PLCSIM (Page 94).
0000_1000 Invalid value at "Setpoint" parameter: Value has an invalid number format.
If automatic mode was active before the error occurred and ActivateRecoverMode = TRUE, PID_Compact
outputs the configured substitute output value. As soon as the error is no longer pending, PID_Compact
switches back to automatic mode.
If pretuning or fine tuning mode was active before the error occurred and ActivateRecoverMode = TRUE,
PID_Compact switches to the operating mode that is saved in the Mode parameter.
0001_0000 Invalid value at ManualValue parameter. Value has an invalid number format.
If ActivateRecoverMode = TRUE before an error occurred, PID_Compact uses SubstituteOutput as the out
put value. As soon as you specify a valid value in ManualValue, PID_Compact uses it as the output value.
0002_0000 Invalid value at SubstituteOutput tag. Value has an invalid number format.
PID_Compact uses the output value low limit as the output value.
If automatic mode was active before the error occurred, ActivateRecoverMode = TRUE, and the error is no
longer pending, PID_Compact switches back to automatic mode.
0004_0000 Invalid value at Disturbance parameter. Value has an invalid number format.
If automatic mode was active and ActivateRecoverMode = TRUE before the error occurred, Disturbance is
set to zero. PID_Compact remains in automatic mode.
If pretuning or fine tuning mode was active and ActivateRecoverMode = TRUE before the error occurred,
PID_Compact switches to the operating mode saved in the Mode parameter. If Disturbance in the current
phase has no effect on the output value, tuning is not be canceled.
PID control
256 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.1 PID_Compact
The ActivateRecoverMode tag determines the response in the event of an error. The Error
parameter indicates if an error is pending. When the error is no longer pending, Error =
FALSE. The ErrorBits parameter shows which errors have occurred.
Automatic mode
NOTICE
Your system may be damaged.
If ActivateRecoverMode = TRUE, PID_Compact remains in automatic mode even if there is an
error and the process limit values are exceeded. This may damage your system.
It is essential to configure how your controlled system responds in the event of an error to
protect your system from damage.
ActivateRecover Description
Mode
FALSE PID_Compact automatically switches to "Inactive" mode in the event of an error. The controller is only
activated by a falling edge at Reset or a rising edge at ModeActivate.
TRUE If errors occur frequently in automatic mode, this setting has a negative effect on the control response,
because PID_Compact switches between the calculated output value and the substitute output value at
each error. In this case, check the ErrorBits parameter and eliminate the cause of the error.
If one or more of the following errors occur, PID_Compact stays in automatic mode:
• 0001h: The "Input" parameter is outside the process value limits.
• 0800h: Sampling time error
• 40000h: Invalid value at Disturbance parameter.
If one or more of the following errors occur, PID_Compact switches to "Substitute output value with error
monitoring" mode:
• 0002h: Invalid value at Input_PER parameter.
• 0200h: Invalid value at Input parameter.
• 0400h: Calculation of output value failed.
• 1000h: Invalid value at Setpoint parameter.
If the following error occurs, PID_Compact switches to "Substitute output value with error monitoring"
mode and moves the actuator to Config.OutputLowerLimit:
• 20000h: Invalid value at SubstituteOutput tag. Value has an invalid number format.
This characteristics are independent of SetSubstituteOutput.
As soon as the errors are no longer pending, PID_Compact switches back to automatic mode.
PID control
Function Manual, 11/2023, A5E35300227-AG 257
Instructions
10.1 PID_Compact
ActivateRecover Description
Mode
FALSE PID_Compact automatically switches to "Inactive" mode in the event of an error. The controller is only
activated by a falling edge at Reset or a rising edge at ModeActivate.
TRUE If the following error occurs, PID_Compact remains in the active mode:
• 0020h: Pretuning is not permitted during fine tuning.
The following errors are ignored:
• 10000h: Invalid value at ManualValue parameter.
• 20000h: Invalid value at SubstituteOutput tag.
When any other error occurs, PID_Compact cancels the tuning and switches to the mode from which tun
ing was started.
Manual mode
ActivateRecoverMode is not effective in manual mode.
If several warnings are pending simultaneously, the values of the Warning tag are displayed
with binary addition. The display of the warning 16#0000_0003, for example, indicates that
the warnings 0000_0001 and 0000_0002 are pending simultaneously.
Warning Description
(DW#16#....)
0000_0000 No warning pending.
0000_0001 The point of inflection was not found during pretuning.
0000_0004 The setpoint was limited to the configured limits.
0000_0008 Not all the necessary controlled system properties were defined for the selected method of calculation.
Instead, the PID parameters were calculated using the TIR.TuneRule = 3 method.
0000_0010 The operating mode could not be changed because Reset = TRUE or ManualEnable = TRUE.
0000_0020 The cycle time of the calling OB limits the sampling time of the PID algorithm.
Improve results by using shorter OB cycle times.
0000_0040 The process value exceeded one of its warning limits.
0000_0080 Invalid value at Mode. The operating mode is not switched.
0000_0100 The manual value was limited to the limits of the controller output.
0000_0200 The specified rule for tuning is not supported. No PID parameters are calculated.
0000_1000 The substitute output value cannot be reached because it is outside the output value limits.
PID control
258 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.1 PID_Compact
The IntegralResetMode tag determines how the integral action PIDCtrl.IntegralSum is pre-
assigned:
• When switching from "Inactive" operating mode to "Automatic mode"
• With edge TRUE -> FALSE at parameter Reset and parameter Mode = 3
This setting only works for one cycle and is only effective if the integral action is activated
(Retain.CtrlParams.Ti > 0.0 tag).
IntegralReset Description
Mode
0 Smooth
The value of PIDCtrl.IntegralSum is pre-assigned so that the switchover is bumpless, which means
"Automatic mode" starts with the output value = 0.0 (parameter Output) and there is no jump of the out
put value regardless of the control deviation (setpoint – actual value).
1 Delete
We recommend setting the weighting of the proportional action (Retain.CtrlParams.PWeighting) to 1.0 if
this option is used.
The value of PIDCtrl.IntegralSum is deleted. Any control deviation will cause a jump change of the output
value. The direction of the output value jump depends on the configured weighting of the proportional
action (Retain.CtrlParams.PWeighting tag) and the control deviation:
• Proportional action weighting = 1.0:
Output value jump and control deviation have identical signs.
Example: If the actual value is smaller than the setpoint (positive control deviation), the output value
jumps to a positive value.
• Proportional action weighting < 1.0:
For large control deviations, the output value jump and control deviation have identical signs.
Example: If the actual value is much smaller than the setpoint (positive control deviation), the output
value jumps to a positive value.
For small control deviations, the output value jump and control deviation have different signs.
Example: If the actual value is just below the setpoint (positive control deviation), the output value
jumps to a negative value. This is usually not desirable, because it results in a temporary increase in
the control deviation.
The smaller the configured weighting of the proportional action, the greater the control deviation
must be to receive an output value jump with identical sign.
We recommend setting the weighting of the proportional action (Retain.CtrlParams.PWeighting) to 1.0
when this option is used. Otherwise, you may experience the undesirable behavior described for small
control deviations. Alternatively, you can also use IntegralResetMode = 4. This option guarantees identical
signs of the output value jump and control deviation independent of the configured weighting of the pro
portional action and the control deviation.
2 Hold
The value of PIDCtrl.IntegralSum is not changed. You can define a new value using the user program.
3 Pre-assign
The value of PIDCtrl.IntegralSum is automatically pre-assigned as if Output = OverwriteInitialOutputValue
in the last cycle.
4 Like setpoint change (only for PID_Compact with version ≥ 2.3)
The value of PIDCtrl.IntegralSum is automatically pre-assigned so that a similar output value jump results
as for a PI controller in automatic mode in case of a setpoint change from the current actual value to the
current setpoint.
Any control deviation will cause a jump of the output value. Output value jump and control deviation have
identical signs.
Example: If the actual value is smaller than the setpoint (positive control deviation), the output value
jumps to a positive value. This is independent of the configured weighting of the proportional action and
the control deviation.
PID control
Function Manual, 11/2023, A5E35300227-AG 259
Instructions
10.1 PID_Compact
If IntegralResetMode is assigned a value outside the valid value range, PID_Compact behaves
as with the pre-assignment of IntegralResetMode:
• PID_Compact up to V2.2: IntegralResetMode = 1
• PID_Compact as of V2.3: IntegralResetMode = 4
All statements made above regarding the sign of the output value jump are based on a
normal control logic (Config.InvertControl = FALSE tag). With an inverted control logic
(Config.InvertControl = TRUE), the output value jump will have a reverse sign.
In the following example, you are controlling temperature values with the technology object
of the instruction "PID_Compact". The temperature values are simulated based on a block
which simulates a delay element of the third order (PT3 element). The PID parameters of the
technology object can be set automatically via the pretuning.
TFUQPJOU 1*%@$PNQBDU PVUQVU7BMVF 4-*@130$@$ JOQVU7BMVF
6HWSRLQW &RQWUROOHUV 0DQLSXODWHG &RQWUROOHG 3URFHVVYDOXH
YDULDEOH
V\VWHP
3URFHVVYDOXH
Data storage
Create seven tags in a global data block for storage of the interconnection data.
PID control
260 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.1 PID_Compact
Network 2: You interconnect the parameters of the block simulating the temperature values
"SLI_PROC_C" as follows.
PID control
Function Manual, 11/2023, A5E35300227-AG 261
Instructions
10.1 PID_Compact
Technology object
You configure the technology object with the properties of the instruction "PID_Compact" or
by using the path Technology object > Configuration. The controller type and the
input/output parameters are important for the example. With the controller type, you make a
preselection for the unit of the value to the controlled. In this example, "Temperature" with
the unit "°C" is used as controller type. The parameters of the "PID_Compact" are already
interconnected with global tags. Therefore, the information on use of the parameters Input
and Output is sufficient.
PID control
262 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.1 PID_Compact
3. Pretuning is selected.
Click the "Start" button in the "Tuning mode" area.
A pretuning is performed. The PID parameters are automatically adjusted to the process.
After the completion of the pretuning PID_Compact switches to automatic mode.
NOTE
Alternative to start PID_Compact
Alternatively, you can switch PID_Compact to automatic mode in the "Online status of
controller" area with the "Stop PID_Compact" / "Start PID_Compact" without pretuning. In
this case the controller uses default values for the PID parameters and shows a worse
controller behavior for the application case.
The instruction "PID_Compact" exits the control and outputs the value "0.0" as
manipulated variable.
2. Click the "Stop" button in the "Measurement" area.
3. To set the process value immediately to the value "0.0", follow these steps:
In the block "SLI_OB_PID_Compact", set the "resetAll" tag to the value "TRUE", and then to
the value "FALSE".
PID control
Function Manual, 11/2023, A5E35300227-AG 263
Instructions
10.1 PID_Compact
"PID_Compact" instruction
The setpoint for the temperature that is to be controlled is specified at the parameter
Setpoint ("setpoint"). The control is started when the instruction "PID_Compact" was started
with the technology object. The instruction "PID_Compact" outputs a manipulated variable at
the output parameter Output ("outputValue"). The process value of the temperature is
transferred to the instruction "PID_Compact" with the input parameter Input ("inputValue").
The instruction "PID_Compact" adjusts the manipulated variable ("outputValue") depending
on the history of the difference between setpoint ("setpoint") and process value
("inputValue") . The process is repeated so that the process value ("inputValue") approaches
the setpoint ("setpoint") through the manipulated variable ("outputValue").
The current operating mode of the instruction "PID_Compact" is displayed at the output
parameter State ("state"). After pretuning (the value of "state" is "1"), the PID_Compact
switches to automatic mode (the value is "3").
The output parameter Error ("error") currently shows that no error is pending. The output
parameter ErrorBits ("errorBits") provides information on the error type in case of error. If an
error occurs, this can be acknowledged in the technology object, in the optimization status
area with the "ErrorAck" button.
PID control
264 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.1 PID_Compact
"SLI_PROC_C" block
The "SLI_PROC_C" block simulates the process value ("inputValue") of the rising temperature
of a plant. The block "SLI_PROC_C" contains the manipulated variable of the controller
("outputValue) and simulates the temperature behavior of the process. This temperature is
fed as process value ("inputValue") into the controller.
A change in the values of the "resetAll" tag (of the comRst parameter) has the following
effects:
PID control
Function Manual, 11/2023, A5E35300227-AG 265
Instructions
10.1 PID_Compact
Program code
You can find additional information about the program code for the above-named example
under the keyword "Sample Library for Instructions".
10.1.5 PID_Compact V1
Description
The PID_Compact instruction provides a PID controller with integrated tuning for automatic
and manual mode.
Call
PID_Compact is called in the constant interval of the cycle time of the calling OB (preferably in
a cyclic interrupt OB).
Download to device
The actual values of retentive tags are only updated when you download PID_Compact
completely.
Downloading technology objects to device (Page 46)
Startup
At the startup of the CPU, PID_Compact starts in the operating mode that was last active. To
retain PID_ Compact in "Inactive" mode, set sb_RunModeByStartup = FALSE.
PID control
266 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.1 PID_Compact
During controller tuning and in automatic mode, PID_Compact 1.0 is set to "Inactive"
operating mode under the following conditions:
• New mean value >= 1.1 x old mean value
• New mean value <= 0.9 x old mean value
• Current sampling time >= 1.5 x current mean value
• Current sampling time <= 0.5 x current mean value
PID algorithm
PID_Compact is a PIDT1 controller with anti-windup and weighting of the proportional and
derivative actions. The following equation is used to calculate the output value.
5%wT
Z,Q < CwXY 5*wT
XY
Bw5%wT
DwXY >
Symbol Description
y Output value
Kp Proportional gain
s Laplace operator
b Proportional action weighting
w Setpoint
x Process value
TI Integration time
a Derivative delay coefficient (T1 = a × TD)
Derivative action time
c Derivative action weighting
PID control
Function Manual, 11/2023, A5E35300227-AG 267
Instructions
10.1 PID_Compact
C@*OQVU@1&3@0O
$31@*/ 4DBMF 17@"-3. *OQVU8BSOJOH@)
*OQVU@1&3
*OQVU8BSOJOH@-
*OQVU
1*%5
"OUJ8JOEVQ
-JNJU
4FUQPJOU
*/7 C@*OW$USM
0VUQVU
.BOVBM&OBCMF
-JNJU $31@065
.BOVBM7BMVF 0VUQVU@1&3
18.
0VUQVU@18.
4FUQPJOU X C
"OUJXJOEVQ
,1
-*.*5 * Z
4DBMFE*OQVU Y %5
PID control
268 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.1 PID_Compact
Control logic
An increase of the output value is generally intended to cause an increase in the process
value. This is referred to as a normal control logic. For cooling and discharge control systems,
it may be necessary to invert the control logic. PID_Compact does not work with negative
proportional gain. If InvertControl = TRUE, an increasing control deviation causes a reduction
in the output value. The control logic is also taken into account during pretuning and fine
tuning.
See also
Control mode V1 (Page 95)
Table 10-4
Parameter Data type Default Description
Setpoint REAL 0.0 Setpoint of the PID controller in automatic mode
Input REAL 0.0 A variable of the user program is used as source for the process value.
If you are using parameter Input, then
sPid_Cmpt.b_Input_PER_On = FALSE must be set.
Input_PER WORD W#16#0 Analog input as the source of the process value
If you are using parameter Input_PER, then
sPid_Cmpt.b_Input_PER_On = TRUE must be set.
ManualEnable BOOL FALSE • A FALSE -> TRUE edge selects "Manual mode", while State = 4,
sRet.i_Mode remains unchanged.
• A TRUE -> FALSE edge selects the most recently active operating
mode, State =sRet.i_Mode.
A change of sRet.i_Mode will not take effect during ManualEnable =
TRUE. The change of sRet.i_Mode will only be considered upon a
TRUE -> FALSE edge at ManualEnable .
PID_Compact V1.2 and PID_Compact V1.0
If at start of the CPU ManualEnable = TRUE, PID_Compact starts in manu
al mode. A rising edge (FALSE > TRUE) at ManualEnable is not neces
sary.
PID_Compact V1.1
At the start of the CPU, PID_Compact only switches to manual mode
with a rising edge (FALSE->TRUE) at ManualEnable . Without rising
edge, PID_Compact starts in the last operating mode in which
ManualEnable was FALSE.
ManualValue REAL 0.0 Manual value
This value is used as the output value in manual mode.
Reset BOOL FALSE The Reset parameter (Page 278) restarts the controller.
PID control
Function Manual, 11/2023, A5E35300227-AG 269
Instructions
10.1 PID_Compact
Table 10-5
Parameter Data type Default Description
ScaledInput REAL 0.0 Output of the scaled process value
Outputs "Output", "Output_PER", and "Output_PWM" can be used concurrently.
Output REAL 0.0 Output value in REAL format
Output_PER WORD W#16#0 Analog output value
Output_PWM BOOL FALSE Pulse-width-modulated output value
The output value is formed by minimum On and Off times.
SetpointLimit_H BOOL FALSE If SetpointLimit_H = TRUE, the setpoint absolute high limit is reached.
The setpoint in the CPU is limited to the configured setpoint absolute
high limit. The configured process value absolute high limit is the
default for the setpoint high limit.
If you set sPid_Cmpt.r_Sp_Hlm to a value within the process value lim
its, this value is used as the setpoint high limit.
SetpointLimit_L BOOL FALSE If SetpointLimit_L = TRUE, the setpoint absolute low limit has been
reached. In the CPU, the setpoint is limited to the configured setpoint
absolute low limit. The configured process value absolute low limit is
the default setting for the setpoint low limit.
If you set sPid_Cmpt.r_Sp_Llm to a value within the process value lim
its, this value is used as the setpoint low limit.
InputWarning_H BOOL FALSE If InputWarning_H = TRUE, the process value has reached or exceeded
the warning high limit.
InputWarning_L BOOL FALSE If InputWarning_L = TRUE, the process value has reached or fallen
below the warning low limit.
State INT 0 The State parameter (Page 275) shows the current operating mode of
the PID controller. To change the operating mode, use variable
sRet.i_Mode.
• State = 0: Inactive
• State = 1: pretuning
• State = 2: fine tuning
• State = 3: Automatic mode
• State = 4: Manual mode
Error DWORD W#16#0 The Error parameter (Page 277) indicates the error messages.
Error = 0000: No error pending.
PID control
270 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.1 PID_Compact
NOTE
You must not change tags that are not listed. These are used for internal purposes only.
Change the tags identified with (1) only in "Inactive" mode to prevent malfunction of the PID
controller. "Inactive" mode is forced by setting the "sRet.i_Mode" tag to "0".
Table 10-6
Tag Data type Default Description
sb_GetCycleTime BOOL TRUE If sb_GetCycleTime = TRUE, the automatic determina
tion of the cycle time is started.
CycleTime.StartEstimation = FALSE once measurement
is complete.
sb_EnCyclEstimation BOOL TRUE If sb_EnCyclEstimation = TRUE, the PID_Compact
sampling time is calculated.
sb_EnCyclMonitoring BOOL TRUE If sb_EnCyclMonitoring = FALSE, the PID_Compact
sampling time is not monitored. If it is not possible to
execute PID_Compact within the sampling time, an
0800 error is not output and PID_Compact does not
change to "Inactive" mode.
sb_RunModeByStartup BOOL TRUE Activate Mode after CPU restart
If sb_RunModeByStartup = FALSE, the controller
remains inactive after a CPU startup.
If sb_RunModeByStartup = TRUE, the controller returns
to the last active operating mode after a CPU restart.
si_Unit INT 0 Unit of measurement of the process value and set
point, e.g., ºC, or ºF.
si_Type INT 0 Physical quantity of the process value and setpoint,
e.g., temperature.
sd_Warning DWORD DW#16#0 Variable sd_warning (Page 279) displays the warnings
generated since the reset, or since the last change of
the operating mode.
sBackUp.r_Gain REAL 1.0 Saved proportional gain
You can reload values from the sBackUp structure with
sPid_Cmpt.b_LoadBackUp = TRUE.
sBackUp.r_Ti REAL 20.0 Saved integral action time [s]
sBackUp.r_Td REAL 0.0 Saved derivative action time [s]
sBackUp.r_A REAL 0.0 Saved derivative delay coefficient
sBackUp.r_B REAL 0.0 Saved proportional action weighting factor
sBackUp.r_C REAL 0.0 Saved derivative action weighting factor
sBackUp.r_Cycle REAL 1.0 Saved sampling time of PID algorithm
sPid_Calc.r_Cycle(1) REAL 0.1 Sampling time of the PID_Compact instruction
r_Cycle is determined automatically and is usually
equivalent to the cycle time of the calling OB.
PID control
Function Manual, 11/2023, A5E35300227-AG 271
Instructions
10.1 PID_Compact
PID control
272 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.1 PID_Compact
PID control
Function Manual, 11/2023, A5E35300227-AG 273
Instructions
10.1 PID_Compact
PID control
274 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.1 PID_Compact
See also
Downloading technology objects to device (Page 46)
NOTE
You wish to repeat successful fine tuning without exiting automatic mode with
i_Mode = 0.
Setting sRet.i_Mode to an invalid value such as 9999 for one cycle has no effect on State.
Set Mode = 2 in the next cycle. You can generate a change to sRet.i_Mode without first
switching to "inactive" mode.
PID control
Function Manual, 11/2023, A5E35300227-AG 275
Instructions
10.1 PID_Compact
Meaning of values
PID control
276 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.1 PID_Compact
See also
Output parameters of PID_Compact V1 (Page 270)
Pretuning V1 (Page 106)
Fine tuning V1 (Page 107)
"Manual" mode V1 (Page %getreference)
Tag i_Event_SUT V1 (Page 280)
Tag i_Event_TIR V1 (Page 280)
If several errors are pending simultaneously, the values of the error codes are displayed with
binary addition. The display of error code 0003, for example, indicates that the errors 0001
and 0002 are pending simultaneously.
Error Description
(DW#16#...)
0000 There is no error.
0001 The "Input" parameter is outside the process value limits.
• Input > sPid_Cmpt.r_Pv_Hlm or
• Input < sPid_Cmpt.r_Pv_Llm
You cannot move the actuator again until you eliminate the error.
0002 Invalid value at "Input_PER" parameter. Check whether an error is pending at the analog input.
0004 Error during fine tuning. Oscillation of the process value could not be maintained.
0008 Error at start of pretuning. The process value is too close to the setpoint. Start fine tuning.
0010 The setpoint was changed during tuning.
0020 Pretuning is not permitted in automatic mode or during fine tuning.
PID control
Function Manual, 11/2023, A5E35300227-AG 277
Instructions
10.1 PID_Compact
Error Description
(DW#16#...)
0080 Error during pretuning. The output value limits are not configured correctly or the actual value does not
react as expected.
Check whether the limits of the output value are configured correctly and match the control logic.
Also make sure that the actual value does not oscillate strongly before starting pretuning.
0100 Error during tuning resulted in invalid parameters.
0200 Invalid value at "Input" parameter: Value has an invalid number format.
0400 Calculation of output value failed. Check the PID parameters.
0800 Sampling time error: PID_Compact is not called within the sampling time of the cyclic interrupt OB.
If this error occurred during simulation with PLCSIM, see the notes under Simulating PID_Compact V1 with
PLCSIM (Page 110).
1000 Invalid value at "Setpoint" parameter: Value has an invalid number format.
See also
Output parameters of PID_Compact V1 (Page 270)
The response to Reset = TRUE depends on the version of the PID_Compact instruction.
U NT
U NT
4UBUF
U NT
① Activation
② Error
③ Reset
PID control
278 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.1 PID_Compact
U NT
U NT
4UBUF
U NT
① Activation
② Error
③ Reset
If several warnings are pending, the values of variable sd_warning are displayed by means of
binary addition. The display of warning 0003, for example, indicates that the warnings 0001
and 0002 are also pending.
sd_warning Description
(DW#16#....)
0000 No warning pending.
0001 The point of inflection was not found during pretuning.
0002 Oscillation increased during fine tuning.
0004 The setpoint was outside the set limits.
0008 Not all the necessary controlled system properties were defined for the selected method of calculation. The
PID parameters were instead calculated using the "i_CtrlTypeTIR = 3" method.
0010 The operating mode could not be changed because ManualEnable = TRUE.
0020 The cycle time of the calling OB limits the sampling time of the PID algorithm.
Improve results by using shorter OB cycle times.
0040 The process value exceeded one of its warning limits.
PID control
Function Manual, 11/2023, A5E35300227-AG 279
Instructions
10.1 PID_Compact
The following warnings are deleted as soon as the cause is dealt with:
• 0004
• 0020
• 0040
All other warnings are cleared with a rising edge at Reset.
See also
Static tags of PID_Compact V1 (Page 271)
Parameters State and sRet.i_Mode V1 (Page 275)
See also
Static tags of PID_Compact V1 (Page 271)
Parameters State and sRet.i_Mode V1 (Page 275)
PID control
280 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.2 PID_3Step
10.2 PID_3Step
PID_3Step V2.3
• As of PID_3Step Version 2.3 the monitoring and limiting of the travel time can be
deactivated with Config.VirtualActuatorLimit = 0.0.
PID_3Step V2.2
• Use with S7-1200
As of PID_3Step V2.2, the instruction with V2 functionality can also be used on S7-1200
with firmware version 4.0 or higher.
PID_3Step V2.0
• Reaction to error
The reaction to ActivateRecoverMode = TRUE has been completely overhauled. PID_3Step
reacts in a more fault tolerant manner in the default setting.
NOTICE
Your system may be damaged.
If you use the default setting, PID_3Step remains in automatic mode even if the process
value limits are exceeded. This may damage your system.
It is essential to configure how your controlled system reacts in the event of an error to
protect your system from damage.
You use the ErrorAck input parameter to acknowledge the errors and warnings without
restarting the controller or clearing the integral action.
Switching operating modes does not acknowledge errors that are no longer pending.
• Switching the operating mode
You specify the operating mode at the Mode in/out parameter and use a positive edge at
ModeActivate to start the operating mode. The Retain.Mode tag has been omitted.
The transition time measurement can no longer be started with GetTransitTime.Start, but
only with Mode = 6 and a positive edge at ModeActivate.
• Multi-instance capability
You can call up PID_3Step as multi-instance DB.
• Startup characteristics
The operating mode specified at the Mode parameter is also started on a negative edge at
Reset and during a CPU cold restart, if RunModeByStartup = TRUE.
• ENO characteristics
ENO is set depending on the operating mode.
If State = 0, then ENO = FALSE.
If State ≠ 0, then ENO = TRUE.
PID control
Function Manual, 11/2023, A5E35300227-AG 281
Instructions
10.2 PID_3Step
• Manual mode
The Manual_UP and Manual_DN input parameters no longer function as edge-triggered
parameters. Edge-triggered manual mode continues to be possible using the
ManualUpInternal and ManualDnInternal tags.
In "Manual mode without endstop signals" (Mode = 10), the endstop signals Actuator_H
and Actuator_L are ignored even though they are activated.
• Default value of PID parameters
The following default settings have been changed:
– Proportional action weighting (PWeighting) from 0.0 to 1.0
– Derivative action weighting (DWeighting) from 0.0 to 1.0
– Coefficient for derivative delay (TdFiltRatio) from 0.0 to 0.2
• Limiting of motor transition time
You configure the maximum percentage of the motor transition time that the actuator will
travel in one direction in the Config.VirtualActuatorLimit tag.
• Setpoint value specification during tuning
You configure the permitted fluctuation of the setpoint during tuning at the
CancelTuningLevel tag.
• Switching a disturbance variable on
You can switch a disturbance variable on at the Disturbance parameter.
• Troubleshooting
If the endstop signals are not activated (ActuatorEndStopOn = FALSE), ScaledFeedback is
determined without Actuator_H or Actuator_L.
PID_3Step V1.1
• Manual mode on CPU startup
If ManualEnable = TRUE when the CPU starts, PID_3Step starts in manual mode. A positive
edge at ManualEnable is not necessary.
• Reaction to error
The ActivateRecoverMode tag is no longer effective in manual mode.
• Troubleshooting
The Progress tag is reset following successful tuning or transition time measurement.
CPU FW PID_3Step
S7-1200 V4.2 or higher V2.3
V2.2
V1.1
V4.0 to V4.1 V2.2
V1.1
V3.x V1.1
V1.0
V2.x V1.1
V1.0
PID control
282 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.2 PID_3Step
CPU FW PID_3Step
S7-1200 V1.x -
S7-1500 V3.0 or higher V2.3
V2.0 to V2.9 V2.3
V2.2
V2.1
V2.0
V1.5 to V1.8 V2.2
V2.1
V2.0
V1.1 V2.1
V2.0
V1.0 V2.0
PID control
Function Manual, 11/2023, A5E35300227-AG 283
Instructions
10.2 PID_3Step
CPU FW Typ. CPU processing time Typ. CPU processing time pre-
Automatic mode tuning and fine tuning
CPU 1211 ≥ V4.0 260 µs 310 µs
CPU 1212
CPU 1214
CPU 1215
CPU 1217
CPU 1510SP ≤ V2.9 80 µs 95 µs
CPU 1511
CPU 1511C
CPU 1512C
CPU 1512SP
CPU 1513
CPU 1515 70 µs 80 µs
CPU 1516
CPU 1517 Every 11 µs 15 µs
CPU 1518 5 µs 7 µs
CPU 1510SP ≥ V3.0 65 µs 85 µs
CPU 1511
CPU 1511C
CPU 1512C
CPU 1512SP
CPU 1513
CPU 1514SP
CPU 1515 50 µs 70 µs
CPU 1516
Typical CPU processing times of the PID_3Step technology object as of Version V2.0,
depending on the CPU type and operating mode for R-CPUs in the RUN-Redundant system
state.
CPU FW Typ. CPU processing time Typ. CPU processing time pre-
Automatic mode tuning and fine tuning
CPU 1513R ≥ V3.0 110 µs 150 µs
CPU 1515R 85 µs 100 µs
PID control
284 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.2 PID_3Step
Memory requirement
Memory requirement of an instance DB of the PID_3Step technology object as of Version
V2.0.
10.2.4 PID_3Step V2
Description
You use the PID_3Step instruction to configure a PID controller with self tuning for valves or
actuators with integrating behavior.
The following operating modes are possible:
• Inactive
• Pretuning
• Fine tuning
• Automatic mode
• Manual mode
• Approach substitute output value
• Transition time measurement
• Error monitoring
• Approach substitute output value with error monitoring
• Manual mode without endstop signals
For a more detailed description of the operating modes, see the State parameter.
PID control
Function Manual, 11/2023, A5E35300227-AG 285
Instructions
10.2 PID_3Step
PID algorithm
PID_3Step is a PIDT1 controller with anti-windup and weighting of the proportional and
derivative actions. The PID algorithm operates according to the following equation:
7'ÃV
¨\ .SÃVÃ > EÃZ[ 7,ÃV
Z[
DÃ7'ÃV
FÃZ[ @
Δy Output value of the PID algorithm
Kp Proportional gain
s Laplace operator
b Proportional action weighting
w Setpoint
x Process value
TI Integration time
TD Derivative action time
a Derivative delay coefficient (derivative delay T1 = a × TD)
c Derivative action weighting
*OQVU8BSOJOH@-
*OQVU1FS0O
"OUJ8JOEVQ
$31@*/ 4DBMF
*OQVU@1&3
'BD
*OQVU 1*%5 *OU
"OUJ8JOEVQ
ǡW
-JNJU
4FUQPJOU
0VUQVU1FS0O
%
%JTUVSCBODF
0VUQVU1FS0O .BOVBM&OBCMF
.BOVBM7BMVF '"$
-JNJU 3PD@-JN
0VUQVU6QQFS-JNJU
0VUQVU-PXFS-JNJU 4UBUF
$31@065
0VUQVU@1&3
.BOVBM@%/ .BOVBM@61
ࣣ
"EFBE@#
4UBUF
4UBUF .BOVBM@61
0VUQVU@61
.BOVBM61*OUFSOBM ࣣ
1VMTF0VU
5IS4UQ ࣣ
.BOVBM%/*OUFSOBM
0VUQVU@%/
ࣣ .BOVBM@%/ ࣣ
4UBUF
PID control
286 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.2 PID_3Step
17@"-3. *OQVU8BSOJOH@)
*OQVU1FS0O *OQVU8BSOJOH@-
$31@*/ 4DBMF
*OQVU@1&3 "OUJ8JOEVQ
*OU
*OQVU 1*%5
"OUJ8JOEVQ ࣣ -JNJU 'BD
-JNJU
4FUQPJOU
4UBUF 7
%
%JTUVSCBODF
.BOVBM7BMVF
'FFECBDL1FS0O
$31@*/ 4DBMF
'FFECBDL@1&3
'FFECBDL
.BOVBM@61
0VUQVU6QQFS-JNJU
0VUQVU-PXFS-JNJU 4UBUF
$31@065
0VUQVU1FS0O 0VUQVU@1&3
.BOVBM@%/
ࣣ
"EFBE@#
4UBUF
.BOVBM@61
4UBUF
ࣣ 0VUQVU@61
.BOVBM61*OUFSOBM
1VMTF0VU
5IS4UQ
.BOVBM%/*OUFSOBM ࣣ
0VUQVU@%/
ࣣ
.BOVBM@%/ ࣣ
4UBUF
PID control
Function Manual, 11/2023, A5E35300227-AG 287
Instructions
10.2 PID_3Step
C
4FUQPJOU X
%5 % ,1
D ǡZ
%FBE@#
5J *
4DBMFE*OQVU Y
'BD5U "OUJ8JOEVQ
Call
PID_3Step is called in the constant time scale of a cyclic interrupt OB.
Download to device
The actual values of retentive tags are only updated when you download PID_3Step
completely.
Downloading technology objects to device (Page 46)
Startup
When the CPU starts up, PID_3Step starts in the operating mode that is saved in the Mode
in/out parameter. To retain PID_3Step in "Inactive" mode, set RunModeByStartup = FALSE.
PID control
288 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.2 PID_3Step
PID control
Function Manual, 11/2023, A5E35300227-AG 289
Instructions
10.2 PID_3Step
PID control
290 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.2 PID_3Step
NOTE
Use with two or more actuators
PID_3 Step is not suitable for use with two or more actuators (for example, in heating/cooling
applications), because different actuators need different PID parameters to achieve a good
control response.
PID control
Function Manual, 11/2023, A5E35300227-AG 291
Instructions
10.2 PID_3Step
If you deactivate the sampling time monitoring (CycleTime.EnMonitoring = FALSE), you can
also call PID_3Step in OB1. You must then accept a lower control quality due to the deviating
sampling time.
Control logic
An increase of the output value is generally intended to cause an increase in the process
value. This is referred to as a normal control logic. For cooling and discharge control systems,
it may be necessary to invert the control logic. PID_3Step does not work with negative
proportional gain. If InvertControl = TRUE, an increasing control deviation causes a reduction
in the output value. The control logic is also taken into account during pretuning and fine
tuning.
See also
Configuring PID_3Step V1 (Page 129)
PID control
292 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.2 PID_3Step
The following table shows what has changed in the PID_3Step instruction interface.
The names of the following parameters apply both to the data block and to access via the
Openness API.
Table 10-7
Parameter Data type Default Description
Setpoint REAL 0.0 Setpoint of the PID controller in automatic mode
Input REAL 0.0 A tag of the user program is used as source for the process
value.
If you are using parameter Input, then
Config.InputPerOn = FALSE must be set.
Input_PER INT 0 An analog input is used as the source of the process value.
If you are using parameter Input_PER, then
Config.InputPerOn = TRUE must be set.
Actuator_H BOOL FALSE Digital position feedback of the valve for the high endstop
If Actuator_H = TRUE, the valve is at the high endstop and is no
longer moved towards this direction.
PID control
Function Manual, 11/2023, A5E35300227-AG 293
Instructions
10.2 PID_3Step
PID control
294 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.2 PID_3Step
The names of the following parameters apply both to the data block and to access via the
Openness API.
Table 10-8
Parameter Data type Default Description
ScaledInput REAL 0.0 Scaled process value
ScaledFeedback REAL 0.0 Scaled position feedback
For an actuator without position feedback, the position of the
actuator indicated by ScaledFeedback is very imprecise.
ScaledFeedback may only be used for rough estimation of the
current position in this case.
Output_UP BOOL FALSE Digital output value for opening the valve
If Config.OutputPerOn = FALSE, the Output_UP parameter is
used.
Output_DN BOOL FALSE Digital output value for closing the valve
If Config.OutputPerOn = FALSE, the Output_DN parameter is
used.
Output_PER INT 0 Analog output value
If Config.OutputPerOn = TRUE, Output_PER is used.
Use Output_PER if you are using a valve as actuator which is
triggered via an analog output and controlled with a continu
ous signal, e.g. 0...10 V or 4...20 mA.
The value at Output_PER corresponds to the target position of
the valve, e.g. Output_PER = 13824, when the valve is to be
opened by 50%.
SetpointLimit_H BOOL FALSE If SetpointLimit_H = TRUE, the absolute setpoint high limit is
reached (Setpoint ≥ Config.SetpointUpperLimit).
The setpoint is limited to Config.SetpointUpperLimit .
PID control
Function Manual, 11/2023, A5E35300227-AG 295
Instructions
10.2 PID_3Step
See also
State and Mode V2 parameters (Page 305)
ErrorBits V2 parameter (Page 310)
The names of the following parameters apply both to the data block and to access via the
Openness API.
Table 10-9
Parameter Data type Default Description
Mode INT 4 At the Mode parameter, you specify the operating mode to
which PID_3Step is to switch. Options are:
• Mode = 0: Inactive
• Mode = 1: Pretuning
• Mode = 2: Fine tuning
• Mode = 3: Automatic mode
• Mode = 4: Manual mode
• Mode = 6: Transition time measurement
• Mode = 10: Manual mode without endstop signals
PID control
296 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.2 PID_3Step
NOTE
Change the tags identified with (1) only in "Inactive" mode to prevent malfunction of the PID
controller.
The names of the following variables apply both to the data block and to access via the
Openness API.
Tag Data type Default Description
ManualUpInternal BOOL FALSE In manual mode, each rising edge opens the valve by 5% of the total
control range or for the duration of the minimum motor transition
time. ManualUpInternal is only evaluated if you are not using
Output_PER or a position feedback. This tag is used in the commis
sioning dialog.
ManualDnInternal BOOL FALSE In manual mode, every rising edge closes the valve by 5% of the
total control range or for the duration of the minimum motor trans
ition time. ManualDnInternal is only evaluated if you are not using
Output_PER or position feedback. This tag is used in the commission
ing dialog.
ActivateRecoverMode BOOL TRUE The ActivateRecoverMode V2 (Page 312) tag determines the reac
tion to error.
RunModeByStartup BOOL TRUE Activate operating mode at Mode parameter after CPU restart
If RunModeByStartup = TRUE, PID_3Step starts in the operating
mode saved in the Mode parameter after CPU startup.
If RunModeByStartup = FALSE, PID_3Step remains in "Inactive" mode
after CPU startup.
LoadBackUp BOOL FALSE If LoadBackUp = TRUE, the last set of PID parameters is reloaded. The
set was saved prior to the last tuning. LoadBackUp is automatically
set back to FALSE.
PhysicalUnit INT 0 Unit of measurement of the process value and setpoint, e.g., ºC, or
ºF.
PhysicalUnit serves the display in the editors and has no influence on
the behavior of the control algorithm in the CPU.
When importing PID_3Step via the Openness API, PhysicalUnit is
reset to the default value.
PID control
Function Manual, 11/2023, A5E35300227-AG 297
Instructions
10.2 PID_3Step
PID control
298 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.2 PID_3Step
PID control
Function Manual, 11/2023, A5E35300227-AG 299
Instructions
10.2 PID_3Step
PID control
300 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.2 PID_3Step
PID control
Function Manual, 11/2023, A5E35300227-AG 301
Instructions
10.2 PID_3Step
PID control
302 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.2 PID_3Step
PID control
Function Manual, 11/2023, A5E35300227-AG 303
Instructions
10.2 PID_3Step
PID control
304 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.2 PID_3Step
See also
State and Mode V2 parameters (Page 305)
Tag ActivateRecoverMode V2 (Page 312)
Downloading technology objects to device (Page 46)
Meaning of values
PID control
Function Manual, 11/2023, A5E35300227-AG 305
Instructions
10.2 PID_3Step
PID control
306 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.2 PID_3Step
ENO characteristics
If State = 0, then ENO = FALSE.
If State ≠ 0, then ENO = TRUE.
PID control
Function Manual, 11/2023, A5E35300227-AG 307
Instructions
10.2 PID_3Step
PID control
308 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.2 PID_3Step
*OBDUJWF &SSPSNPOJUPSJOH
&SSPS#FIBWJPVS'"-4& &SSPS#FIBWJPVS'"-4&
"DUJWBUF3FDPWFS.PEF'"-4& "DUJWBUF3FDPWFS.PEF536&
"VUPNBUJDNPEF
&SSPS#FIBWJPVS536& &SSPS#FIBWJPVS536&
"DUJWBUF3FDPWFS.PEF'"-4& "DUJWBUF3FDPWFS.PEF536&
"QQSPBDITVCTUJUVUFPVUQVUWBMVF "QQSPBDITVCTUJUVUFPVUQVUWBMVF
XJUIFSSPSNPOJUPSJOH
See also
Tag ActivateRecoverMode V2 (Page 312)
ErrorBits V2 parameter (Page 310)
PID control
Function Manual, 11/2023, A5E35300227-AG 309
Instructions
10.2 PID_3Step
If several errors are pending simultaneously, the values of the ErrorBits are displayed with
binary addition. The display of ErrorBits = 16#0000_0003, for example, indicates that the
errors 16#0000_0001 and 16#0000_0002 are pending simultaneously.
If there is a position feedback, PID_3Step uses ManualValue as output value in manual mode.
The exception is Errorbits = 16#0001_0000.
ErrorBits Description
(DW#16#...)
0000_0000 There is no error.
0000_0001 The "Input" parameter is outside the process value limits.
• Input > Config.InputUpperLimit or
• Input < Config.InputLowerLimit
If automatic mode was active before the error occurred and ActivateRecoverMode = TRUE, PID_3Step
remains in automatic mode.
If pretuning, fine tuning, or transition time measurement mode and ActivateRecoverMode = TRUE were
active before the error occurred, PID_3Step switches to the operating mode that is saved in the Mode
parameter.
0000_0002 Invalid value at "Input_PER" parameter. Check whether an error is pending at the analog input.
If automatic mode was active before the error occurred and ActivateRecoverMode = TRUE, PID_3Step
switches to "Approach substitute output value with error monitoring" or "Error monitoring" mode. As soon
as the error is no longer pending, PID_3Step switches back to automatic mode.
If pretuning, fine tuning, or transition time measurement mode and ActivateRecoverMode = TRUE were
active before the error occurred, PID_3Step switches to the operating mode that is saved in the Mode
parameter.
0000_0004 Error during fine tuning. The oscillation of the process value could not be maintained.
If ActivateRecoverMode = TRUE before the error occurred, PID_3Step cancels the tuning and switches to
the operating mode that is saved in the Mode parameter.
0000_0010 The setpoint was changed during tuning.
You can set the permitted fluctuation of the setpoint at the CancelTuningLevel tag.
If ActivateRecoverMode = TRUE before the error occurred, PID_3Step cancels the tuning and switches to
the operating mode that is saved in the Mode parameter.
0000_0020 Pretuning is not permitted during fine tuning.
If ActivateRecoverMode = TRUE before the error occurred, PID_3Step remains in fine tuning mode.
0000_0080 Error during pretuning. The output value limits are not configured correctly or the process value is not
reacting as expected.
Make sure that:
• The limits of the output value are configured correctly and match the control logic.
• It is possible to change the output value so that the process value approaches the setpoint. The output
value is not already limited by the corresponding output value limit before the start of pretuning and
the actuator has not yet reached the corresponding endstop.
Example: With normal control logic and a process value that is below the setpoint, the output value
must not have reached the high limit and the actuator must not have reached the high endstop before
the start of the pretuning.
• The process value does not show a strong oscillation before the start of the pretuning.
If ActivateRecoverMode = TRUE before the error occurred, PID_3Step cancels the tuning and switches to
the operating mode that is saved in the Mode parameter.
0000_0100 Error during fine tuning resulted in invalid parameters.
If ActivateRecoverMode = TRUE before the error occurred, PID_3Step cancels the tuning and switches to
the operating mode that is saved in the Mode parameter.
PID control
310 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.2 PID_3Step
ErrorBits Description
(DW#16#...)
0000_0200 Invalid value at "Input" parameter: Value has an invalid number format.
If automatic mode was active before the error occurred and ActivateRecoverMode = TRUE, PID_3Step
switches to "Approach substitute output value with error monitoring" or "Error monitoring" mode. As soon
as the error is no longer pending, PID_3Step switches back to automatic mode.
If pretuning, fine tuning, or transition time measurement mode and ActivateRecoverMode = TRUE were
active before the error occurred, PID_3Step switches to the operating mode that is saved in the Mode
parameter.
0000_0400 Calculation of output value failed. Check the PID parameters.
If automatic mode was active before the error occurred and ActivateRecoverMode = TRUE, PID_3Step
switches to "Approach substitute output value with error monitoring" or "Error monitoring" mode. As soon
as the error is no longer pending, PID_3Step switches back to automatic mode.
If pretuning, fine tuning, or transition time measurement mode and ActivateRecoverMode = TRUE were
active before the error occurred, PID_3Step switches to the operating mode that is saved in the Mode
parameter.
0000_0800 Sampling time error: PID_3Step is not called within the sampling time of the cyclic interrupt OB.
It is recommended to call PID_3Step in a cyclic interrupt OB without conditions and to activate or deactiv
ate it via the operating mode at the Mode parameter. Conditional calls or the call in OB1 can have a neg
ative effect on the control quality.
Monitoring of the sampling time can be disabled with CycleTime.EnMonitoring = FALSE.
If automatic mode was active before the error occurred and ActivateRecoverMode = TRUE, PID_3Step
remains in automatic mode.
If pretuning, fine tuning, or transition time measurement mode and ActivateRecoverMode = TRUE were
active before the error occurred, PID_3Step switches to the operating mode that is saved in the Mode
parameter.
If this error occurred during simulation with PLCSIM, see the notes under Simulating PID_3Step V2 with
PLCSIM (Page 128).
0000_1000 Invalid value at "Setpoint" parameter: Value has an invalid number format.
If automatic mode was active before the error occurred and ActivateRecoverMode = TRUE, PID_3Step
switches to "Approach substitute output value with error monitoring" or "Error monitoring" mode. As soon
as the error is no longer pending, PID_3Step switches back to automatic mode.
If pretuning, fine tuning, or transition time measurement mode and ActivateRecoverMode = TRUE were
active before the error occurred, PID_3Step switches to the operating mode that is saved in the Mode
parameter.
0000_2000 Invalid value at Feedback_PER parameter.
Check whether an error is pending at the analog input.
The actuator cannot be moved to the substitute output value and remains in its current position. In manu
al mode, you can change the position of the actuator only with Manual_UP and Manual_DN, and not with
ManualValue.
If automatic mode was active before the error occurred, ActivateRecoverMode = TRUE, and the error is no
longer pending, PID_3Step switches back to automatic mode.
If pretuning, fine tuning, or transition time measurement mode and ActivateRecoverMode = TRUE were
active before the error occurred, PID_3Step switches to the operating mode that is saved in the Mode
parameter.
0000_4000 Invalid value at Feedback parameter. Value has an invalid number format.
The actuator cannot be moved to the substitute output value and remains in its current position. In manu
al mode, you can change the position of the actuator only with Manual_UP and Manual_DN, and not with
ManualValue.
If automatic mode was active before the error occurred, ActivateRecoverMode = TRUE, and the error is no
longer pending, PID_3Step switches back to automatic mode.
If pretuning, fine tuning, or transition time measurement mode and ActivateRecoverMode = TRUE were
active before the error occurred, PID_3Step switches to the operating mode that is saved in the Mode
parameter.
PID control
Function Manual, 11/2023, A5E35300227-AG 311
Instructions
10.2 PID_3Step
ErrorBits Description
(DW#16#...)
0000_8000 Error during digital position feedback. Actuator_H = TRUE and Actuator_L = TRUE.
The actuator cannot be moved to the substitute output value and remains in its current position. Manual
mode is not possible in this state.
In order to move the actuator from this state, you must deactivate the "Actuator endstop"
(Config.ActuatorEndStopOn = FALSE) or switch to manual mode without endstop signals (Mode = 10).
If automatic mode was active before the error occurred, ActivateRecoverMode = TRUE, and the error is no
longer pending, PID_3Step switches back to automatic mode.
If pretuning, fine tuning, or transition time measurement mode and ActivateRecoverMode = TRUE were
active before the error occurred, PID_3Step switches to the operating mode that is saved in the Mode
parameter.
0001_0000 Invalid value at ManualValue parameter. Value has an invalid number format.
The actuator cannot be moved to the manual value and remains in its current position.
Specify a valid value in ManualValue or move the actuator in manual mode with Manual_UP and
Manual_DN.
0002_0000 Invalid value at SavePosition tag. Value has an invalid number format.
The actuator cannot be moved to the substitute output value and remains in its current position.
0004_0000 Invalid value at Disturbance parameter. Value has an invalid number format.
If automatic mode was active and ActivateRecoverMode = TRUE before the error occurred, Disturbance is
set to zero. PID_3Step remains in automatic mode.
If pretuning or fine tuning mode was active and ActivateRecoverMode = TRUE before the error occurred,
PID_3Step switches to the operating mode saved in the Mode parameter. If Disturbance in the current
phase has no effect on the output value, tuning is not be canceled.
The error has no effect during transition time measurement.
The ActivateRecoverMode tag determines the reaction to error. The Error parameter indicates
if an error is pending. When the error is no longer pending, Error = FALSE. The ErrorBits
parameter shows which errors have occurred.
NOTICE
Your system may be damaged.
If ActivateRecoverMode = TRUE, PID_3Step remains in automatic mode even if the process
limit values are exceeded. This may damage your system.
It is essential to configure how your controlled system reacts in the event of an error to
protect your system from damage.
PID control
312 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.2 PID_3Step
Automatic mode
ActivateRecover Description
Mode
FALSE In the event of an error, PID_3Step switches to "Inactive" or "Approach substitute output value" mode. The
controller is only activated by a falling edge at Reset or a rising edge at ModeActivate.
TRUE If errors occur frequently in automatic mode, this setting has a negative effect on the control response,
because PID_3Step switches between the calculated output value and the substitute output value at each
error. In this case, check the ErrorBits parameter and eliminate the cause of the error.
If one or more of the following errors occur, PID_3Step stays in automatic mode:
• 0001h: The "Input" parameter is outside the process value limits.
• 0800h: Sampling time error
• 40000h: Invalid value at Disturbance parameter.
If one or more of the following errors occur, PID_3Step switches to "Approach substitute output value
with error monitoring" or "Error monitoring" mode:
• 0002h: Invalid value at Input_PER parameter.
• 0200h: Invalid value at Input parameter.
• 0400h: Calculation of output value failed.
• 1000h: Invalid value at Setpoint parameter.
If one or more of the following errors occur, PID_3Step can no longer move the actuator:
• 2000h: Invalid value at Feedback_PER parameter.
• 4000h: Invalid value at Feedback parameter.
• 8000h: Error during digital position feedback.
• 20000h: Invalid value at SavePosition tag. Value has an invalid number format.
The characteristics are independent of ErrorBehaviour.
As soon as the errors are no longer pending, PID_3Step switches back to automatic mode.
ActivateRecover Description
Mode
FALSE In the event of an error, PID_3Step switches to "Inactive" or "Approach substitute output value" mode. The
controller is only activated by a falling edge at Reset or a rising edge at ModeActivate.
The controller changes to "Inactive" mode after successful transition time measurement.
TRUE If the following error occurs, PID_3Step remains in the active mode:
• 0020h: Pretuning is not permitted during fine tuning.
The following errors are ignored:
• 10000h: Invalid value at ManualValue parameter.
• 20000h: Invalid value at SavePosition tag.
When any other error occurs, PID_3Step cancels the tuning and switches to the mode from which tuning
was started.
Manual mode
ActivateRecoverMode is not effective in manual mode.
PID control
Function Manual, 11/2023, A5E35300227-AG 313
Instructions
10.2 PID_3Step
See also
Static tags of PID_3Step V2 (Page 297)
State and Mode V2 parameters (Page 305)
If several warnings are pending simultaneously, their values are displayed with binary
addition. The display of warning 16#0000_0005, for example, indicates that the warnings
16#0000_0001 and 16#0000_0004 are pending simultaneously.
Warning Description
(DW#16#...)
0000_0000 No warning pending.
0000_0001 The point of inflection was not found during pretuning.
0000_0004 The setpoint was limited to the configured limits.
0000_0008 Not all the necessary controlled system properties were defined for the selected method of calculation.
Instead, the PID parameters were calculated using the TIR.TuneRule = 3 method.
0000_0010 The operating mode could not be changed because Reset = TRUE or ManualEnable = TRUE.
0000_0020 The cycle time of the calling OB limits the sampling time of the PID algorithm.
Improve results by using shorter OB cycle times.
0000_0040 The process value exceeded one of its warning limits.
0000_0080 Invalid value at Mode. The operating mode is not switched.
0000_0100 The manual value was limited to the limits of the controller output.
0000_0200 The specified rule for tuning is not supported. No PID parameters are calculated.
0000_0400 The transition time cannot be measured because the actuator settings do not match the selected measur
ing method.
0000_0800 The difference between the current position and the new output value is too small for transition time
measurement. This can produce incorrect results. The difference between the current output value and
new output value must be at least 50% of the entire control range.
0000_1000 The substitute output value cannot be reached because it is outside the output value limits.
0000_2000 The actuator was moved in one direction for longer than Config.VirtualActuatorLimit × Retain.TransitTime.
Check whether the actuator has reached an endstop signal.
PID control
314 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.2 PID_3Step
10.2.5 PID_3Step V1
Description
You use the PID_3Step instruction to configure a PID controller with self tuning for valves or
actuators with integrating behavior.
The following operating modes are possible:
• Inactive
• Pretuning
• Fine tuning
• Automatic mode
• Manual mode
• Approach substitute output value
• Transition time measurement
• Approach substitute output value with error monitoring
• Error monitoring
For a more detailed description of the operating modes, see the State parameter.
PID algorithm
PID_3Step is a PIDT1 controller with anti-windup and weighting of the proportional and
derivative actions. The following equation is used to calculate the output value.
7'ÃV
¨\ .SÃVÃ > EÃZ[ 7,ÃV
Z[
DÃ7'ÃV
FÃZ[ @
Δy Output value of the PID algorithm
Kp Proportional gain
s Laplace operator
b Proportional action weighting
w Setpoint
x Process value
TI Integration time
a Derivative delay coefficient (T1 = a × TD)
TD Derivative action time
c Derivative action weighting
PID control
Function Manual, 11/2023, A5E35300227-AG 315
Instructions
10.2 PID_3Step
*OQVU8BSOJOH@)
17@"-3.
*OQVU8BSOJOH@-
*OQVU1FS0O
"OUJ8JOEVQ
$31@*/ 4DBMF
*OQVU@1&3
'BD *OU
*OQVU 1*%5 ǡW
"OUJ8JOEVQ
-JNJU
4FUQPJOU
0VUQVU1FS0O
.BOVBM&OBCMF
0VUQVU1FS0O
-JNJU $31@065
0VUQVU@1&3
"EFBE@#
.BOVBM&OBCMF
.BOVBM@61
1VMTF0VU 0VUQVU@61
5IS4UQ 0VUQVU@%/
.BOVBM@%/
PID control
316 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.2 PID_3Step
17@"-3. *OQVU8BSOJOH@)
*OQVU8BSOJOH@-
*OQVU1FS0O
"OUJ8JOEVQ
$31@*/ 4DBMF
*OQVU@1&3
*OU -JNJU
'BD
*OQVU 1*%5
"OUJ8JOEVQ 9
-JNJU .BOVBM&OBCMF
4FUQPJOU
ǡ7
.BOVBM7BMVF
'FFECBDL1FS0O
$31@*/ 4DBMF
'FFECBDL@1&3
'FFECBDL
0VUQVU1FS0O
$31@065
0VUQVU@1&3
.BOVBM&OBCMF
.BOVBM@61 0VUQVU@61
1VMTF0VU
"EFBE@# 5IS4UQ
.BOVBM@%/ 0VUQVU@%/
PID control
Function Manual, 11/2023, A5E35300227-AG 317
Instructions
10.2 PID_3Step
C
4FUQPJOU X
%5 % ,
D 1
ǡZ
%FBE@#
5J *
4DBMFE*OQVU Y
'BD5U "OUJ8JOEVQ
Call
PID_3Step is called in the constant time interval of the cycle time of the calling OB (preferably
in a cyclic interrupt OB).
Download to device
The actual values of retentive tags are only updated when you download PID_3Step
completely.
Downloading technology objects to device (Page 46)
Startup
At the startup of the CPU, PID_3Step starts in the operating mode that was last active. To
retain PID_3Step in "Inactive" mode, set RunModeByStartup = FALSE.
PID control
318 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.2 PID_3Step
PID control
Function Manual, 11/2023, A5E35300227-AG 319
Instructions
10.2 PID_3Step
NOTE
Use with two or more actuators
PID_3 Step is not suitable for use with two or more actuators (for example, in heating/cooling
applications), because different actuators need different PID parameters to achieve a good
control response.
PID control
320 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.2 PID_3Step
PID control
Function Manual, 11/2023, A5E35300227-AG 321
Instructions
10.2 PID_3Step
If no relevant motor transition time is in effect in your process (e.g. with solenoid valves), so
that the output value has a direct and full effect on the process, use PID_Compact instead.
Control logic
An increase of the output value is generally intended to cause an increase in the process
value. This is referred to as a normal control logic. For cooling and discharge control systems,
it may be necessary to invert the control logic. PID_3Step does not work with negative
proportional gain. If InvertControl = TRUE, an increasing control deviation causes a reduction
in the output value. The control logic is also taken into account during pretuning and fine
tuning.
See also
Configuring PID_3Step V1 (Page 129)
Table 10-10
Parameters Data type Default Description
Setpoint REAL 0.0 Setpoint of the PID controller in automatic mode
Input REAL 0.0 A tag of the user program is used as source for the process
value.
If you are using parameter Input, then
Config.InputPerOn = FALSE must be set.
Input_PER WORD W#16#0 An analog input is used as the source of the process value.
If you are using parameter Input_PER, then
Config.InputPerOn = TRUE must be set.
Actuator_H BOOL FALSE Digital position feedback of the valve for the high endstop
If Actuator_H = TRUE, the valve is at the high endstop and is no
longer moved towards this direction.
Actuator_L BOOL FALSE Digital position feedback of the valve for the low endstop
If Actuator_L = TRUE, the valve is at the low endstop and is no
longer moved towards this direction.
Feedback REAL 0.0 Position feedback of the valve
If you are using parameter Feedback, then
Config.FeedbackPerOn = FALSE must be set.
Feedback_PER WORD W#16#0 Analog position feedback of a valve
If you are using parameter Feedback_PER, then
Config.FeedbackPerOn = TRUE must be set.
Feedback_PER is scaled based on the tags:
• Config.FeedbackScaling.LowerPointIn
• Config.FeedbackScaling.UpperPointIn
• Config.FeedbackScaling.LowerPointOut
• Config.FeedbackScaling.UpperPointOut
PID control
322 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.2 PID_3Step
Table 10-11
Parameter Data type Default Description
ScaledInput REAL 0.0 Scaled process value
ScaledFeedback REAL 0.0 Scaled position feedback
For an actuator without position feedback, the position of the
actuator indicated by ScaledFeedback is very imprecise.
ScaledFeedback may only be used for rough estimation of the
current position in this case.
Output_UP BOOL FALSE Digital output value for opening the valve
If Config.OutputPerOn = FALSE, the Output_UP parameter is
used.
PID control
Function Manual, 11/2023, A5E35300227-AG 323
Instructions
10.2 PID_3Step
PID control
324 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.2 PID_3Step
See also
State and Retain.Mode V1 parameters (Page 332)
Parameter ErrorBits V1 (Page 338)
NOTE
You must not change tags that are not listed. These are used for internal purposes only.
Change the tags identified with (1) only in "Inactive" mode to prevent malfunction of the PID
controller. "Inactive" mode is forced by setting the "Retain.Mode" tag to "0".
Table 10-12
Tag Data type Default Description
ActivateRecoverMode BOOL TRUE The ActivateRecoverMode tag (Page 340) determines the reaction to
error.
RunModeByStartup BOOL TRUE Activate Mode after CPU restart
If RunModeByStartup = TRUE, the controller returns to the last active
operating mode after a CPU restart.
If RunModeByStartup = FALSE, the controller remains inactive after a
CPU startup.
PhysicalUnit INT 0 Unit of measurement of the process value and setpoint, e.g., ºC, or
ºF.
PhysicalQuantity INT 0 Physical quantity of the process value and setpoint, e.g., temperat
ure
ErrorBehaviour INT 0 If ErrorBehaviour = 0 and an error has occurred, the valve stays at its
current position and the controller switches directly to "Inactive" or
"Error monitoring" mode.
If ErrorBehaviour = 1 and an error occurs, the actuator moves to the
substitute output value and only then switches to "Inactive" or "Error
monitoring" mode.
If the following errors occur, you can no longer move the valve to a
configured substitute output value.
• 2000h: Invalid value at Feedback_PER parameter.
• 4000h: Invalid value at Feedback parameter.
• 8000h: Error during digital position feedback.
Warning DWORD DW#16#0 The Warning tag (Page 332) displays the warnings generated since a
Reset or since the last operating mode switchover.
Cyclic warnings (for example, process value warning) are shown
until the cause of the warning is removed. They are automatically
deleted once their cause has gone. Non-cyclic warnings (for
example, point of inflection not found) remain and are deleted like
errors.
SavePosition REAL 0.0 Substitute output value
If ErrorBehaviour = 1 and an error occurs, the actuator moves to a
safe position for the plant and only then switches to "Inactive" mode.
PID control
Function Manual, 11/2023, A5E35300227-AG 325
Instructions
10.2 PID_3Step
PID control
326 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.2 PID_3Step
PID control
Function Manual, 11/2023, A5E35300227-AG 327
Instructions
10.2 PID_3Step
PID control
328 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.2 PID_3Step
PID control
Function Manual, 11/2023, A5E35300227-AG 329
Instructions
10.2 PID_3Step
PID control
330 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.2 PID_3Step
PID control
Function Manual, 11/2023, A5E35300227-AG 331
Instructions
10.2 PID_3Step
See also
State and Retain.Mode V1 parameters (Page 332)
Tag ActivateRecoverMode V1 (Page 340)
Downloading technology objects to device (Page 46)
NOTE
You want, for example, to repeat successful fine tuning without exiting automatic mode
with Mode = 0.
Setting Retain.Mode to an invalid value such as 9999 for one cycle has no effect on State.
Set Mode = 2 in the next cycle. In this way, you can generate a change to Retain.Mode
without first switching to "Inactive" mode.
Meaning of values
State / Description
Retain.Mode
0 Inactive
The controller is switched off and no longer changes the valve position.
1 Pretuning
The pretuning determines the process response to a pulse of the output value and searches for the point of
inflection. The optimized PID parameters are calculated as a function of the maximum rate of rise and dead
time of the controlled system.
PID control
332 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.2 PID_3Step
State / Description
Retain.Mode
Pretuning requirements:
• State = 0 or State = 4
• ManualEnable = FALSE
• The motor transition time has been configured or measured.
• The setpoint and the process value lie within the configured limits.
The more stable the process value is, the easier it is to calculate the PID parameters and the more precise the
result will be. Noise on the process value can be tolerated as long as the rate of rise of the process value is sig
nificantly higher as compared to the noise.
Before the PID parameters are recalculated, they are backed up and can be reactivated with
Config.LoadBackUp. The setpoint is frozen in the CurrentSetpoint tag.
The controller switches to automatic mode following successful pretuning and to "Inactive" mode following
unsuccessful pretuning.
The pretuning phase is indicated with the SUT.State tag.
2 Fine tuning
Fine tuning generates a constant, limited oscillation of the process value. The PID parameters are tuned based
on the amplitude and frequency of this oscillation. The differences between the process response during pre
tuning and fine tuning are analyzed. All PID parameters are recalculated from the results. PID parameters from
fine tuning usually have better master control and disturbance characteristics than PID parameters from pre
tuning.
PID_3Step automatically attempts to generate an oscillation greater than the noise of the process value. Fine
tuning is only minimally influenced by the stability of the process value.
The PID parameters are backed up before fine tuning. They can be reactivated with Config.LoadBackUp. The
setpoint is frozen in the CurrentSetpoint tag.
Requirements for fine tuning:
• The motor transition time has been configured or measured.
• The setpoint and the process value lie within the configured limits.
• ManualEnable = FALSE
• Automatic (State = 3), inactive (State = 0) or manual (State = 4) mode
Fine tuning proceeds as follows when started from:
• Automatic mode (State = 3)
Start fine tuning from automatic mode if you wish to improve the existing PID parameters through tuning.
PID_3Step controls the system using the existing PID parameters until the control loop has stabilized and
the requirements for fine tuning have been met. Only then will fine tuning start.
• Inactive (State = 0) or manual mode (State = 4)
Pretuning is always started first. The determined PID parameters will be used for control until the control
loop has stabilized and the requirements for fine tuning have been met.
If PIDSelfTune.TIR.RunIn = TRUE, pretuning is skipped and an attempt is made to reach the setpoint with
the minimum or maximum output value. This can produce increased overshoot. Fine tuning then starts
automatically.
The controller switches to automatic mode following successful fine tuning. If fine tuning was not successful,
the controller switches to "Inactive" mode.
The fine tuning phase is indicated with the TIR.State tag.
3 Automatic mode
In automatic mode, PID_3Step controls the controlled system in accordance with the parameters specified.
The controller switches to automatic mode if one the following requirements is fulfilled:
• Pretuning successfully completed
• Fine tuning successfully completed
• Changing the Retain.Mode tag to the value 3.
When the CPU is switched on or switches from Stop to RUN mode, PID_3Step starts in the most recently active
operating mode. To retain PID_3Step in "Inactive" mode, set RunModeByStartup = FALSE.
The ActivateRecoverMode tag is taken into consideration in automatic mode.
PID control
Function Manual, 11/2023, A5E35300227-AG 333
Instructions
10.2 PID_3Step
State / Description
Retain.Mode
4 Manual mode
In manual mode, you specify manual output values in the Manual_UP and Manual_DN parameters or
ManualValue parameter. Whether or not the actuator can be moved to the output value in the event of an
error is described in the ErrorBits parameter.
This operating mode is enabled if Retain.Mode = 4, or on a rising edge at ManualEnable.
If ManualEnable changes to TRUE, only State changes. Retain.Mode retains its current value. On a falling edge
at ManualEnable, PID_3Step returns to the previous operating mode.
The switchover to automatic mode is bumpless.
PID_3Step V1.1
Manual mode is always possible in the event of an error.
PID_3Step V1.0
Manual mode is dependent on the ActivateRecoverMode tag in the event of an error.
5 Approach substitute output value
This operating mode is activated in the event of an error or when Reset = TRUE if Errorbehaviour = 1 and
ActivateRecoverMode = FALSE..
PID_3Step moves the actuator to the substitute output value and then switches to "Inactive" mode.
6 Transition time measurement
The time that the motor needs to completely open the valve from the closed condition is determined.
This operating mode is activated when GetTransitTime.Start = TRUE is set.
If endstop signals are used to measure the transition time, the valve will be opened completely from its cur
rent position, closed completely, and opened completely again. If GetTransitTime.InvertDirection = TRUE, this
behavior is inverted.
If position feedback is used to measure the transition time, the actuator will be moved from its current posi
tion to a target position.
The output value limits are not taken into consideration during the transition time measurement. The actuat
or can travel to the high or the low endstop.
7 Error monitoring
The control algorithm is switched off and no longer changes the valve position.
This operating mode is activated instead of "Inactive" mode in the event of an error.
All the following conditions must be met:
• Mode = 3 (automatic mode)
• Errorbehaviour = 0
• ActivateRecoverMode = TRUE
• One or more errors have occurred in which ActivateRecoverMode (Page 340) is effective.
As soon as the errors are no longer pending, PID_3Step switches back to automatic mode.
8 Approach substitute output value with error monitoring
This operating mode is activated instead of "Approach substitute output value" mode in the event of an error.
PID_3Step moves the actuator to the substitute output value and then switches to "Error monitoring" mode.
All the following conditions must be met:
• Mode = 3 (automatic mode)
• Errorbehaviour = 1
• ActivateRecoverMode = TRUE
• One or more errors have occurred in which ActivateRecoverMode (Page 340) is effective.
As soon as the errors are no longer pending, PID_3Step switches back to automatic mode.
PID control
334 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.2 PID_3Step
*OBDUJWF
"VUPNBUJDNPEF
"QQSPBDITVCTUJUVUFPVUQVUWBMVF
PID control
Function Manual, 11/2023, A5E35300227-AG 335
Instructions
10.2 PID_3Step
*OBDUJWF &SSPSNPOJUPSJOH
&SSPS#FIBWJPVS &SSPS#FIBWJPVS
"DUJWBUF3FDPWFS.PEF'"-4& "DUJWBUF3FDPWFS.PEF536&
"VUPNBUJDNPEF
&SSPS#FIBWJPVS &SSPS#FIBWJPVS
"DUJWBUF3FDPWFS.PEF'"-4& "DUJWBUF3FDPWFS.PEF536&
"QQSPBDITVCTUJUVUFPVUQVUWBMVF "QQSPBDITVCTUJUVUFPVUQVUWBMVF
XJUIFSSPSNPOJUPSJOH
PID control
336 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.2 PID_3Step
Automatic switchover of operating mode in automatic and manual modes (PID_3Step V1.0)
PID_3Step automatically switches the operating mode in the event of an error. The following
diagram illustrates the influence of ErrorBehaviour and ActivateRecoverMode on this
switchover of operating mode.
*OBDUJWF &SSPSNPOJUPSJOH
.BOVBMNPEF "VUPNBUJDNPEF
"DUJWBUF3FDPWFS.PEF536&
"QQSPBDITVCTUJUVUFPVUQVUWBMVF "QQSPBDITVCTUJUVUFPVUQVUWBMVF
XJUIFSSPSNPOJUPSJOH
See also
Tag ActivateRecoverMode V1 (Page 340)
Parameter ErrorBits V1 (Page 338)
PID control
Function Manual, 11/2023, A5E35300227-AG 337
Instructions
10.2 PID_3Step
If several errors are pending simultaneously, the values of the error codes are displayed with
binary addition. The display of error code 0003, for example, indicates that the errors 0001
and 0002 are pending simultaneously.
ErrorBits Description
(DW#16#...)
0000 There is no error.
0001 The "Input" parameter is outside the process value limits.
• Input > Config.InputUpperLimit or
• Input < Config.InputLowerLimit
If ActivateRecoverMode = TRUE and ErrorBehaviour = 1, the actuator moves to the substitute output
value. If ActivateRecoverMode = TRUE and ErrorBehaviour = 0, the actuator stops in its current position. If
ActivateRecoverMode = FALSE, the actuator stops in its current position.
PID_3Step V1.1
You can move the actuator in manual mode.
PID_3Step V1.0
Manual mode is not possible in this state. You cannot move the actuator again until you eliminate the
error.
0002 Invalid value at "Input_PER" parameter. Check whether an error is pending at the analog input.
If automatic mode was active before the error occurred, ActivateRecoverMode = TRUE, and the error is no
longer pending, PID_3Step switches back to automatic mode.
0004 Error during fine tuning. Oscillation of the process value could not be maintained.
0020 Pretuning is not permitted in automatic mode or during fine tuning.
0080 Error during pretuning. The output value limits are not configured correctly or the actual value does not
react as expected.
Check whether the limits of the output value are configured correctly and match the control logic.
Also make sure that the actual value does not oscillate strongly before starting pretuning.
0100 Error during fine tuning resulted in invalid parameters.
0200 Invalid value at "Input" parameter: Value has an invalid number format.
If automatic mode was active before the error occurred, ActivateRecoverMode = TRUE, and the error is no
longer pending, PID_3Step switches back to automatic mode.
0400 Calculation of output value failed. Check the PID parameters.
0800 Sampling time error: PID_3Step is not called within the sampling time of the cyclic interrupt OB.
If automatic mode was active before the error occurred, ActivateRecoverMode = TRUE, and the error is no
longer pending, PID_3Step switches back to automatic mode.
If this error occurred during simulation with PLCSIM, see the notes under Simulating PID_3Step V1 with
PLCSIM (Page 145).
1000 Invalid value at "Setpoint" parameter: Value has an invalid number format.
If automatic mode was active before the error occurred, ActivateRecoverMode = TRUE, and the error is no
longer pending, PID_3Step switches back to automatic mode.
2000 Invalid value at Feedback_PER parameter.
Check whether an error is pending at the analog input.
The actuator cannot be moved to the substitute output value and remains in its current position. Manual
mode is not possible in this state. You must deactivate position feedback (Config. FeedbackOn = FALSE) to
move the actuator from this state.
If automatic mode was active before the error occurred, ActivateRecoverMode = TRUE, and the error is no
longer pending, PID_3Step switches back to automatic mode.
PID control
338 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.2 PID_3Step
ErrorBits Description
(DW#16#...)
4000 Invalid value at Feedback parameter. Value has an invalid number format.
The actuator cannot be moved to the substitute output value and remains in its current position. Manual
mode is not possible in this state. You must deactivate position feedback (Config. FeedbackOn = FALSE) to
move the actuator from this state.
If automatic mode was active before the error occurred, ActivateRecoverMode = TRUE, and the error is no
longer pending, PID_3Step switches back to automatic mode.
8000 Error during digital position feedback. Actuator_H = TRUE and Actuator_L = TRUE.
The actuator cannot be moved to the substitute output value and remains in its current position. Manual
mode is not possible in this state.
In order to move the actuator from this state, you must deactivate the "Actuator endstop"
(Config.ActuatorEndStopOn = FALSE).
If automatic mode was active before the error occurred, ActivateRecoverMode = TRUE, and the error is no
longer pending, PID_3Step switches back to automatic mode.
A rising edge at Reset triggers a change to "Inactive" mode, and errors and warnings are reset.
A falling edge at Reset triggers a change to the most recently active operating mode. If
automatic mode was active before, switchover to automatic mode is bumpless.
3FTFU
U NT
.PEF
U NT
4UBUF
U NT
① Activation
② Error
③ Reset
PID control
Function Manual, 11/2023, A5E35300227-AG 339
Instructions
10.2 PID_3Step
The effect of the ActivateRecoverMode variable depends on the version of the PID_3Step.
PID control
340 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.2 PID_3Step
ActivateRecover Description
Mode
As soon as the errors are no longer pending, PID_3Step switches back to automatic mode.
Errors in manual mode
If one or more of the following errors occur, PID_3Step stays in manual mode:
• 0002h: Invalid value at parameter Input_PER.
• 0200h: Invalid value at parameter Input.
• 0800h: Sampling time error
• 1000h: Invalid value at parameter Setpoint.
• 2000h: Invalid value at parameter Feedback_PER.
• 4000h: Invalid value at parameter Feedback.
• 8000h: Error in digital position feedback.
With errors 2000h, 4000h and 8000h, you cannot move the valve to a suitable position.
See also
PID_3Step V1 static tags (Page 325)
State and Retain.Mode V1 parameters (Page 332)
If several warnings are pending simultaneously, their values are displayed with binary
addition. The display of warning 0003, for example, indicates that the warnings 0001 and
0002 are pending simultaneously.
Warning Description
(DW#16#...)
0000 No warning pending.
0001 The point of inflection was not found during pretuning.
0002 Oscillation increased during fine tuning.
0004 The setpoint was limited to the configured limits.
0008 Not all the necessary controlled system properties were defined for the selected method of calculation.
The PID parameters were instead calculated using the TuneRuleTIR = 3 method.
0010 The operating mode could not be changed because ManualEnable = TRUE.
0020 The cycle time of the calling OB limits the sampling time of the PID algorithm.
Improve results by using shorter OB cycle times.
0040 The process value exceeded one of its warning limits.
0080 Invalid value at Retain.Mode. The operating mode is not switched.
0100 The manual value was limited to the limits of the controller output.
0200 The rule used for tuning produces an incorrect result, or is not supported.
0400 Method selected for transition time measurement not suitable for actuator.
The transition time cannot be measured because the actuator settings do not match the selected measur
ing method.
0800 The difference between the current position and the new output value is too small for transition time
measurement. This can produce incorrect results. The difference between the current output value and
new output value must be at least 50% of the entire control range.
1000 The substitute output value cannot be reached because it is outside the output value limits.
PID control
Function Manual, 11/2023, A5E35300227-AG 341
Instructions
10.2 PID_3Step
PID control
342 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.3 PID_Temp
10.3 PID_Temp
PID_Temp V1.1
• Response of the output value on switchover from "Inactive" operating mode to
"Automatic mode"
The new option IntegralResetMode = 4 was added and defined as default. With
IntegralResetMode = 4, the integral action is automatically pre-assigned when switching
from "Inactive" operating mode to "Automatic mode" so that a control deviation results in
a jump of the PID output value with identical sign.
• Initialization of the integral action in automatic mode
The integral action can be initialized in automatic mode with the tags
OverwriteInitialOutputValue and PIDCtrl.PIDInit. This simplifies the use of PID_Temp for
override controls.
CPU FW PID_Temp
S7-1200 as of V4.2 V1.1
V1.0
V4.1 V1.0
S7-1500 as of V3.0 V1.1
V2.0 to V2.9 V1.1
V1.0
V1.7 to V1.8 V1.0
PID control
Function Manual, 11/2023, A5E35300227-AG 343
Instructions
10.3 PID_Temp
CPU FW Typ. CPU processing time Typ. CPU processing time pre-
Automatic mode tuning and fine tuning
CPU 1211 ≥ V4.1 290 µs 450 µs
CPU 1212
CPU 1214
CPU 1215
CPU 1217
CPU 1510SP ≤ V2.9 85 µs 140 µs
CPU 1511
CPU 1511C
CPU 1512C
CPU 1512SP
CPU 1513
CPU 1515 80 µs 110 µs
CPU 1516
CPU 1517 ≥ V1.7 12 µs 18 µs
CPU 1518 6 µs 9 µs
CPU 1510SP ≥ V3.0 75 µs 110 µs
CPU 1511
CPU 1511C
CPU 1512C
CPU 1512SP
CPU 1513
CPU 1514SP
CPU 1515 55 µs 90 µs
CPU 1516
Typical CPU processing times of the PID_Temp technology object as of Version V1.0,
depending on the CPU type and operating mode for R-CPUs in the RUN-Redundant system
state.
CPU FW Typ. CPU processing time Typ. CPU processing time pre-
Automatic mode tuning and fine tuning
CPU 1513R ≥ V3.0 110 µs 160 µs
CPU 1515R 95 µs 130 µs
PID control
344 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.3 PID_Temp
Memory requirement
Memory requirement of an instance DB of the PID_Temp technology object as of Version
V1.0.
10.3.4 PID_Temp
Description
The PID_Temp instruction provides a PID controller with integrated tuning for temperature
processes. PID_Temp can be used for pure heating or heating/cooling applications.
The following operating modes are possible:
• Inactive
• Pretuning
• Fine tuning
• Automatic mode
• Manual mode
• Substitute output value with error monitoring
For a more detailed description of the operating modes, see the State parameter.
PID algorithm
PID_Temp is a PIDT1 controller with anti-windup and weighting of the proportional and
derivative actions. The PID algorithm operates according to the following equation (control
zone and dead zone deactivated):
5%wT
Z,Q < CwXY 5*wT
XY
Bw5%wT
DwXY >
The table below shows the meaning of the icons used in the equation and in the subsequent
figures.
PID control
Function Manual, 11/2023, A5E35300227-AG 345
Instructions
10.3 PID_Temp
PID control
346 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.3 PID_Temp
*OQVU
[ THO
$USM1BSBNT
)FBU(BJO
)FBU5Jܵ
$PPM(BJO
$PPM5J
4VCTUJUVUF4FUQPJOU0O
4DBMFE*OQVU
4FUQPJOU
-JNJU 1*%5
4VCTUJUVUF4FUQPJOU $VSSFOU4FUQPJOU "OUJ
8JOEVQ
%JTUVSCBODF
4UBUF
-JNJU
.BOVBM7BMVF 1JE0VUQVU4VN
4DBMF
0VUQVU)FBU
1JE0VUQVU $POH0VUQVU)FBU4FMFDU
4DBMF 18.
0TFU)FBU
'"-4& 0VUQVU)FBU@18.
1*%4FMG5VOF5*30VUQVU0TFU)FBU
ࣣ
0VUQVU)FBU@1&3
ࣣ
-JNJU $POH"DUJWBUF$PPMJOH
4QMJU 4DBMF
0VUQVU$PPM
1*%4FMG5VOF5*30VUQVU0TFU$PPM $POH0VUQVU$PPM4FMFDU
4DBMF 18.
1JE0VUQVU
'"-4& '"-4& 0VUQVU$PPM@18.
0TFU$PPM
ࣣ
4DBMF
0VUQVU$PPM@1&3
ࣣ
PID control
Function Manual, 11/2023, A5E35300227-AG 347
Instructions
10.3 PID_Temp
$VSSFOU4FUQPJOU X C
$POH0VUQVU
)FBU1JE6QQFS-JNJU
D %5 ,Q
Z
%FBE;POF
$POH0VUQVU
)FBU1JE-PXFS-JNJU
$POH0VUQVU
$PPM1JE-PXFS-JNJU
"OUJ8JOEVQ
4DBMFE*OQVU Y -JNJU *
$POUSPM;POF
Call
PID_Temp is called in the constant time scale of a cyclic interrupt OB.
Download to device
The process values of retentive tags are only updated when you download PID_Temp
completely.
Download technology object to device (Page 46)
Startup
When the CPU starts up, PID_Temp starts in the operating mode that is saved in the Mode
in/out parameter. To switch to "Inactive" operating mode during startup, set
RunModeByStartup = FALSE.
PID control
348 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.3 PID_Temp
In manual mode, PID_Temp uses ManualValue as output value, unless ManualValue is invalid.
• If ManualValue is invalid, SubstituteOutput is used.
• If ManualValue and SubstituteOutput are invalid, Config.Output.Heat.PidLowerLimit is
used.
The Error parameter indicates if an error is pending. When the error is no longer pending,
Error = FALSE. The ErrorBits parameter shows which errors have occurred. ErrorBits is reset by
a rising edge at Reset or ErrorAck.
PID control
Function Manual, 11/2023, A5E35300227-AG 349
Instructions
10.3 PID_Temp
Substitute setpoint
You can specify a substitute setpoint at the SubstituteSetpoint tag and activate it with
SubstituteSetpointOn = TRUE. In this way, you can temporarily specify the setpoint directly,
for example for a slave controller in a cascade, without having to change the user program.
The limits set for the setpoint also apply to the substitute setpoint.
PID control
350 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.3 PID_Temp
The PID output value is scaled and output at the outputs for heating and cooling. Scaling can
be defined separately for each output and is specified in the structures Config.Output.Heat or
Config.Output.Cool with 2 value pairs each:
PID control
Function Manual, 11/2023, A5E35300227-AG 351
Instructions
10.3 PID_Temp
Example:
Output scaling when using output OutputHeat (cooling deactivated;
Config.Output.Heat.PidLowerLimit may be unequal to 0.0):
0VUQVU)FBU
$POH0VUQVU)FBU
6QQFS4DBMJOH
$POH0VUQVU)FBU
-PXFS4DBMJOH
1JE0VUQVU4VN
$POH0VUQVU)FBU $POH0VUQVU)FBU
1JE-PXFS-JNJU 1JE6QQFS-JNJU
Example:
Output scaling when using output OutputHeat_PWM and OutputCool_PER (cooling activated;
Config.Output.Heat.PidLowerLimit must be 0.0):
0VUQVU$PPM@1&3 0VUQVU)FBU@18.
$POH0VUQVU$PPM
1FS6QQFS4DBMJOH $POH0VUQVU)FBU
1XN6QQFS4DBMJOH
$POH0VUQVU)FBU
1XN-PXFS4DBMJOH
$POH0VUQVU$PPM
1FS-PXFS4DBMJOH 1JE0VUQVU4VN
$POH0VUQVU)FBU
$POH0VUQVU$PPM 1JE-PXFS-JNJU $POH0VUQVU)FBU
1JE-PXFS-JNJU $POH0VUQVU$PPM 1JE6QQFS-JNJU
1JE6QQFS-JNJU
With the exception of the "Inactive" operating mode, the value at an output is always located
between its scaled high output value and scaled low output value, for example, for
OutputHeat always between Config.Output.Heat.UpperScaling and
Config.Output.Heat.LowerScaling.
If you want to limit the value at the associated output, you therefore have to adapt these
scaling values as well.
PID control
352 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.3 PID_Temp
Cascading
PID_Temp supports you when you use cascade control (see: Program creation (Page 179)).
PID control
Function Manual, 11/2023, A5E35300227-AG 353
Instructions
10.3 PID_Temp
Control logic
PID_Temp can be used for heating or heating/cooling applications and always works with
normal control logic.
An increase of the PID output value (PidOutputSum) is intended to increase the process value.
The values at the outputs for heating and cooling resulting from the PID output value are the
result of the configured output scaling.
An inverted control logic or negative proportional gain are not supported.
If you only need an output value for your application in which an increase is to reduce the
process value (for example, discharge control), you can use PID_Compact with inverted
control logic.
The names of the following parameters apply both to the data block and to access via the
Openness API.
Parameter Data type Default Description
Setpoint REAL 0.0 Setpoint of the PID controller in automatic mode
Valid range of values:
Config.SetpointUpperLimit ≥ Setpoint ≥ Config.SetpointLowerLimit
Config.InputUpperLimit ≥ Setpoint ≥ Config.InputLowerLimit
Input REAL 0.0 A tag of the user program is used as source for the process value.
If you are using the Input parameter, Config.InputPerOn = FALSE must be set.
Input_PER INT 0 An analog input is used as the source of the process value.
If you are using the Input_PER parameter, Config.InputPerOn = TRUE must be
set.
Disturbance REAL 0.0 Disturbance variable or precontrol value
PID control
354 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.3 PID_Temp
PID control
Function Manual, 11/2023, A5E35300227-AG 355
Instructions
10.3 PID_Temp
The names of the following parameters apply both to the data block and to access via the
Openness API.
Parameter Data type Default Description
ScaledInput REAL 0.0 Scaled process value
OutputHeat REAL 0.0 Output value (heating) in REAL format
The PID output value (PidOutputSum) is scaled with the two value pairs
Config.Output.Heat.PidUpperLimit, Config.Output.Heat.UpperScaling and Con
fig.Output.Heat.PidLowerLimit, Config.Output.Heat.LowerScaling and output
in REAL format at OutputHeat.
OutputHeat is always calculated.
OutputCool REAL 0.0 Output value (cooling) in REAL format
The PID output value (PidOutputSum) is scaled with the two value pairs
Config.Output.Cool.PidUpperLimit, Config.Output.Cool.LowerScaling and Con
fig.Output.Cool.PidLowerLimit, Config.Output.Cool.UpperScaling and output in
REAL format at OutputCool.
OutputCool is only calculated if the cooling output is activated
(Config.ActivateCooling = TRUE).
OutputHeat_PER INT 0 Analog output value (heating)
The PID output value (PidOutputSum) is scaled with the two value pairs
Config.Output.Heat.PidUpperLimit, Config.Output.Heat.PerUpperScaling and
Config.Output.Heat.PidLowerLimit, Config.Output.Heat.PerLowerScaling and
output as analog value at OutputHeat_PER.
OutputHeat_PER is only calculated if Config.Output.Heat.Select = 2.
OutputCool_PER INT 0 Analog output value (cooling)
The PID output value (PidOutputSum) is scaled with the two value pairs
Config.Output.Cool.PidUpperLimit, Config.Output.Cool.PerLowerScaling and
Config.Output.Cool.PidLowerLimit, Config.Output.Cool.PerUpperScaling and
output as analog value at OutputCool_PER.
OutputCool_PER is only calculated if the cooling output is activated
(Config.ActivateCooling = TRUE) and Config.Output.Cool.Select = 2.
OutputHeat_PW BOOL FALSE Pulse-width modulated output value (heating)
M The PID output value (PidOutputSum) is scaled with the two value pairs
Config.Output.Heat.PidUpperLimit, Config.Output.Heat.PwmUpperScaling and
Config.Output.Heat.PidLowerLimit, Config.Output.Heat.PwmLowerScaling and
output as pulse-width modulated value (variable switch on and switch off
times) at OutputHeat_PWM.
OutputHeat_PWM is only calculated if Config.Output.Heat.Select = 1.
OutputCool_PW BOOL FALSE Pulse-width modulated output value (cooling)
M The PID output value (PidOutputSum) is scaled with the two value pairs
Config.Output.Cool.PidUpperLimit, Config.Output.Cool.PwmLowerScaling and
Config.Output.Cool.PidLowerLimit, Config.Output.Cool.PwmUpperScaling and
output as pulse-width modulated value (variable switch on and switch off
times) at OutputCool_PWM.
OutputCool_PWM is only calculated if the cooling output is activated
(Config.ActivateCooling = TRUE) and Config.Output.Cool.Select = 1.
SetpointLimit_H BOOL FALSE If SetpointLimit_H = TRUE, the absolute setpoint high limit is reached
(Setpoint ≥ Config.SetpointUpperLimit) or Setpoint ≥ Config.InputUpperLimit.
The setpoint high limit is the minimum of Config.SetpointUpperLimit and Con
fig.InputUpperLimit.
PID control
356 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.3 PID_Temp
The names of the following parameters apply both to the data block and to access via the
Openness API.
Parameter Data type Default Description
Mode INT 4 At Mode, specify the operating mode to which PID_Temp is to switch. Options
are:
• Mode = 0: Inactive
• Mode = 1: Pretuning
• Mode = 2: Fine tuning
• Mode = 3: Automatic mode
• Mode = 4: Manual mode
The operating mode is activated by:
• Rising edge at ModeActivate
• Falling edge at Reset
• Falling edge at ManualEnable
• Cold restart of CPU if RunModeByStartup = TRUE
For pretuning and fine tuning, you specify with Heat.EnableTuning and
Cool.EnableTuning whether tuning takes place for heating or cooling.
Mode is retentive.
A detailed description of the operating modes can be found in State and Mode
parameters (Page 383).
PID control
Function Manual, 11/2023, A5E35300227-AG 357
Instructions
10.3 PID_Temp
See also
PID_Temp state and mode parameters (Page 383)
Program creation (Page 179)
Cascade control with PID_Temp (Page 177)
PID control
358 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.3 PID_Temp
NOTE
Change the tags identified with (1) only in "Inactive" mode to prevent malfunction of the PID
controller.
The names of the following variables apply both to the data block and to access via the
Openness API.
Tag Data Default Description
type
IntegralResetMode Int V1.0: 1, The IntegralResetMode tag (Page 396) determines how the
as of version integral action PIDCtrl.IOutputOld is preassigned when switch
V1.1: 4 ing from "Inactive" operating mode to "Automatic mode".
This setting only works for one cycle.
• IntegralResetMode = 0: Smooth
• IntegralResetMode = 1: Delete
• IntegralResetMode = 2: Hold
• IntegralResetMode = 3: Pre-assign
• IntegralResetMode = 4: Like setpoint change (only for
PID_Temp with version ≥ 1.1)
OverwriteInitialOutputValue REAL 0.0 If one of the following conditions is met, the integral action
PIDCtrl.IOutputOld is preassigned automatically as if
PIDOutputSum = OverwriteInitialOutputValue in the previous
cycle:
• IntegralResetMode = 3 when switching from "Inactive"
operating mode to "Automatic mode"
• IntegralResetMode = 3, TRUE -> FALSE edge at parameter
Reset and parameter Mode = 3
• PIDCtrl.PIDInit = TRUE in "Automatic mode" (available as of
PID_Temp version 1.1)
RunModeByStartup BOOL TRUE Activate operating mode at Mode parameter after CPU restart
• If RunModeByStartup = TRUE, PID_Temp starts in the oper
ating mode saved in the Mode parameter after CPU startup.
• If RunModeByStartup = FALSE, PID_Temp remains in
"Inactive" mode after CPU startup.
LoadBackUp BOOL FALSE If LoadBackUp = TRUE, the last set of PID parameters is reloaded
from the CtrlParamsBackUp structure. The set was saved prior
to the last tuning. LoadBackUp is automatically set back to
FALSE. The acceptance is bumpless.
SetSubstituteOutput BOOL TRUE Selection of the output value while an error is pending
(State = 5):
• If SetSubstituteOutput = TRUE and
ActivateRecoverMode = TRUE, the configured substitute
output value SubstituteOutput is output as PID output value
as long as an error is pending.
• If SetSubstituteOutput = FALSE and
ActivateRecoverMode = TRUE, the actuator remains at the
current PID output value as long as an error is pending.
PID control
Function Manual, 11/2023, A5E35300227-AG 359
Instructions
10.3 PID_Temp
PID control
360 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.3 PID_Temp
PID control
Function Manual, 11/2023, A5E35300227-AG 361
Instructions
10.3 PID_Temp
PID control
362 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.3 PID_Temp
PID control
Function Manual, 11/2023, A5E35300227-AG 363
Instructions
10.3 PID_Temp
PID control
364 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.3 PID_Temp
PID control
Function Manual, 11/2023, A5E35300227-AG 365
Instructions
10.3 PID_Temp
PID control
366 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.3 PID_Temp
PID control
Function Manual, 11/2023, A5E35300227-AG 367
Instructions
10.3 PID_Temp
PID control
368 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.3 PID_Temp
PID control
Function Manual, 11/2023, A5E35300227-AG 369
Instructions
10.3 PID_Temp
PID control
370 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.3 PID_Temp
PID control
Function Manual, 11/2023, A5E35300227-AG 371
Instructions
10.3 PID_Temp
PID control
372 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.3 PID_Temp
PID control
Function Manual, 11/2023, A5E35300227-AG 373
Instructions
10.3 PID_Temp
PID control
374 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.3 PID_Temp
PID control
Function Manual, 11/2023, A5E35300227-AG 375
Instructions
10.3 PID_Temp
PID control
376 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.3 PID_Temp
PID control
Function Manual, 11/2023, A5E35300227-AG 377
Instructions
10.3 PID_Temp
PID control
378 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.3 PID_Temp
PID control
Function Manual, 11/2023, A5E35300227-AG 379
Instructions
10.3 PID_Temp
PID control
380 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.3 PID_Temp
PID control
Function Manual, 11/2023, A5E35300227-AG 381
Instructions
10.3 PID_Temp
PID control
382 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.3 PID_Temp
See also
PID_Temp ActivateRecoverMode tag (Page 392)
PID_Temp Warning tag (Page 393)
Multi-zone controlling with PID_Temp (Page 183)
Meaning of values
PID control
Function Manual, 11/2023, A5E35300227-AG 383
Instructions
10.3 PID_Temp
PID control
384 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.3 PID_Temp
The more stable the process value is, the easier it is to calculate the PID parameters and the more precise the
result will be. Noise on the process value can be tolerated as long as the rate of rise of the process value is sig
nificantly higher compared to the noise. This is most likely the case in operating modes "Inactive" or "Manual
mode".
The setpoint is frozen in the CurrentSetpoint tag. Tuning is canceled when:
• Setpoint > CurrentSetpoint + CancelTuningLevel
or
• Setpoint < CurrentSetpoint - CancelTuningLevel
The method for calculation of the PID parameters can be specified separately for heating and cooling with
PIDSelfTune.SUT.TuneRuleHeat and PIDSelfTune.SUT.TuneRuleCool.
Before the PID parameters are recalculated, they are backed up in the CtrlParamsBackUp structure and can be
reactivated with LoadBackUp.
After successful pretuning, the switch is made to automatic mode.
After unsuccessful pretuning, the switch to the mode is determined by ActivateRecoverMode.
The phase of pretuning is indicated with PIDSelfTune.SUT.State.
For starting pretuning of heating or pretuning of heating and cooling in Automatic mode, it is recommended
to perform the required setpoint change simultaneously with the rising edge at ModeActivate. If the setpoint
is changed first and the pretuning is started later, the output value in automatic mode is adjusted accordingly
and causes a change to the process value. This can have a negative effect on the subsequent pretuning or
prevent it from starting.
2 Fine tuning
Fine tuning generates a constant, limited oscillation of the process value. The PID parameters are tuned for
the operating point from the amplitude and frequency of this oscillation. PID parameters from fine tuning
usually have better master control and disturbance characteristics than PID parameters from pretuning. You
obtain the best PID parameters when you perform pretuning and fine tuning.
PID_Temp automatically attempts to generate an oscillation greater than the noise of the process value. Fine
tuning is only minimally influenced by the stability of the process value.
PID_Temp offers different fine tuning types depending on the configuration:
• Fine tuning heating:
PID_Temp generates an oscillation of the process value with periodic changes at the output value heating
and calculates the PID parameters for heating (Struktur Retain.CtrlParams.Heat).
• Fine tuning cooling:
PID_Temp generates an oscillation of the process value with periodic changes at the output value cooling
and calculates the PID parameters for cooling (Struktur Retain.CtrlParams.Cool).
PID control
Function Manual, 11/2023, A5E35300227-AG 385
Instructions
10.3 PID_Temp
PID control
386 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.3 PID_Temp
PID control
Function Manual, 11/2023, A5E35300227-AG 387
Instructions
10.3 PID_Temp
ENO characteristics
If State = 0, then ENO = FALSE.
If State ≠ 0, then ENO = TRUE.
PID control
388 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.3 PID_Temp
If several errors are pending simultaneously, the values of the ErrorBits are displayed with
binary addition. The display of ErrorBits = 16#0000_0003, for example, indicates that the
errors 16#0000_0001 and 16#0000_0002 are pending simultaneously.
ErrorBits Description
(DW#16#...)
0000_0000 There is no error.
0000_0001 The "Input" parameter is outside the process value limits.
• Input > Config.InputUpperLimit or
• Input < Config.InputLowerLimit
If automatic mode was active before the error occurred and ActivateRecoverMode = TRUE, PID_Temp
remains in automatic mode.
If manual mode was active before the error occurred and ActivateRecoverMode = TRUE, PID_Temp
remains in manual mode.
If pretuning or fine tuning mode was active before the error occurred and ActivateRecoverMode = TRUE,
PID_Temp switches to the operating mode that is saved in the Mode parameter.
0000_0002 Invalid value at "Input_PER" parameter. Check whether an error is pending at the analog input.
If automatic mode was active before the error occurred and ActivateRecoverMode = TRUE, PID_Temp out
puts the configured substitute output value. As soon as the error is no longer pending, PID_Temp switches
back to automatic mode.
If manual mode was active before the error occurred and ActivateRecoverMode = TRUE, PID_Temp
remains in manual mode.
If pretuning or fine tuning mode was active before the error occurred and ActivateRecoverMode = TRUE,
PID_Temp switches to the operating mode that is saved in the Mode parameter.
0000_0004 Error during fine tuning. The oscillation of the process value could not be maintained.
If PID_Temp is used as a heating cooling controller (Config.ActivateCooling = TRUE), then in order to gen
erate a process value oscillation and successfully carry out the fine tuning, the PID output value
(PidOutputSum) at the setpoint must be
• positive for fine tuning heating
• negative for fine tuning cooling
If this requirement is not met, use the tuning offsets ( PIDSelfTune.TIR.OutputOffsetCool and
PIDSelfTune.TIR.OutputOffsetHeat tags), see Fine tuning (Page 171).
If ActivateRecoverMode was = TRUE before the error occurred, PID_Temp cancels the tuning and switches
to the operating mode that is saved in the Mode parameter.
0000_0008 Error at start of pretuning. The process value is too close to the setpoint or greater than the setpoint. Start
fine tuning.
If ActivateRecoverMode = TRUE before the error occurred, PID_Temp cancels the tuning and switches to
the operating mode that is saved in the Mode parameter.
0000_0010 The setpoint was changed during tuning.
You can set the permitted fluctuation of the setpoint at the CancelTuningLevel tag.
If ActivateRecoverMode = TRUE before the error occurred, PID_Temp cancels the tuning and switches to
the operating mode that is saved in the Mode parameter.
0000_0020 Pretuning is not permitted during fine tuning.
If ActivateRecoverMode = TRUE before the error occurred, PID_Temp remains in fine tuning mode.
0000_0040 Error during pretuning. Cooling could not reduce the process value.
If ActivateRecoverMode = TRUE before the error occurred, PID_Temp cancels the tuning and switches to
the operating mode that is saved in the Mode parameter.
0000_0100 Error during fine tuning resulted in invalid parameters.
If ActivateRecoverMode = TRUE before the error occurred, PID_Temp cancels the tuning and switches to
the operating mode that is saved in the Mode parameter.
PID control
Function Manual, 11/2023, A5E35300227-AG 389
Instructions
10.3 PID_Temp
ErrorBits Description
(DW#16#...)
0000_0200 Invalid value at "Input" parameter: Value has an invalid number format.
If automatic mode was active before the error occurred and ActivateRecoverMode = TRUE, PID_Temp out
puts the configured substitute output value. As soon as the error is no longer pending, PID_Temp switches
back to automatic mode.
If manual mode was active before the error occurred and ActivateRecoverMode = TRUE, PID_Temp
remains in manual mode.
If pretuning or fine tuning mode was active before the error occurred and ActivateRecoverMode = TRUE,
PID_Temp switches to the operating mode that is saved in the Mode parameter.
0000_0400 Calculation of output value failed. Check the PID parameters.
If automatic mode was active before the error occurred and ActivateRecoverMode = TRUE, PID_Temp out
puts the configured substitute output value. As soon as the error is no longer pending, PID_Temp switches
back to automatic mode.
If pretuning or fine tuning mode was active before the error occurred and ActivateRecoverMode = TRUE,
PID_Temp switches to the operating mode that is saved in the Mode parameter.
0000_0800 Sampling time error: PID_Temp is not called within the sampling time of the cyclic interrupt OB.
It is recommended to call PID_Temp in a cyclic interrupt OB without conditions and to activate or deactiv
ate it via the operating mode at the Mode parameter. Conditional calls or the call in OB1 can have a negat
ive effect on the control quality.
Monitoring of the sampling time can be disabled with CycleTime.EnMonitoring = FALSE.
If automatic mode was active before the error occurred and ActivateRecoverMode = TRUE, PID_Temp
remains in automatic mode.
If manual mode was active before the error occurred and ActivateRecoverMode = TRUE, PID_Temp
remains in manual mode.
If pretuning or fine tuning mode was active before the error occurred and ActivateRecoverMode = TRUE,
PID_Temp switches to the operating mode that is saved in the Mode parameter.
If this error occurred during simulation with PLCSIM, see the notes under Simulating PID_Temp with
PLCSIM (Page 189).
0000_1000 Invalid value at "Setpoint" parameter or "SubstituteSetpoint": Value has an invalid number format.
If automatic mode was active before the error occurred and ActivateRecoverMode = TRUE, PID_Temp out
puts the configured substitute output value. As soon as the error is no longer pending, PID_Temp switches
back to automatic mode.
If manual mode was active before the error occurred and ActivateRecoverMode = TRUE, PID_Temp
remains in manual mode.
If pretuning or fine tuning mode was active before the error occurred and ActivateRecoverMode = TRUE,
PID_Temp switches to the operating mode that is saved in the Mode parameter.
0001_0000 Invalid value at ManualValue parameter. Value has an invalid number format.
If ActivateRecoverMode = TRUE before the error occurred, PID_Temp remains in manual mode and uses
SubstituteOutput as PID output value. As soon as you specify a valid value in ManualValue, PID_Temp uses
it as the PID output value.
0002_0000 Invalid value at SubstituteOutput tag. Value has an invalid number format.
PID_Temp remains in the "Substitute output value with error monitoring" mode or manual mode and uses
the low limit of the PID output value for heating (Config.Output.Heat.PidLowerLimit) as PID output value.
As soon as you specify a valid value in SubstituteOutput, PID_Temp uses it as the PID output value.
0004_0000 Invalid value at Disturbance parameter. Value has an invalid number format.
If automatic mode was active and ActivateRecoverMode = TRUE before the error occurred, Disturbance is
set to zero. PID_Temp remains in automatic mode.
If pretuning or fine tuning mode was active before the error occurred and ActivateRecoverMode = TRUE,
PID_Temp switches to the operating mode that is saved in the Mode parameter. If Disturbance in the cur
rent phase has no effect on the output value, tuning is not be canceled.
0020_0000 Error in master in the cascade: Slaves are not in automatic mode or have enabled a substitute setpoint and
are preventing tuning of the master.
If ActivateRecoverMode = TRUE before the error occurred, PID_Temp cancels the tuning and switches to
the operating mode that is saved in the Mode parameter.
PID control
390 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.3 PID_Temp
ErrorBits Description
(DW#16#...)
0040_0000 Pretuning heating is not permitted while cooling is active.
If ActivateRecoverMode = TRUE before the error occurred, PID_Temp cancels the tuning and switches to
the operating mode that is saved in the Mode parameter.
0080_0000 The process value must be close to the setpoint to start pretuning cooling.
If ActivateRecoverMode = TRUE before the error occurred, PID_Temp cancels the tuning and switches to
the operating mode that is saved in the Mode parameter.
0100_0000 Error at start of tuning: Heat.EnableTuning and Cool.EnableTuning are not set or do not match the config
uration.
If ActivateRecoverMode = TRUE before the error occurred, PID_Temp cancels the tuning and switches to
the operating mode that is saved in the Mode parameter.
0200_0000 Pretuning cooling requires successful pretuning heating.
If ActivateRecoverMode = TRUE before the error occurred, PID_Temp cancels the tuning and switches to
the operating mode that is saved in the Mode parameter.
0400_0000 Error at start of fine tuning: Heat.EnableTuning and Cool.EnableTuning must not be set simultaneously.
If ActivateRecoverMode = TRUE before the error occurred, PID_Temp cancels the tuning and switches to
the operating mode that is saved in the Mode parameter.
0800_0000 Error during calculation of the PID parameters resulted in invalid parameters.
The invalid parameters are discarded and the original PID parameters are retained unchanged.
If this error occurs during pretuning, make sure that:
• Pretuning heating or pretuning heating and cooling: The PID output value is not already limited by the
high limit for heating before the start of the pretuning.
• Pretuning cooling: The PID output value is not already limited by the low limit for cooling before the
start of the pretuning.
For starting a pretuning of heating or pretuning of heating and cooling in automatic mode, it is recom
mended to perform the required setpoint change simultaneously with the rising edge at ModeActivate.
This prevents the PID output value from running into the limitation between the setpoint change and the
start of the pretuning. Alternatively, this can also be achieved by starting from manual mode or "Inactive"
mode.
A distinction is made between the following scenarios:
• If automatic mode was active before the error occurred and ActivateRecoverMode = TRUE, PID_Temp
remains in automatic mode.
• If manual mode was active before the error occurred and ActivateRecoverMode = TRUE, PID_Temp
remains in manual mode.
• If pretuning or fine tuning mode was active before the error occurred and ActivateRecoverMode =
TRUE, PID_Temp switches to the operating mode that is saved in the Mode parameter.
PID control
Function Manual, 11/2023, A5E35300227-AG 391
Instructions
10.3 PID_Temp
The ActivateRecoverMode tag determines the reaction to error. The Error parameter indicates
if an error is pending. When the error is no longer pending, Error = FALSE. The ErrorBits
parameter shows which errors have occurred.
NOTICE
Your system may be damaged.
If ActivateRecoverMode = TRUE, PID_Temp remains in automatic mode or in manual mode
even if there is an error and the process limit values are exceeded.
This may damage your system.
It is essential to configure how your controlled system reacts in the event of an error to
protect your system from damage.
ActivateRecover Description
Mode
FALSE PID_Temp switches to "Inactive" mode in the event of an error. The controller is only activated by a falling
edge at Reset or a rising edge at ModeActivate.
TRUE Automatic mode
If errors occur frequently in automatic mode, this setting has a negative effect on the control response,
because PID_Temp switches between the calculated PID output value and the substitute output value at
each error. In this case, check the ErrorBits parameter and eliminate the cause of the error.
If one or several of the following errors occur and automatic mode was active before the error occurred,
PID_Temp remains in automatic mode:
• 0000001h: The "Input" parameter is outside the process value limits.
• 0000800h: Sampling time error
• 0040000h: Invalid value at Disturbance parameter.
• 8000000h: Error during calculation of the PID parameters
If one or several of the following errors occur and automatic mode was active before the error occurred,
PID_Temp switches to "Substitute output value with error monitoring" mode:
• 0000002h: Invalid value at Input_PER parameter.
• 0000200h: Invalid value at Input parameter.
• 0000400h: Calculation of output value failed.
• 0001000h: Invalid value at Setpoint parameter or SubstituteSetpoint.
As soon as the errors are no longer pending, PID_Temp switches back to automatic mode.
If the following error occurs in "Substitute output value with error monitoring" mode, PID_Temp sets the
PID output value to Config.Output.Heat.PidLowerLimit as long as this error is pending:
• 0020000h: Invalid value at SubstituteOutput tag. Value has an invalid number format.
PID control
392 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.3 PID_Temp
ActivateRecover Description
Mode
If the error 0010000h is pending in manual mode and the following error occurs, PID_Temp sets the PID
output value to Config.Output.Heat.PidLowerLimit as long as this error is pending:
• 0020000h: Invalid value at SubstituteOutput tag. Value has an invalid number format.
This behavior is independent of SetSubstituteOutput.
ActivateRecover Description
Mode
FALSE PID_Temp switches to "Inactive" mode in the event of an error. The controller is only activated by a falling
edge at Reset or a rising edge at ModeActivate.
TRUE If the following error occurs, PID_Temp remains in the active mode:
• 0000020h: Pretuning is not permitted during fine tuning.
The following errors are ignored:
• 0010000h: Invalid value at ManualValue parameter.
• 0020000h: Invalid value at SubstituteOutput tag.
When any other error occurs, PID_Temp cancels the tuning and switches to the mode from which tuning
was started.
If several warnings are pending simultaneously, the values of the Warning tag are displayed
with binary addition. The display of warning 16#0000_0003, for example, indicates that the
warnings 16#0000_0001 and 16#0000_0002 are pending simultaneously.
Warning Description
(DW#16#....)
0000_0000 No warning pending.
0000_0001 The point of inflection was not found during pretuning.
0000_0004 The setpoint was limited to the configured limits.
0000_0008 Not all the necessary controlled system properties were defined for the selected method of calculation.
Instead, the PID parameters were calculated using the method TIR.TuneRuleHeat = 3 or
TIR.TuneRuleCool = 3.
0000_0010 The operating mode could not be changed because Reset = TRUE or ManualEnable = TRUE.
0000_0020 The cycle time of the calling OB limits the sampling time of the PID algorithm.
Improve results by using shorter OB cycle times.
0000_0040 The process value exceeded one of its warning limits.
0000_0080 Invalid value at Mode. The operating mode is not switched.
0000_0100 The manual value was limited to the limits of the PID output value.
0000_0200 The specified rule for tuning is not supported. No PID parameters are calculated.
0000_1000 The substitute output value cannot be reached because it is outside the output value limits.
0000_4000 The specified selection of the output value for heating and/or cooling is not supported.
Only the output OutputHeat or OutputCool is used.
0000_8000 Invalid value at PIDSelfTune.SUT.AdaptDelayTime. The default value 0 is used.
PID control
Function Manual, 11/2023, A5E35300227-AG 393
Instructions
10.3 PID_Temp
Warning Description
(DW#16#....)
0001_0000 Invalid value at PIDSelfTune.SUT.CoolingMode. The default value 0 is used.
0002_0000 The activation of cooling (Config.ActivateCooling tag) is not supported by the controller that is used as mas
ter (Config.Cascade.IsMaster tag). PID_Temp works as heating controller.
Set the Config.ActivateCooling tag to FALSE.
0004_0000 Invalid value at Retain.CtrlParams.Heat.Gain, Retain.CtrlParams.Cool.Gain or Config.CoolFactor. PID_Temp
supports only positive values for proportional gain (heating and cooling) and cooling factor. Automatic
mode remains active with PID output value 0.0. The integral component is stopped.
The following warnings are deleted as soon as the cause has been remedied or you repeat
the action with valid parameters:
• 16#0000_0001
• 16#0000_0004
• 16#0000_0008
• 16#0000_0040
• 16#0000_0100
All other warnings are cleared with a rising edge at Reset or ErrorAck.
PID control
394 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.3 PID_Temp
PID control
Function Manual, 11/2023, A5E35300227-AG 395
Instructions
10.3 PID_Temp
0VUQVU
U NT
0VUQVU@18.
536&
'"-4&
U NT
① PID_Temp sampling time = 100.0 ms (cycle time of the calling cyclic interrupt OB, CycleTime.Value tag)
② PID algorithm sampling time = 2000.0 ms (Retain.CtrlParams.Heat.Cycle tag)
③ Time period of the PWM for heating = 600.0 ms (Config.Output.Heat.PwmPeriode tag)
The IntegralResetMode tag determines how the integral action PIDCtrl.IOutputOld is pre-
assigned:
• When switching from "Inactive" operating mode to "Automatic mode"
• With edge TRUE -> FALSE at parameter Reset and parameter Mode = 3
This setting only works for one cycle and is only effective if the integral action is activated
(Retain.CtrlParams.Heat.Ti and Retain.CtrlParams.Cool.Ti > 0.0 tags).
IntegralReset Description
Mode
0 Smooth
The value of PIDCtrl.IOutputOld is pre-assigned so that the switchover is bumpless, which means
"Automatic mode" starts with the output value = 0.0 (parameter PidOutputSum) and there is no jump of
the output value regardless of the control deviation (setpoint – process value).
PID control
396 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.3 PID_Temp
IntegralReset Description
Mode
1 Delete
We recommend setting the weighting of the proportional action (Retain.CtrlParams.Heat.PWeighting and
Retain.CtrlParams.Cool.PWeighting tags) to 1.0 if this option is used.
The value of PIDCtrl.IOutputOld is deleted. Any control deviation will cause a jump of the PID output value.
The direction of the output value jump depends on the active weighting of the proportional action
(Retain.CtrlParams.Heat.PWeighting and Retain.CtrlParams.Cool.PWeighting tags) and the control devi
ation:
• Active proportional action weighting = 1.0:
Output value jump and control deviation have identical signs.
Example: If the process value value is smaller than the setpoint (positive control deviation), the PID
output value jumps to a positive value.
• Active proportional action weighting < 1.0:
For large control deviations, the PID output value jump and control deviation have identical signs.
Example: If the process value is much smaller than the setpoint (positive control deviation), the PID
output value jumps to a positive value.
For small control deviations, the PID output value jump and control deviation have different signs.
Example: If the process value is just below the setpoint (positive control deviation), the PID output
value jumps to a negative value. This is usually not desirable, because it results in a temporary increase
in the control deviation.
The smaller the configured weighting of the proportional action, the greater the control deviation
must be to receive a PID output value jump with identical sign.
We recommend setting the weighting of the proportional action (Retain.CtrlParams.Heat.PWeighting and
Retain.CtrlParams.Cool.PWeighting tags) to 1.0 when this option is used. Otherwise, you may experience
the undesirable behavior described for small control deviations. Alternatively, you can also use
IntegralResetMode = 4. This option guarantees identical signs of the PID output value jump and control
deviation independent of the configured weighting of the proportional action and the control deviation.
2 Hold
The value of PIDCtrl.IOutputOld is not changed. You can define a new value using the user program.
3 Pre-assign
The value of PIDCtrl.IOutputOld is automatically pre-assigned as if PidOutputSum =
OverwriteInitialOutputValue in the last cycle.
4 Like setpoint change (only for PID_Temp with version ≥ 1.1)
The value of PIDCtrl.IOutputOld is automatically pre-assigned so that a similar PID output value jump res
ults as for a PI controller in automatic mode in case of a setpoint change from the current process value to
the current setpoint.
Any control deviation will cause a jump of the PID output value. The PID output value jump and control
deviation have identical signs.
Example: If the process value value is smaller than the setpoint (positive control deviation), the PID output
value jumps to a positive value. This is independent of the configured weighting of the proportional action
and the control deviation.
If IntegralResetMode is assigned a value outside the valid value range, PID_Temp behaves as
with the pre-assignment of IntegralResetMode:
• PID_Temp up to V1.0: IntegralResetMode = 1
• PID_Temp as of V1.1: IntegralResetMode = 4
PID control
Function Manual, 11/2023, A5E35300227-AG 397
Instructions
10.4 PID basic functions
10.4.1 CONT_C
Application
You can use the controller as a PID fixed setpoint controller, or in multi-loop control systems,
also as a cascade, blending or ratio controller. The functions of the controller are based on
the PID control algorithm of the sampling controller with an analog signal, if necessary
extended by including a pulse shaper stage to generate pulse-width modulated output
signals for two or three step controllers with proportional actuators.
Call
The CONT_C instruction has an initialization routine that is run through when input
parameter COM_RST = TRUE is set. During initialization, the integral action is set to the
initialization value I_ITVAL. All the signal outputs are set to zero. COM_RST = FALSE has to be
set after the initialization routine has been completed.
The calculation of the values in the control blocks is only correct if the block is called at
regular intervals. You should therefore call the control blocks in a cyclic interrupt OB (OB 30
to OB 38). Enter the sampling time in the CYCLE parameter.
Error information
The error message word RET_VAL is not evaluated by the block.
PID control
398 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.4 PID basic functions
Setpoint branch
The setpoint is entered in floating-point format at the SP_INT input.
PID Algorithm
The PID algorithm operates as a position algorithm. The proportional, integral (INT), and
differential (DIF) actions are connected in parallel and can be activated or deactivated
individually. This allows P, PI, PD, and PID controllers to be configured. Pure I controllers are
also possible.
PID control
Function Manual, 11/2023, A5E35300227-AG 399
Instructions
10.4 PID basic functions
Feedforward control
A disturbance variable can be added at the DISV input.
41@*/5
171&3@0/ ("*/
17@*/ %&"%#"/%
9
$31@*/ 17@/03.
17@1&3
%&"%#@8
17 &3
17@'"$
17@0''
1@4&-
-./@1
*/5
*@4&- %*47
5* */5@)0-% -./@*
*@*5-@0/
*@*5-7"-
%*'
-./@%
5% 5.@-"(
%@4&-
2-./@)-.
."/@0/ 2-./@--.
-./
."/
-./-*.*5 -./@/03. $31@065
-./@1&3
-./@)-. -./@'"$
-./@--. -./@0''
PID control
400 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.4 PID basic functions
The names of the following parameters apply both to the data block and to access via the
Openness API.
Table 10-13
Parameters Data Default Description
type
COM_RST BOOL FALSE The instruction has an initialization routine that is processed when the "Restart" input is
set.
MAN_ON BOOL TRUE If the input "Enable manual mode" is set then the control loop is interrupted. A manual
value is set as the manipulated value.
PVPER_ON BOOL FALSE If the process value is to be read in from the I/Os, the PV_PER input must be interconnec
ted with the I/Os and the "Enable process value I/Os" input must be set.
P_SEL BOOL TRUE The PID actions can be switched on and off individually in the PID algorithm. P-action is on
when the "Enable P-action" input is set.
I_SEL BOOL TRUE The PID actions can be switched on and off individually in the PID algorithm. I action is on
when the input "I-action on" is set.
INT_HOLD BOOL FALSE The output of the integral action can be frozen. For this the input "I-action hold" must be
set.
I_ITL_ON BOOL FALSE The output of the integral action can be set at the I_ITLVAL input. For this the input "Set
I-action" must be set.
D_SEL BOOL FALSE The PID actions can be switched on and off individually in the PID algorithm. D-action is on
when the input "Enable D-action" is set.
CYCLE TIME T#1s The time between block calls must be constant. The "Sampling time" input specifies the
time between block calls.
CYCLE >= 1ms
SP_INT REAL 0.0 The input "Internal setpoint" is used to specify a setpoint.
Permissible are values from -100 to 100 % or a physical variable 1).
PV_IN REAL 0.0 At the "Process value input" you can assign parameters to a commissioning value or you
can interconnect an external process value in floating-point format.
Permissible are values from -100 to 100 % or a physical variable 1).
PV_PER WORD W#16# The process value in I/O format is interconnected with the controller at the "Process value
0000 I/0" input.
MAN REAL 0.0 The "Manual value" input is used to set a manual value using the operator interface
functions.
Permissible are values from -100 to 100 % or a physical variable 2).
GAIN REAL 2.0 The "Proportional gain" input specifies controller amplification.
TI TIME T#20s The "Integration time" input determines the time response of the integral action.
TI >= CYCLE
TD TIME T#10s The "Derivative action time" input determines the time response of the derivative action.
TD >= CYCLE
TM_LAG TIME T#2s Time lag of the D-action
The algorithm of the D-action contains a delay for which parameters can be assigned at
the input "Time lag of the D-action".
TM_LAG >= CYCLE/2
DEADB_W REAL 0.0 A dead band is applied to the system deviation. The "Dead band width" input determines
the size of the dead band.
DEADB_W >= 0.0 (%) or a physical variable 1)
PID control
Function Manual, 11/2023, A5E35300227-AG 401
Instructions
10.4 PID basic functions
1) Parameters in the setpoint and process value branches with the same unit
2) Parameters in the manipulated value branch with the same unit
The names of the following parameters apply both to the data block and to access via the
Openness API.
Table 10-14
Parameter Data Default Description
type
LMN REAL 0.0 The effective "Manipulated value" is output in floating point format at the "Manipulated
value" output.
LMN_PER WORD W#16# The manipulated value in I/O format is interconnected on the input "Manipulated value
0000 I/O" with the controller.
QLMN_HLM BOOL FALSE The manipulated value is always restricted to a high limit and low limit. The output "High
limit of manipulated value reached" indicates that the high limit has been reached.
QLMN_LLM BOOL FALSE The manipulated value is always restricted to a high limit and low limit. The output "Low
limit of manipulated value reached" indicates that the low limit has been reached.
LMN_P REAL 0.0 The "P-action" output contains the proportional action of the manipulated variable.
LMN_I REAL 0.0 The "I-action" output contains the integral action of the manipulated variable.
LMN_D REAL 0.0 The "D-action" output contains the derivative action of the manipulated variable.
PV REAL 0.0 The effective process value is output at the "Process value" output.
ER REAL 0.0 The effective system deviation is output at the "Error signal" output.
PID control
402 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.4 PID basic functions
10.4.2 CONT_S
Application
You can use the controller as a PI fixed setpoint controller or in secondary control loops in
cascade, blending or ratio controllers, however you cannot use it as the primary controller.
The functions of the controller are based on the PI control algorithm of the sampling
controller supplemented by the functions for generating the binary output signal from the
analog actuating signal.
Call
The CONT_S instruction has an initialization routine that is run through when input
parameter COM_RST = TRUE is set. All the signal outputs are set to zero. COM_RST = FALSE
has to be set after the initialization routine has been completed.
The calculation of the values in the control blocks is only correct if the block is called at
regular intervals. You should therefore call the control blocks in a cyclic interrupt OB (OB 30
to OB 38). Enter the sampling time in the CYCLE parameter.
Error information
The error message word RET_VAL is not evaluated by the block.
Setpoint branch
The setpoint is entered in floating-point format at the SP_INT input.
PID control
Function Manual, 11/2023, A5E35300227-AG 403
Instructions
10.4 PID basic functions
PI step algorithm
The instruction operates without position feedback. The I-action of the PI algorithm and the
assumed position feedback signal are calculated in one integral action (INT) and compared
with the remaining P-action as a feedback value. The difference is applied to a three-step
element (THREE_ST) and a pulse shaper (PULSEOUT) that generates the pulses for the control
valve. The switching frequency of the controller can be reduced by adapting the response
threshold of the three-step element.
Feedforward control
A disturbance variable can be added at the DISV input.
PID control
404 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.4 PID basic functions
41@*/5
171&3@0/ ("*/
17@*/ %&"%#"/%
9
$31@*/ 17@/03.
17@1&3
%&"%#@8
17 &3
17@'"$
17@0''
*/5 -./-*.*5
-./3@)4
-./3@-4 -./3@4*.
-./%/
-./4@0/
%*47
16-4&065 "/% 2-./61
5)3&&@45 "/%
BEBQUJW
"/% 2-./%/
"/%
16-4&@5.
#3&",@5.
.53@5.
03
-./4@0/ .53@5. 9
*/5
5*
9
PID control
Function Manual, 11/2023, A5E35300227-AG 405
Instructions
10.4 PID basic functions
The names of the following parameters apply both to the data block and to access via the
Openness API.
Table 10-15
Parameters Data Default Description
type
COM_RST BOOL FALSE The block has an initialization routine that is processed when the "Restart" input is set.
LMNR_HS BOOL FALSE The signal "Control valve at high endstop" is interconnected at the input "High endstop
signal of position feedback". LMNR_HS=TRUE means: The control valve is at high end
stop.
LMNR_LS BOOL FALSE The signal "Control valve at low endstop" is interconnected on the input "Low endstop
signal of position feedback". LMNR_LS=TRUE means The control valve is at low endstop.
LMNS_ON BOOL FALSE Manipulated value signal processing is switched to manual mode at the "Enable manual
mode of manipulated signal".
LMNUP BOOL FALSE The output signal QLMNUP is operated in manual mode of the manipulated value signals
at the input "Manipulated value signal up".
LMNDN BOOL FALSE The output signal QLMNDN is operated in manual mode of the manipulated value signals
at the input "Manipulated value signal down"
PVPER_ON BOOL FALSE If the process value is to be read from the I/O then the input PV_PER must be interconnec
ted with the I/O and the input "Enable process value I/O" must be set.
CYCLE TIME T#1s The time between block calls must be constant. The "Sampling time" input specifies the
time between block calls.
CYCLE >= 1ms
SP_INT REAL 0.0 The input "Internal setpoint" is used to specify a setpoint.
Permissible are values from -100 to 100 % or a physical variable 1).
PV_IN REAL 0.0 At the "Process value input" you can assign parameters to a commissioning value or you
can interconnect an external process value in floating-point format.
Permissible are values from -100 to 100 % or a physical variable 1).
PV_PER WORD W#16#0 The process value in I/O format is interconnected with the controller at the "Process value
000 I/O" input.
GAIN REAL 2.0 The "Proportional gain" input specifies controller amplification.
TI TIME T#20s The "Integration time" input determines the time response of the integral action.
TI >= CYCLE
DEADB_W REAL 1.0 A dead band is applied to the system deviation. The "Dead band width" input determines
the size of the dead band.
Permissible are values from 0 to 100 % or a physical variable 1).
PV_FAC REAL 1.0 The "Process value factor" input is multiplied by the process value. The input is used to
scale the process value range.
PV_OFF REAL 0.0 The input "Process value offset" is added to the process value. The input is used to scale
the process value range.
PULSE_TM TIME T#3s You can assign a minimum pulse time at the parameter "Minimum pulse time".
PULSE_TM >= CYCLE
PID control
406 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.4 PID basic functions
The names of the following parameters apply both to the data block and to access via the
Openness API.
Table 10-16
Parameters Data Default Description
type
QLMNUP BOOL FALSE If the output "Manipulated value signal up" is set then the control valve should be
open.
QLMNDN BOOL FALSE If the output "Manipulated value signal down" is set then the control valve should
be closed.
PV REAL 0.0 The effective process value is output at the "Process value" output.
ER REAL 0.0 The effective system deviation is output at the "Error signal" output.
PID control
Function Manual, 11/2023, A5E35300227-AG 407
Instructions
10.4 PID basic functions
10.4.3 PULSEGEN
The instruction PULSEGEN serves as the structure of a PID controller with impulse output for
proportional actuators. PULSEGEN transforms the input value INV (= LMN of the PID
controller) through modulation of the impulse width in an impulse sequence with a constant
period duration, which corresponds with the cycle time with which the input value is
updated.
Application
You can use the PULSEGEN instruction to configure two- or three-step PID controllers with
pulse width modulation. The function is normally used in conjunction with the continuous
controller CONT_C.
$0/5@$ 16-4&(&/
-./ */7
Call
The PULSEGEN instruction has an initialization routine that is run through when input
parameter COM_RST = TRUE is set. All the signal outputs are set to zero. COM_RST = FALSE
has to be set after the initialization routine has been completed.
The calculation of the values in the control blocks is only correct if the block is called at
regular intervals. You should therefore call the control blocks in a cyclic interrupt OB (OB 30
to OB 38). Enter the sampling time in the CYCLE parameter.
PID control
408 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.4 PID basic functions
*/7
-./
U
2104@1
U
38/6(*(1F\FOH
1&3@5. &217B&F\FOH
An input variable of 30% and 10 PULSEGEN calls per PER_TM mean the following:
• "One" at the QPOS_P output for the first three calls of PULSEGEN (30% of 10 calls)
• "Zero" at the QPOS_P output for seven further calls of PULSEGEN (70% of 10 calls)
PID control
Function Manual, 11/2023, A5E35300227-AG 409
Instructions
10.4 PID basic functions
Block diagram
104@1@0/
/&(@1@0/
4:/@0/
45&1@0/ ."/@0/
45#*@0/
2104@1
*/7
2/&(@1
1&3@5.
1@#@5.
3"5*0'"$
NOTE
The reduction ratio of the call frequency must be programmed by the user.
Automatic synchronization
It is possible to automatically synchronize the pulse output with the instruction that updates
the input variable INV (e.g. CONT_C). This ensures that a change in the input variable is
output as quickly as possible as a pulse.
The pulse shaper evaluates the input value INV at intervals corresponding to the period
duration PER_TM and converts the value into a pulse signal of corresponding length.
Since, however, INV is usually calculated in a slower cyclic interrupt class, the pulse shaper
should start the conversion of the discrete value into a pulse signal as soon as possible after
the updating of INV.
To allow this, the block can synchronize the start of the period using the following procedure:
PID control
410 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.4 PID basic functions
If INV changes and if the block call is not in the first or last two call cycles of a period, a
synchronization is performed. The pulse duration is recalculated and in the next cycle is
output with a new period.
-./*/7 -./*/7 -./*/7
1SPDFTTJOH$0/5@$
U
$:$-&WPO$0/5@$
1FSJPETUBSU
1&3@5. 1&3@5.
$:$-&PG
16-4&(&/
4ZODISPOJ[BUJPOPGUIF /PTZODISPOJ[BUJPO
QFSJPETUBSU SFRVJSFE
16-4&(&/EFUFDUT 16-4&(&/EFUFDUT
*/7IBTDIBOHFEBOEUIFDBMMJTOPU */7IBTDIBOHFEUPPSBOE
JOUIFSTUPSJOUIFMBTUUXPDZDMFT UIFDBMMJTJOUIFSTUPSJOUIFMBTUUXP
PGUIFQFSJPE DZDMFTPGUIFQFSJPE
1SPDFTTJOH16-4&(&/ 1SPDFTTJOH16-4&4&(.&/54JOUIFSTUPSUIFMBTUUXPDZDMFTPG
UIFQFSJPE
NOTE
The start of a new period and subsequent synchronization usually leads to a certain
imprecision when the old value of INV (i.e. of LMN) is mapped to the pulse signal.
PID control
Function Manual, 11/2023, A5E35300227-AG 411
Instructions
10.4 PID basic functions
Modes
Depending on the parameters assigned to the pulse shaper, PID controllers with a three-step
output or with a bipolar or unipolar two-step output can be configured. The following table
illustrates the setting of the switch combinations for the possible modes.
Mode MAN_ON STEP3_ON ST2BI_ON
Three-step control FALSE TRUE Any
Two-step control with bi-polar FALSE FALSE TRUE
Manipulating range (-100 % to 100 %)
Two-step control with unipolar FALSE FALSE FALSE
Manipulating range (0 % to 100 %)
Manual mode TRUE Any Any
Three-step control
In "Three-step control" mode, it is possible to generate three statuses of the actuating signal.
For this, the status values of the binary output signals QPOS_P and QNEG_P are assigned to
the respective operating statuses of the actuator. The table shows the example of a
temperature control:
PID control
412 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.4 PID basic functions
A correctly assigned minimum pulse duration or minimum interval P_B_TM can prevent short
on/off times, which reduce the working life of switching elements and actuators. Small
absolute values of input variable LMN that could otherwise generate a pulse duration shorter
than P_B_TM are suppressed. Large input values that would generate a pulse duration longer
than PER_TM - P_B_TM are set to 100% or -100%.
The duration of positive or negative pulses is calculated by multiplying the input variable (in
%) by the period duration:
Pulse duration = INV / 100 * PER_TM
The following figure shows a symmetrical characteristic curve of the three-step controller
(ratio factor = 1).
'XUDWLRQRIWKHSRVSXOVH
3HUPDQHQWO\21
1&3@5.
1&3@5.1@#@5.
1@#@5.
3HUPDQHQWO\2))
'XUDWLRQRIWKHQHJSXOVH
PID control
Function Manual, 11/2023, A5E35300227-AG 413
Instructions
10.4 PID basic functions
1&3@5.
1&3@5.1@#@5.
1@#@5.
1@#@5.
1&3@5.
'XUDWLRQRIWKHQHJSXOVH
In two-step control, only the positive pulse output QPOS_P of PULSEGEN is connected to the
on/off actuator. Depending on the manipulated value range used, the two-step controller has
a bipolar or a unipolar manipulated value range.
Two-step control with bipolar manipulated variable range (-100% to 100%)
'XUDWLRQRIWKHSRVSXOVH 3HUPDQHQWO\21
1&3@5.
1&3@5.1@#@5.
3HUPDQHQWO\2))
1@#@5.
PID control
414 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.4 PID basic functions
1&3@5.
1&3@5.1@#@5.
1@#@5.
The negated output signal is available at QNEG_P if the connection of the two-step controller
in the control loop requires a logically inverted binary signal for the actuating pulses.
The values of the input parameters are not limited in the block. There is no parameter check.
Table 10-17
Parameters Data Default Description
type
INV REAL 0.0 At the input parameter "Input variable" an analog manipulated variable is connected.
Values from -100 to 100 % are permitted.
PER_TM TIME T#1s At the parameter "Period duration" the constant period duration of the pulse width modu
lation is entered. This corresponds to the sampling time of the controller. The ratio
between the sampling time of the pulse shaper and the sampling time of the controller
determines the accuracy of the pulse width modulation.
PER_TM >=20*CYCLE
P_B_TM TIME T#50 ms You can assign a minimum pulse/break time at the parameter "Minimum pulse/break
time".
P_B_TM >= CYCLE
RATIOFAC REAL 1.0 Using the "Ratio factor" input parameter the ratio of the duration of positive to negative
pulses can be changed. In a thermal process, this would, for example, allow different
time constants for heating and cooling to be compensated (for example, in a process
with electrical heating and water cooling).
Values from 0.1 to 10.0 are permitted.
STEP3_ON BOOL TRUE At the input parameter "Enable three-step control" the appropriate mode is activated. In
three-step control both output signals are active.
ST2BI_ON BOOL FALSE At the input parameter "Enable two-step control for bipolar manipulated value range" you
can select from the modes "Two-step control for bipolar manipulated value range" and
"Two-step control for unipolar manipulated value range". STEP3_ON = FALSE is required.
MAN_ON BOOL FALSE Setting the input parameter "Enable manual mode" allows the output signals to be set
manually.
PID control
Function Manual, 11/2023, A5E35300227-AG 415
Instructions
10.4 PID basic functions
Table 10-18
Parameters Data type Default Description
QPOS_P BOOL FALSE The output parameter "Output signal positive pulse" is set if a
pulse will be output. In three-step control, this is always the
positive pulse. In two-step control, the QNEG_P is always set
inversely to QPOS_P.
QNEG_P BOOL FALSE The output parameter "Output signal negative pulse" is set if a
pulse will be output. In three-step control, this is always the
negative pulse. In two-step control, QNEG_P is always set
inversely to QPOS_P.
10.4.4 TCONT_CP
Application
The controller controls one actuator; in other words, with one controller you can either heat
or cool but not both. If you use the block for cooling, GAIN must be assigned a negative
value. This inversion of the controller means that if the temperature rises, for example, the
manipulated variable LMN and with it the cooling action is increased.
PID control
416 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.4 PID basic functions
Call
The instruction TCONT_CP must be called with a constant bus cycle time. To achieve this, use
a cyclic interrupt priority class (for example, OB35 for an S7-300).
The TCONT_CP instruction has an initialization routine that is run through when input
parameter COM_RST = TRUE is set. During initialization, the integral action is set to the
initialization value I_ITVAL. All the signal outputs are set to zero. Following execution of the
initialization routine, the block sets COM_RST back to FALSE. If you require initialization when
the CPU restarts, call the block in OB100 with COM_RST = TRUE.
See also
Operating principle of the pulse generator (Page 426)
Block diagram TCONT_CP (Page 429)
Setpoint branch
The setpoint is entered at input SP_INT in floating-point format as a physical value or
percentage. The setpoint and process value used to form the control deviation must have the
same unit.
PID control
Function Manual, 11/2023, A5E35300227-AG 417
Instructions
10.4 PID basic functions
NOTE
With pulse control, the process value must be transferred to the block in the fast pulse call
(reason: mean value filtering). Otherwise, the control quality can deteriorate.
17@0''4
$31@*/<p$>
PID control
418 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.4 PID basic functions
41@*/517
%&"%#@8
PID algorithm
The following figure shows the block diagram of the PID algorithm.
-./@1
41@*/5 G
1'"$@41
("*/ %*47
*/5
-./@4VN
9
*/5@)104
-./@*
&3 */5@)/&(
5* *@*5-@0/
*@*5-7"-
%*'
-./@%
5% %@'
PID control
Function Manual, 11/2023, A5E35300227-AG 419
Instructions
10.4 PID basic functions
U
5%%@'
-./@4VN U ("*/w&3 w 5*
wU %@'wF
Where:
LMN_Sum(t) the manipulated variable in the controller's automatic mode
ER (0) is the step height of the normalized control deviation
GAIN is the controller gain
TI is the integration time
TD is the derivative action time
D_F is the derivative factor
&3
-./@4VN
("*/ &3
&3 U
("*/ &3
U
5%%@'
5*
PID control
420 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.4 PID basic functions
PID control
Function Manual, 11/2023, A5E35300227-AG 421
Instructions
10.4 PID basic functions
-./@1&3
&3
-NO/
$0/;@0/ -./@)-. -./@'"$
$0/@;0/& -./@--. -./@0''4
16-4&(&/
NOTE
Changing the manipulated variable from LMN_LLM or LMN_HLM to LMN_Sum occurs
under compliance of a hysteresis of 20% of the control zone.
PID control
422 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.4 PID basic functions
5FNQFSBUVSF
%POPUIFBUXJUI-./-./@--.
41@*/5 $0/@;0/&
)JHIDPOUSPM[POF
41@*/5
-PXDPOUSPM[POF
41@*/5$0/@;0/&
)FBUXJUI-./-./@--.
5JNF
NOTE
Before enabling the control zone manually, make sure that the control zone band is not
too narrow. If the control zone band is too small, oscillations will occur in the manipulated
variable and process value.
NOTE
The MAN_ON parameter has no effect during tuning.
PID control
Function Manual, 11/2023, A5E35300227-AG 423
Instructions
10.4 PID basic functions
PID control
424 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.4 PID basic functions
NOTE
The controller parameters are only written back to the controller with UNDO_PAR or
LOAD_PID, if the controller gain is not equal to 0:
With LOAD_PID, the parameters are only copied if the corresponding GAIN <> 0 is (either the
PI or PID parameters). This strategy takes into account the situation that no tuning has yet
been made or that PID parameters are missing. If PID_ON = TRUE and PID.GAIN = FALSE,
PID_ON is set to FALSE and the PI parameter is copied.
• D_F, PFAC_SP are preset by the tuning. These can then be modified by the user. LOAD_PID
does not change these parameters.
• With LOAD_PID, the control zone is always recalculated
(CON_ZONE = 250/GAIN), even if CONZ_ON = FALSE.
See also
Operating principle of the pulse generator (Page 426)
Block diagram TCONT_CP (Page 429)
PID control
Function Manual, 11/2023, A5E35300227-AG 425
Instructions
10.4 PID basic functions
The function PULSEGEN transforms the analog manipulated value LmnN through pulse width
module into an impulse sequence with the period duration PER_TM. PULSEGEN is switched on
with PULSE_ON = TRUE and is processed in the cycle CYCLE_P.
-NO/
U
216-4&
U
$:$-&@1
1&3@5.
A manipulated value of LmnN = 30% and 10 PULSEGEN calls per PER_TM therefore means:
• TRUE at output QPULSE for the first three PULSEGEN calls
(30% of 10 calls)
• FALSE at output QPULSE for seven further PULSEGEN calls
(70% of 10 calls)
The duration of a pulse per pulse repetition period is proportional to the manipulated variable
and is calculated as follows:
Pulse duration = PER_TM * LmnN /100
By suppressing the minimum pulse or break time, the characteristic curve of the conversion
develops "knees" in the start and end regions.
PID control
426 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.4 PID basic functions
The following diagram illustrates two-step control with a unipolar manipulated variable range
(0% to 100%):
'XUDWLRQRIWKHSRVSXOVH
1&3@5.
1&3@5.1@#@5.
1@#@5.
1@#@5. 1@#@5.
PID control
Function Manual, 11/2023, A5E35300227-AG 427
Instructions
10.4 PID basic functions
NOTE
When calling the controller in the pulse shaper cycle, you must note the following:
Calling the controller in the pulse shaper cycle will cause the process value to be averaged. As
a result, at output PV, different values may be at input PV_IN and PV_PER. If you want to track
the setpoint value, you must save the process value at input parameter PV_IN at the call times
for complete controller processing (QC_ACT = TRUE). For pulse shaper calls occurring
between these times, you must supply the input parameters PV_IN and SP_INT with the saved
process value.
See also
Description TCONT_CP (Page 416)
Mode of operation TCONT_CP (Page 417)
Block diagram TCONT_CP (Page 429)
Input parameters TCONT_CP (Page 430)
Output parameters TCONT_CP (Page 431)
In/out parameters TCONT_CP (Page 431)
Static variables TCONT_CP (Page 432)
Parameter STATUS_H (Page 436)
Parameters STATUS_D (Page 437)
PID control
428 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.4 PID basic functions
41@*/5
171&3@0/ ("*/
%&"%#"/%
17@*/ 9
$31@*/ 17@/03. %&"%#@8
17@1&3 p$ &3
17
1&[email protected]% 17@'"$
17@0''4
41@*/5 -./@1
G
1'"$@41
%*47
*/5
-./@4VN
*/5@)104 1'"$@41
*/5@)/&( -./@* 1*%@56/& ("*/ 5*
5* *@*5-7"- 17 5% %@'
1*% $0/;@0/
-NO/ $0/;0/&
%*'
56/@0/
-./@% 56/@45C[X
1*%@0/
5% %@' 56/@%-.
2-./@)-.
."/ ."/@0/ 2-./@--. -./
$0/;0/& -./-*.*5
-./@/03. $31@065
-./@1&3
-NO/
&3
-./@)-. -./@'"$
$0/;@0/ 16-4&(&/
-./@--. -./@0''
$0/@;0/
216-4&
16-4&@0/
1&3@5.
#3&",@5.
."/@0/ ."/@0/
1'"$@41
("*/
1*%@$0/ 1*%@0/ -0"%@1*% 4"7&@1"3 6/%0@1"3 1'"$@41
5*
("*/
("*/ 5% 5*
5* %@'
1*@$0/ 1"3@4"7 1"3@4"7 5%
5% $0/;@0/
%@'
$0/;0/& $0/;0/&
$0/;@0/
$0/;0/&
PID control
Function Manual, 11/2023, A5E35300227-AG 429
Instructions
10.4 PID basic functions
See also
Description TCONT_CP (Page 416)
Mode of operation TCONT_CP (Page 417)
Operating principle of the pulse generator (Page 426)
Input parameters TCONT_CP (Page 430)
Output parameters TCONT_CP (Page 431)
In/out parameters TCONT_CP (Page 431)
Static variables TCONT_CP (Page 432)
Parameter STATUS_H (Page 436)
Parameters STATUS_D (Page 437)
The names of the following parameters apply both to the data block and to access via the
Openness API.
Table 10-19
Parameters Addre Data Default Description
ss type
PV_IN 0.0 REAL 0.0 At the "Process value input" you can assign parameters to a commissioning value or
you can interconnect an external process value in floating-point format. The valid
values depend on the sensors used.
PV_PER 4.0 INT 0 The process value in I/O format is interconnected with the controller at the "Process
value I/O" input.
DISV 6.0 REAL 0.0 For feedforward control, the disturbance variable is interconnected to the
"Disturbance variable" input.
INT_HPOS 10.0 BOOL FALSE The output of the integral action can be held in the positive direction. For this, the
input INT_HPOS must be set to TRUE. In a cascade control, INT_HPOS of the
primary controller is connected to QLMN_HLM of the secondary controller.
INT_HNEG 10.1 BOOL FALSE The output of the integral action can be held in the negative direction. For this, the
input INT_HNEG must be set to TRUE. In a cascade control, INT_HNEG of the
primary controller is connected to QLMN_LLM of the secondary controller.
SELECT 12.0 INT 0 If the pulse shaper is on, there are several ways of calling the PID algorithm and
pulse shaper:
• SELECT = 0: The controller is called in a fast cyclic interrupt priority class and
the PID algorithm and pulse shaper are processed.
• SELECT = 1: The controller is called in OB1 and only the PID algorithm is pro
cessed.
• SELECT = 2: The controller is called in a fast cyclic interrupt priority class and
only the pulse shaper is processed.
• SELECT = 3: The controller is called a slow cyclic interrupt priority class and only
the PID algorithm is processed.
PID control
430 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.4 PID basic functions
See also
Operating principle of the pulse generator (Page 426)
Block diagram TCONT_CP (Page 429)
The names of the following parameters apply both to the data block and to access via the
Openness API.
Table 10-20
Parameter Addres Data Default Description
s type
PV 14.0 REAL 0.0 The effective process value is output at the "Process value" output.
The valid values depend on the sensors used.
LMN 18.0 REAL 0.0 The effective "Manipulated value" is output in floating point format at the
"Manipulated value" output.
LMN_PER 22.0 INT 0 The manipulated value in I/O format is interconnected with the controller on the
output "Manipulated value I/O".
QPULSE 24.0 BOOL FALSE The manipulated value is pulse-width-modulated at the QPULSE output.
QLMN_HLM 24.1 BOOL FALSE The manipulated value is always restricted to a high limit and low limit. The out
put QLMN_HLM signals that the high limit has been reached.
QLMN_LLM 24.2 BOOL FALSE The manipulated value is always restricted to a high limit and low limit. The out
put QLMN_LLM signals that the low limit has been reached.
QC_ACT 24.3 BOOL TRUE This parameter indicates whether continuous control component will be pro
cessed the next time the block is called (relevant only when SELECT has the value
0 or 1).
See also
Operating principle of the pulse generator (Page 426)
Block diagram TCONT_CP (Page 429)
Parameter STATUS_H (Page 436)
Parameters STATUS_D (Page 437)
The names of the following parameters apply both to the data block and to access via the
Openness API.
Table 10-21
Parameters Addres Data Default Description
s type
CYCLE 26.0 REAL 0.1 s Sets the sampling time for the PID algorithm. In phase 1, the tuner calculates
the sampling time and enters it in CYCLE.
CYCLE > 0.001 s
CYCLE_P 30.0 REAL 0.02 s At this input, you set the sampling time for the pulse shaper action. In phase 1,
the TCONT_CP instruction calculates the sampling time and enters it in CYCLE_P.
CYCLE_P > 0.001 s
PID control
Function Manual, 11/2023, A5E35300227-AG 431
Instructions
10.4 PID basic functions
See also
Operating principle of the pulse generator (Page 426)
Block diagram TCONT_CP (Page 429)
The names of the following variables apply both to the data block and to access via the
Openness API.
Table 10-22
Parameters Address Data Default Description
type
DEADB_W 44.0 REAL 0.0 A deadband is applied to the control deviation. The "Deadband width" input
determines the size of the deadband.
The valid values depend on the sensors used.
I_ITLVAL 48.0 REAL 0.0 The output of the integrator can be set at the I_ITL_ON input. The initialization
value is applied to the "Initialization value of the I-action" input. During a restart
COM_RST = TRUE, the I-action is set to the initialization value.
Values from -100 to 100 % are permitted.
LMN_HLM 52.0 REAL 100.0 The output value is always restricted to a high limit and low limit. The
"Manipulated value high limit" input specifies the high limit.
LMN_HLM > LMN_LLM
LMN_LLM 56.0 REAL 0.0 The output value is always restricted to a high limit and low limit. The
"Manipulated value low limit" input specifies the low limit.
LMN_LLM < LMN_HLM
PV_FAC 60.0 REAL 1.0 The "Process value factor" input is multiplied by the "Process value I/O". The input
is used to scale the process value range.
PV_OFFS 64.0 REAL 0.0 The "Process value offset" input is added to the "Process value I/O". The input is
used to scale the process value range.
LMN_FAC 68.0 REAL 1.0 The "Output value factor" input is multiplied with the output value. The input is
used to scale the output value range.
LMN_OFFS 72.0 REAL 0.0 The "Output value offset" input is added to the output value. The input is used to
scale the output value range.
PER_TM 76.0 REAL 1.0 s The period duration of the pulse width modulation is entered at the PER_TM para
meter. The relationship of the period duration to the sampling time of the pulse
shaper determines the accuracy of the pulse width modulation.
PER_TM ≥ CYCLE
PID control
432 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.4 PID basic functions
PID control
Function Manual, 11/2023, A5E35300227-AG 433
Instructions
10.4 PID basic functions
PID control
434 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.4 PID basic functions
PID control
Function Manual, 11/2023, A5E35300227-AG 435
Instructions
10.4 PID basic functions
See also
Operating principle of the pulse generator (Page 426)
Block diagram TCONT_CP (Page 429)
PID control
436 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.4 PID basic functions
NOTE
If you cancel tuning in phase 1 or 2, STATUS_H = 0 is set. However, STATUS_D still displays
the status of the last controller calculation.
The higher the value of STATUS_D, the higher the order of the control process, the greater
the TU/TA ratio and the gentler the controller parameters will be.
See also
Operating principle of the pulse generator (Page 426)
Block diagram TCONT_CP (Page 429)
STATUS_D Description
0 No controller parameters were calculated.
110 N_PTN <= 1.5 Process type I fast
121 N_PTN > 1.5 Process type I
200 N_PTN > 1.9 Process type II (transition range)
310 N_PTN >= 2.1 Process type III fast
320 N_PTN > 2.6 Process type III
111, 122, 201, 311, 321 Parameters have been corrected from phase 7.
NOTE
The higher the value of STATUS_D, the higher the order of the control process, the greater
the TU/TA ratio and the gentler the controller parameters will be.
See also
Operating principle of the pulse generator (Page 426)
Block diagram TCONT_CP (Page 429)
PID control
Function Manual, 11/2023, A5E35300227-AG 437
Instructions
10.4 PID basic functions
10.4.5 TCONT_S
Application
You can also use the controller in a cascade control as a secondary position controller. You
specify the actuator position via the setpoint input SP_INT. In this case, you must set the
process value input and the parameter TI (integration time) to zero. An application might be,
for example, temperature control with heating power control using pulse-break activation
and cooling control using a butterfly valve. To close the valve completely, the manipulated
variable (ER*GAIN) should be negative.
Call
The instruction TCONT_S must be called with a constant bus cycle time. To achieve this, use a
cyclic interrupt level (e.g. OB35 with S7-300). The sampling time is specified at the CYCLE
parameter.
Start-up
The TCONT_S instruction has an initialization routine that is run through when input
parameter COM_RST = TRUE is set. Following execution of the initialization routine, the block
sets COM_RST back to FALSE. All outputs are set to their initial values. If you require
initialization when the CPU restarts, call the block in OB100 with COM_RST = TRUE.
PID control
438 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.4 PID basic functions
See also
Block diagram TCONT_S (Page 443)
Setpoint branch
The setpoint is entered at input SP_INT in floating-point format as a physical value or
percentage. The setpoint and process value used to form the control deviation must have the
same unit.
PID control
Function Manual, 11/2023, A5E35300227-AG 439
Instructions
10.4 PID basic functions
17@0''4
$31@*/<p$>
PID control
440 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.4 PID basic functions
41@*/517
%&"%#@8
Feedforward control
A disturbance variable can be added at the DISV input.
PID control
Function Manual, 11/2023, A5E35300227-AG 441
Instructions
10.4 PID basic functions
PID control
442 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.4 PID basic functions
41@*/5
171&3@0/ ("*/
%&"%#"/%
17@*/ 9
$31@*/ 17@/03. %&"%#@8
17@1&3 p$ &3
17
1&[email protected]%& 17@'"$
17@0''4
41@*/5
G
1'"$@41
-./3@)4
-./3@-4
-./61
-./%/
-./4@0/
16-4&065
5)3&&@4 2-./61
%*47 "/% "/%
BEBQUJW
2-./%/
"/% "/%
16-4&@5.
.53@5. #3&",@5.
-./4@0/
9
03 .53@5.
*/5
5*
9
See also
Description TCONT_S (Page 438)
Mode of operation TCONT_S (Page 439)
Input paramters TCONT_S (Page 444)
Output parameters TCONT_S (Page 445)
In/out parameters TCONT_S (Page 445)
Static variables TCONT_S (Page 445)
PID control
Function Manual, 11/2023, A5E35300227-AG 443
Instructions
10.4 PID basic functions
The names of the following parameters apply both to the data block and to access via the
Openness API.
Table 10-23
Paramet Addr Data Defa Description
ers ess type ult
CYCLE 0.0 REAL 0.1 s At this input, you enter the sampling time for the controller.
CYCLE ≥ 0.001
SP_INT 4.0 REAL 0.0 The input "Internal setpoint" is used to specify a setpoint.
The valid values depend on the sensors used.
PV_IN 8.0 REAL 0.0 At the "Process variable input" you can assign parameters to a com
missioning value or you can interconnect an external process value
in floating-point format.
The valid values depend on the sensors used.
PV_PER 12.0 INT 0 The process value in I/O format is interconnected with the controller
at the "Process value I/O" input.
DISV 14.0 REAL 0.0 For feedforward control, the disturbance variable is interconnected
to the "Disturbance variable" input.
LMNR_HS 18.0 BOOL FALSE The signal "Control valve at high endstop" is interconnected on the
input "High endstop signal of position feedback".
• LMNR_HS=TRUE: The control valve is located at the high endstop.
LMNR_LS 18.1 BOOL FALSE The signal "Control valve at low endstop" is interconnected on the
input "Low endstop signal of position feedback".
• LMNR_LS=TRUE:
The control valve is located at the low endstop.
LMNS_ON 18.2 BOOL TRUE Manipulated value signal processing is switched to manual mode at
the "Enable manual mode of manipulated signal".
LMNUP 18.3 BOOL FALSE In manual mode of manipulated signals, the output parameter
QLMNUP is operated at the input parameter "Manipulated signal up".
LMNDN 18.4 BOOL FALSE In manual mode of the manipulated signals, the output parameter
QLMNDN is operated at the input parameter "Manipulated signal
down".
See also
Block diagram TCONT_S (Page 443)
PID control
444 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.4 PID basic functions
The names of the following parameters apply both to the data block and to access via the
Openness API.
Table 10-24
Paramet Addr Data Defa Description
ers ess type ult
QLMNUP 20.0 BOOL FALSE If the output "Manipulated value signal up" is set then the control
valve should be open.
QLMNDN 20.1 BOOL FALSE If the output "Manipulated value signal down" is set then the control
valve should be closed.
PV 22.0 REAL 0.0 The effective process value is output at the "Process value" output.
ER 26.0 REAL 0.0 The effective system deviation is output at the "Error signal" output.
See also
Block diagram TCONT_S (Page 443)
The names of the following parameters apply both to the data block and to access via the
Openness API.
Table 10-25
Paramet Addr Data Defa Description
ers ess type ult
COM_RST 30.0 BOOL FALSE The block has an initialization routine that is processed when the
COM_RST input is set.
See also
Block diagram TCONT_S (Page 443)
The names of the following variables apply both to the data block and to access via the
Openness API.
Table 10-26
Parameters Addre Data Default Description
ss type
PV_FAC 32.0 REAL 1.0 The "Process value factor" input is multiplied by the process value. The input is used
to scale the process value range.
PV_OFFS 36.0 REAL 0.0 The input "Process value offset" is added to the process value. The input is used to
scale the process value range.
The valid values depend on the sensors used.
DEADB_W 40.0 REAL 0.0 A deadband is applied to the control deviation. The "Deadband width" input
determines the size of the deadband.
DEADB_W ≥ 0.0
PID control
Function Manual, 11/2023, A5E35300227-AG 445
Instructions
10.4 PID basic functions
See also
Block diagram TCONT_S (Page 443)
PID control
446 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.4 PID basic functions
10.4.6.1 CONT_C_SF
CONT_C_SF
The instruction CONT_C_SF is integrated in the S7-300 compact CPUs. The instruction must
not be transmitted to the S7-300 CPU during loading. The scope of function corresponds with
the instruction CONT_C.
See also
Description CONT_C (Page 398)
How CONT_C works (Page 399)
CONT_C block diagram (Page 400)
Input parameter CONT_C (Page 401)
Output parameters CONT_C (Page 402)
10.4.6.2 CONT_S_SF
CONT_S_SF
The instruction CONT_S_SF is integrated in the S7-300 compact CPUs. The instruction must
not be transmitted to the S7-300 CPU during loading. The scope of function corresponds with
the instruction CONT_S.
See also
Description CONT_S (Page 403)
Mode of operation CONT_S (Page 403)
Block diagram CONT_S (Page 405)
Input parameters CONT_S (Page 406)
Output parameters CONT_S (Page 407)
PID control
Function Manual, 11/2023, A5E35300227-AG 447
Instructions
10.5 Polyline
10.4.6.3 PULSEGEN_SF
PULSEGEN_SF
The instruction PULSEGEN_SF is integrated in the S7-300 compact CPUs. The instruction must
not be transmitted to the S7-300 CPU during loading. The scope of function corresponds with
the instruction PULSEGEN.
See also
Description PULSEGEN (Page 408)
Mode of operation PULSEGEN (Page 409)
Mode of operation PULSEGEN (Page 412)
Three-step control (Page 412)
Two-step control (Page 414)
Input parameters PULSEGEN (Page 415)
Output parameter PULSEGEN (Page 416)
10.5 Polyline
CPU FW Polyline
S7-1200 as of V4.2 V1.0
S7-1500-based CPUs as of version V2.0 V1.0
PID control
448 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.5 Polyline
Description
The Polyline instruction maps input value Input onto output value Output using a
characteristic curve. The characteristic curve is defined as a polyline with maximum 50 points.
Linear interpolation is performed between the points. You can fit the polyline to the desired
characteristic curve using the number and configuration of the points.
The Polyline instruction can be used, for example, to linearize non-linear characteristics of
sensors or actuators.
Interpolation calculation
Polyline calculates the output value at the Output parameter for the input value at the Input
parameter that lies between point values xi and xi+1 with a linear interpolation. The linear
interpolation is calculated according to the following formula:
*OQVUYJ
0VUQVU ZJ ZJ ZJ
YJ YJ
With parameter Reset = TRUE, an alternative output value can also be specified using the
SubstituteOutput parameter.
Polyline data
The value pairs for the polyline are contained in the Static area of the instruction.
NOTE
• The minimum number of value pairs to be configured is 2.
• The maximum number of value pairs to be configured is 50.
• For a valid configuration, the x values must be specified in ascending order.
To allow the polyline data to be changed without the changes taking effect immediately, the
value pairs of the polyline are duplicated and contained in the following structures:
• UserData
The polyline data in this structure can be edited.
Make use of this structure to specify or change the polyline data. Changes in this structure
do not affect the interpolation calculation until the check and duplication of the data to
the WorkingData structure is initiated. This happens by setting Validate = TRUE or
automatically during the first processing of Polyline after the operating state transition of
the CPU from STOP to RUN.
The preassignment of values in this structure does not represent a valid configuration. To
use the values for the interpolation calculation, change the tags to valid values.
• WorkingData
The polyline data in this structure cannot be edited. This data is used for the interpolation
calculation. Do not manually change the data in this structure.
PID control
Function Manual, 11/2023, A5E35300227-AG 449
Instructions
10.5 Polyline
Both structures have the same data type and thus the same content:
• NumberOfUsedPoints
Number of points used for the interpolation calculation.
• Point
The array with 50 elements contains value pairs of points Point[i].x and Point[i].y with
index "i" from 1 to 50.
The following figure shows a polyline with four points.
0VUQVU
1PJOU<>Z
1PJOU<>
1PJOU<>Z
1PJOU<>
1PJOU<>Z
1PJOU<>
1PJOU<>Z
1PJOU<>
Call
Polyline is called in an OB as a single-instance DB, Polyline is called in an FC as a single-
instance DB or parameter instance DB; Polyline can be called as a single-instance DB, as a
multi-instance DB and as a parameter instance DB in an FB.
When the instruction is called, no technology object is created. Polyline configuration is
available in the Inspector window of the programming editor.
Startup
The tags in the UserData and WorkingData structures are not retentive. These tags are
initialized with the start values after each operating state transition of the CPU from STOP to
RUN.
If you change the actual values in the UserData structure in online mode and these values are
to be retained after the operating state transition of the CPU from STOP to RUN, back up
these values in the start values of the data block.
At the first call of the Polyline instruction after the operating state transition of the CPU from
STOP to RUN, the data in the UserData structure is automatically checked for validity. If the
check is successful, the data is transferred to the WorkingData structure.
PID control
450 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.5 Polyline
ErrorMode Output
0 Value of the Input parameter
1 Value of the SubstituteOutput parameter
2 The last valid result of interpolation calculation
0.0 if there is no valid result
The following applies in addition for all values of the ErrorMode tag:
• If the substitute output value is not a valid REAL value, 0.0 is output as output value.
• The substitute output value is limited to the value range of the data type REAL. Only then
is the substitute output value output at the Output parameter.
• The ErrorMode tag is only effective when the Reset = FALSE parameter is set. If the Reset =
TRUE parameter is set, the value of the SubstituteOutput parameter is output at the
Output parameter.
The Error parameter indicates if an error is pending. When the error is no longer pending,
Error is set to FALSE. The ErrorBits parameter shows which errors have occurred. ErrorBits is
retentive and is reset only by a positive edge at the Reset or ErrorAck parameter.
Polyline data
To change the polyline, you edit the values in the UserData structure. The values are then
checked for validity and transferred to the WorkingData structure. Only in the WorkingData
structure are the values used for the interpolation calculation.
The values are checked and transferred when
• You set the Validate parameter to TRUE while the Reset parameter is set to FALSE.
• Polyline is called for the first time after the change of operating state of the CPU from
STOP to RUN while the Reset parameter is set to FALSE.
If Polyline has already been called, for example in OB100, another automatic check of the
values is not performed at the subsequent calls.
If the polyline data in the UserData structure is invalid, the previous polyline data in the
WorkingData structure remains unchanged and a corresponding error message is output. If
the check was performed for the first time, no valid values are available in the WorkingData
structure and a corresponding error message is output. In this case, the Output parameter is
specified with the substitute output value that you configure with the ErrorMode tag.
The check and transfer of the values from the UserData structure requires more CPU
processing time than the interpolation calculation. In time-critical applications, the first
execution of Polyline can be in startup OB 100. In this way, the time-consuming one-time
check and transfer of the polyline data can be completed before the cyclic application
program sections.
PID control
Function Manual, 11/2023, A5E35300227-AG 451
Instructions
10.5 Polyline
NOTE
If more than the maximum number of 50 points are needed for your application, use two or
more instances of Polyline.
1PJOU<>Z
1PJOU<>
1PJOU<>Z
1PJOU<>
1PJOU<>Z
1PJOU<>
1PJOU<>Z
1PJOU<>
PID control
452 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.5 Polyline
If the OutOfRangeMode tag lies outside the permissible value range of 0 to 1, the default
preassignment 0 becomes effective.
• OutOfRangeMode = 1
The output value is limited to the y-value of the first or last point.
0VUQVU
1PJOU<>Z
1PJOU<>
1PJOU<>Z
1PJOU<>
1PJOU<>Z
1PJOU<>
1PJOU<>Z
1PJOU<>
The Output parameter has a permissible value range of a REAL data type of -3.402823e+38 to
3.402823e+38. The output value at the Output parameter is checked for validity each time
the Polyline instruction is executed. If the interpolation calculation yields an invalid REAL
value, the output value is replaced with the setting at the ErrorMode tag.
PID control
Function Manual, 11/2023, A5E35300227-AG 453
Instructions
10.5 Polyline
The NextXIndex index outputs the index of the next higher x-value for the current input
value. You can use this to determine the points that are being used for the current
interpolation calculation.
WorkingData.Point[NextXIndex-1].x < Input ≤ WorkingData.Point[NextXIndex].x
Example:
• If the value of the Input parameter is between WorkingData.Point[3].x and
WorkingData.Point[4].x, the NextXIndex tag has the value 4.
• If the value of the Input parameter is less than WorkingData.Point[1].x, the NextXIndex
tag has the value 1.
• If the value of the Input parameter is greater than
WorkingData.Point[WorkingData.NumberOfUsedPoints].x and is thus greater than the last
x-value of the polyline, the NextXIndex tag has the value of the
WorkingData.NumberOfUsedPoints + 1 tag. Consequently, maximum permissible value of
the NextXIndex tag is 51.
PID control
454 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.5 Polyline
PID control
Function Manual, 11/2023, A5E35300227-AG 455
Instructions
10.5 Polyline
PID control
456 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.5 Polyline
ErrorBits Description
(DW#16#...)
0000_0002 Cause of error:
One or more tags in the UserData structure have invalid values while the polyline data is checked
(Validate = TRUE and Reset = FALSE).
Response to error:
The polyline data in the UserData structure is not transferred to the WorkingData structure so that the
changes made in the UserData structure will not become effective.
The Polyline FB continues the interpolation calculation with the unchanged and valid polyline data in the
WorkingData structure.
Solution:
Ensure that the following conditions are met when the Validate parameter is set to TRUE:
• 2 ≤ UserData.NumberOfUsedPoints ≤ 50
• UserData.Point[j].x < UserData.Point[j+1].x with index j = 1..(UserData.NumberOfUsedPoints - 1)
• -3.402823e+38 ≤ UserData.Point[i].x ≤ 3.402823e+38 with index i =
1..UserData.NumberOfUsedPoints
• -3.402823e+38 ≤ UserData.Point[i].y ≤ 3.402823e+38 with index i =
1..UserData.NumberOfUsedPoints
• UserData.Point[i].x and UserData.Point[i].y are valid REAL values (≠ NaN) with index i =
1..UserData.NumberOfUsedPoints
PID control
Function Manual, 11/2023, A5E35300227-AG 457
Instructions
10.5 Polyline
ErrorBits Description
(DW#16#...)
0002_0000 Cause of error:
The Input parameter has no valid REAL value, while the interpolation calculation is being performed
(Reset = FALSE).
Response to error:
The substitute output value that is configured at the ErrorMode tag is output at the Output parameter.
When ErrorMode = 0, 0.0 is used as output value.
The NextXIndex tag is not updated as long as the Input parameter has an invalid REAL value
Solution:
Make sure that the parameter Input is a valid REAL value (≠ NaN e.g. 16#7FFF_FFFF).
0004_0000 Cause of error:
The interpolation calculation yields an invalid REAL value for the Output parameter.
Response to error:
The substitute output value that is configured at the ErrorMode tag is output at the Output parameter.
The NextXIndex tag can have an invalid value as long as this error is pending.
Solution:
Check the REAL values in the WorkingData structure for validity.
Additional information:
If you want to change the polyline data, first edit the UserData structure and then set parameter
Validate = TRUE. Do not manually change the data of the WorkingData structure.
0008_0000 Cause of error:
One or more tags in the UserData structure have invalid values while the polyline data is checked.
Response to error:
The polyline data in the UserData structure is not transferred to the WorkingData structure so that the val
ues in the UserData structure do not become effective.
FB Polyline does not output the interpolation value at the Output parameter because no valid polyline
data is contained in the WorkingData structure. The substitute output value that is configured at the
ErrorMode tag is output at the Output parameter.
Solution:
Ensure that the following conditions are met when the polyline data is checked:
• 2 ≤ UserData.NumberOfUsedPoints ≤ 50
• UserData.Point[j].x < UserData.Point[j+1].x with index j = 1..(UserData.NumberOfUsedPoints – 1)
• -3.402823e+38 ≤ UserData.Point[i].x ≤ 3.402823e+38 with index i =
1..UserData.NumberOfUsedPoints
• -3.402823e+38 ≤ UserData.Point[i].y ≤ 3.402823e+38 with index i =
1..UserData.NumberOfUsedPoints
• UserData.Point[i].x and UserData.Point[i].y are valid REAL values (≠ NaN) with index i =
1..UserData.NumberOfUsedPoints
Additional information:
The polyline data in the UserData structure is checked when
• The Validate parameter is set to TRUE while the Reset parameter is set to FALSE
or
• Polyline is called for the first time with parameter Reset = FALSE after the operating state transition of
the CPU from STOP to RUN.
Note that all tags in the UserData and WorkingData structures are not retentive. These tags are initialized
with the start values after each operating state transition of the CPU from STOP to RUN.
PID control
458 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.6 SplitRange
10.6 SplitRange
CPU FW SplitRange
S7-1200 as of V4.2 V1.0
S7-1500-based CPUs as of version V2.0 V1.0
Description
The SplitRange instruction converts the input value into an output value. The input value is
located in the value range that is limited by Points.x1 and Points.x2. The output value is
located in the value range that is limited by Points.y1 and Points.y2.
The following figure shows the relevant characteristic of an example configuration of the
SplitRange instruction:
0VUQVU
1PJOUTZ
1PJOUTZ
Use SplitRange when you need to control a process that is influenced by multiple actuators.
SplitRange splits the output value range of the PID controller into multiple subranges. Assign
a subrange to each actuator. The user program calls the block once per subrange. The input
value of each SplitRange instance is connected to the output value of the PID controller.
PID control
Function Manual, 11/2023, A5E35300227-AG 459
Instructions
10.6 SplitRange
The figure below shows an example of a control loop with two SplitRange instances and two
actuators:
1*%@ 4QMJU3BOHF@
*OQVU 0VUQVU *OQVU 0VUQVU
"DUVBUPS@
4FUQPJOU
4QMJU3BOHF@
*OQVU 0VUQVU
"DUVBUPS@
PID control
460 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.6 SplitRange
Call
In an OB or FC, SplitRange is called as single-instance DB. In an FB, SplitRange can be called as
a single-instance DB, as a multi-instance DB, and as a parameter instance DB.
When the instruction is called, no technology object is created. No parameter assignment
interface or commissioning interface is available. You assign the SplitRange parameters
directly using the instance DB and commission SplitRange using a watch table of the user
program in the CPU or HMI.
Startup
The tags in the static area of SplitRange are not retentive. These tags are initialized with the
start values after each operating state transition of the CPU from STOP to RUN.
If you change the actual values in the Points structure in online mode and these values are to
be retained after the operating state transition of the CPU from STOP to RUN, back up these
values in the start values of the data block.
ErrorMode Output
0 Value of the Input parameter
1 Value of the SubstituteOutput parameter
2 The last valid result of output value calculation
0.0 if there is no valid result
The following applies in addition for all values of the ErrorMode tag:
• If the substitute output value is not a valid REAL value, 0.0 is output as output value.
• The substitute output value is limited to the value range of the data type REAL. Only then
is the substitute output value output at the Output parameter.
• The ErrorMode tag is only effective when the Reset = FALSE parameter is set. If the Reset =
TRUE parameter is set, the value of the SubstituteOutput parameter is output at the
Output parameter.
The Error parameter indicates if an error is pending. When the error is no longer pending,
Error is set to FALSE. The ErrorBits parameter shows which errors have occurred. ErrorBits is
retentive and is reset only by a positive edge at the Reset or ErrorAck parameter.
PID control
Function Manual, 11/2023, A5E35300227-AG 461
Instructions
10.6 SplitRange
PID control
462 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.6 SplitRange
PID control
Function Manual, 11/2023, A5E35300227-AG 463
Instructions
10.7 RampFunction
The output parameter Error is deleted as soon as there are no longer any errors.
ErrorBits Description
(DW#16#...)
0001_0000 Cause of error:
The SubstituteOutput or Input parameter that is being used as the output value has no valid REAL value.
Response to error:
The output is set to 0.0.
Solution:
Make sure that the parameter used as output value is a valid REAL value (≠ NaN e.g. 16#7FFF_FFFF). The
parameter that is used as output value depends on Reset and ErrorMode:
Reset ErrorMode Output value
FALSE 0 Input
FALSE 1 SubstituteOutput
TRUE - SubstituteOutput
0002_0000 Cause of error:
The Input parameter has no valid REAL value while the calculation of the output value is being performed
(Reset = FALSE).
Response to error:
The substitute output value that is configured at the ErrorMode tag is output at the Output parameter.
When ErrorMode = 0, 0.0 is used as output value.
Solution:
Make sure that the parameter Input is a valid REAL value (≠NaN e.g. 16#7FFF_FFFF).
0004_0000 Possible causes of error:
• One or more tags in the Points structure have invalid values.
• The calculation of the output value yields an invalid REAL value for the Output parameter.
Response to error:
The substitute output value that is configured at the ErrorMode tag is output at the Output parameter.
Solution:
Ensure that the following conditions are met:
1. Points.x1 < Points.x2
2. Points.x1, Points.y1, Points.x2 and Points.y2 are within the permitted value range from
-3.402823e+38 to 3.402823e+38
3. Points.x1, Points.y1, Points.x2 and Points.y2 are valid REAL values (≠ NaN e.g. 16#7FFF_FFFF)
Additional information:
Note that all tags in the Points structure are not retentive. These tags are initialized with the start values
after each operating state transition of the CPU from STOP to RUN.
10.7 RampFunction
CPU FW RampFunction
S7-1200 as of V4.2 V1.0
S7-1500-based CPUs as of version V2.0 V1.0
PID control
464 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.7 RampFunction
Description
The RampFunction instruction limits the slew rate of a signal. RampFunction outputs a signal
jump at the input as ramp function of the output value.
Use the RampFunction to prevent signal jumps, for example, in the following cases:
• Between setpoint source and setpoint input of the controller to achieve a smoother
response without influencing the disturbance reaction.
• Between the controller output and the actuator input to preserve the actuator, for
example, a motor with gears or the process.
The following limits can be set for the slew rate:
• Increasing slew rate in positive value range
• Decreasing slew rate in positive value range
• Increasing slew rate in negative value range
• Decreasing slew rate in negative value range
In addition, the RampFunction instruction limits the output value to the high and low limit.
When the slew rate limit or the low or high limit are reached, RampFunction sets the
associated output bit to TRUE.
PID control
Function Manual, 11/2023, A5E35300227-AG 465
Instructions
10.7 RampFunction
Function chart
The following figure shows the RampFunction instruction and a function chart as an example:
3BNQ'VODUJPO
*OQVU 0VUQVU
4VCTUJUVUF0VUQVU
1PTJUJWF3JTJOH4MFX3BUF@"DUJWF
&SSPS"DL
3FTFU 1PTJUJWF'BMMJOH4MFX3BUF@"DUJWF
/FHBUJWF3JTJOH4MFX3BUF@"DUJWF
/FHBUJWF'BMMJOH4MFX3BUF@"DUJWF
6QQFS-JNJU@"DUJWF
-PXFS-JNJU@"DUJWF
&SSPS#JUT
&SSPS
3FTFU
6QQFS-JNJU@
"DUJWF
-PXFS-JNJU@
"DUJWF
1PTJUJWF3JTJOH
4MFX3BUF@"DUJWF
1PTJUJWF'BMMJOH
4MFX3BUF@"DUJWF
/FHBUJWF3JTJOH
4MFX3BUF@"DUJWF
/FHBUJWF'BMMJOH
4MFX3BUF@"DUJWF
U
*OQVU
6QQFS-JNJU
4VCTUJUVUF0VUQVU
U
0VUQVU
-PXFS-JNJU
Call
In an OB or FC, RampFunction is called as single-instance DB. In an FB, RampFunction can be
called as a single-instance DB, as a multi-instance DB, and as a parameter instance DB.
When the instruction is called, no technology object is created. No parameter assignment
interface or commissioning interface is available. You assign the RampFunction parameters
directly using the instance DB and commission RampFunction using a watch table of the user
program in the CPU or HMI.
PID control
466 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.7 RampFunction
Startup
The tags in the static area of RampFunction are not retentive. These tags are initialized with
the start values after each operating state transition of the CPU from STOP to RUN.
If you change the actual values of the limits in online mode and these values are to be
retained after the operating state transition of the CPU, back up these values in the start
values of the data block.
Specify the initialization value for the Output parameter at the StartMode tag.
During the first call of RampFunction after the
• Operating state transition of the CPU
or
• Execution of "Load start values as actual values" (only with "All values" option, not with
"Only setpoints" option)
the initialization value is output at the Output parameter.
For subsequent calls, RampFunction calculates the output value, starting from this
initialization value, based on the input value and the slew rate limits.
The following table shows the dependency between the StartMode tag and the Output
parameter. The values in the Output column are output at the Output parameter after the
operating state transition of the CPU.
0VUQVU
$16 $16 U
4501 36/
$16 $16 U
4501 36/
0VUQVU
$16 $16 U
4501 36/
3 0.0
*OQVU
0VUQVU
$16 $16 U
4501 36/
PID control
Function Manual, 11/2023, A5E35300227-AG 467
Instructions
10.7 RampFunction
0VUQVU
-PXFS-JNJU
$16 $16 U
4501 36/
0VUQVU
$16 $16 U
4501 36/
The following applies in addition for all values of the StartMode tag:
• When the values of the UpperLimit and LowerLimit tags are valid, the initialization value is
limited to the value range of these tags. Only then is the initialization value output at the
Output parameter.
• If the initialization value is not a valid REAL value, the substitute output value is output at
the Output parameter. The substitute output value is configured by the ErrorMode tag.
The substitute output value is limited by the value range of the tags UpperLimit and
LowerLimit. If the substitute output value is also not a valid REAL value, 0.0 is output at
the Output parameter. For subsequent calls, the instruction calculates the output value
starting from this substitute output value.
• The StartMode tag is only effective when the Reset = FALSE parameter is set at the first
call of the instruction and at the same time no error with error message ErrorBits ≥
16#0002_0000 is pending. If the Reset = TRUE parameter is set, the value of the
SubstituteOutput parameter is output at the Output parameter. If an error with error
message ErrorBits ≥ 16#0002_0000 is pending, the substitute output value that is
configured at the ErrorMode tag is output at the Output parameter.
ErrorMode Output
0 Value of the Input parameter
1 Value of the SubstituteOutput parameter
2 The last valid output value at the Output parameter
PID control
468 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.7 RampFunction
ErrorMode Output
3 0.0
4 Value of the LowerLimit tag
5 Value of the UpperLimit tag
The following applies in addition for all values of the ErrorMode tag:
• If the substitute output value is not a valid REAL value, 0.0 is output as output value.
• When the values of the UpperLimit and LowerLimit tags are valid, the substitute output
value is limited to the value range of these tags. Only then is the substitute output value
output at the Output parameter.
• The ErrorMode tag is only effective when the Reset = FALSE parameter is set. If the Reset =
TRUE parameter is set, the value of the SubstituteOutput parameter is output at the
Output parameter.
• If an error is pending that prevents correct calculation of the output value, RampFunction
changes at the Output parameter from the calculated output value to the substitute
output value. A jump of the output value can occur, depending on the value of the
ErrorMode tag.
The Error parameter indicates if an error is pending. When the error is no longer pending,
Error is set to FALSE. The ErrorBits parameter shows which errors have occurred. ErrorBits is
retentive and is reset only by a positive edge at the Reset or ErrorAck parameter.
PID control
Function Manual, 11/2023, A5E35300227-AG 469
Instructions
10.7 RampFunction
The output value Output increases by 1.0 per call (10.0 per second) until the value at the
Input parameter has been reached.
To disable the slew rate limit for one or more areas, set the corresponding tag to the value
3.402823e+38.
When the output value Output is currently limited by a slew rate limit, RampFunction sets the
associated output bit to TRUE:
• PositiveRisingSlewRate_Active
• PositiveFallingSlewRate_Active
• NegativeRisingSlewRate_Active
• NegativeFallingSlewRate_Active
When the Reset parameter is set to TRUE, the slew rate limits are not in effect. This means
jumps at the SubstituteOutput parameter result in jumps at the Output parameter.
RampFunction checks whether the following conditions for the tags PositiveRisingSlewRate,
PositiveFallingSlewRate, NegativeRisingSlewRate and NegativeFallingSlewRate are met for
each call:
• Values are within the permitted value range greater than 0.0 up to 3.402823e+38
• Values are valid REAL values (≠ NaN e.g. 16#7FFF_FFFF)
If one or more conditions are not met, the substitute output value is output at the Output
parameter. A corresponding error message is output at the ErrorBits parameter.
PID control
470 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.7 RampFunction
NOTE
The active breakpoints extend the time period between two calls of RampFunction.
The longer the time period between two calls, the greater the maximum permitted change of
the output value at the Output parameter.
Example:
The following scenario applies for the example:
• PositiveRisingSlewRate = 10.0
• Call time of RampFunction = 0.1 s
• Input > Output ≥ 0.0
Result without breakpoints:
The output value Output increases by 1.0 per call until the value at the Input parameter has
been reached.
Result with an active breakpoint of ten seconds:
With the next call, the output value Output increases by 100.0.
PID control
Function Manual, 11/2023, A5E35300227-AG 471
Instructions
10.7 RampFunction
If you do not need the calculation of the output value based on the actual time with active
breakpoints, follow these steps:
• Disable automatic measurement of the cycle time by setting the tag
CycleTime.EnableMeasurement = FALSE.
• Enter the cycle time manually at the CycleTime.Value tag.
PID control
472 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.7 RampFunction
PID control
Function Manual, 11/2023, A5E35300227-AG 473
Instructions
10.7 RampFunction
PID control
474 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.7 RampFunction
As soon as there are no longer errors with error messages ErrorBits ≥ 16#0001_0000,
RampFunction reacts as follows:
• The output value is determined as follows:
– When Reset = FALSE, output value calculation
– When Reset = TRUE, output of SubstituteOutput
• The enable output ENO is set to TRUE.
The output parameter Error is deleted as soon as there are no longer any errors.
ErrorBits Description
(DW#16#...)
0001_0000 Cause of error:
The SubstituteOutput parameter or a different tag that is being used as output value has no valid REAL
value.
Response to error:
The output is set to 0.0 and limited by the tags LowerLimit and UpperLimit.
Solution:
Make sure that the tag used as output value is a valid REAL value (≠ NaN e.g. 16#7FFF_FFFF). The tag that
is used as output value depends on Reset and ErrorMode:
Reset ErrorMode Output value
FALSE 0 Input
FALSE 1 SubstituteOutput
FALSE 4 LowerLimit
FALSE 5 UpperLimit
TRUE - SubstituteOutput
0002_0000 Cause of error:
The Input parameter has no valid REAL value while the calculation of the output value is being performed
(Reset = FALSE).
Response to error:
The substitute output value is output at the Output parameter that is configured at the ErrorMode tag and
is limited by the tags UpperLimit and LowerLimit.
When ErrorMode = 0, 0.0 is used as output value.
Solution:
Make sure that the parameter Input is a valid REAL value (≠ NaN e.g. 16#7FFF_FFFF).
0004_0000 Cause of error:
The calculation of the output value yields an invalid REAL value for the Output parameter.
Response to error:
The substitute output value is output at the Output parameter that is configured at the ErrorMode tag and
is limited by the tags UpperLimit and LowerLimit.
Solution:
Check all tags involved in the calculation of the output value:
• Input
• PositiveRisingSlewRate
• PositiveFallingSlewRate
• NegativeRisingSlewRate
• NegativeFallingSlewRate
• CycleTime.Value
These tags have valid values. The calculation of the output value fails in this combination of tags.
PID control
Function Manual, 11/2023, A5E35300227-AG 475
Instructions
10.7 RampFunction
ErrorBits Description
(DW#16#...)
0008_0000 Cause of error:
The LowerLimit or UpperLimit tag has an invalid value.
Response to error:
The following value is output at the Output parameter, depending on the Reset parameter:
• Reset = FALSE
The substitute output value that is configured at the ErrorMode tag is output at the Output parameter.
• Reset = TRUE
The value of the SubstituteOutput parameter is output at the Output parameter.
In both cases, the Ouput parameter is limited to the value range of the REAL data type from
-3.402823e+38 to 3.402823e+38.
Solution:
Ensure that the following conditions are met:
1. LowerLimit < UpperLimit
2. LowerLimit and UpperLimit are within the permitted value range from -3.402823e+38 to
3.402823e+38
3. LowerLimit and UpperLimit are valid REAL values (≠ NaN e.g. 16#7FFF_FFFF)
0010_0000 Cause of error:
At least one of the following tags has invalid values while the calculation of the output value is being per
formed (Reset = FALSE):
1. PositiveRisingSlewRate
2. PositiveFallingSlewRate
3. NegativeRisingSlewRate
4. NegativeFallingSlewRate
Response to error:
The substitute output value is output at the Output parameter that is configured at the ErrorMode tag and
is limited by the tags UpperLimit and LowerLimit.
Solution:
Ensure that the following conditions are met for all four tags listed above:
• The values are within the permitted value range greater than 0.0 up to 3.402823e+38
• The values are valid REAL values (≠ NaN e.g. 16#7FFF_FFFF)
0020_0000 Cause of error:
The tag (configured with StartMode) for the initialization of the Output parameter at the first call of the
instruction does not have a valid REAL value.
Response to error:
The substitute output value is output with the first call of the instruction at the Output parameter that is
configured at the ErrorMode tag and is limited by the tags LowerLimit and UpperLimit. For subsequent
calls, RampFunction calculates the output value starting from this substitute output value.
Solution:
Make sure that the tag for initializing the parameter Output is a valid REAL value (≠ NaN e.g.
16#7FFF_FFFF). When Reset = FALSE is set, the initialization takes effect with the first call of the instruc
tion after the operating state transition of the CPU from STOP to RUN. The tag that is used for the initializ
ation of the Output parameter depends on StartMode:
• StartMode = 1: Substitute Output
• StartMode = 2: Output
0040_0000 Cause of error:
The CycleTime.Value tag has an invalid value, while the calculation of the output value is being performed
(Reset = FALSE).
Response to error:
The substitute output value is output at the Output parameter that is configured at the ErrorMode tag and
is limited by the tags UpperLimit and LowerLimit.
Solution:
PID control
476 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.8 RampSoak
ErrorBits Description
(DW#16#...)
Ensure that the following conditions are met:
• 0.0 < CycleTime.Value ≤ 3.402823e+38
• CycleTime.Value is a valid REAL value (≠ NaN e.g. 16#7FFF_FFFF)
Additional information:
To automatically calculate the value of the CycleTime.Value tag, set the CycleTime.EnableMeasurement
tag to TRUE.
10.8 RampSoak
CPU FW RampSoak
S7-1200 as of V4.2 V1.0
S7-1500-based CPUs as of version V2.0 V1.0
Description
You can use the RampSoak instruction to generate an output value that follows a
configurable profile on a time-dependent basis. Every point of this profile has a target value
and a time value. When the profile is executed, the target value of the current point is
reached within the time value.
The following figure shows a profile with 4 points:
1PJOU<>7BMVF
0VUQVU
1PJOU<>7BMVF
U
1PJOU<>7BMVF
1PJOU<>7BMVF
&OBCMF
The RampSoak instruction can be used, for example, to provide a setpoint value profile for
regulating a temperature process.
PID control
Function Manual, 11/2023, A5E35300227-AG 477
Instructions
10.8 RampSoak
Call
In an OB or FC, RampSoak is called as single-instance DB. In an FB, RampSoak can be called as
a single-instance DB, as a multi-instance DB, and as a parameter instance DB.
When the instruction is called, no technology object is created. No parameter assignment
interface or commissioning interface is available. You assign the RampSoak parameters
directly using the instance DB and commission RampSoak using a watch table of the user
program in the CPU or HMI.
Startup
The tags in the static area of RampSoak and hence also the profile data in the UserData and
WorkingData structures are not retentive. These tags are initialized with the start values after
each operating state transition of the CPU from STOP to RUN.
If you change the actual values in the UserData structure in online mode and these values are
to be retained after the operating state transition of the CPU from STOP to RUN, back up
these values in the start values of the data block.
At the first call of the RampSoak instruction after the operating state transition of the CPU
from STOP to RUN, the data in the UserData structure is automatically validated. If the check
is successful, the data is transferred to the WorkingData structure.
With the tag StartMode (Page 486), you can define the starting behavior of the RampSoak
instruction at the first call after the operating state transition of the CPU from STOP to RUN.
Error Output
Mode
0 Value of the WorkingData.StartValue tag
Make sure that the profile data in UserData is validated with the Validate parameter and
accepted after WorkingData. If the profile data has never been verified and accepted, the
default value 0.0 of WorkingData.StartValue is used.
PID control
478 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.8 RampSoak
Error Output
Mode
1 Value of the SubstituteOutput parameter
2 The last valid output value of the profile execution
0.0, if no valid output value of the profile execution is available.
3 0.0
The following applies in addition for all values of the ErrorMode tag:
• If the substitute output value is not a valid REAL value, 0.0 is output as output value.
• The substitute output value is limited to the value range -3.402823e+38 ..
+3.402823e+38 of the data type REAL. Only then is the substitute output value output at
the Output parameter.
• The ErrorMode tag is only effective when the Reset = FALSE parameter is set. If the Reset =
TRUE parameter is set, the value of the SubstituteOutput parameter or 0.0 is output at the
Output parameter.
The Error parameter indicates if an error is pending. When the error is no longer pending,
Error is set to FALSE. The ErrorBits parameter shows which errors have occurred. ErrorBits is
retentive and is reset only by a positive edge at the Reset or ErrorAck parameter.
PID control
Function Manual, 11/2023, A5E35300227-AG 479
Instructions
10.8 RampSoak
The following figure shows a profile with 6 points. Point number 5 has a duration of 0
seconds, which results in skipping of the output value.
5PUBM5JNF
3FNBJOJOH5JNF@5PUBM
3FNBJOJOH5JNF@1PJOU
1PJOU<>7BMVF
1PJOU<>7BMVF 0VUQVU
1PJOU<>7BMVF
1PJOU<>7BMVF
U
1PJOU<>7BMVF
1PJOU<>7BMVF
PID control
480 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.8 RampSoak
NOTE
The value and duration of the current point are temporarily stored and also remain
unchanged after a successful validation of the new profile data until the current point is
completed. The new profile data is used from the start of the next point.
If one of the conditions is not fulfilled, the existing profile data in the WorkingData structure
remains unchanged. An error with the error message ErrorBits = 16#0000_0004 (Page 496) is
pending.
If the Enable parameter or the Next parameter is set to TRUE, but there is no valid profile data
present in the WorkingData structure, then an error with the error message ErrorBits =
16#0008_0000 (Page 496) will be pending.
NOTE
If you do not change the default values in the UserData structure, the validation of the profile
data fails.
NOTE
You cannot change the offline values of the WorkingData structure. If you want to change
the profile data, first edit the UserData structure and then set parameter Validate = TRUE.
To execute a profile and calculate the output value, you need validated profile data and a
positive edge at the Enable parameter.
PID control
Function Manual, 11/2023, A5E35300227-AG 481
Instructions
10.8 RampSoak
The following graphic shows how the input parameters Enable, Reset and Hold determine the
execution of the profile:
5PUBM5JNF
3FNBJOJOH5JNF@5PUBM
3FNBJOJOH5JNF@1PJOU
4VCTUJUVUF0VUQVU
1PJOU<>7BMVF
0VUQVU
1PJOU<>7BMVF
U
1PJOU<>7BMVF
1PJOU<>7BMVF
&OBCMF
)PME
3FTFU
In this example, the starting and stopping behavior of the profile execution (marked with an
*) is shown with the default StartMode = StopMode = 2 (start from last output value / keep
last output value).
PID control
482 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.8 RampSoak
PID control
Function Manual, 11/2023, A5E35300227-AG 483
Instructions
10.8 RampSoak
NOTE
At the first call of the RampSoak instruction after the operating state transition of the CPU
from STOP to RUN, the behavior is determined by StartMode. The Next parameter is only
effective with the following calls.
An example profile with the Next parameter is available in the following section "Continuing
the profile execution with a certain point - NextPoint parameter".
PID control
484 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.8 RampSoak
The following graphic shows how the Next and NextPoint parameters determine the profile
execution: If the automatic change of NextPoint is subsequently overwritten by a user input,
this is marked with →:
5PUBM5JNF
3FNBJOJOH5JNF@5PUBM
3FNBJOJOH5JNF@1PJOU
1PJOU<>7BMVF
1PJOU<>7BMVF
0VUQVU U
1PJOU<>7BMVF
1PJOU<>7BMVF
&OBCMF
/FYU
In this example, the stopping behavior of the profile execution is shown with StopMode <> 4.
PID control
Function Manual, 11/2023, A5E35300227-AG 485
Instructions
10.8 RampSoak
With the StartMode tag, you can define the behavior of the RampSoak instruction in the
following cases.
• When the RampSoak instruction is executed after the operating state transition of the CPU
from STOP to RUN (restart).
• The profile execution is started.
• Execution of "Load start values as actual values" (only with "All values" option, not with
"Only setpoints" option).
The following settings of the StartMode tag are possible:
• StartMode = 0
The Output parameter assumes the value of WorkingData.StartValue.
The profile execution starts from this value if, after a restart of the CPU, Enable = TRUE is
set or if Enable changes from FALSE to TRUE.
The following graphic shows the start of the profile execution and restart of the CPU with
StartMode = 0:
8PSLJOH%BUB4UBSU7BMVF
0VUQVU
4VCTUJUVUF0VUQVU
&OBCMF
$16 $16 $16 $16 U
4501 36/ 4501 36/
NOTE
With this setting, the profile data must be validated with the first call of the instruction
after the CPU restart and assumed by the WorkingData. Otherwise, the default value 0.0
of WorkingData.StartValue is used.
PID control
486 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.8 RampSoak
• StartMode = 1
The Output parameter assumes the value of SubstituteOutput.
The profile execution starts from this value if, after a restart of the CPU, Enable = TRUE is
set or if Enable changes from FALSE to TRUE.
The following graphic shows the start of the profile execution and restart of the CPU with
StartMode = 1:
8PSLJOH%BUB4UBSU7BMVF
0VUQVU
4VCTUJUVUF0VUQVU
&OBCMF
$16 $16 $16 $16 U
4501 36/ 4501 36/
• StartMode = 2
The Output parameter remains unchanged.
The profile execution starts from the unchanged value of the Output parameter, if, after a
restart of the CPU, Enable = TRUE is set or if Enable changes from FALSE to TRUE.
The following graphic shows the start of the profile execution and restart of the CPU with
StartMode = 2:
8PSLJOH%BUB4UBSU7BMVF
0VUQVU
4VCTUJUVUF0VUQVU
&OBCMF
$16 $16 $16 $16 U
4501 36/ 4501 36/
PID control
Function Manual, 11/2023, A5E35300227-AG 487
Instructions
10.8 RampSoak
• StartMode = 3
The Output parameter adopts the value 0.0.
The profile execution starts from this value if, after a restart of the CPU, Enable = TRUE is
set or if Enable changes from FALSE to TRUE.
The following graphic shows the start of the profile execution and restart of the CPU with
StartMode = 3:
8PSLJOH%BUB4UBSU7BMVF
0VUQVU
4VCTUJUVUF0VUQVU
&OBCMF
$16 $16 $16 $16 U
4501 36/ 4501 36/
• StartMode = 4
The Output parameter remains unchanged.
The profile execution continues if, after the restart of the CPU, Enable = TRUE remains set
and the profile execution was activated before the restart.
The profile execution starts from the unchanged value of the Output parameter, if, after a
restart of the CPU, Enable = TRUE is set and the profile execution was deactivated before
the restart or if Enable changes from FALSE to TRUE.
The following graphic shows the start of the profile execution and restart of the CPU with
StartMode = 4:
8PSLJOH%BUB4UBSU7BMVF
0VUQVU
4VCTUJUVUF0VUQVU
&OBCMF
$16 $16 $16 $16 U
4501 36/ 4501 36/
The following applies in addition for all values of the StartMode tag:
• The Enable parameter, the StartMode tag and the profile data in the UserData and
WorkingData structures are not retentive. These tags are initialized with the start values
after each operating state transition of the CPU from STOP to RUN. Make sure that at the
first call of the RampSoak instruction, after the operating status transition of the CPU from
STOP to RUN, these tags have suitable values to achieve the desired behavior.
• The value selected through StartMode is limited to the value range of the REAL data type.
Only then is it output at the Output parameter.
PID control
488 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.8 RampSoak
• If the value selected through StartMode is not a valid REAL value, the substitute output
value is output at the Output parameter. The substitute output value is configured by
means of the ErrorMode tag and is limited to the value range of the REAL data type. If the
profile execution is activated, it starts from this substitute output value.
• Only if the parameter Reset = FALSE has been set and, at the same time, there is no error
pending with an error message ErrorBits ≥ 16#0002_0000, does the StartMode tag act on
the Output parameter. If the Reset = TRUE parameter is set, the value of the
SubstituteOutput parameter is output at the Output parameter. If an error with error
message ErrorBits ≥ 16#0002_0000 is pending, the substitute output value that is
configured at the ErrorMode tag is output at the Output parameter.
With the StopMode tag, you can define the behavior of the RampSoak instruction in the
following cases.
• The profile execution is finished in that the last point has been reached.
• The profile execution is stopped by resetting Enable.
The value that is set through StopMode is used as the output value until a new action, for
example the start of the profile execution, is triggered.
The following settings of the StopMode tag are possible:
• StopMode = 0
The Output parameter assumes the value of WorkingData.StartValue.
The following graphic shows how the execution of a profile with 5 points is ended and
stopped with StopMode = 0:
8PSLJOH%BUB4UBSU7BMVF
0VUQVU
4VCTUJUVUF0VUQVU
&OBCMF
PID control
Function Manual, 11/2023, A5E35300227-AG 489
Instructions
10.8 RampSoak
• StopMode = 1
The Output parameter assumes the value of SubstituteOutput.
The following graphic shows how the execution of a profile with 5 points is ended and
stopped with StopMode = 1:
8PSLJOH%BUB4UBSU7BMVF
0VUQVU
4VCTUJUVUF0VUQVU
&OBCMF
• StopMode = 2
The Output parameter assumes the last valid value of the profile execution.
The following graphic shows how the execution of a profile with 5 points is ended and
stopped with StopMode = 2:
8PSLJOH%BUB4UBSU7BMVF
0VUQVU
4VCTUJUVUF0VUQVU
&OBCMF
• StopMode = 3
The Output parameter adopts the value 0.0.
The following graphic shows how the execution of a profile with 5 points is ended and
stopped with StopMode = 3:
8PSLJOH%BUB4UBSU7BMVF
0VUQVU
4VCTUJUVUF0VUQVU
&OBCMF
PID control
490 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.8 RampSoak
• StopMode = 4
If the profile execution has ended with the last point, it is automatically restarted and it is
continued with WorkingData.Point[1]. As long as Enable is not reset, the profile execution
is repeated.
If the profile execution is stopped with Enable = FALSE, then the Output parameter
assumes the last valid value of the profile execution.
The following graphic shows how the execution of a profile with 5 points is ended and
stopped with StopMode = 4:
8PSLJOH%BUB4UBSU7BMVF
0VUQVU
&OBCMF 4VCTUJUVUF0VUQVU
The following applies in addition for all values of the StopMode tag:
• The value selected through StopMode is limited to the value range of the REAL data type.
Only then is it output at the Output parameter.
• If the value selected through StopMode is not a valid REAL value, the substitute output
value is output at the Output parameter and then retained. The substitute output value is
configured by means of the ErrorMode tag and is limited to the value range of the REAL
data type.
• Only if the parameter Reset = FALSE has been set and, at the same time, there is no error
pending with an error message ErrorBits ≥ 16#0002_0000, does the StopMode tag act on
the Output parameter. If the Reset = TRUE parameter is set, the value of the
SubstituteOutput parameter is output at the Output parameter. If an error with error
message ErrorBits ≥ 16#0002_0000 is pending, the substitute output value that is
configured at the ErrorMode tag is output at the Output parameter.
PID control
Function Manual, 11/2023, A5E35300227-AG 491
Instructions
10.8 RampSoak
When you disable automatic measurement of the cycle time by setting the
CycleTime.EnableMeasurement = FALSE tag, you must enter the cycle time manually at the
CycleTime.Value tag. RampSoak checks the CycleTime.Value tag for validity at each call.
NOTE
The active breakpoints extend the time period between two calls of RampSoak.
The longer the time period between two calls, the greater the change of the output value at
the Output parameter. Points can be skipped depending on the elapsed time and the
configured profile data.
If you do not need the calculation of the output value based on the actual time with active
breakpoints, follow these steps:
• Disable automatic measurement of the cycle time by setting the tag
CycleTime.EnableMeasurement = FALSE.
• Enter the cycle time manually for the CycleTime.Value tag.
If one of the following conditions is met, enable output ENO is set to FALSE.
• Enable input EN is set to TRUE and an error with the error message ErrorBits ≥
16#0001_0000 is pending.
• Enable input EN is set to FALSE.
In all other cases the enable output ENO is set to TRUE.
PID control
492 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.8 RampSoak
PID control
Function Manual, 11/2023, A5E35300227-AG 493
Instructions
10.8 RampSoak
PID control
494 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.8 RampSoak
PID control
Function Manual, 11/2023, A5E35300227-AG 495
Instructions
10.8 RampSoak
PID control
496 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.8 RampSoak
ErrorBits Description
(DW#16#...)
0000_0004 Cause of error:
One or more tags in the UserData structure have invalid values while the profile data is checked.
Response to error:
The profile data in the UserData structure is not transferred to the WorkingData structure, so the changes
made in the UserData structure do not become effective.
Solution:
Ensure that the following conditions are met when the profile data is checked:
• 1 ≤ UserData.NumberOfUsedPoints ≤ 50
• -3.402823e+38 ≤ UserData.Point[i].Value ≤ 3.402823e+38 with index i =
1..UserData.NumberOfUsedPoints
• 0.0 ≤ UserData.Point[i].Time ≤ 3.402823e+38 with index i = 1..UserData.NumberOfUsedPoints
• -3.402823e+38 ≤ UserData.StartValue ≤ 3.402823e+38
• NextPoint ≤ UserData.NumberOfUsedPoints
• 0.0 < UserData.Point[1].Time + UserData.Point[2].Time +…+
UserData.Point[UserData.NumberOfUsedPoints].Time ≤ 3.402823e+38
• With execution of the profile activated: CurrentPoint ≤ UserData.NumberOfUsedPoints
Additional information:
The profile data in the UserData structure are checked in the following cases:
• If the Validate parameter is set to TRUE.
• Or if RampSoak is called after the operating state transition of the CPU from STOP to RUN for the first
time with the parameter Enable = TRUE and there was no validation of the profile data carried out previ
ously.
Note that all tags in the UserData and WorkingData structures are not retentive. These tags are initialized
with the start values after each operating state transition of the CPU from STOP to RUN.
0000_0008 Cause of error:
The NextPoint parameter has an invalid value.
Response to error:
NextPoint is reset to the last valid value.
Solution:
Ensure that the following condition is met:
• 1 ≤ NextPoint ≤ WorkingData.NumberOfUsedPoints
PID control
Function Manual, 11/2023, A5E35300227-AG 497
Instructions
10.8 RampSoak
The output parameter Error is deleted as soon as there are no longer any errors.
ErrorBits Description
(DW#16#...)
0001_0000 Cause of error:
The SubstituteOutput parameter or the WorkingData.StartValue tag is currently used for determining the out
put value, but does not have any valid REAL value.
Response to error:
If Reset = TRUE and SubstituteOutput is a valid REAL value, then SubstituteOutput continues to be output at
the parameter Output.
In all other cases, parameter Output is set to 0.0.
Solution:
Make sure that the SubstituteOutput parameter and the WorkingData.StartValue tag are valid REAL values
(≠NaN, e.g. 16#7FFF_FFFF). The tag that is used depends on Reset the pending errors and ErrorMode:
Reset ErrorBits ErrorMode Tag used
- >= 16#0002_0000 0 WorkingData.StartValue
- >= 16#0002_0000 1 SubstituteOutput
TRUE - - SubstituteOutput
Additional information:
If you want to change the WorkingData.StartValue, first edit the UserData.StartValue and then set the para
meter Validate = TRUE. Do not manually change the data of the WorkingData structure.
0004_0000 Cause of error:
The calculation during the execution of the profile yields an invalid REAL value.
Response to error:
Execution of the profile is aborted.
If Reset = FALSE, the substitute output value that is configured at the ErrorMode tag is output at the Output
parameter and then retained.
If Reset = TRUE, then SubstituteOutput continues to be output at the Output parameter.
Solution:
Validate the REAL values in the WorkingData structure and, if required, start execution of the profile once
again.
Additional information:
If you want to change the profile data, first edit the UserData structure and then set parameter Validate =
TRUE. Do not manually change the data of the Struktur WorkingData.
0008_0000 Cause of error:
The Enable parameter or the Next parameter is set to TRUE, but there is no valid profile data present in the
WorkingData structure.
Response to error:
Parameter Enable and parameter Next are not effective.
If Reset = FALSE, the substitute output value that is configured at the ErrorMode tag is output at the Output
parameter.
If Reset = TRUE, then SubstituteOutput continues to be output at the Output parameter.
Solution:
Input valid profile data in the UserData structure and then set the parameter Validate = TRUE. In this manner,
the profile data is transferred after validation to the WorkingData structure.
Additional information:
If parameter Enable or parameter Next is still set to TRUE, they become effective as soon as valid profile data
is present in the WorkingData structure. A fresh positive edge is not required.
Note that all tags in the UserData and WorkingData structures are not retentive. These tags are initialized
with the start values after each operating state transition of the CPU from STOP to RUN.
PID control
498 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.8 RampSoak
ErrorBits Description
(DW#16#...)
0010_0000 Cause of error:
The tag (configured with StopMode) which determines the output value when the execution of the profile
has ended or been stopped does not have any valid REAL value.
Response to error:
If Reset = FALSE, the substitute output value that is configured at the ErrorMode tag is output at the Output
parameter and then retained.
If Reset = TRUE, then SubstituteOutput continues to be output at the Output parameter.
Solution:
Make sure that the tag is a valid REAL value (≠ NaN for example, 16#7FFF_FFFF). The tag that is used
depends on StopMode:
• StopMode = 0: WorkingData.StartValue
• StopMode = 1: SubstituteOutput
Additional information:
If you want to change the WorkingData.StartValue, first edit the UserData.StartValue and then set the para
meter Validate = TRUE. Do not manually change the data of the WorkingData structure.
0020_0000 Cause of error:
The tag (configured with StartMode), which determines the output value when the instruction is called for
the first time, or the execution of the profile is started, does not have a valid REAL value.
Response to error:
If Reset = FALSE, the substitute output value that is configured at the ErrorMode tag is output at the Output
parameter and then retained.
If the execution of the profile is activated (Enable = TRUE), it starts initially from this substitute output value.
If Reset = TRUE, then SubstituteOutput continues to be output at the Output parameter.
Solution:
Make sure that the tag is a valid REAL value (≠ NaN for example, 16#7FFF_FFFF). The tag that is used
depends on StartMode:
• StartMode = 0: WorkingData.StartValue
• StartMode = 1: SubstituteOutput
• StartMode = 2: Output
Additional information:
If you want to change the WorkingData.StartValue, first edit the UserData.StartValue and then set the para
meter Validate = TRUE. Do not manually change the data of the WorkingData structure.
0040_0000 Cause of error:
The CycleTime.Value tag has an invalid value while the execution of the profile is activated (Enable = TRUE).
Response to error:
Execution of the profile is paused.
If Reset = FALSE, the substitute output value that is configured at the ErrorMode tag is output at the Output
parameter.
If Reset = TRUE, then SubstituteOutput continues to be output at the Output parameter.
Execution of the profile is continued as soon as this error is not present any more. If execution of the profile
is stopped beforehand, the substitute output value is retained.
Solution:
Ensure that the following conditions are met:
• 0.0 < CycleTime.Value ≤ 3.402823e+38
• CycleTime.Value is a valid REAL value (≠ NaN e.g. 16#7FFF_FFFF)
Additional information:
To automatically calculate the value of the tag CycleTime.Value, set the tag CycleTime.EnableMeasurement
to TRUE.
PID control
Function Manual, 11/2023, A5E35300227-AG 499
Instructions
10.9 Filter_PT1
10.9 Filter_PT1
CPU FW Filter_PT1
S7-1200 as of V4.2 V1.0
S7-1500-based CPUs as of version V2.0 V1.0
Description
The instruction Filter_PT1 is a proportional transfer element with a first-order lag, also
referred to as PT1 element.
You can use Filter_PT1 for the following purposes:
• Low-pass filter to attenuate high frequency components, such as noise, in a signal.
• Delay element to smooth signal step changes, for example, from the setpoint or the
output value of a controller.
• Process simulation block to implement a closed control loop within the CPU. This means,
for example, that you can test controllers before commissioning.
You can specify the following filter parameters:
• Proportional gain (Gain)
• Lag time constant (Lag)
NOTE
Differences between a continuous-time PT1 element and Filter_PT1
Because Filter_PT1 is executed in a PLC program, Filter_PT1 is a discrete-time implementation
of a PT1 element. Discrete-time systems cannot have the same properties as the
corresponding continuous-time model. Depending on the cycle time, discrete-time systems
can emulate a continuous-time system well: The smaller and more constant the cycle time,
the smaller the conformity error between the properties of Filter_PT1 and the properties of a
continuous-time PT1 element. The properties of a continuous-time PT1 element are the
transfer function, the time response and the frequency response which are described below.
For a good simulation of the frequency response, a maximum cycle time of one-tenth of the
shortest period duration of the input signal components is recommended. For example, a
signal with frequency components of up to 50 Hz has a minimum period duration of 20 ms.
To achieve good simulation of the frequency response, a maximum cycle time of 2 ms is
recommended for this example.
PID control
500 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.9 Filter_PT1
ǡ*OQVUw(BJO
wǡ*OQVUw(BJO
0VUQVU U
wǡ*OQVUw(BJO
*OQVU U
ǡ*OQVU
-BH w-BH U
PID control
Function Manual, 11/2023, A5E35300227-AG 501
Instructions
10.9 Filter_PT1
]( ȕ ] E#
(BJOE#
(BJOE#E#
(BJOE#E#
-BH -BH -BH -BH ȕ -BH
The phase response describes the phase offset of a signal through the transfer element
depending on the angular frequency of the signal.
The following equation describes the phase response of a PT1 element:
Ȓ ȕ UBOy ȕw-BH
PID control
502 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.9 Filter_PT1
Ȝȕ
p
p
p
p
-BH -BH -BH -BH ȕ -BH
Call
In an OB or FC, Filter_PT1 is called as single-instance DB. In an FB, Filter_PT1 can be called as a
single-instance DB, as a multi-instance DB, and as a parameter instance DB.
When the instruction is called, no technology object is created. No parameter assignment
interface or commissioning interface is available. You assign the Filter_PT1 parameters
directly using the instance DB and commission Filter_PT1 using a watch table of the user
program in the CPU or HMI.
PID control
Function Manual, 11/2023, A5E35300227-AG 503
Instructions
10.9 Filter_PT1
Startup
The tags in the static area of Filter_PT1 are not retentive. These tags are initialized with the
start values after each operating state transition of the CPU from STOP to RUN. If you change
the actual values in online mode and these values are to be retained after the operating state
transition of the CPU, back up these values in the start values of the data block.
Specify the initialization value for the Output parameter at the StartMode tag.
During the first call of Filter_PT1 after the
• Operating state transition of the CPU
or
• Execution of "Load start values as actual values" (only with "All values" option, not with
"Only setpoints" option)
the initialization value is output at the Output parameter.
For subsequent calls, Filter_PT1 calculates the output value, starting from this initialization
value, based on the input value and the filter configuration.
The following table shows the dependency between the StartMode tag and the Output
parameter. The values in the Output column are output at the Output parameter after the
operating state transition of the CPU.
0VUQVU
*OQVU
$16 $16 U
4501 36/
0VUQVU 4VCTUJUVUF0VUQVU
*OQVU
$16 $16 U
4501 36/
PID control
504 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.9 Filter_PT1
$16 $16 U
4501 36/
0VUQVU
*OQVU
The following applies in addition for all values of the StartMode tag:
• The initialization value is limited to the value range of the data type REAL. Only then is the
initialization value output at the Output parameter.
• If the initialization value is not a valid REAL value, the substitute output value is output at
the Output parameter. The substitute output value is configured by the ErrorMode tag.
The substitute output value is limited to the value range of the data type REAL before it is
output at the Output parameter. If the substitute output value is also not a valid REAL
value, 0.0 is output at the Output parameter. For subsequent calls, the instruction
calculates the output value starting from this substitute output value.
• The StartMode tag is only effective when the Reset = FALSE parameter is set at the first
call of the instruction and at the same time no error with error message ErrorBits ≥
16#0002_0000 is pending. If the Reset = TRUE parameter is set, the value of the
SubstituteOutput parameter is output at the Output parameter. If an error with error
message ErrorBits ≥ 16#0002_0000 is pending, the substitute output value that is
configured at the ErrorMode tag is output at the Output parameter.
Specify the substitute output value that is output if an error occurs that prevents correct
calculation of the output value at the ErrorMode tag.
The following table shows the dependency between the ErrorMode tag and the substitute
output value that is output by the Filter_PT1 at the Output parameter:
ErrorMode Output
0 Value of the Input parameter
1 Value of the SubstituteOutput parameter
PID control
Function Manual, 11/2023, A5E35300227-AG 505
Instructions
10.9 Filter_PT1
ErrorMode Output
2 The last valid filter output value
0.0, if no valid filter output value exists
Default setting
Is used when ErrorMode is not in the range 0...4
3 0.0
4 Value of the Input * Gain product
The following applies in addition for all values of the ErrorMode tag:
• If the substitute output value is not a valid REAL value, 0.0 is output as output value.
• The substitute output value is limited to the value range of the data type REAL. Only then
is the substitute output value output at the Output parameter.
• The ErrorMode tag is only effective when the Reset = FALSE parameter is set. If the Reset =
TRUE parameter is set, the value of the SubstituteOutput parameter is output at the
Output parameter.
The Error parameter indicates if an error is pending. When the error is no longer pending,
Error is set to FALSE. The ErrorBits parameter shows which errors have occurred. ErrorBits is
retentive and is reset only by a positive edge at the Reset or ErrorAck parameter.
Reset response
Filter_PT1 behaves as follows depending on the Reset parameter:
• If the Reset =TRUE parameter is set, the value of the SubstituteOutput parameter is output
at the Output parameter.
• If the Reset = FALSE parameter is set, the value that is output at the Output parameter is
calculated by the filter algorithm.
• When the Reset parameter is set from FALSE to TRUE, the value at the Output parameter
changes directly to the value of the SubstituteOutput parameter. An output jump can
occur during this transition. In addition, the ErrorBits parameter is reset.
• When the Reset parameter is set from TRUE to FALSE, the filtering algorithm is added so
that the transition is bumpless.
PID control
506 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.9 Filter_PT1
NOTE
The active breakpoints extend the time period between two calls of Filter_PT1.
The longer the time period between two calls, the greater the change of the output value at
the Output parameter.
Furthermore, it is possible that the longer time intervals violate the condition
Lag ≥ CycleTime.Value/2 and an error with the error message ErrorBits = 16#0008_0000 is
therefore identified.
If you do not need the calculation of the output value based on the actual time with active
breakpoints, follow these steps:
• Disable automatic measurement of the cycle time by setting the tag
CycleTime.EnableMeasurement = FALSE.
• Enter the cycle time manually at the CycleTime.Value tag.
PID control
Function Manual, 11/2023, A5E35300227-AG 507
Instructions
10.9 Filter_PT1
PID control
508 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.9 Filter_PT1
PID control
Function Manual, 11/2023, A5E35300227-AG 509
Instructions
10.9 Filter_PT1
ErrorBits Description
(DW#16#...)
When ErrorBits ≥ 16#0001_0000 and Reset = FALSE, the substitute output value is limited on its output. In
this case, check the following parameters depending on the set value at the tag ErrorMode:
• Input
• SubstituteOutput
• The product of Input and Gain
When Reset = TRUE, check the SubstituteOutput parameter.
0000_0002 Cause of error:
The measurement of the cycle time yields in an invalid value while the output value is being calculated
(Reset = FALSE).
Response to error:
If a valid value of the cycle time has already been measured, Filter_PT1 calculates the output value based
on the last value of the CycleTime.Value tag.
If no valid value of the cycle time was previously measured, Filter_PT1 still outputs the output value con
figured with the StartMode tag at the Output parameter.
PID control
510 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.9 Filter_PT1
ErrorBits Description
(DW#16#...)
0002_0000 Cause of error:
The Input parameter has no valid REAL value while the calculation of the output value is being performed
(Reset = FALSE).
Response to error:
The substitute output value that is configured at the ErrorMode tag is output at the Output parameter.
When ErrorMode = 0, 0.0 is used as output value.
Solution:
Make sure that the parameter Input is a valid REAL value (≠NaN e.g. 16#7FFF_FFFF).
0004_0000 Cause of error:
The calculation of the output value yields an invalid REAL value for the Output parameter.
Response to error:
The substitute output value that is configured at the ErrorMode tag is output at the Output parameter.
Solution:
Check all tags involved in the calculation of the output value:
• Input
• Gain
• Lag
• CycleTime.Value
These tags have valid values. The calculation of the output value fails in this combination of tags.
0008_0000 Cause of error:
The Lag or Gain tag has an invalid value, while the calculation of the output value is being performed
(Reset = FALSE).
Response to error:
The substitute output value that is configured at the ErrorMode tag is output at the Output parameter.
Solution:
Ensure that the following conditions for the values of the Gain and Lag tags are met:
• -3.402823e+38 ≤ Gain ≤ 3.402823e+38
• CycleTime.Value/2 ≤ Lag ≤ 3.402823e+38
• The values are valid REAL values (≠ NaN, for example 16#7FFF_FFFF)
Additional information:
Note that the condition CycleTime.Value/2 ≤ Lag may be violated in the following scenarios:
• The time interval between two calls of Filter_PT1 is longer than 2 * Lag, for example, due to condition
al calls in the program sequence or active breakpoints.
• A snapshot of the Filter_PT1 instance DB is loaded into the CPU as actual values, and the snapshot was
created more than 2 * Lag ago.
In these scenarios, an error message ErrorBits = 16#0008_0000 is detected during automatic measure
ment of the cycle time.
0020_0000 Cause of error:
The tag (configured with StartMode) for the initialization of the Output parameter at the first call of the
instruction does not have a valid REAL value.
Response to error:
The substitute output value is output with the first call of the instruction at the Output parameter that is
configured at the ErrorMode tag. For subsequent calls, Filter_PT1 calculates the output value starting from
this substitute output value.
Solution:
Make sure that the tag for initializing the parameter Output is a valid REAL value (≠ NaN e.g.
16#7FFF_FFFF). When Reset = FALSE is set, the initialization takes effect with the first call of the instruc
tion after the operating state transition of the CPU from STOP to RUN. The tag that is used for the initializ
ation of the Output parameter depends on StartMode:
• StartMode = 1: SubstituteOutput
• StartMode = 2: Output
• StartMode = 4: Product of Input and Gain
PID control
Function Manual, 11/2023, A5E35300227-AG 511
Instructions
10.10 Filter_PT2
ErrorBits Description
(DW#16#...)
0040_0000 Cause of error:
The CycleTime.Value tag has an invalid value, while the calculation of the output value is being performed
(Reset = FALSE).
Response to error:
The substitute output value that is configured at the ErrorMode tag is output at the Output parameter.
Solution:
Ensure that the following conditions are met:
• 0.0 < CycleTime.Value ≤ 3.402823e+38
• CycleTime.Value is a valid REAL value (≠ NaN e.g. 16#7FFF_FFFF)
Additional information:
To automatically calculate the value of the CycleTime.Value tag, set the CycleTime.EnableMeasurement
tag to TRUE.
10.10 Filter_PT2
CPU FW Filter_PT2
S7-1200 as of V4.2 V1.0
S7-1500-based CPUs as of version V2.0 V1.0
PID control
512 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.10 Filter_PT2
Description
The instruction Filter_PT2 is a proportional transfer element with a second-order lag, also
referred to as PT2 element.
You can use Filter_PT2 for the following purposes:
• Low-pass filter to attenuate high frequency components, such as noise, in a signal.
• Delay element to smooth signal step changes, for example, from the setpoint or the
output value of a controller.
• Process simulation block to implement a closed control loop within the CPU. This means,
for example, that you can test controllers before commissioning.
You can specify the following filter parameters:
• Proportional gain (Gain)
• Time constant (TimeConstant)
• Damping (Damping)
NOTE
Differences between a continuous-time PT2 element and Filter_PT2
Because Filter_PT2 is executed in a PLC program, Filter_PT2 is a discrete-time implementation
of a PT2 element. Discrete-time systems cannot have the same properties as the
corresponding continuous-time model. Depending on the cycle time, discrete-time systems
can emulate a continuous-time system well: The smaller and more constant the cycle time,
the smaller the conformity error between the properties of Filter_PT2 and the properties of a
continuous-time PT2 element. The properties of a continuous-time PT2 element are the
transfer function, the time response and the frequency response which are described below.
For a good simulation of the frequency response, a maximum cycle time of one-tenth of the
shortest period duration of the input signal components is recommended. For example, a
signal with frequency components of up to 50 Hz has a minimum period duration of 20 ms.
To achieve good simulation of the frequency response, a maximum cycle time of 2 ms is
recommended for this example.
If Damping ≥ 1, the PT2 element can be described as two PT1 elements switched in series:
0VUQVU T (BJO
( T
*OQVU T -BHwT w -BHwT
The lag time constants of the PT1 elements switched in series are calculated as follows:
PID control
Function Manual, 11/2023, A5E35300227-AG 513
Instructions
10.10 Filter_PT2
%BNQJOH
5JNF$POTUBOU wU %BNQJOH %BNQJOH %BNQJOH
0VUQVU U ࢉ*OQVUw(BJOw F w DPT 5JNF$POTUBOU ࢜U
࢜TJO 5JNF$POTUBOU ࢜U
%BNQJOH
The following formula with the above calculated Lag1 and Lag2 applies to Damping > 1:
-BHݳ U
-BHݴ U
0VUQVU U ࢉ*OQVUw(BJOw -BHݳ-BH࢜ݴF -BHݳ ࢜F -BHݴ
-BHݳ-BHݴ
The following figure shows the step response of a PT2 element with various values for the
damping:
%BNQJOH
ǡ*OQVUw(BJO %BNQJOH
%BNQJOH
0VUQVU U
ǡ*OQVU
*OQVU U
PID control
514 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.10 Filter_PT2
]( ȕ ] E#
%BNQJOH
(BJOE#
E#
%BNQJOH
(BJOE#E#
(BJOE#E#
ȕ
5JNF$POTUBOU 5JNF$POTUBOU 5JNF$POTUBOU 5JNF$POTUBOU 5JNF$POTUBOU
NOTE
When Damping < 1/√2, a resonance peak appears in the amplitude response.
The phase response describes the phase offset of a signal through the transfer element
depending on the angular frequency of the signal.
PID control
Function Manual, 11/2023, A5E35300227-AG 515
Instructions
10.10 Filter_PT2
Ȝȕ
%BNQJOH
p
p
p
p
ȕ
5JNF$POTUBOU 5JNF$POTUBOU 5JNF$POTUBOU 5JNF$POTUBOU 5JNF$POTUBOU
Call
In an OB or FC, Filter_PT2 is called as single-instance DB. In an FB, Filter_PT2 can be called as a
single-instance DB, as a multi-instance DB, and as a parameter instance DB.
When the instruction is called, no technology object is created. No parameter assignment
interface or commissioning interface is available. You assign the Filter_PT2 parameters
directly using the instance DB and commission Filter_PT2 using a watch table of the user
program in the CPU or HMI.
PID control
516 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.10 Filter_PT2
Startup
The tags in the static area of Filter_PT2 are not retentive. These tags are initialized with the
start values after each operating state transition of the CPU from STOP to RUN. If you change
the actual values in online mode and these values are to be retained after the operating state
transition of the CPU, back up these values in the start values of the data block.
Specify the initialization value for the Output parameter at the StartMode tag.
During the first call of Filter_PT2 after the
• Operating state transition of the CPU
or
• Execution of "Load start values as actual values" (only with "All values" option, not with
"Only setpoints" option)
the initialization value is output at the Output parameter.
For subsequent calls, Filter_PT2 calculates the output value, starting from this initialization
value, based on the input value and the filter configuration.
The following table shows the dependency between the StartMode tag and the Output
parameter. The values in the Output column are output at the Output parameter after the
operating state transition of the CPU.
0VUQVU
*OQVU
$16 $16 U
4501 36/
0VUQVU 4VCTUJUVUF0VUQVU
*OQVU
$16 $16 U
4501 36/
PID control
Function Manual, 11/2023, A5E35300227-AG 517
Instructions
10.10 Filter_PT2
$16 $16 U
4501 36/
0VUQVU
*OQVU
The following applies in addition for all values of the StartMode tag:
• The initialization value is limited to the value range of the data type REAL. Only then is the
initialization value output at the Output parameter.
• If the initialization value is not a valid REAL value, the substitute output value is output at
the Output parameter. The substitute output value is configured by the ErrorMode tag.
The substitute output value is limited to the value range of the data type REAL before it is
output at the Output parameter. If the substitute output value is also not a valid REAL
value, 0.0 is output at the Output parameter. For subsequent calls, the instruction
calculates the output value starting from this substitute output value.
• The StartMode tag is only effective when the Reset = FALSE parameter is set at the first
call of the instruction and at the same time no error with error message ErrorBits ≥
16#0002_0000 is pending. If the Reset = TRUE parameter is set, the value of the
SubstituteOutput parameter is output at the Output parameter. If an error with error
message ErrorBits ≥ 16#0002_0000 is pending, the substitute output value that is
configured at the ErrorMode tag is output at the Output parameter.
ErrorMode Output
0 Value of the Input parameter
1 Value of the SubstituteOutput parameter
PID control
518 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.10 Filter_PT2
ErrorMode Output
2 The last valid filter output value
0.0, if no valid filter output value exists
Default setting
Is used when ErrorMode is not in the range 0...4
3 0.0
4 Value of the Input * Gain product
The following applies in addition for all values of the ErrorMode tag:
• If the substitute output value is not a valid REAL value, 0.0 is output as output value.
• The substitute output value is limited to the value range of the data type REAL. Only then
is the substitute output value output at the Output parameter.
• The ErrorMode tag is only effective when the Reset = FALSE parameter is set. If the Reset =
TRUE parameter is set, the value of the SubstituteOutput parameter is output at the
Output parameter.
The Error parameter indicates if an error is pending. When the error is no longer pending,
Error is set to FALSE. The ErrorBits parameter shows which errors have occurred. ErrorBits is
retentive and is reset only by a positive edge at the Reset or ErrorAck parameter.
Reset response
Filter_PT2 behaves as follows depending on the Reset parameter:
• If the Reset =TRUE parameter is set, the value of the SubstituteOutput parameter is output
at the Output parameter.
• If the Reset = FALSE parameter is set, the value that is output at the Output parameter is
calculated by the filter algorithm.
• When the Reset parameter is set from FALSE to TRUE, the value at the Output parameter
changes directly to the value of the SubstituteOutput parameter. An output jump can
occur during this transition. In addition, the ErrorBits parameter is reset.
• When the Reset parameter is set from TRUE to FALSE, the filtering algorithm is added so
that the transition is bumpless.
PID control
Function Manual, 11/2023, A5E35300227-AG 519
Instructions
10.10 Filter_PT2
NOTE
The active breakpoints extend the time period between two calls of Filter_PT2.
The longer the time period between two calls, the greater the change of the output value at
the Output parameter.
Furthermore, it is possible that the longer time intervals violate the condition
TimeConstant ≥ CycleTime.Value/2 and an error with the error message
ErrorBits = 16#0008_0000 is therefore identified.
If you do not need the calculation of the output value based on the actual time with active
breakpoints, follow these steps:
• Disable automatic measurement of the cycle time by setting the
CycleTime.EnableMeasurement tag = FALSE.
• Enter the cycle time manually at the CycleTime.Value tag.
PID control
520 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.10 Filter_PT2
PID control
Function Manual, 11/2023, A5E35300227-AG 521
Instructions
10.10 Filter_PT2
PID control
522 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.10 Filter_PT2
ErrorBits Description
(DW#16#...)
When ErrorBits ≥ 16#0001_0000 and Reset = FALSE, the substitute output value is limited on its output. In
this case, check the following parameters depending on the set value at the tag ErrorMode:
• Input
• SubstituteOutput
• The product of Input and Gain
When Reset = TRUE, check the SubstituteOutput parameter.
0000_0002 Cause of error:
The measurement of the cycle time yields in an invalid value while the output value is being calculated
(Reset = FALSE).
Response to error:
If a valid value of the cycle time has already been measured, Filter_PT2 calculates the output value based
on the last value of the CycleTime.Value tag.
If no valid value of the cycle time was previously measured, Filter_PT2 still outputs the output value con
figured with the StartMode tag at the Output parameter.
PID control
Function Manual, 11/2023, A5E35300227-AG 523
Instructions
10.10 Filter_PT2
ErrorBits Description
(DW#16#...)
0002_0000 Cause of error:
The Input parameter has no valid REAL value while the calculation of the output value is being performed
(Reset = FALSE).
Response to error:
The substitute output value that is configured at the ErrorMode tag is output at the Output parameter.
When ErrorMode = 0, 0.0 is used as output value.
Solution:
Make sure that the parameter Input is a valid REAL value (≠NaN e.g. 16#7FFF_FFFF).
0004_0000 Cause of error:
The calculation of the output value yields an invalid REAL value for the Output parameter.
Response to error:
The substitute output value that is configured at the ErrorMode tag is output at the Output parameter.
Solution:
Check all tags involved in the calculation of the output value:
• Input
• Gain
• TimeConstant
• Damping
• CycleTime.Value
These tags have valid values. The calculation of the output value fails in this combination of tags.
0008_0000 Cause of error:
The Gain, TimeConstant or Damping tag has an invalid value, while the calculation of the output value is
being performed (Reset = FALSE).
Response to error:
The substitute output value that is configured at the ErrorMode tag is output at the Output parameter.
Solution:
Ensure that the following conditions for the values of the Gain, TimeConstant and Damping tags are met:
• -3.402823e+38 ≤ Gain ≤ 3.402823e+38
• CycleTime.Value/2 ≤ TimeConstant ≤ 3.402823e+38
• 0.0 < Damping ≤ 3.402823e+38
• The values are valid REAL values (≠ NaN, for example 16#7FFF_FFFF)
Additional information:
Note that the condition CycleTime.Value/2 ≤ TimeConstant may be violated in the following scenarios:
• The time interval between two calls of Filter_PT2 is longer than 2 * TimeConstant, for example, due to
conditional calls in the program sequence or active breakpoints.
• A snapshot of the Filter_PT2 instance DB is loaded into the CPU as actual values, and the snapshot was
created more than 2 * TimeConstant ago.
In these scenarios, an error message ErrorBits = 16#0008_0000 is detected during automatic measure
ment of the cycle time.
0020_0000 Cause of error:
The tag (configured with StartMode) for the initialization of the Output parameter at the first call of the
instruction does not have a valid REAL value.
Response to error:
The substitute output value is output with the first call of the instruction at the Output parameter that is
configured at the ErrorMode tag. For subsequent calls, Filter_PT2 calculates the output value starting from
this substitute output value.
Solution:
PID control
524 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.11 Filter_DT1
ErrorBits Description
(DW#16#...)
Make sure that the tag for initializing the parameter Output is a valid REAL value (≠ NaN e.g.
16#7FFF_FFFF). When Reset = FALSE is set, the initialization takes effect with the first call of the instruc
tion after the operating state transition of the CPU from STOP to RUN. The tag that is used for the initializ
ation of the Output parameter depends on StartMode:
• StartMode = 1: SubstituteOutput
• StartMode = 2: Output
• StartMode = 4: Product of Input and Gain
0040_0000 Cause of error:
The CycleTime.Value tag has an invalid value, while the calculation of the output value is being performed
(Reset = FALSE).
Response to error:
The substitute output value that is configured at the ErrorMode tag is output at the Output parameter.
Solution:
Ensure that the following conditions are met:
• 0.0 < CycleTime.Value ≤ 3.402823e+38
• CycleTime.Value is a valid REAL value (≠ NaN e.g. 16#7FFF_FFFF)
Additional information:
To automatically calculate the value of the CycleTime.Value tag, set the CycleTime.EnableMeasurement
tag to TRUE.
10.11 Filter_DT1
CPU FW Filter_DT1
S7-1200 as of V4.2 V1.0
S7-1500-based CPUs as of version V2.0 V1.0
PID control
Function Manual, 11/2023, A5E35300227-AG 525
Instructions
10.11 Filter_DT1
Description
The instruction Filter_DT1 is a differentiator with a first-order lag, also referred to as DT1
element.
You can use Filter_DT1 for the following purposes:
• High-pass filter to attenuate low frequency components in a signal.
• Differentiator to calculate the derivation of a signal, such as the speed from position
values.
• Feedforward control to lessen the effect of measurable disturbances on the process.
You can specify the following filter parameters:
• Derivative action time (Td)
• Lag time constant (Lag)
NOTE
Differences between a continuous-time DT1 element and Filter_DT1
Because Filter_DT1 is executed in a PLC program, Filter_DT1 is a discrete-time
implementation of a DT1 element. Discrete-time systems cannot have the same properties as
the corresponding continuous-time model. Depending on the cycle time, discrete-time
systems can emulate a continuous-time system well: The smaller and more constant the cycle
time, the smaller the conformity error between the properties of Filter_DT1 and the
properties of a continuous-time DT1 element. The properties of a continuous-time DT1
element are the transfer function, the time response and the frequency response which are
described below.
For a good simulation of the frequency response, a maximum cycle time of one-tenth of the
shortest period duration of the input signal components is recommended. For example, a
signal with frequency components of up to 50 Hz has a minimum period duration of 20 ms.
To achieve good simulation of the frequency response, a maximum cycle time of 2 ms is
recommended for this example.
PID control
526 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.11 Filter_DT1
5E
ǡ*OQVUw
-BH
*OQVU U
ǡ*OQVU
wǡ*OQVUw5E-BH
0VUQVU U
wǡ*OQVUw5E-BH
-BH w-BH U
To disable the lag, set the Lag parameter to the minimum value CycleTime.Value / 2. In this
case, changes to the input value are multiplied by Td / CycleTime.Value and output at the
Output parameter. After one cycle, the output value is 0.0.
PID control
Function Manual, 11/2023, A5E35300227-AG 527
Instructions
10.11 Filter_DT1
The following figure shows the step response in case of Lag = CycleTime.Value / 2:
5E
ǡ*OQVUw
$ZDMF5JNF7BMVF
*OQVU U
ǡ*OQVU
0VUQVU U
U
$ZDMF5JNF7BMVF
PID control
528 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.11 Filter_DT1
]( ȕ ] E#
5E
-BHE#
E#
5E -BH ȕ
The phase response describes the phase offset of a signal through the transfer element
depending on the angular frequency of the signal.
The following equation describes the phase response of a DT1 element:
Ȓ ȕ UBO ȕw-BH
PID control
Function Manual, 11/2023, A5E35300227-AG 529
Instructions
10.11 Filter_DT1
Ȝȕ
p
p
p
p
-BH -BH -BH -BH ȕ -BH
Call
In an OB or FC, Filter_DT1 is called as single-instance DB. In an FB, Filter_DT1 can be called as
a single-instance DB, as a multi-instance DB, and as a parameter instance DB.
When the instruction is called, no technology object is created. No parameter assignment
interface or commissioning interface is available. You assign the Filter_DT1 parameters
directly using the instance DB and commission Filter_DT1 using a watch table of the user
program in the CPU or HMI.
PID control
530 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.11 Filter_DT1
Startup
The tags in the static area of Filter_DT1 are not retentive. These tags are initialized with the
start values after each operating state transition of the CPU from STOP to RUN. If you change
the actual values in online mode and these values are to be retained after the operating state
transition of the CPU, back up these values in the start values of the data block.
Specify the initialization value for the Output parameter at the StartMode tag.
During the first call of Filter_DT1 after the
• Operating state transition of the CPU
or
• Execution of "Load start values as actual values" (only with "All values" option, not with
"Only setpoints" option)
the initialization value is output at the Output parameter.
For subsequent calls, Filter_DT1 calculates the output value, starting from this initialization
value, based on the input value and the filter configuration.
The following table shows the dependency between the StartMode tag and the Output
parameter. The values in the Output column are output at the Output parameter after the
operating state transition of the CPU.
0VUQVU
$16 $16 U
4501 36/
0VUQVU 4VCTUJUVUF0VUQVU
$16 $16 U
4501 36/
3 0.0 *OQVU
0VUQVU
$16 $16 U
4501 36/
PID control
Function Manual, 11/2023, A5E35300227-AG 531
Instructions
10.11 Filter_DT1
The following applies in addition for all values of the StartMode tag:
• The initialization value is limited to the value range of the data type REAL. Only then is the
initialization value output at the Output parameter.
• If the initialization value is not a valid REAL value, the substitute output value is output at
the Output parameter. The substitute output value is configured by the ErrorMode tag.
The substitute output value is limited to the value range of the data type REAL before it is
output at the Output parameter. If the substitute output value is also not a valid REAL
value, 0.0 is output at the Output parameter. For subsequent calls, the instruction
calculates the output value starting from this substitute output value.
• The StartMode tag is only effective when the Reset = FALSE parameter is set at the first
call of the instruction and at the same time no error with error message ErrorBits ≥
16#0002_0000 is pending. If the Reset = TRUE parameter is set, the value of the
SubstituteOutput parameter is output at the Output parameter. If an error with error
message ErrorBits ≥ 16#0002_0000 is pending, the substitute output value that is
configured at the ErrorMode tag is output at the Output parameter.
ErrorMode Output
0 Value of the Input parameter
1 Value of the SubstituteOutput parameter
2 The last valid filter output value
0.0, if no valid filter output value exists
Default setting
Is used when ErrorMode is not in the range 0...3
3 0.0
The following applies in addition for all values of the ErrorMode tag:
• If the substitute output value is not a valid REAL value, 0.0 is output as output value.
• The substitute output value is limited to the value range of the data type REAL. Only then
is the substitute output value output at the Output parameter.
• The ErrorMode tag is only effective when the Reset = FALSE parameter is set. If the Reset =
TRUE parameter is set, the value of the SubstituteOutput parameter is output at the
Output parameter.
The Error parameter indicates if an error is pending. When the error is no longer pending,
Error is set to FALSE. The ErrorBits parameter shows which errors have occurred. ErrorBits is
retentive and is reset only by a positive edge at the Reset or ErrorAck parameter.
PID control
532 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.11 Filter_DT1
Reset response
Filter_DT1 behaves as follows depending on the Reset parameter:
• If the Reset =TRUE parameter is set, the value of the SubstituteOutput parameter is output
at the Output parameter.
• If the Reset = FALSE parameter is set, the value that is output at the Output parameter is
calculated by the filter algorithm.
• When the Reset parameter is set from FALSE to TRUE, the value at the Output parameter
changes directly to the value of the SubstituteOutput parameter. An output jump can
occur during this transition. In addition, the ErrorBits parameter is reset.
• When the Reset parameter is set from TRUE to FALSE, the filtering algorithm is added so
that the transition is bumpless.
PID control
Function Manual, 11/2023, A5E35300227-AG 533
Instructions
10.11 Filter_DT1
NOTE
The active breakpoints extend the time period between two calls of Filter_DT1.
The longer the time period between two calls, the greater the change of the output value at
the Output parameter.
Furthermore, it is possible that the longer time intervals violate the conditions
Lag ≥ CycleTime.Value/2 or Td ≥ CycleTime.Value. An error is then detected with the error
message ErrorBits = 16#0008_0000 .
If you do not need the calculation of the output value based on the actual time with active
breakpoints, follow these steps:
• Disable automatic measurement of the cycle time by setting the
CycleTime.EnableMeasurement tag = FALSE.
• Enter the cycle time manually at the CycleTime.Value tag.
PID control
534 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.11 Filter_DT1
PID control
Function Manual, 11/2023, A5E35300227-AG 535
Instructions
10.11 Filter_DT1
PID control
536 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.11 Filter_DT1
PID control
Function Manual, 11/2023, A5E35300227-AG 537
Instructions
10.11 Filter_DT1
ErrorBits Description
(DW#16#...)
0008_0000 Cause of error:
The Lag or Td tag has an invalid value, while the calculation of the output value is being performed (Reset
= FALSE).
Response to error:
The substitute output value that is configured at the ErrorMode tag is output at the Output parameter.
Solution:
Ensure that the following conditions for the values of the Td and Lag tags are met:
• CycleTime.Value ≤ Td ≤ 3.402823e+38
• CycleTime.Value/2 ≤ Lag ≤ 3.402823e+38
• The values are valid REAL values (≠ NaN, for example 16#7FFF_FFFF)
Additional information:
Note that the conditions CycleTime.Value/2 ≤ Lag and CycleTime.Value ≤ Td may be violated in the follow
ing scenarios:
• The time interval between two calls of Filter_DT1 is longer than 2 * Lag or Td, for example, due to
conditional calls in the program sequence or active breakpoints.
• A snapshot of the Filter_DT1 instance DB is loaded into the CPU as actual values, and the snapshot was
created more than 2 * Lag or Td ago.
In these scenarios, an error message ErrorBits = 16#0008_0000 is detected during automatic measure
ment of the cycle time.
0020_0000 Cause of error:
The tag (configured with StartMode) for the initialization of the Output parameter at the first call of the
instruction does not have a valid REAL value.
Response to error:
The substitute output value is output with the first call of the instruction at the Output parameter that is
configured at the ErrorMode tag. For subsequent calls, Filter_DT1 calculates the output value starting
from this substitute output value.
Solution:
Make sure that the tag for initializing the parameter Output is a valid REAL value (≠ NaN e.g.
16#7FFF_FFFF). When Reset = FALSE is set, the initialization takes effect with the first call of the instruc
tion after the operating state transition of the CPU from STOP to RUN. The tag that is used for the initializ
ation of the Output parameter depends on StartMode:
• StartMode = 1: SubstituteOutput
• StartMode = 2: Output
0040_0000 Cause of error:
The CycleTime.Value tag has an invalid value, while the calculation of the output value is being performed
(Reset = FALSE).
Response to error:
The substitute output value that is configured at the ErrorMode tag is output at the Output parameter.
Solution:
Ensure that the following conditions are met:
• 0.0 < CycleTime.Value ≤ 3.402823e+38
• CycleTime.Value is a valid REAL value (≠ NaN e.g. 16#7FFF_FFFF)
Additional information:
To automatically calculate the value of the CycleTime.Value tag, set the CycleTime.EnableMeasurement
tag to TRUE.
PID control
538 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.12 Filter_Universal
10.12 Filter_Universal
CPU FW Filter_Universal
S7-1500-based CPUs as of version V2.0 V1.0
Description
The Filter_Universal instruction is a configurable filter of the order 1 to 10.
It is used to manipulate a signal in such a way that specific frequency components of this
signal are either allowed through or attenuated.
Filter_Universal can be used for the following purposes:
• High-pass filter
• Low-pass filter
• Bandpass filter
• Bandstop filter
The following filter parameters can be specified based on the corresponding tags in order to
achieve the desired filter behavior:
• Type ( Type tag)
• Frequency (Frequency tag)
• Bandwidth (Bandwidth tag)
• Order (Order tag)
• Characteristic (Characteristic tag)
An extended description of the filter parameters and corresponding tags can be found in
section Filter parameters (Page 541).
Call
Filter_Universal requires a constant cycle time and therefore needs to be called in a cyclic
interrupt OB.
In an OB or FC, Filter_Universal is called as a single-instance DB. In a function
block, Filter_Universal can be called as a single-instance DB, as a multi-instance DB, and as a
parameter instance DB.
When the instruction is called, no technology object is created. No parameter assignment
interface or commissioning interface is available. You assign the Filter_Universal parameters
directly using the instance DB and commission Filter_Universal using a watch table of the
user program in the CPU or HMI.
PID control
Function Manual, 11/2023, A5E35300227-AG 539
Instructions
10.12 Filter_Universal
Startup
The tags in the static area of Filter_Universal are not retentive. These tags are initialized with
the start values after each operating state transition of the CPU from STOP to RUN. If you
change the actual values in online mode and these values are to be retained after the
operating state transition of the CPU from STOP to RUN, back up these values in the start
values of the data block.
With the tag StartMode (Page 546), you can define the start behavior of the Filter_Universal
instruction at the first call after the operating state transition of the CPU from STOP to RUN.
The following applies in addition for all values of the ErrorMode tag:
• If the substitute output value is not a valid REAL value, 0.0 is output as output value.
• The substitute output value is limited to the value range -3.402823e+38 ..
+3.402823e+38 of the data type REAL. Only then is the substitute output value output at
the Output parameter.
• The ErrorMode tag is only effective when the Reset = FALSE parameter is set. If the Reset =
TRUE parameter is set, the value of the SubstituteOutput parameter or 0.0 is output at the
Output parameter.
The Error parameter indicates if an error is pending. When the error is no longer pending,
Error is set to FALSE. The ErrorBits parameter shows which errors have occurred. ErrorBits is
retentive and is reset only by a positive edge at the Reset or ErrorAck parameter.
Filter_Universal returns to output value calculation through the filter algorithm as soon as
there are no more pending errors with error messages ErrorBits ≥ 16 0002_0000. Switchover
depends on the filter type:
• For high-pass and bandpass filters (Type = 1 or 2), the filter algorithm is set up as if it were
in a steady state with Output = 0.0. If the Input parameter remains constant, the output
value will jump to Output = 0.0. If the Input parameter changes, the output value jumps to
an appropriate value.
• For low-pass and bandstop filters (Type = 0 or 3), the filter algorithm is set up as if it were
in a steady state with Output = SubstituteOutput. Switchover is bumpless.
PID control
540 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.12 Filter_Universal
The filter parameters Type, Frequency, Bandwidth, Characteristic and Order can be specified
based on the corresponding tags in order to achieve the desired filter behavior.
Filter type
The filter type determines the general transfer behavior for the different frequency
components of the input signal. It is defined by the Type tag.
The following table shows the different filter types:
Type Description Application example
0 Low-pass filter: Noise reduction at a measured input value to obtain
The filter allows frequency components below the smoother signal characteristics
cutoff frequency through, and attenuates frequency
components above the cutoff frequency.
1 High-pass filter: Suppression of DC or low frequency components, e.g. DC
The filter allows frequency components above the component in signal
cutoff frequency through, and attenuates frequency
components below the cutoff frequency.
2 Bandpass filter: Determination of the wanted signal with a specific fre
The filter allows frequency components within a spe quency range from a signal that contains additional fre
cific range around the center frequency through, and quency components
attenuates frequency components outside of this
range.
3 Bandstop filter: Attenuation of interferences in a specific frequency range,
The filter attenuates frequency components within a e.g. interruptions due to the line frequency
specific range around the center frequency, and allows
frequency components outside of this range through.
PID control
Function Manual, 11/2023, A5E35300227-AG 541
Instructions
10.12 Filter_Universal
G )[
Bandpass and bandstop filters have a low and a high cutoff frequency whose position is
defined by the center frequency and bandwidth. The following table shows the
corresponding tags that are configured for such filters:
Tag Description
Frequency Determines the center frequency that is the geometrical mean of the low and high cutoff fre
quency. In logarithmic frequency scaling, the center frequency is midway between the low and high
cutoff frequency.
Bandwidth The bandwidth determines the difference between the low and high cutoff frequency. It defines the
width of the frequency range that is attenuated or allowed through.
PID control
542 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.12 Filter_Universal
The following figure shows the amplitude response of a bandpass filter with Frequency = 100
Hz and different values for the tag Bandwidth (Order = 10, Characteristic = 2):
]0VUQVU*OQVU] E#
#BOEXJEUI)[
#BOEXJEUI)[
G )[
#BOEXJEUI)[
#BOEXJEUI)[
The maximum cutoff or center frequency that can be used depends on the cycle time. The
permitted range of values is Frequency < 0.5 / CycleTime.Value.
The maximum bandwidth that can be used depends on the cycle time and the center
frequency. The permitted range of values is Bandwidth < 0.5 / CycleTime.Value - Frequency.
NOTE
To avoid aliasing, the sampling rate for the Filter_Universal (= 1 / cycle time) must be at least
double the maximum frequency of the processed signals or signal components. The
recommendation is to set a cycle time that is lower than this limit.
Example: A signal with frequency components up to 100 Hz requires a sampling rate greater
than 200 Hz. This corresponds to a maximum cycle time of 5 ms, but the recommendation is
to set a lower value.
PID control
Function Manual, 11/2023, A5E35300227-AG 543
Instructions
10.12 Filter_Universal
Order
The filter order determines how quickly attenuation increases beyond the cutoff frequency.
This corresponds to the slope of the amplitude response beyond the cutoff frequency. The
filter order is defined by the Order tag.
With a higher-order filter:
• The same frequency is attenuated more strongly beyond the cutoff frequency. The
amplitude response shows a higher slope.
• Increases the execution time of Filter_Universal.
• The overshoot of the step response increases after an input jump for Butterworth and
Chebyshev filter characteristic ( Characteristic tag = 1 or 2).
For bandpass and bandstop filters, the recommendation is to use only higher order filters;
otherwise, the desired filter effect in the frequency range around the center frequency may
not be reached.
Values from 0 to 10 can be configured at the Order tag for the filter order.
With the setting Order = 0, the filter has no effect and Output = Input.
Characteristic
The filter characteristic is defined by the Characteristic tag.
This affects:
• The ripple of the amplitude response in the passband
• The slope of the amplitude response beyond the cutoff frequency (how fast attenuation
increases)
• The overshoot in the step response after an input jump
Three characteristics can be configured for Filter_Universal based on the Characteristic tag:
Characteristic Description
0 Bessel:
This filter has a flat amplitude response in the passband. The slope of the amplitude response bey
ond the cutoff frequency is smaller as compared to the Butterworth filter and Chebyshev filter. The
step response only shows a small overshoot.
1 Butterworth:
This filter has a flat amplitude response in the passband. The slope of the amplitude response bey
ond the cutoff frequency is greater as compared to the Bessel filter and smaller as compared to the
Chebyshev filter. The overshoot of the step response is greater as compared to the Bessel filter and
smaller as compared to the Chebyshev filter.
2 Chebyshev Type I:
This filter has a 0.5 dB ripple of the amplitude response in the passband. The slope of the amplitude
response beyond the cutoff frequency is greater as compared to the Bessel filter and to the Butter
worth filter. The step response shows a greater overshoot as compared to the Bessel filter and the
Butterworth filter.
PID control
544 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.12 Filter_Universal
The following figure shows the effect of different order and characteristic values on the
amplitude response of the low-pass filter:
]0VUQVU*OQVU] E#
G )[
0SEFS $IBDUFSJTUJD 0SEFS $IBDUFSJTUJD
PID control
Function Manual, 11/2023, A5E35300227-AG 545
Instructions
10.12 Filter_Universal
If one of these conditions is not met and Reset = FALSE at the same time, correct calculation
of the output value by the filter algorithm is not possible. In this case, an error message is
output and a substitute output value is output at the Output parameter until all filter
parameters have a valid value.
When all values are valid, the filter coefficients are determined once and saved internally for
the filter algorithm calculation.
The reaction of the output value to valid changes to the filter parameters depends on the
filter type:
• For high-pass and bandpass filters (Type = 1 or 2), the filter algorithm is set up as if it were
in a steady state with Output = 0.0. If the Input parameter remains constant, the output
value will jump to Output = 0.0. If the Input parameter changes, the output value jumps to
an appropriate value.
• For low-pass and bandstop filters (Type = 0 or 3), the filter algorithm is set up as if it were
in a steady state with Output = SubstituteOutput. Switchover is bumpless.
For time-critical applications, it should be taken into account that determining the filter
coefficient requires a multiple of the execution time for calculating the filter algorithm.
The first value of the Output parameter is initialized after the following actions for the first
execution:
• Operating state change of the CPU from STOP to RUN
• Execution of "Load start values as actual values" with the option "All values"
The first value of the Output parameter depends on the filter type:
• For high-pass and bandpass filters (Type = 1 or 2), the first value of the parameter Output
= 0.0.
• For low-pass and bandstop filters (Type = 0 or 3), the first value of the Output parameter
can be configured via the StartMode tag.
For subsequent calls, Filter_Universal calculates the output value, starting from this
initialization value, with consideration of the input value and the filter parameters.
The following settings of the StartMode tag are possible for low-pass and bandstop filters:
• StartMode = 0
The Output parameter assumes the value of the Input parameter.
*OQVU
0VUQVU
PID control
546 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.12 Filter_Universal
• StartMode = 1
The Output parameter assumes the value of the SubstituteOutput parameter.
*OQVU
0VUQVU 4VCTUJUVUF0VUQVU
$16 $16 U
4501 36/
• StartMode = 2
The Output parameter remains unchanged.
*OQVU
0VUQVU
*OQVU
0VUQVU
$16 $16 U
4501 36/
The following applies in addition for all values of the StartMode tag:
• The StartMode tag and the filter parameters are not retentive. These tags are initialized
with the start values after each operating state transition of the CPU from STOP to RUN.
Make sure that at the first call of the Filter_Universal instruction, after the operating state
transition of the CPU from STOP to RUN, these tags have suitable values to achieve the
desired behavior.
• The value selected through StartMode is limited to the value range of the REAL data type.
Only then is it output at the Output parameter.
• If the value selected through StartMode is not a valid REAL value, the substitute output
value is output at the Output parameter. The substitute output value is configured by
means of the ErrorMode tag and is limited to the value range of the REAL data type. If the
substitute output value is also not a valid REAL value, 0.0 is output at the Output
parameter. For subsequent calls, the instruction calculates the output value starting from
this substitute output value.
• Only if the parameter Reset = FALSE has been set and, at the same time, there is no error
pending with an error message ErrorBits ≥ 16#0002_0000, does the StartMode tag act on
the Output parameter. If the Reset = TRUE parameter is set, the value of the
SubstituteOutput parameter is output at the Output parameter. If an error with error
message ErrorBits ≥ 16#0002_0000 is pending, the substitute output value that is
configured at the ErrorMode tag is output at the Output parameter.
PID control
Function Manual, 11/2023, A5E35300227-AG 547
Instructions
10.12 Filter_Universal
If the input value is constant, the output value of the Filter_Universal should also reach a
constant final value after some time:
• Output = 0.0 for high-pass and bandpass filters (Type = 1 or 2)
• Output = Input for low-pass and bandstop filters (Type = 0 or 3)
The limited accuracy of the floating point arithmetic can have the result that this final value is
not reached exactly.
This is more common with odd ordered filters (tag Order = 1, 3, 5, 7, or 9) than with even
ordered filters.
In addition to choosing a even filter order, setting the tag FinalValueMode = 1 can help to
achieve the final value. If the absolute value of the output value does not change for several
cycles, this setting converts the output value to the final value. This option is only effective
with a constant input value.
Using the FinalValueMode = 1 option can almost double the calculation time of the filter
algorithm. The effect on the execution time depends on the filter parameters, input value and
cycle time. For time-critical applications, you can check whether use of the FinalValueMode =
1 tag is necessary or whether the behavior with FinalValueMode = 0 is adequate.
Depending on the filter parameters, input value and cycle time, it is possible that the final
value is already reached exactly with the FinalValueMode = 0 option and the
FinalValueMode = 1 option is not necessary.
Example:
The following table shows the effect of the FinalValueMode tag on the output value of a low-
pass filter with Frequency = 120.0, Order = 1, Characteristic = 2 and CycleTime.Value = 0.001,
on an input jump from 1.0 to 0.0:
Time in seconds Input Output with FinalValueMode = 0 Output with FinalValueMode = 1
-0.001 1.0 1.0000000 1.0000000
0.000 0.0 0.7163693 0.7163693
0.001 0.0 0.3100007 0.3100007
… 0.0 ... ...
0.075 0.0 -4.597156E-17 -4.597156E-17
0.076 0.0 4.597156E-17 4.597156E-17
0.077 0.0 -4.597156E-17 -4.597156E-17
0.078 0.0 4.597156E-17 0.0000000
0.079 0.0 -4.597156E-17 0.0000000
... 0.0 +/-4.597156E-17 0.0000000
PID control
548 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.12 Filter_Universal
To calculate the output value, Filter_Universal requires a constant cycle time and therefore
needs to be called in a cyclic interrupt OB. With the default configuration, Filter_Universal
detects the cycle time of the OB automatically and saves it in the CycleTime.Value tag. This
happens in the following situations:
• On the first execution after the change of operating state of the CPU from STOP to RUN
• Every time the filter parameters are changed
• When "Load start values as actual values" is executed
If the automatic detection of the cycle time does not return a valid result or Filter_Universal is
not called in a cyclic interrupt OB, correct calculation of the Output parameter is not possible.
In this case, an error message is output and a substitute output value is output at the
parameter until until a valid cycle time of a cyclic interrupt OB is detected.
Please note that changes to the call rate due to conditional calls of Filter_Universal lead to
deviations between the detected and actual cycle time, which influences the filter behavior.
Therefore, avoid conditional calls of Filter_Universal.
Active breakpoints or the loading of snapshots as actual values have no effect on the
automatic detection of the cycle time.
When you disable automatic detection of the cycle time by setting the
CycleTime.EnableDetection = FALSE tag, you must enter the cycle time manually at the
CycleTime.Value tag. Filter_Universal checks the Variable CycleTime.Value tag for validity at
each call.
Deactivating the automatic detection of the cycle time reduces the execution time of the
Filter_Universal, which can be helpful for time-critical applications. Calls outside of a cyclic
interrupt OB can have a negative effect on the filter behavior, because the actual cycle time is
not constant in this case.
PID control
Function Manual, 11/2023, A5E35300227-AG 549
Instructions
10.12 Filter_Universal
If one of the following conditions is met, enable output ENO is set to FALSE:
• Enable input EN is set to TRUE and the Output parameter is specified by a substitute
output value in case of error messages ErrorBits ≥ 16#0001_0000.
• Enable input EN is set to FALSE.
Otherwise, the enable output ENO is set to TRUE.
PID control
550 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.12 Filter_Universal
PID control
Function Manual, 11/2023, A5E35300227-AG 551
Instructions
10.12 Filter_Universal
PID control
552 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.12 Filter_Universal
PID control
Function Manual, 11/2023, A5E35300227-AG 553
Instructions
10.12 Filter_Universal
PID control
554 Function Manual, 11/2023, A5E35300227-AG
Instructions
10.12 Filter_Universal
ErrorBits Description
(DW#16#...)
0008_0000 Cause of error:
One or more filter parameters have an invalid value while the calculation of the output value is being per
formed (Reset = FALSE).
Response to error:
The substitute output value that is configured at the ErrorMode tag is output at the Output parameter.
Solution:
Ensure that the following conditions for the values of the filter parameters are met:
• 0.0 < Frequency < 0.5 / CycleTime.Value
• 0.0 ≤ Bandwidth < 0.5 / CycleTime.Value - Frequency
• 0 ≤ Type ≤ 3
• 0 ≤ Characteristic ≤ 2
• 0 ≤ Order ≤ 10
0010_0000 Cause of error:
Automatic detection of the cycle time failed because Filter_Universal is not called in a cyclic interrupt OB.
Response to error:
The substitute output value that is configured at the ErrorMode tag is output at the Output parameter.
Solution:
Make sure that Filter_Universal is called in a cyclic interrupt OB.
Additional information:
Automatic detection of the cycle time can be disabled by setting the tag CycleTime.EnableDetection =
FALSE. You then need to specify the cycle time manually at the Variable CycleTime.Value. Calling of
Filter_Universal outside of a cyclic interrupt OB can have a negative effect on the filter behavior, because
the actual cycle time fluctuates in this case.
0020_0000 Cause of error:
The tag (configured with StartMode) for the initialization of the Output parameter at the first call of the
instruction does not have a valid REAL value.
Response to error:
The substitute output value is output with the first call of the instruction at the Output parameter that is
configured at the ErrorMode tag. For subsequent calls, Filter_Universal calculates the output value start
ing from this substitute output value.
Solution:
Make sure that the tag for initializing the parameter Output is a valid REAL value (≠ NaN e.g.
16#7FFF_FFFF). When Reset = FALSE is set, the initialization takes effect with the first call of the instruc
tion after the operating state transition of the CPU from STOP to RUN. The tag that is used for the initializ
ation of the Output parameter depends on StartMode:
• StartMode = 1: SubstituteOutput
• StartMode = 2: Output
0040_0000 Cause of error:
The CycleTime.Value tag has an invalid value, while the calculation of the output value is being performed
(Reset = FALSE).
Response to error:
The substitute output value that is configured at the ErrorMode tag is output at the Output parameter.
Solution:
Ensure that the following conditions are met:
• 0.0 < CycleTime.Value ≤ 3.402823e+38
• CycleTime.Value is a valid REAL value (≠ NaN e.g. 16#7FFF_FFFF)
Additional information:
To automatically calculate the value of the CycleTime.Value tag, set the CycleTime.EnableDetection tag to
TRUE.
PID control
Function Manual, 11/2023, A5E35300227-AG 555
Instructions
10.12 Filter_Universal
ErrorBits Description
(DW#16#...)
0080_0000 Cause of error:
An internal error occurred during automatic detection of the cycle time.
Response to error:
The substitute output value that is configured at the ErrorMode tag is output at the Output parameter.
Solution:
Make sure that Filter_Universal is called in a cyclic interrupt OB.
If the error continues to occur, contact SIMATIC Customer Support.
Additional information:
Automatic detection of the cycle time can be disabled by setting the tag CycleTime.EnableDetection =
FALSE. You then need to specify the cycle time manually at the CycleTime.Value tag.
PID control
556 Function Manual, 11/2023, A5E35300227-AG
Index
C PID_Compact
Input parameters, 238
CONT_C
Output parameters, 239
Mode of operation, 399
In/out parameters, 240
Block diagram, 400
Instruction, 266
Input parameters, 401
Input parameters, 269
Output parameters, 402
Output parameters, 270
CONT_S Static tags, 271
Instruction, 403
PID_Temp
Mode of operation, 403
Cascading, 177
Block diagram, 405
Multi-zone applications, 183
Input parameters, 406
Operating principle, 349
Output parameters, 407
Input parameters, 354
Output parameters, 356
F In/out parameters, 357
Mode, 357
Filter_DT1, 525
Cascade, 357
Filter_PT1, 500 PID_Temp state and mode parameters, 383
Filter_PT2, 512 ErrorBits parameter, 389
ActivateRecoverMode tag, 392
Filter_Universal, 539
Tag Warning, 393
PwmPeriode, 394
I Polyline, 448
Icon PULSEGEN
For value comparison, 50 Instruction, 408
Operating principle, 409
P PULSEGEN
Input parameters, 415
PID_3Step Output parameters, 416
Instruction, 285
Input parameters, 293
Output parameters, 295 R
In/out parameters, 296 RampFunction, 464
Instruction, 315
Input parameters, 322 RampSoak, 477
Output parameters, 323
Static tags, 325 S
Software controller
Configuring, 41
SplitRange, 459
PID control
Function Manual, 11/2023, A5E35300227-AG 557
Index
T
TCONT_CP
Instruction, 416
Operating principle, 417
Input parameters, 430
Output parameters, 431
In/out parameters, 431
Static tags, 432
TCONT_S
Instruction, 438
Operating principle, 439
Input parameters, 444
Output parameters, 445
In/out parameters, 445
Static tags, 445
Technology objects
PID_Compact, 71
PID_3Step, 111
PID_Temp, 146
CONT_C, 190
CONT_S, 194
TCONT_CP, 197
TCONT_S, 217
V
Values
Comparing, 50
PID control
558 Function Manual, 11/2023, A5E35300227-AG