s71500 Pid Control Function Manual EnUS en-US
s71500 Pid Control Function Manual EnUS en-US
Preface
___________________
Documentation guide 1
SIMATIC
___________________
Principles for control 2
Configuring a software
___________________
controller 3
S7-1200, S7-1500
PID control
___________________
Using PID_Compact 4
___________________
Using PID_3Step 5
Function Manual
___________________
Using PID_Temp 6
___________________
Using PID basic functions 7
___________________
Instructions 8
___________________
Service & Support A
09/2016
A5E35300227-AB
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.
Conventions
Please 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.
Additional assistance
Information on the offers of our Technical Support are available in the appendix
Service & Support (Page 520).
The range of technical documentation for the individual SIMATIC products and
automation systems is available on the Internet
(http://www.siemens.com/simatic-tech-doku-portal).
The online catalog and the ordering system are available on the Internet
(http://mall.automation.siemens.com).
PID control
4 Function Manual, 09/2016, A5E35300227-AB
Table of contents
Preface ...................................................................................................................................................... 4
1 Documentation guide ............................................................................................................................... 12
2 Principles for control ................................................................................................................................ 16
2.1 Controlled system and actuators ............................................................................................16
2.2 Controlled systems .................................................................................................................18
2.3 Characteristic values of the control section ............................................................................20
2.4 Pulse controller .......................................................................................................................23
2.5 Response to setpoint changes and disturbances ...................................................................27
2.6 Control Response at Different Feedback Structures ..............................................................29
2.7 Selection of the controller structure for specified controlled systems.....................................36
2.8 PID parameter settings ...........................................................................................................37
3 Configuring a software controller ............................................................................................................. 38
3.1 Overview of software controller ..............................................................................................38
3.2 Steps for the configuration of a software controller ................................................................40
3.3 Add technology objects ...........................................................................................................40
3.4 Comparing values ...................................................................................................................42
3.4.1 Comparison display and boundary conditions ........................................................................42
3.4.2 Comparing values ...................................................................................................................43
3.5 Configure technology objects .................................................................................................45
3.6 Call instruction in the user program ........................................................................................46
3.7 Parameter view .......................................................................................................................47
3.7.1 Introduction to the parameter view .........................................................................................47
3.7.2 Structure of the parameter view..............................................................................................49
3.7.2.1 Toolbar ....................................................................................................................................49
3.7.2.2 Navigation ...............................................................................................................................50
3.7.2.3 Parameter table ......................................................................................................................51
3.7.3 Opening the parameter view ...................................................................................................53
3.7.4 Default setting of the parameter view .....................................................................................54
3.7.5 Working with the parameter view............................................................................................57
3.7.5.1 Overview .................................................................................................................................57
3.7.5.2 Filtering the parameter table ...................................................................................................58
3.7.5.3 Sorting the parameter table ....................................................................................................59
3.7.5.4 Transferring parameter data to other editors ..........................................................................59
3.7.5.5 Indicating errors ......................................................................................................................60
3.7.5.6 Editing start values in the project ............................................................................................61
3.7.5.7 Status of configuration (offline) ...............................................................................................63
3.7.5.8 Monitoring values online in the parameter view .....................................................................64
PID control
Function Manual, 09/2016, A5E35300227-AB 5
Table of contents
PID control
6 Function Manual, 09/2016, A5E35300227-AB
Table of contents
PID control
Function Manual, 09/2016, A5E35300227-AB 7
Table of contents
PID control
8 Function Manual, 09/2016, A5E35300227-AB
Table of contents
PID control
Function Manual, 09/2016, A5E35300227-AB 9
Table of contents
PID control
10 Function Manual, 09/2016, A5E35300227-AB
Table of contents
PID control
Function Manual, 09/2016, A5E35300227-AB 11
Documentation guide 1
The documentation for the SIMATIC S7-1500 automation system, for CPU 1516pro-2 PN
based on SIMATIC S7-1500, and for the distributed I/O systems SIMATIC ET 200MP,
ET 200SP and ET 200AL is divided into three areas.
This division allows you easier access to the specific information you require.
Basic information
System manuals and Getting Started manuals describe in detail the configuration,
installation, wiring and commissioning of the SIMATIC S7-1500, ET 200MP, ET 200SP and
ET 200AL systems; use the corresponding operating instructions for CPU 1516pro-2 PN.
The STEP 7 online help supports you in configuration and programming.
Device information
Product manuals contain a compact description of the module-specific information, such as
properties, terminal diagrams, characteristics and technical specifications.
PID control
12 Function Manual, 09/2016, A5E35300227-AB
Documentation guide
General information
The function manuals contain detailed descriptions on general topics such as diagnostics,
communication, Motion Control, Web server, OPC UA.
You can download the documentation free of charge from the Internet
(http://w3.siemens.com/mcms/industrial-automation-systems-simatic/en/manual-
overview/Pages/Default.aspx).
Changes and additions to the manuals are documented in product information sheets.
You will find the product information on the Internet:
S7-1500/ET 200MP (https://support.industry.siemens.com/cs/us/en/view/68052815)
ET 200SP (https://support.industry.siemens.com/cs/us/en/view/73021864)
ET 200AL (https://support.industry.siemens.com/cs/us/en/view/99494757)
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 (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)
"mySupport"
With "mySupport", your personal workspace, you make the best out of your Industry Online
Support.
In "mySupport", you can save filters, favorites and tags, request CAx data and compile your
personal library in the Documentation area. In addition, your data is already filled out in
support requests and you can get an overview of your current requests at any time.
You must register once to use the full functionality of "mySupport".
You can find "mySupport" on the Internet (https://support.industry.siemens.com/My/ww/en).
"mySupport" - Documentation
In the Documentation area in "mySupport" you can combine entire manuals or only parts of
these to your own manual.
You can export the manual as PDF file or in a format that can be edited later.
You can find "mySupport" - Documentation on the Internet
(http://support.industry.siemens.com/My/ww/en/documentation).
PID control
Function Manual, 09/2016, A5E35300227-AB 13
Documentation guide
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 will find the application examples on the Internet
(https://support.industry.siemens.com/sc/ww/en/sc/2054).
PID control
14 Function Manual, 09/2016, A5E35300227-AB
Documentation guide
PRONETA
With SIEMENS PRONETA (PROFINET network analysis), you analyze the plant network
during commissioning. PRONETA features two core functions:
The topology overview independently scans PROFINET and all connected components.
The IO check is a fast test of the wiring and the module configuration of a plant.
You can find SIEMENS PRONETA on the Internet
(https://support.industry.siemens.com/cs/ww/en/view/67460624).
PID control
Function Manual, 09/2016, A5E35300227-AB 15
Principles for control 2
2.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.
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
PID control
16 Function Manual, 09/2016, A5E35300227-AB
Principles for control
2.1 Controlled system and actuators
PID control
Function Manual, 09/2016, A5E35300227-AB 17
Principles for control
2.2 Controlled systems
PID control
18 Function Manual, 09/2016, A5E35300227-AB
Principles for control
2.2 Controlled systems
PID control
Function Manual, 09/2016, A5E35300227-AB 19
Principles for control
2.3 Characteristic values of the control section
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
20 Function Manual, 09/2016, A5E35300227-AB
Principles for control
2.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:
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, 09/2016, A5E35300227-AB 21
Principles for control
2.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 fur- 1 to 5 min 10 to 20 min Up to 20 K/min.
nace
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 2C/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 min1
Voltage Small generators None 1 to 5 s Not relevant
Large generators None 5 to 10 s Not relevant
PID control
22 Function Manual, 09/2016, A5E35300227-AB
Principles for control
2.4 Pulse controller
ON
OFF
Yh Control range
w Setpoint
PID control
Function Manual, 09/2016, A5E35300227-AB 23
Principles for control
2.4 Pulse controller
PID control
24 Function Manual, 09/2016, A5E35300227-AB
Principles for control
2.4 Pulse controller
PID control
Function Manual, 09/2016, A5E35300227-AB 25
Principles for control
2.4 Pulse controller
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
PID control
26 Function Manual, 09/2016, A5E35300227-AB
Principles for control
2.5 Response to setpoint changes and disturbances
x Process value
w Setpoint
PID control
Function Manual, 09/2016, A5E35300227-AB 27
Principles for control
2.5 Response to setpoint changes and disturbances
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.
x Process value
w Setpoint
Influencing a disturbance variable
PID control
28 Function Manual, 09/2016, A5E35300227-AB
Principles for control
2.6 Control Response at Different Feedback Structures
Control deviation
Output value of a continuous controller
Output value of a pulse controller
PID control
Function Manual, 09/2016, A5E35300227-AB 29
Principles for control
2.6 Control Response at Different Feedback Structures
Control deviation
Output value of a continuous controller
Output value of a pulse controller
TM_LAG Delay of the Derivative action
PID control
30 Function Manual, 09/2016, A5E35300227-AB
Principles for control
2.6 Control Response at Different Feedback Structures
PID control
Function Manual, 09/2016, A5E35300227-AB 31
Principles for control
2.6 Control Response at Different Feedback Structures
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, integral action time TI (integral action), and derivative action time TD (derivative
action).
PID control
32 Function Manual, 09/2016, A5E35300227-AB
Principles for control
2.6 Control Response at Different Feedback Structures
PID control
Function Manual, 09/2016, A5E35300227-AB 33
Principles for control
2.6 Control Response at Different Feedback Structures
Control deviation
Output value of a continuous controller
Output value of a pulse controller
TM_LAG Delay of the Derivative action
Ti Integral action time
PID control
34 Function Manual, 09/2016, A5E35300227-AB
Principles for control
2.6 Control Response at Different Feedback Structures
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
Function Manual, 09/2016, A5E35300227-AB 35
Principles for control
2.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
36 Function Manual, 09/2016, A5E35300227-AB
Principles for control
2.8 PID parameter settings
PID control
Function Manual, 09/2016, A5E35300227-AB 37
Configuring a software controller 3
3.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
38 Function Manual, 09/2016, A5E35300227-AB
Configuring a software controller
3.1 Overview of software controller
PID control
Function Manual, 09/2016, A5E35300227-AB 39
Configuring a software controller
3.2 Steps for the configuration of a software controller
Step Description
1 Add technology object (Page 40)
2 Configure technology object (Page 45)
3 Call instruction in the user program (Page 46)
4 Download technology object to device (Page 72)
5 Commission software controller (Page 74)
6 Save optimized PID parameters in the project (Page 74)
7 Comparing values (Page 43)
8 Display instances of a technology object (Page 75)
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
40 Function Manual, 09/2016, A5E35300227-AB
Configuring a software controller
3.3 Add 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.
PID control
Function Manual, 09/2016, A5E35300227-AB 41
Configuring a software controller
3.4 Comparing values
Icon Function
Start value PLC matches the configured Start value project
Start value PLC does not match the configured Start value project
The comparison of the Start value PLC with the configured Start value project cannot be
performed
At least one of the two comparison values has a process-related or syntax error.
Transfers updated start values in the project to the CPU (initialize setting 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
42 Function Manual, 09/2016, A5E35300227-AB
Configuring a software controller
3.4 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 42) 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.
PID control
Function Manual, 09/2016, A5E35300227-AB 43
Configuring a software controller
3.4 Comparing values
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.
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
44 Function Manual, 09/2016, A5E35300227-AB
Configuring a software controller
3.5 Configure technology objects
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.
Symbols
Icons in the area navigation of the configuration and in the Inspector window show additional
details about the completeness of the configuration:
The properties of a technology object are described in detail in the section for the technology
object.
PID control
Function Manual, 09/2016, A5E35300227-AB 45
Configuring a software controller
3.6 Call instruction in the user program
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
46 Function Manual, 09/2016, A5E35300227-AB
Configuring a software controller
3.7 Parameter view
PID control
Function Manual, 09/2016, A5E35300227-AB 47
Configuring a software controller
3.7 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.
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
48 Function Manual, 09/2016, A5E35300227-AB
Configuring a software controller
3.7 Parameter view
3.7.2.1 Toolbar
The following functions can be selected in the toolbar of the parameter view.
PID control
Function Manual, 09/2016, A5E35300227-AB 49
Configuring a software controller
3.7 Parameter view
3.7.2.2 Navigation
Within the "Parameter view" tab, the following alternative navigation structures can be
selected.
Navigation Explanation
Functional navi- In the functional navigation, the structure of the parameters is
gation 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.
You can use the "Select navigation structure" drop-down list to toggle the navigation
structure.
PID control
50 Function Manual, 09/2016, A5E35300227-AB
Configuring a software controller
3.7 Parameter view
PID control
Function Manual, 09/2016, A5E35300227-AB 51
Configuring a software controller
3.7 Parameter view
See also
Comparing values (Page 42)
PID control
52 Function Manual, 09/2016, A5E35300227-AB
Configuring a software controller
3.7 Parameter view
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.
See also
Default setting of the parameter view (Page 54)
PID control
Function Manual, 09/2016, A5E35300227-AB 53
Configuring a software controller
3.7 Parameter view
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
54 Function Manual, 09/2016, A5E35300227-AB
Configuring a software controller
3.7 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 50).
PID control
Function Manual, 09/2016, A5E35300227-AB 55
Configuring a software controller
3.7 Parameter view
PID control
56 Function Manual, 09/2016, A5E35300227-AB
Configuring a software controller
3.7 Parameter view
3.7.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.
PID control
Function Manual, 09/2016, A5E35300227-AB 57
Configuring a software controller
3.7 Parameter view
PID control
58 Function Manual, 09/2016, A5E35300227-AB
Configuring a software controller
3.7 Parameter view
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.
PID control
Function Manual, 09/2016, A5E35300227-AB 59
Configuring a software controller
3.7 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.
PID control
60 Function Manual, 09/2016, A5E35300227-AB
Configuring a software controller
3.7 Parameter view
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.
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
Function Manual, 09/2016, A5E35300227-AB 61
Configuring a software controller
3.7 Parameter view
PID control
62 Function Manual, 09/2016, A5E35300227-AB
Configuring a software controller
3.7 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.
See also
Configure technology objects (Page 45)
PID control
Function Manual, 09/2016, A5E35300227-AB 63
Configuring a software controller
3.7 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 51)
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.
PID control
64 Function Manual, 09/2016, A5E35300227-AB
Configuring a software controller
3.7 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 .
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.
PID control
Function Manual, 09/2016, A5E35300227-AB 65
Configuring a software controller
3.7 Parameter view
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 "Modify 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, 09/2016, A5E35300227-AB
Configuring a software controller
3.7 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)
PID control
Function Manual, 09/2016, A5E35300227-AB 67
Configuring a software controller
3.7 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 compare the start values on the various target systems, follow these steps:
1. Click the "Selection of compare 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
68 Function Manual, 09/2016, A5E35300227-AB
Configuring a software controller
3.7 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 configurations.
PID control
Function Manual, 09/2016, A5E35300227-AB 69
Configuring a software controller
3.7 Parameter view
Requirements
The technology object is of type "PID_Compact" or "PID_3Step".
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 .
Result
The current monitor values are applied to the "Snapshot" column and their setpoints are
copied to the "Start value 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 project" column using the "Copy" and "Paste"
commands in the shortcut menu.
PID control
70 Function Manual, 09/2016, A5E35300227-AB
Configuring a software controller
3.7 Parameter view
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 type "PID_Compact" or "PID_3Step".
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 a "Setpoint" have a "Start value 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 project" column.
Ensure that the start values are free of process-related and syntax errors.
2. Click the "Initialize setpoints" icon .
Result
The setpoints in the CPU are initialized with the start values from the project.
PID control
Function Manual, 09/2016, A5E35300227-AB 71
Configuring a software controller
3.8 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
72 Function Manual, 09/2016, A5E35300227-AB
Configuring a software controller
3.8 Downloading technology objects to device
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.
PID control
Function Manual, 09/2016, A5E35300227-AB 73
Configuring a software controller
3.9 Commissioning software controller
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
74 Function Manual, 09/2016, A5E35300227-AB
Configuring a software controller
3.11 Display instance DB of a technology object.
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
Function Manual, 09/2016, A5E35300227-AB 75
Using PID_Compact 4
4.1 PID_Compact V2
Introduction 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)
PID control
76 Function Manual, 09/2016, A5E35300227-AB
Using PID_Compact
4.1 PID_Compact V2
Control mode V2
Physical quantity
Select the physical quantity and unit of measurement for setpoint, process value, and
disturbance variable in the "Controller type" group. Setpoint, process value, and disturbance
variable is displayed in this unit of measurement.
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.
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.
PID control
Function Manual, 09/2016, A5E35300227-AB 77
Using PID_Compact
4.1 PID_Compact V2
Setpoint V2
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.
Process value V2
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
78 Function Manual, 09/2016, A5E35300227-AB
Using PID_Compact
4.1 PID_Compact V2
Output value 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
nonlinear 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
Function Manual, 09/2016, A5E35300227-AB 79
Using PID_Compact
4.1 PID_Compact V2
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.
PID control
80 Function Manual, 09/2016, A5E35300227-AB
Using PID_Compact
4.1 PID_Compact V2
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:
In the output value settings, you can specify the reaction of PID_Compact when the process
value high limit or low limit is violated.
See also
Parameters State and Mode V2 (Page 274)
PID control
Function Manual, 09/2016, A5E35300227-AB 81
Using PID_Compact
4.1 PID_Compact V2
PWM limits V2
The value at the output parameter Output is transformed into a pulse sequence that is output
at output parameter Output_PWM by means of a pulse width modulation. Output is
calculated in the PID algorithm sampling time, Output_PWM is output in the PID_Compact
sampling time.
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.
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.
The "Minimum ON time" and the "Minimum OFF time" are rounded to an integer multiple of
the PID_Compact sampling time.
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.
PID control
82 Function Manual, 09/2016, A5E35300227-AB
Using PID_Compact
4.1 PID_Compact V2
Example
PID_Compact sampling time = 100 ms
PID algorithm sampling time = 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.
In order to minimize operation frequency and conserve the actuator, extend the minimum ON
and OFF times.
If you are using "Output" or "Output_PER", you must configure the value 0.0 for the minimum
ON and OFF times.
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, 09/2016, A5E35300227-AB 83
Using PID_Compact
4.1 PID_Compact V2
Output value 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.
PID control
84 Function Manual, 09/2016, A5E35300227-AB
Using PID_Compact
4.1 PID_Compact V2
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.
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
Parameters State and Mode V2 (Page 274)
PID control
Function Manual, 09/2016, A5E35300227-AB 85
Using PID_Compact
4.1 PID_Compact V2
PID parameters 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.
The PID algorithm operates according to the following equation:
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 Integral action 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:
All PID parameters are retentive. If you enter the PID parameters manually, you must
completely download PID_Compact.
Downloading technology objects to device (Page 72)
PID control
86 Function Manual, 09/2016, A5E35300227-AB
Using PID_Compact
4.1 PID_Compact V2
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, 09/2016, A5E35300227-AB 87
Using PID_Compact
4.1 PID_Compact V2
PID control
88 Function Manual, 09/2016, A5E35300227-AB
Using PID_Compact
4.1 PID_Compact V2
4.1.2.1 Pretuning 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
Function Manual, 09/2016, A5E35300227-AB 89
Using PID_Compact
4.1 PID_Compact 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
Parameters State and Mode V2 (Page 274)
PID control
90 Function Manual, 09/2016, A5E35300227-AB
Using PID_Compact
4.1 PID_Compact V2
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 one of the following operating modes: Inactive, automatic mode, or
manual mode.
PID control
Function Manual, 09/2016, A5E35300227-AB 91
Using PID_Compact
4.1 PID_Compact 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 no errors occurred during fine tuning, 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
Parameters State and Mode V2 (Page 274)
PID control
92 Function Manual, 09/2016, A5E35300227-AB
Using PID_Compact
4.1 PID_Compact V2
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.
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, follow these steps:
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
Parameters State and Mode V2 (Page 274)
PID control
Function Manual, 09/2016, A5E35300227-AB 93
Using PID_Compact
4.1 PID_Compact V2
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_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 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 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.
PID control
94 Function Manual, 09/2016, A5E35300227-AB
Using PID_Compact
4.1 PID_Compact V2
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.
The valve is controlled with the output value of PID_Compact in I/O format (parameter
Output_PER) by writing the program tag ActuatorInput.
PID control
Function Manual, 09/2016, A5E35300227-AB 95
Using PID_Compact
4.1 PID_Compact V2
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.
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.
PID control
96 Function Manual, 09/2016, A5E35300227-AB
Using PID_Compact
4.1 PID_Compact V2
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.
This example can be implemented with the following SCL program code:
PID control
Function Manual, 09/2016, A5E35300227-AB 97
Using PID_Compact
4.1 PID_Compact V2
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
98 Function Manual, 09/2016, A5E35300227-AB
Using PID_Compact
4.2 PID_Compact V1
4.2 PID_Compact V1
Introduction 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)
PID control
Function Manual, 09/2016, A5E35300227-AB 99
Using PID_Compact
4.2 PID_Compact V1
Control mode V1
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.
Setpoint 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 control
100 Function Manual, 09/2016, A5E35300227-AB
Using PID_Compact
4.2 PID_Compact V1
Process value V1
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.
Output value V1
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
nonlinear actuator response.
Output_PWM
The actuator is controlled via a digital output. Pulse width modulation creates minimum
ON and minimum OFF times.
PID control
Function Manual, 09/2016, A5E35300227-AB 101
Using PID_Compact
4.2 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.
PID control
102 Function Manual, 09/2016, A5E35300227-AB
Using PID_Compact
4.2 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 104)
PWM limits V1 (Page 105)
Output value limits V1 (Page 108)
PID parameters V1 (Page 109)
PID control
Function Manual, 09/2016, A5E35300227-AB 103
Using PID_Compact
4.2 PID_Compact V1
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:
See also
Process value settings V1 (Page 103)
PWM limits V1 (Page 105)
Output value limits V1 (Page 108)
PID parameters V1 (Page 109)
PID control
104 Function Manual, 09/2016, A5E35300227-AB
Using PID_Compact
4.2 PID_Compact V1
PWM limits V1
The value at the output parameter Output is transformed into a pulse sequence that is output
at output parameter Output_PWM by means of a pulse width modulation. Output is
calculated in the PID algorithm sampling time, Output_PWM is output in the PID_Compact
sampling time.
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.
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.
The "Minimum ON time" and the "Minimum OFF time" are rounded to an integer multiple of
the PID_Compact sampling time.
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.
PID control
Function Manual, 09/2016, A5E35300227-AB 105
Using PID_Compact
4.2 PID_Compact V1
Example
PID_Compact sampling time = 100 ms
PID algorithm sampling time = 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.
In order to minimize operation frequency and conserve the actuator, extend the minimum ON
and OFF times.
If you are using "Output" or "Output_PER", you must configure the value 0.0 for the minimum
ON and OFF times.
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
106 Function Manual, 09/2016, A5E35300227-AB
Using PID_Compact
4.2 PID_Compact V1
See also
Process value settings V1 (Page 103)
Process value monitoring V1 (Page 104)
Output value limits V1 (Page 108)
PID parameters V1 (Page 109)
PID control
Function Manual, 09/2016, A5E35300227-AB 107
Using PID_Compact
4.2 PID_Compact V1
PID_Compact sets the output value to 0.0 if an error occurs. 0.0 must therefore always be
within the output value limits. You will need to add an offset to Output and Output_PER in the
user program if you want an output value low limit of greater than 0.0.
See also
Process value settings V1 (Page 103)
Process value monitoring V1 (Page 104)
PWM limits V1 (Page 105)
PID parameters V1 (Page 109)
PID control
108 Function Manual, 09/2016, A5E35300227-AB
Using PID_Compact
4.2 PID_Compact V1
PID parameters V1
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.
The PID algorithm operates according to the following equation:
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 Integral action 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:
All PID parameters are retentive. If you enter the PID parameters manually, you must
completely download PID_Compact.
PID control
Function Manual, 09/2016, A5E35300227-AB 109
Using PID_Compact
4.2 PID_Compact V1
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
110 Function Manual, 09/2016, A5E35300227-AB
Using PID_Compact
4.2 PID_Compact V1
See also
Downloading technology objects to device (Page 72)
PID control
Function Manual, 09/2016, A5E35300227-AB 111
Using PID_Compact
4.2 PID_Compact V1
4.2.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 113)
Fine tuning V1 (Page 115)
"Manual" mode V1 (Page 117)
PID control
112 Function Manual, 09/2016, A5E35300227-AB
Using PID_Compact
4.2 PID_Compact V1
4.2.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.
PID control
Function Manual, 09/2016, A5E35300227-AB 113
Using PID_Compact
4.2 PID_Compact V1
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.
See also
Parameters State and sRet.i_Mode V1 (Page 303)
Commissioning V1 (Page 112)
Fine tuning V1 (Page 115)
"Manual" mode V1 (Page 117)
PID control
114 Function Manual, 09/2016, A5E35300227-AB
Using PID_Compact
4.2 PID_Compact V1
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, 09/2016, A5E35300227-AB 115
Using PID_Compact
4.2 PID_Compact 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_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 303)
Commissioning V1 (Page 112)
Pretuning V1 (Page 113)
"Manual" mode V1 (Page 117)
PID control
116 Function Manual, 09/2016, A5E35300227-AB
Using PID_Compact
4.2 PID_Compact V1
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 process by
specifying a manual value. To define a manual value, proceed as follows:
1. Select the check box "Manual mode" in the "Online status of the 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 change to automatic mode is bumpless.
See also
Parameters State and sRet.i_Mode V1 (Page 303)
Commissioning V1 (Page 112)
Pretuning V1 (Page 113)
Fine tuning V1 (Page 115)
PID control
Function Manual, 09/2016, A5E35300227-AB 117
Using PID_Compact
4.2 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
118 Function Manual, 09/2016, A5E35300227-AB
Using PID_Compact
4.3 Technology object PID_Compact
Additional information
Overview of software controller (Page 38)
Add technology objects (Page 40)
Configure technology objects (Page 45)
Configuring PID_Compact V2 (Page 76)
Configuring PID_Compact V1 (Page 99)
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, 09/2016, A5E35300227-AB 119
Using PID_3Step 5
5.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 38)
Add technology objects (Page 40)
Configure technology objects (Page 45)
Configuring PID_3Step V2 (Page 121)
Configuring PID_3Step V1 (Page 144)
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
120 Function Manual, 09/2016, A5E35300227-AB
Using PID_3Step
5.2 PID_3Step V2
5.2 PID_3Step V2
Introduction 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)
PID control
Function Manual, 09/2016, A5E35300227-AB 121
Using PID_3Step
5.2 PID_3Step V2
Control mode V2
Physical quantity
Select the physical quantity and unit of measurement for setpoint, process value, and
disturbance variable in the "Controller type" group. Setpoint, process value, and disturbance
variable is displayed in this unit of measurement.
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.
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.
PID control
122 Function Manual, 09/2016, A5E35300227-AB
Using PID_3Step
5.2 PID_3Step V2
Setpoint V2
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.
Process value V2
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.
Position feedback V2
Position feedback configuration depends upon the actuator used.
Actuator without position feedback
Actuator with digital endstop signals
Actuator with analog position feedback
Actuator with analog position feedback and endstop signals
PID control
Function Manual, 09/2016, A5E35300227-AB 123
Using PID_3Step
5.2 PID_3Step V2
PID control
124 Function Manual, 09/2016, A5E35300227-AB
Using PID_3Step
5.2 PID_3Step V2
Output value 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, 09/2016, A5E35300227-AB 125
Using PID_3Step
5.2 PID_3Step V2
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.
PID control
126 Function Manual, 09/2016, A5E35300227-AB
Using PID_3Step
5.2 PID_3Step V2
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 72)
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.
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.
PID control
Function Manual, 09/2016, A5E35300227-AB 127
Using PID_3Step
5.2 PID_3Step V2
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
128 Function Manual, 09/2016, A5E35300227-AB
Using PID_3Step
5.2 PID_3Step V2
PID control
Function Manual, 09/2016, A5E35300227-AB 129
Using PID_3Step
5.2 PID_3Step V2
PID control
130 Function Manual, 09/2016, A5E35300227-AB
Using PID_3Step
5.2 PID_3Step V2
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:
In the actuator settings, you can configure the response of PID_3Step when the process
value high limit or low limit is violated.
PID control
Function Manual, 09/2016, A5E35300227-AB 131
Using PID_3Step
5.2 PID_3Step V2
PID parameters 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.
The PID algorithm operates according to the following equation:
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:
All PID parameters are retentive. If you enter the PID parameters manually, you must
completely download PID_3Step.
Downloading technology objects to device (Page 72)
PID control
132 Function Manual, 09/2016, A5E35300227-AB
Using PID_3Step
5.2 PID_3Step V2
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.
PID control
Function Manual, 09/2016, A5E35300227-AB 133
Using PID_3Step
5.2 PID_3Step V2
PID control
134 Function Manual, 09/2016, A5E35300227-AB
Using PID_3Step
5.2 PID_3Step V2
5.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).
PID control
Function Manual, 09/2016, A5E35300227-AB 135
Using PID_3Step
5.2 PID_3Step V2
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 responds with the configured reaction to errors.
PID control
136 Function Manual, 09/2016, A5E35300227-AB
Using PID_3Step
5.2 PID_3Step V2
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
Function Manual, 09/2016, A5E35300227-AB 137
Using PID_3Step
5.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.
PID control
138 Function Manual, 09/2016, A5E35300227-AB
Using PID_3Step
5.2 PID_3Step V2
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).
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 132)
PID control
Function Manual, 09/2016, A5E35300227-AB 139
Using PID_3Step
5.2 PID_3Step V2
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
140 Function Manual, 09/2016, A5E35300227-AB
Using PID_3Step
5.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.
PID control
Function Manual, 09/2016, A5E35300227-AB 141
Using PID_3Step
5.2 PID_3Step V2
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
142 Function Manual, 09/2016, A5E35300227-AB
Using PID_3Step
5.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
Function Manual, 09/2016, A5E35300227-AB 143
Using PID_3Step
5.3 PID_3Step V1
5.3 PID_3Step V1
Introduction 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)
PID control
144 Function Manual, 09/2016, A5E35300227-AB
Using PID_3Step
5.3 PID_3Step V1
Control mode V1
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.
Setpoint 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 control
Function Manual, 09/2016, A5E35300227-AB 145
Using PID_3Step
5.3 PID_3Step V1
Process value V1
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.
Position feedback V1
Position feedback configuration depends upon the actuator used.
Actuator without position feedback
Actuator with digital endstop signals
Actuator with analog position feedback
Actuator with analog position feedback and endstop signals
PID control
146 Function Manual, 09/2016, A5E35300227-AB
Using PID_3Step
5.3 PID_3Step V1
Output value 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.
PID control
Function Manual, 09/2016, A5E35300227-AB 147
Using PID_3Step
5.3 PID_3Step V1
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
148 Function Manual, 09/2016, A5E35300227-AB
Using PID_3Step
5.3 PID_3Step V1
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, 09/2016, A5E35300227-AB 149
Using PID_3Step
5.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 control
150 Function Manual, 09/2016, A5E35300227-AB
Using PID_3Step
5.3 PID_3Step V1
PID control
Function Manual, 09/2016, A5E35300227-AB 151
Using PID_3Step
5.3 PID_3Step V1
PID control
152 Function Manual, 09/2016, A5E35300227-AB
Using PID_3Step
5.3 PID_3Step V1
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, 09/2016, A5E35300227-AB 153
Using PID_3Step
5.3 PID_3Step V1
PID parameters V1
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.
The PID algorithm operates according to the following equation:
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:
All PID parameters are retentive. If you enter the PID parameters manually, you must
completely download PID_3Step.
Downloading technology objects to device (Page 72)
PID control
154 Function Manual, 09/2016, A5E35300227-AB
Using PID_3Step
5.3 PID_3Step V1
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.
PID control
Function Manual, 09/2016, A5E35300227-AB 155
Using PID_3Step
5.3 PID_3Step V1
PID control
156 Function Manual, 09/2016, A5E35300227-AB
Using PID_3Step
5.3 PID_3Step V1
5.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, 09/2016, A5E35300227-AB 157
Using PID_3Step
5.3 PID_3Step V1
5.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
158 Function Manual, 09/2016, A5E35300227-AB
Using PID_3Step
5.3 PID_3Step V1
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, 09/2016, A5E35300227-AB 159
Using PID_3Step
5.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
160 Function Manual, 09/2016, A5E35300227-AB
Using PID_3Step
5.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, 09/2016, A5E35300227-AB 161
Using PID_3Step
5.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
162 Function Manual, 09/2016, A5E35300227-AB
Using PID_3Step
5.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, 09/2016, A5E35300227-AB 163
Using PID_Temp 6
6.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 38)
Add technology objects (Page 40)
Configure technology objects (Page 45)
Configuring PID_Temp (Page 165)
PID control
164 Function Manual, 09/2016, A5E35300227-AB
Using PID_Temp
6.2 Configuring PID_Temp
6.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, 09/2016, A5E35300227-AB 165
Using PID_Temp
6.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.
6.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
166 Function Manual, 09/2016, A5E35300227-AB
Using PID_Temp
6.2 Configuring PID_Temp
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, 09/2016, A5E35300227-AB 167
Using PID_Temp
6.2 Configuring PID_Temp
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.
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
168 Function Manual, 09/2016, A5E35300227-AB
Using PID_Temp
6.2 Configuring PID_Temp
6.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 198).
PID control
Function Manual, 09/2016, A5E35300227-AB 169
Using PID_Temp
6.2 Configuring PID_Temp
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
170 Function Manual, 09/2016, A5E35300227-AB
Using PID_Temp
6.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.
PID control
Function Manual, 09/2016, A5E35300227-AB 171
Using PID_Temp
6.2 Configuring PID_Temp
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.
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.
PID control
172 Function Manual, 09/2016, A5E35300227-AB
Using PID_Temp
6.2 Configuring PID_Temp
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.
Substitute output value while error is pending
PID_Temp behaves as described at "Current value while error is pending", but outputs
the configured substitute output value (SubstituteOutput) as a PID output value
(PidOutputSum) in "Substitute output value with error monitoring" operating mode.
The values at the outputs for heating and cooling resulting from the PID output value are
produced by the configured output scaling.
In the case of controllers with activated cooling output (Config.ActivateCooling = TRUE),
enter:
A positive substitute output value to output the value at the outputs for heating.
A negative substitute output value to output the value at the outputs for cooling.
If the following error occurs, PID_Temp stays in "Substitute output value with error
monitoring" mode and outputs the low limit of the PID output value for heating
(Config.Output.Heat.PidLowerLimit):
0020000h: Invalid value at SubstituteOutput tag.
PID control
Function Manual, 09/2016, A5E35300227-AB 173
Using PID_Temp
6.2 Configuring PID_Temp
PID control
174 Function Manual, 09/2016, A5E35300227-AB
Using PID_Temp
6.2 Configuring PID_Temp
The low limit of PID output value (heating) (Config.Output.Heat.PidLowerLimit) has to have the
value 0.0, if the cooling is activated (Config.ActivateCooling = TRUE).
The high limit of PID output value (cooling) (Config.Output.Cool.PidUpperLimit) must always have
the value 0.0.
PID control
Function Manual, 09/2016, A5E35300227-AB 175
Using PID_Temp
6.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):
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):
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).
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.
PID control
176 Function Manual, 09/2016, A5E35300227-AB
Using PID_Temp
6.2 Configuring PID_Temp
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:
You can configure the response of PID_Temp when the process value high limit or low limit
is violated in the output settings.
PID control
Function Manual, 09/2016, A5E35300227-AB 177
Using PID_Temp
6.2 Configuring PID_Temp
PID control
178 Function Manual, 09/2016, A5E35300227-AB
Using PID_Temp
6.2 Configuring PID_Temp
The "Minimum ON time" and the "Minimum OFF time" can be set separately for heating and
cooling, rounded to an integer multiple of the PID_Temp sampling time.
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 for OutputHeat_PWM
PID_Temp sampling time = 100 ms
PID algorithm sampling time = 1000 ms
Minimum ON time = 200 ms
The PID output value PidOutputSum amounts to 15% constantly. The smallest pulse that
PID_Temp can output corresponds to 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.
In order to minimize operation frequency and conserve the actuator, extend the minimum ON
and OFF times.
If you have selected OutputHeat/OutputCool or OutputHeat_PER/OutputCool_PER as the
output in the basic settings, the minimum ON time and the minimum OFF time are not
evaluated and cannot be changed.
PID control
Function Manual, 09/2016, A5E35300227-AB 179
Using PID_Temp
6.2 Configuring PID_Temp
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
180 Function Manual, 09/2016, A5E35300227-AB
Using PID_Temp
6.2 Configuring PID_Temp
PID control
Function Manual, 09/2016, A5E35300227-AB 181
Using PID_Temp
6.2 Configuring PID_Temp
The diagram below illustrates the integration of the parameters into the PID algorithm:
All PID parameters are retentive. If you enter the PID parameters manually, you must
completely download PID_Temp (Downloading technology objects to device (Page 72)).
PID control
182 Function Manual, 09/2016, A5E35300227-AB
Using PID_Temp
6.2 Configuring PID_Temp
PID control
Function Manual, 09/2016, A5E35300227-AB 183
Using PID_Temp
6.2 Configuring PID_Temp
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
184 Function Manual, 09/2016, A5E35300227-AB
Using PID_Temp
6.2 Configuring PID_Temp
PID control
Function Manual, 09/2016, A5E35300227-AB 185
Using PID_Temp
6.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.
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.
PID control
186 Function Manual, 09/2016, A5E35300227-AB
Using PID_Temp
6.2 Configuring PID_Temp
PID control
Function Manual, 09/2016, A5E35300227-AB 187
Using PID_Temp
6.3 Commissioning PID_Temp
6.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
188 Function Manual, 09/2016, A5E35300227-AB
Using PID_Temp
6.3 Commissioning PID_Temp
6.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 177) configuration).
PID control
Function Manual, 09/2016, A5E35300227-AB 189
Using PID_Temp
6.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.
PID control
190 Function Manual, 09/2016, A5E35300227-AB
Using PID_Temp
6.3 Commissioning PID_Temp
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 reaction to errors.
PID control
Function Manual, 09/2016, A5E35300227-AB 191
Using PID_Temp
6.3 Commissioning PID_Temp
PID control
192 Function Manual, 09/2016, A5E35300227-AB
Using PID_Temp
6.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
Function Manual, 09/2016, A5E35300227-AB 193
Using PID_Temp
6.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.
PID control
194 Function Manual, 09/2016, A5E35300227-AB
Using PID_Temp
6.3 Commissioning PID_Temp
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
Function Manual, 09/2016, A5E35300227-AB 195
Using PID_Temp
6.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
196 Function Manual, 09/2016, A5E35300227-AB
Using PID_Temp
6.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
Function Manual, 09/2016, A5E35300227-AB 197
Using PID_Temp
6.4 Cascade control with PID_Temp
6.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
198 Function Manual, 09/2016, A5E35300227-AB
Using PID_Temp
6.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:
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 200)
PID control
Function Manual, 09/2016, A5E35300227-AB 199
Using PID_Temp
6.4 Cascade control with PID_Temp
PID control
200 Function Manual, 09/2016, A5E35300227-AB
Using PID_Temp
6.4 Cascade control with PID_Temp
Interconnection of the interface for information exchange between master and slave
The "Slave" parameter of a master has to be assigned to the "Master" parameter of all its
directly subordinate slaves (which receive their setpoint from this master). The
assignment should be carried out via the interface of the slave in order to allow the
interconnection of a master with multiple slaves and the display of the interconnection in
the Inspector window of the slave in the basic settings.
This interconnection can be carried out in the programming editor or automatically in the
Inspector window of the slave in the basic settings via the selection of the master.
The Anti-Wind-Up functionality and the evaluation of the slave operating modes at the
master can only function correctly if this interconnection is carried out.
In the example, the "Slave" parameter of PID_Temp_1 is assigned to the "Master"
parameter of PID_Temp_2.
Program code of the example using SCL (without assignment of the output value of the slave
to the actuator):
"PID_Temp_1"(Input:="TempChocolate");
See also
PID_Temp ActivateRecoverMode tag (Page 453)
PID control
Function Manual, 09/2016, A5E35300227-AB 201
Using PID_Temp
6.4 Cascade control with PID_Temp
6.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
202 Function Manual, 09/2016, A5E35300227-AB
Using PID_Temp
6.4 Cascade control with PID_Temp
Configuration of a slave
PID control
Function Manual, 09/2016, A5E35300227-AB 203
Using PID_Temp
6.4 Cascade control with PID_Temp
6.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.
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
204 Function Manual, 09/2016, A5E35300227-AB
Using PID_Temp
6.4 Cascade control with PID_Temp
PID control
Function Manual, 09/2016, A5E35300227-AB 205
Using PID_Temp
6.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
206 Function Manual, 09/2016, A5E35300227-AB
Using PID_Temp
6.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.
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.
PID control
Function Manual, 09/2016, A5E35300227-AB 207
Using PID_Temp
6.5 Multi-zone controlling with PID_Temp
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
208 Function Manual, 09/2016, A5E35300227-AB
Using PID_Temp
6.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 pre-
assignment 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 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 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.
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).
PID control
Function Manual, 09/2016, A5E35300227-AB 209
Using PID_Temp
6.6 Override control with PID_Temp
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.
PID control
210 Function Manual, 09/2016, A5E35300227-AB
Using PID_Temp
6.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.
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
fr 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 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.
PID control
Function Manual, 09/2016, A5E35300227-AB 211
Using PID_Temp
6.6 Override control with PID_Temp
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.
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 control
212 Function Manual, 09/2016, A5E35300227-AB
Using PID_Temp
6.7 Simulating PID_Temp with PLCSIM
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, 09/2016, A5E35300227-AB 213
Using PID basic functions 7
7.1 CONT_C
See also
Overview of software controller (Page 38)
Add technology objects (Page 40)
Configure technology objects (Page 45)
CONT_C (Page 461)
Downloading technology objects to device (Page 72)
PID control
214 Function Manual, 09/2016, A5E35300227-AB
Using PID basic functions
7.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 462)
PID control
Function Manual, 09/2016, A5E35300227-AB 215
Using PID basic functions
7.1 CONT_C
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.
See also
How CONT_C works (Page 462)
PID control
216 Function Manual, 09/2016, A5E35300227-AB
Using PID basic functions
7.1 CONT_C
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 462)
PID control
Function Manual, 09/2016, A5E35300227-AB 217
Using PID basic functions
7.1 CONT_C
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 473)
PID control
218 Function Manual, 09/2016, A5E35300227-AB
Using PID basic functions
7.1 CONT_C
Requirements
The instruction and the technology object are loaded on the CPU.
Procedure
In order to manually determine the optimal PID parameter, 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 in the "Current Values" group on the icon .
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, 09/2016, A5E35300227-AB 219
Using PID basic functions
7.2 CONT_S
7.2 CONT_S
See also
Overview of software controller (Page 38)
Add technology objects (Page 40)
Configure technology objects (Page 45)
CONT_S (Page 468)
Downloading technology objects to device (Page 72)
PID control
220 Function Manual, 09/2016, A5E35300227-AB
Using PID basic functions
7.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 469)
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 469)
PID control
Function Manual, 09/2016, A5E35300227-AB 221
Using PID basic functions
7.2 CONT_S
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.
See also
Mode of operation CONT_S (Page 469)
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 in the "Current Values" group on the icon .
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
222 Function Manual, 09/2016, A5E35300227-AB
Using PID basic functions
7.3 TCONT_CP
7.3 TCONT_CP
See also
Overview of software controller (Page 38)
Add technology objects (Page 40)
Configure technology objects (Page 45)
TCONT_CP (Page 483)
Downloading technology objects to device (Page 72)
PID control
Function Manual, 09/2016, A5E35300227-AB 223
Using PID basic functions
7.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 484)
PID control
224 Function Manual, 09/2016, A5E35300227-AB
Using PID basic functions
7.3 TCONT_CP
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.
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
PID control
Function Manual, 09/2016, A5E35300227-AB 225
Using PID basic functions
7.3 TCONT_CP
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 484)
PID control
226 Function Manual, 09/2016, A5E35300227-AB
Using PID basic functions
7.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 484)
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".
PID control
Function Manual, 09/2016, A5E35300227-AB 227
Using PID basic functions
7.3 TCONT_CP
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):
PID control
228 Function Manual, 09/2016, A5E35300227-AB
Using PID basic functions
7.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 484)
Operating principle of the pulse generator (Page 493)
PID control
Function Manual, 09/2016, A5E35300227-AB 229
Using PID basic functions
7.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
230 Function Manual, 09/2016, A5E35300227-AB
Using PID basic functions
7.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
Function Manual, 09/2016, A5E35300227-AB 231
Using PID basic functions
7.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
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
232 Function Manual, 09/2016, A5E35300227-AB
Using PID basic functions
7.3 TCONT_CP
In the following image, the transient oscillation is illustrated in the stationary state:
PID control
Function Manual, 09/2016, A5E35300227-AB 233
Using PID basic functions
7.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.
PID control
234 Function Manual, 09/2016, A5E35300227-AB
Using PID basic functions
7.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.
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).
PID control
Function Manual, 09/2016, A5E35300227-AB 235
Using PID basic functions
7.3 TCONT_CP
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
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.
PID control
236 Function Manual, 09/2016, A5E35300227-AB
Using PID basic functions
7.3 TCONT_CP
STATUS_H Result
0 Default, i.e., 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
tuning.
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, 09/2016, A5E35300227-AB 237
Using PID basic functions
7.3 TCONT_CP
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
238 Function Manual, 09/2016, A5E35300227-AB
Using PID basic functions
7.3 TCONT_CP
PID control
Function Manual, 09/2016, A5E35300227-AB 239
Using PID basic functions
7.3 TCONT_CP
The following schematic illustrates the overshoot of the process variable when the excitation
is too strong (process type III):
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
240 Function Manual, 09/2016, A5E35300227-AB
Using PID basic functions
7.3 TCONT_CP
Overshoot
Overshoot can occur in the following situations:
PID control
Function Manual, 09/2016, A5E35300227-AB 241
Using PID basic functions
7.3 TCONT_CP
Requirements
The instruction and the technology object are loaded on 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 are loaded on 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
242 Function Manual, 09/2016, A5E35300227-AB
Using PID basic functions
7.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, 09/2016, A5E35300227-AB 243
Using PID basic functions
7.3 TCONT_CP
PID control
244 Function Manual, 09/2016, A5E35300227-AB
Using PID basic functions
7.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 in the "Current Values" group on the icon .
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
Function Manual, 09/2016, A5E35300227-AB 245
Using PID basic functions
7.4 TCONT_S
7.4 TCONT_S
See also
Overview of software controller (Page 38)
Add technology objects (Page 40)
Configure technology objects (Page 45)
TCONT_S (Page 508)
Downloading technology objects to device (Page 72)
PID control
246 Function Manual, 09/2016, A5E35300227-AB
Using PID basic functions
7.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 509)
PID control
Function Manual, 09/2016, A5E35300227-AB 247
Using PID basic functions
7.4 TCONT_S
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.
See also
Mode of operation TCONT_S (Page 509)
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 509)
PID control
248 Function Manual, 09/2016, A5E35300227-AB
Using PID basic functions
7.4 TCONT_S
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 in the "Current Values" group on the icon .
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, 09/2016, A5E35300227-AB 249
Instructions 8
8.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 pre-assigned 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 4.0 or higher.
PID control
250 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.1 PID_Compact
PID_Compact V2.0
Reaction to error
The reaction to error has been completely overhauled. PID_Compact now reacts 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 reacts 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 reaction to 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 rising 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. No technology object is created in
this case and no parameter assignment interface or commissioning interface is available.
You must assign parameters for PID_Compact directly in the multi-instance DB and
commission it via a watch table.
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.
PID control
Function Manual, 09/2016, A5E35300227-AB 251
Instructions
8.1 PID_Compact
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
252 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.1 PID_Compact
CPU FW PID_Compact
S7-1200 V4.2 or higher 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 V2.0 or higher 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, 09/2016, A5E35300227-AB 253
Instructions
8.1 PID_Compact
8.1.3 PID_Compact 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 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:
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 Integral action time
TD Derivative action time
a Derivative delay coefficient (derivative delay T1 = a TD)
c Derivative action weighting
PID control
254 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.1 PID_Compact
PID control
Function Manual, 09/2016, A5E35300227-AB 255
Instructions
8.1 PID_Compact
Call
PID_Compact is called in the constant time scale of a cycle interrupt OB.
If you call PID_Compact as a multi-instance DB, no technology object is created. No
parameter assignment interface or commissioning interface is available. You must assign
parameters for PID_Compact directly in the multi-instance DB and commission it via a watch
table.
Download to device
The actual values of retentive variables are only updated when you download PID_Compact
completely.
Downloading technology objects to device (Page 72)
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.
Reaction to error
In automatic mode and during commissioning, the reaction to error depends on the
SetSubstituteOutput and ActivateRecoverMode variables. In manual mode, the reaction is
independent of SetSubstituteOutput and ActivateRecoverMode. If ActivateRecoverMode =
TRUE, the reaction additionally depends on the error that occurred.
PID control
256 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.1 PID_Compact
Rule:
OutputUpperLimit > OutputLowerLimit
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
Function Manual, 09/2016, A5E35300227-AB 257
Instructions
8.1 PID_Compact
PID control
258 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.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.
PID control
Function Manual, 09/2016, A5E35300227-AB 259
Instructions
8.1 PID_Compact
Table 8- 1
PID control
260 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.1 PID_Compact
PID control
Function Manual, 09/2016, A5E35300227-AB 261
Instructions
8.1 PID_Compact
Table 8- 2
PID control
262 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.1 PID_Compact
Table 8- 3
See also
Parameters State and Mode V2 (Page 274)
PID control
Function Manual, 09/2016, A5E35300227-AB 263
Instructions
8.1 PID_Compact
PID control
264 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.1 PID_Compact
PID control
Function Manual, 09/2016, A5E35300227-AB 265
Instructions
8.1 PID_Compact
PID control
266 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.1 PID_Compact
PID control
Function Manual, 09/2016, A5E35300227-AB 267
Instructions
8.1 PID_Compact
PID control
268 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.1 PID_Compact
PID control
Function Manual, 09/2016, A5E35300227-AB 269
Instructions
8.1 PID_Compact
PID control
270 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.1 PID_Compact
Note
Change the tags listed in this table in "Inactive" mode to prevent malfunction of the
PID controller.
See also
Tag ActivateRecoverMode V2 (Page 280)
Tag Warning V2 (Page 282)
Downloading technology objects to device (Page 72)
PID control
Function Manual, 09/2016, A5E35300227-AB 271
Instructions
8.1 PID_Compact
PID control
272 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.1 PID_Compact
PID control
Function Manual, 09/2016, A5E35300227-AB 273
Instructions
8.1 PID_Compact
Meaning of values
PID control
274 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.1 PID_Compact
Start fine tuning from automatic mode if you wish to improve the existing PID parameters through tuning.
PID_Compact 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)
If the requirements for pretuning are met, pretuning is started. 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 the process value for pretuning is already too near the setpoint or PIDSelfTune.TIR.RunIn = TRUE, an
attempt is made to reach the setpoint with the minimum or maximum output value. This can produce in-
creased overshoot.
PID control
Function Manual, 09/2016, A5E35300227-AB 275
Instructions
8.1 PID_Compact
ENO characteristics
If State = 0, then ENO = FALSE.
If State 0, then ENO = TRUE.
PID control
276 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.1 PID_Compact
PID_Compact automatically switches the operating mode in the event of an error. The
following table shows how Mode and State change during pretuning with errors.
If ActivateRecoverMode = TRUE, the operating mode that is saved in the Mode parameter is
activated. At the start of pretuning or fine tuning, PID_Compact has saved the value of State
in the Mode in/out parameter. PID_Compact therefore switches to the operating mode from
which tuning was started.
If ActivateRecoverMode = FALSE, the system switches to "Inactive" operating mode.
See also
Output parameters of PID_Compact V2 (Page 262)
PID control
Function Manual, 09/2016, A5E35300227-AB 277
Instructions
8.1 PID_Compact
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 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.
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.
0004 Error during fine tuning. 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.
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.
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.
0020 Pretuning is not permitted during fine tuning.
If ActivateRecoverMode = TRUE before the error occurred, PID_Compact remains in fine tuning mode.
0080 Error during pretuning. Incorrect configuration of output value limits.
Check whether the limits of the output value are configured correctly and match the control logic.
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.
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.
PID control
278 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.1 PID_Compact
ErrorBits Description
(DW#16#...)
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.
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.
0800 Sampling time error: PID_Compact is not called within the sampling time of the cyclic interrupt OB.
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 V2
with PLCSIM (Page 98).
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.
10000 Invalid value at ManualValue parameter. Value has an invalid number format.
If ActivateRecoverMode = TRUE before an error occurred, PID_Compact uses SubstituteOutput as the
output value. As soon as you specify a valid value in ManualValue, PID_Compact uses it as the output
value.
20000 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.
40000 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 oc-
curred, 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
Function Manual, 09/2016, A5E35300227-AB 279
Instructions
8.1 PID_Compact
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 reacts in the event of an error to
protect your system from damage.
ActivateRecov- Description
erMode
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 parameter Disturbance.
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
280 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.1 PID_Compact
ActivateRecov- Description
erMode
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
tuning was started.
Manual mode
ActivateRecoverMode is not effective in manual mode.
PID control
Function Manual, 09/2016, A5E35300227-AB 281
Instructions
8.1 PID_Compact
Warning Description
(DW#16#....)
0000 No warning pending.
0001 The point of inflection was not found during pretuning.
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.
Instead, the PID parameters were calculated using the TIR.TuneRule = 3 method.
0010 The operating mode could not be changed because Reset = TRUE or 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 Mode. The operating mode is not switched.
0100 The manual value was limited to the limits of the controller output.
0200 The specified rule for tuning is not supported. No PID parameters are calculated.
1000 The substitute output value cannot be reached because it is outside the output value limits.
PID control
282 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.1 PID_Compact
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
output 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 out-
put value. The direction of the output value jump depends on the configured weighting of the propor-
tional action (Retain.CtrlParams.PWeighting tag) and the control deviation:
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 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 in-
crease 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 iden-
tical signs of the 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.IntegralSum is not changed. You can define a new value using the user program.
PID control
Function Manual, 09/2016, A5E35300227-AB 283
Instructions
8.1 PID_Compact
IntegralReset- Description
Mode
3 Pre-assign
The value of PIDCtrl.IntegralSum is automatically pre-assigned as if Output = OverwriteInitialOutput-
Value 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 re-
sults 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 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 ac-
tion and the control deviation.
PID control
284 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.1 PID_Compact
Data storage
Create seven tags in a global data block for storage of the interconnection data.
PID control
Function Manual, 09/2016, A5E35300227-AB 285
Instructions
8.1 PID_Compact
Network 2: You interconnect the parameters of the block simulating the temperature values
"SLI_PROC_C" as follows.
PID control
286 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.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
Function Manual, 09/2016, A5E35300227-AB 287
Instructions
8.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_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").
PID control
288 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.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.
PID control
Function Manual, 09/2016, A5E35300227-AB 289
Instructions
8.1 PID_Compact
A change in the values of the "resetAll" tag (of the comRst parameter) has the following
effects:
Program code
You can find additional information about the program code for the above-named example
under the keyword "Sample Library for Instructions".
PID control
290 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.1 PID_Compact
Memory requirement
Memory requirement of an instance DB of the PID_Compact technology object as of Version
V2.0.
PID control
Function Manual, 09/2016, A5E35300227-AB 291
Instructions
8.1 PID_Compact
8.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 72)
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
292 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.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.
Symbol Description
y Output value
Kp Proportional gain
s Laplace operator
b Proportional action weighting
w Setpoint
x Process value
TI Integral action time
a Derivative delay coefficient (T1 = a TD)
Derivative action time
c Derivative action weighting
PID control
Function Manual, 09/2016, A5E35300227-AB 293
Instructions
8.1 PID_Compact
PID control
294 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.1 PID_Compact
Reaction to error
If errors occur, they are output in parameter Error, and PID_Compact changes to "Inactive"
mode. Reset the errors using the Reset parameter.
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 100)
PID control
Function Manual, 09/2016, A5E35300227-AB 295
Instructions
8.1 PID_Compact
Table 8- 4
PID control
296 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.1 PID_Compact
Table 8- 5
PID control
Function Manual, 09/2016, A5E35300227-AB 297
Instructions
8.1 PID_Compact
Table 8- 6
PID control
298 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.1 PID_Compact
PID control
Function Manual, 09/2016, A5E35300227-AB 299
Instructions
8.1 PID_Compact
PID control
300 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.1 PID_Compact
PID control
Function Manual, 09/2016, A5E35300227-AB 301
Instructions
8.1 PID_Compact
Note
Change the tags listed in this table in "Inactive" mode to prevent malfunction of the
PID controller. "Inactive" mode is forced by setting the "sRet.i_Mode" tag to "0".
See also
Downloading technology objects to device (Page 72)
PID control
302 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.1 PID_Compact
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, 09/2016, A5E35300227-AB 303
Instructions
8.1 PID_Compact
Meaning of values
PID control
304 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.1 PID_Compact
Start fine tuning in automatic mode if you wish to improve the existing PID parameters using controller
tuning.
PID_Comact will regulate 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 (State = 4) mode
If the requirements for pretuning are met, pretuning is started. The PID parameters established will be
used for adjustment until the control loop has stabilized and the requirements for fine tuning have been
met. Only then will fine tuning start. If pretuning is not possible, PID_Compact will change to "Inactive"
mode.
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 or sPid_Calc.b_RunIn = TRUE. This can produce in-
creased overshoot.
The controller will change to "automatic mode" after successfully completed "fine tuning" and to "inactive"
mode if "fine tuning" has not been successfully completed.
The "Fine tuning" phase is indicated with Tag i_Event_TIR V1 (Page 311).
PID control
Function Manual, 09/2016, A5E35300227-AB 305
Instructions
8.1 PID_Compact
See also
Output parameters of PID_Compact V1 (Page 297)
Pretuning V1 (Page 113)
Fine tuning V1 (Page 115)
"Manual" mode V1 (Page 117)
Tag i_Event_SUT V1 (Page 310)
Tag i_Event_TIR V1 (Page 311)
PID control
306 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.1 PID_Compact
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.
0080 Incorrect configuration of output value limits.
Check whether the limits of the output value are configured correctly and match the control logic.
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 118).
1000 Invalid value at "Setpoint" parameter: Value has an invalid number format.
See also
Output parameters of PID_Compact V1 (Page 297)
PID control
Function Manual, 09/2016, A5E35300227-AB 307
Instructions
8.1 PID_Compact
Activation
Error
Reset
PID control
308 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.1 PID_Compact
Activation
Error
Reset
PID control
Function Manual, 09/2016, A5E35300227-AB 309
Instructions
8.1 PID_Compact
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.
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 298)
Parameters State and sRet.i_Mode V1 (Page 303)
PID control
310 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.1 PID_Compact
See also
Static tags of PID_Compact V1 (Page 298)
Parameters State and sRet.i_Mode V1 (Page 303)
PID control
Function Manual, 09/2016, A5E35300227-AB 311
Instructions
8.2 PID_3Step
8.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. No technology object is created in this
case and no parameter assignment interface or commissioning interface is available. You
must assign parameters for PID_3Step directly in the multi-instance DB and commission
it via a watch table.
PID control
312 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
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.
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.
PID control
Function Manual, 09/2016, A5E35300227-AB 313
Instructions
8.2 PID_3Step
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
V1.x -
S7-1500 V2.0 or higher 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
314 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
Memory requirement
Memory requirement of an instance DB of the PID_3Step technology object as of Version
V2.0.
PID control
Function Manual, 09/2016, A5E35300227-AB 315
Instructions
8.2 PID_3Step
8.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
316 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.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:
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 Integral action time
TD Derivative action time
a Derivative delay coefficient (derivative delay T1 = a TD)
c Derivative action weighting
PID control
Function Manual, 09/2016, A5E35300227-AB 317
Instructions
8.2 PID_3Step
PID control
318 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
PID control
Function Manual, 09/2016, A5E35300227-AB 319
Instructions
8.2 PID_3Step
Call
PID_3Step is called in the constant time scale of a cycle interrupt OB.
If you call PID_3Step as a multi-instance DB, no technology object is created. No parameter
assignment interface or commissioning interface is available. You must assign parameters
for PID_3Step directly in the multi-instance DB and commission it via a watch table.
Download to device
The actual values of retentive tags are only updated when you download PID_3Step
completely.
Downloading technology objects to device (Page 72)
Startup
When the CPU starts up, PID_3Step starts in the operating mode that is saved in the Mode
in/out parameter. To leave PID_3Step in "Inactive" mode, set RunModeByStartup = FALSE.
PID control
320 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
Reaction to error
In automatic mode and during commissioning, the reaction to error depends on the
ErrorBehaviour and ActivateRecoverMode tags. In manual mode, the reaction is
independent of ErrorBehaviour and ActivateRecoverMode. If ActivateRecoverMode = TRUE,
the reaction additionally depends on the error that occurred.
In manual mode, PID_3Step uses ManualValue as output value, unless the following errors
occur:
2000h: Invalid value at Feedback_PER parameter.
4000h: Invalid value at Feedback parameter.
8000h: Error during digital position feedback.
You can only change the position of the actuator with Manual_UP and Manual_DN, not with
ManualValue.
The Error parameter indicates whether an error has occurred in this cycle. The ErrorBits
parameter shows which errors have occurred. ErrorBits is reset by a rising edge at Reset or
ErrorAck.
See also
Parameters State and Mode V2 (Page 342)
Parameter ErrorBits V2 (Page 347)
Configuring PID_3Step V2 (Page 121)
PID control
Function Manual, 09/2016, A5E35300227-AB 321
Instructions
8.2 PID_3Step
PID control
322 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
If OutputPerOn = FALSE and FeedbackOn = FALSE, you cannot limit the output value.
Output_UP and Output_DN are then reset upon Actuator_H = TRUE or Actuator_L = TRUE.
If endstop signals are also not present, Output_UP and Output_DN are reset after a travel
time of Config.VirtualActuatorLimit Retain.TransitTime/100. As of PID_3Step Version 2.3
the monitoring and limiting of the travel time can be deactivated with
Config.VirtualActuatorLimit = 0.0.
The output value is 27648 at 100% and -27648 at -100%. PID_3Step must be able to
completely close the valve.
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, 09/2016, A5E35300227-AB 323
Instructions
8.2 PID_3Step
PID control
324 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
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 144)
PID control
Function Manual, 09/2016, A5E35300227-AB 325
Instructions
8.2 PID_3Step
PID control
326 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
Table 8- 7
PID control
Function Manual, 09/2016, A5E35300227-AB 327
Instructions
8.2 PID_3Step
PID control
328 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
Table 8- 8
PID control
Function Manual, 09/2016, A5E35300227-AB 329
Instructions
8.2 PID_3Step
See also
Parameters State and Mode V2 (Page 342)
Parameter ErrorBits V2 (Page 347)
Table 8- 9
PID control
330 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
PID control
Function Manual, 09/2016, A5E35300227-AB 331
Instructions
8.2 PID_3Step
PID control
332 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
PID control
Function Manual, 09/2016, A5E35300227-AB 333
Instructions
8.2 PID_3Step
PID control
334 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
PID control
Function Manual, 09/2016, A5E35300227-AB 335
Instructions
8.2 PID_3Step
PID control
336 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
PID control
Function Manual, 09/2016, A5E35300227-AB 337
Instructions
8.2 PID_3Step
PID control
338 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
PID control
Function Manual, 09/2016, A5E35300227-AB 339
Instructions
8.2 PID_3Step
PID control
340 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
Note
Change the tags listed in this table in "Inactive" mode to prevent malfunction of the
PID controller.
See also
Parameters State and Mode V2 (Page 342)
Tag ActivateRecoverMode V2 (Page 350)
Downloading technology objects to device (Page 72)
PID control
Function Manual, 09/2016, A5E35300227-AB 341
Instructions
8.2 PID_3Step
Meaning of values
PID control
342 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
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)
If the requirements for pretuning are met, pretuning is started. 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 is unsuccessful,
the switchover of operating mode is dependent on ActivateRecoverMode and ErrorBehaviour.
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 of the Mode in-out parameter to the value 3 and a rising edge at ModeActivate.
The switchover from automatic mode to manual mode is only bumpless if carried out in the commissioning
editor.
The ActivateRecoverMode tag is taken into consideration in automatic mode.
PID control
Function Manual, 09/2016, A5E35300227-AB 343
Instructions
8.2 PID_3Step
PID control
344 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
ENO characteristics
If State = 0, then ENO = FALSE.
If State 0, then ENO = TRUE.
PID_3Step automatically switches the operating mode in the event of an error. The following
table shows how Mode and State change during pretuning with errors.
If ActivateRecoverMode = TRUE, the operating mode that is saved in the Mode parameter is
activated. At the start of transition time measurement, pretuning, or fine tuning, PID_3Step
saved the value of State in the Mode in/out parameter. PID_3Step therefore switches to the
operating mode from which transition time measurement or tuning was started.
If ActivateRecoverMode = FALSE, "Inactive" or "Approach substitute output value" mode is
activated.
PID control
Function Manual, 09/2016, A5E35300227-AB 345
Instructions
8.2 PID_3Step
Automatic switchover of operating mode once the current operation has been completed.
See also
Tag ActivateRecoverMode V2 (Page 350)
Parameter ErrorBits V2 (Page 347)
PID control
346 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
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 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.
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.
0004 Error during fine tuning. 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.
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.
0020 Pretuning is not permitted during fine tuning.
If ActivateRecoverMode = TRUE before the error occurred, PID_3Step remains in fine tuning mode.
0080 Error during pretuning. Incorrect configuration of output value limits.
Check whether the limits of the output value are configured correctly and match the control logic.
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.
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
Function Manual, 09/2016, A5E35300227-AB 347
Instructions
8.2 PID_3Step
ErrorBits Description
(DW#16#...)
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.
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.
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 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 143).
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.
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 man-
ual 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.
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 man-
ual 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
348 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
ErrorBits Description
(DW#16#...)
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" (Con-
fig.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.
10000 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 Manu-
al_DN.
20000 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.
40000 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 oc-
curred, 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.
PID control
Function Manual, 09/2016, A5E35300227-AB 349
Instructions
8.2 PID_3Step
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.
Automatic mode
ActivateRecov- Description
erMode
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.
PID control
350 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
ActivateRecov- Description
erMode
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 tun-
ing was started.
Manual mode
ActivateRecoverMode is not effective in manual mode.
See also
Static tags of PID_3Step V2 (Page 331)
Parameters State and Mode V2 (Page 342)
PID control
Function Manual, 09/2016, A5E35300227-AB 351
Instructions
8.2 PID_3Step
Warning Description
(DW#16#...)
0000 No warning pending.
0001 The point of inflection was not found during pretuning.
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.
Instead, the PID parameters were calculated using the TIR.TuneRule = 3 method.
0010 The operating mode could not be changed because Reset = TRUE or 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 Mode. The operating mode is not switched.
0100 The manual value was limited to the limits of the controller output.
0200 The specified rule for tuning is not supported. No PID parameters are calculated.
0400 The transition time cannot be measured because the actuator settings do not match the selected meas-
uring 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.
2000 The actuator was moved in one direction for longer than Config.VirtualActuatorLimit Re-
tain.TransitTime. Check whether the actuator has reached an endstop signal.
PID control
352 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
8.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 control
Function Manual, 09/2016, A5E35300227-AB 353
Instructions
8.2 PID_3Step
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.
Symbol Description
y Output value
Kp Proportional gain
s Laplace operator
b Proportional action weighting
w Setpoint
x Process value
TI Integral action time
a Derivative delay coefficient (T1 = a TD)
TD Derivative action time
c Derivative action weighting
PID control
354 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
PID control
Function Manual, 09/2016, A5E35300227-AB 355
Instructions
8.2 PID_3Step
PID control
356 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
Call
PID_3Step is called in a 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 72)
Startup
At the startup of the CPU, PID_3Step starts in the operating mode that was last active. To
leave PID_3Step in "Inactive" mode, set RunModeByStartup = FALSE.
Reaction to error
If errors occur, these are output in the Error parameter. You configure the reaction of
PID_3Step using the ErrorBehaviour and ActivateRecoverMode tags.
PID control
Function Manual, 09/2016, A5E35300227-AB 357
Instructions
8.2 PID_3Step
See also
Parameter State and Retain.Mode V1 (Page 374)
Parameter ErrorBits V1 (Page 382)
Configuring PID_3Step V1 (Page 144)
PID control
358 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
PID control
Function Manual, 09/2016, A5E35300227-AB 359
Instructions
8.2 PID_3Step
If OutputPerOn = FALSE and FeedbackOn = FALSE, you cannot limit the output value. The
digital outputs are reset with Actuator_H = TRUE or Actuator_L = TRUE, or after a travel time
amounting to 110% of the motor transition time.
The output value is 27648 at 100% and -27648 at -100%. PID_3Step must be able to
completely close the valve. Therefore, zero must be included in the output value limits.
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
360 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
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 144)
PID control
Function Manual, 09/2016, A5E35300227-AB 361
Instructions
8.2 PID_3Step
Table 8- 10
PID control
362 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
PID control
Function Manual, 09/2016, A5E35300227-AB 363
Instructions
8.2 PID_3Step
Table 8- 11
PID control
364 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
See also
Parameter State and Retain.Mode V1 (Page 374)
Parameter ErrorBits V1 (Page 382)
PID control
Function Manual, 09/2016, A5E35300227-AB 365
Instructions
8.2 PID_3Step
Table 8- 12
PID control
366 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
PID control
Function Manual, 09/2016, A5E35300227-AB 367
Instructions
8.2 PID_3Step
PID control
368 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
PID control
Function Manual, 09/2016, A5E35300227-AB 369
Instructions
8.2 PID_3Step
PID control
370 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
PID control
Function Manual, 09/2016, A5E35300227-AB 371
Instructions
8.2 PID_3Step
PID control
372 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
Note
Change the tags listed in this table in "Inactive" mode to prevent malfunction of the
PID controller. "Inactive" mode is forced by setting the "Retain.Mode" tag to "0".
See also
Parameter State and Retain.Mode V1 (Page 374)
Tag ActivateRecoverMode V1 (Page 385)
Downloading technology objects to device (Page 72)
PID control
Function Manual, 09/2016, A5E35300227-AB 373
Instructions
8.2 PID_3Step
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.
PID control
374 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
Meaning of values
PID control
Function Manual, 09/2016, A5E35300227-AB 375
Instructions
8.2 PID_3Step
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 leave PID_3Step in "Inactive" mode, set RunModeByStartup = FALSE.
The ActivateRecoverMode tag is taken into consideration in automatic mode.
PID control
376 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
PID control
Function Manual, 09/2016, A5E35300227-AB 377
Instructions
8.2 PID_3Step
PID control
378 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
Automatic switchover of operating mode once the current operation has been completed.
PID control
Function Manual, 09/2016, A5E35300227-AB 379
Instructions
8.2 PID_3Step
Automatic switchover of operating mode once the current operation has been completed.
PID control
380 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.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.
Automatic switchover of operating mode once the current operation has been completed.
See also
Tag ActivateRecoverMode V1 (Page 385)
Parameter ErrorBits V1 (Page 382)
PID control
Function Manual, 09/2016, A5E35300227-AB 381
Instructions
8.2 PID_3Step
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 posi-
tion. 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. Incorrect configuration of output value limits.
Check whether the limits of the output value are configured correctly and match the control logic.
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 163).
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
382 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.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" (Con-
fig.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.
PID control
Function Manual, 09/2016, A5E35300227-AB 383
Instructions
8.2 PID_3Step
Activation
Error
Reset
PID control
384 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
ActivateRecov- Description
erMode
FALSE In the event of an error, PID_3Step switches to "Inactive" or "Approach substitute output value" operat-
ing mode. The controller is activated by a reset or a change in Retain.Mode.
TRUE If errors occur frequently in automatic mode, this setting has a negative effect on the control response.
In this case, check the ErrorBits parameter and eliminate the cause of the error.
If one or more errors occur, PID_3Step switches to "Approach substitute output value with error monitor-
ing" or "Error monitoring" 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, PID_3Step cannot approach the configured substitute output
value.
As soon as the errors are no longer pending, PID_3Step switches back to automatic mode.
PID control
Function Manual, 09/2016, A5E35300227-AB 385
Instructions
8.2 PID_3Step
ActivateRecov- Description
erMode
FALSE In the event of an error, PID_3Step switches to "Inactive" or "Approach substitute output value" operat-
ing mode. The controller is activated by a reset or a change in Retain.Mode.
TRUE Errors in automatic mode
If errors occur frequently in automatic mode, this setting has a negative effect on the control response.
In this case, check the ErrorBits parameter and eliminate the cause of the error.
If one or more errors occur, PID_3Step switches to "Approach substitute output value with error monitor-
ing" or "Error monitoring" 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, PID_3Step cannot approach the configured substitute output
value.
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 366)
Parameter State and Retain.Mode V1 (Page 374)
PID control
386 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.2 PID_3Step
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 meas-
uring 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, 09/2016, A5E35300227-AB 387
Instructions
8.3 PID_Temp
PID control
388 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
8.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 V4.2 or higher V1.1
V1.0
V4.1 V1.0
S7-1500 V2.0 or higher V1.1
V1.0
V1.7 to V1.8 V1.0
PID control
Function Manual, 09/2016, A5E35300227-AB 389
Instructions
8.3 PID_Temp
8.3.3 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):
The table below shows the meaning of the icons used in the equation and in the subsequent
figures.
PID control
390 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
PID control
Function Manual, 09/2016, A5E35300227-AB 391
Instructions
8.3 PID_Temp
PID control
392 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
Call
PID_Temp is called in the constant time scale of a cyclic interrupt OB.
If you call PID_Temp as a multi-instance DB, no technology object is created. No parameter
assignment interface or commissioning interface is available. You must assign parameters
for PID_Temp directly in the multi-instance DB and commission it via a watch table.
Download to device
The process values of retentive tags are only updated when you download PID_Temp
completely.
Download technology object to device (Page 72)
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
Function Manual, 09/2016, A5E35300227-AB 393
Instructions
8.3 PID_Temp
Reaction to error
The behavior in the case of an error is determined by the tags SetSubstituteOutput and
ActivateRecoverMode. If ActivateRecoverMode = TRUE, the behavior also depends on the
error that occurred.
PID control
394 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.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
Function Manual, 09/2016, A5E35300227-AB 395
Instructions
8.3 PID_Temp
Two methods are available to calculate the PID output value with activated cooling:
Cooling factor (Config.AdvancedCooling = FALSE):
The output value calculation for cooling takes place with the PID parameters for heating,
taking into consideration the configurable cooling factor Config.CoolFactor. This method
is suitable if the heating and cooling actuators have a similar time response but different
gains. If this method is selected, pretuning and fine tuning for cooling as well as the
PID parameter set for cooling are not available. You can only execute the tuning for
heating.
PID parameter switching (Config.AdvancedCooling = TRUE):
The output value calculation for cooling takes place by means of a separate
PID parameter set. Based on the calculated output value and the control deviation, the
PID algorithm decides whether the PID parameter for heating or cooling is used. This
method is suitable if the heating and cooling actuator have different time responses and
different gains. Pretuning and fine tuning for cooling are only available if this method is
selected.
PID control
396 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
PID control
Function Manual, 09/2016, A5E35300227-AB 397
Instructions
8.3 PID_Temp
Example:
Output scaling when using output OutputHeat (cooling deactivated;
Config.Output.Heat.PidLowerLimit may be unequal to 0.0):
Example:
Output scaling when using output OutputHeat_PWM and OutputCool_PER (cooling
activated; Config.Output.Heat.PidLowerLimit must be 0.0):
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.
Cascading
PID_Temp supports you when you use cascade control (see: Program creation (Page 200)).
PID control
398 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
PID control
Function Manual, 09/2016, A5E35300227-AB 399
Instructions
8.3 PID_Temp
If you use OutputHeat_PWM or OutputCool_PWM, the sampling time of the PID algorithm is
used as time period of the pulse width modulation. The accuracy of the output signal is
determined by the ratio of the PID algorithm sampling time to the cycle time of the OB. The
cycle time should be no more than a tenth of the PID algorithm sampling time.
If the PID algorithm sampling time and thus the time period of the pulse width modulation is
very high when you use OutputHeat_PWM or OutputCool_PWM, you can define a deviating
shorter period duration at the Config.Output.Heat.PwmPeriode or
Config.Output.Cool.PwmPeriode parameters to improve the smoothness of the process
value.
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.
PID control
400 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
PID control
Function Manual, 09/2016, A5E35300227-AB 401
Instructions
8.3 PID_Temp
PID control
402 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
PID control
Function Manual, 09/2016, A5E35300227-AB 403
Instructions
8.3 PID_Temp
PID control
404 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
PID control
Function Manual, 09/2016, A5E35300227-AB 405
Instructions
8.3 PID_Temp
See also
PID_Temp state and mode parameters (Page 440)
Program creation (Page 200)
Cascade control with PID_Temp (Page 198)
PID control
406 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
PID control
Function Manual, 09/2016, A5E35300227-AB 407
Instructions
8.3 PID_Temp
PID control
408 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
PID control
Function Manual, 09/2016, A5E35300227-AB 409
Instructions
8.3 PID_Temp
PID control
410 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
PID control
Function Manual, 09/2016, A5E35300227-AB 411
Instructions
8.3 PID_Temp
PID control
412 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
PID control
Function Manual, 09/2016, A5E35300227-AB 413
Instructions
8.3 PID_Temp
PID control
414 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
PID control
Function Manual, 09/2016, A5E35300227-AB 415
Instructions
8.3 PID_Temp
PID control
416 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
PID control
Function Manual, 09/2016, A5E35300227-AB 417
Instructions
8.3 PID_Temp
PID control
418 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
PID control
Function Manual, 09/2016, A5E35300227-AB 419
Instructions
8.3 PID_Temp
PID control
420 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
PID control
Function Manual, 09/2016, A5E35300227-AB 421
Instructions
8.3 PID_Temp
PID control
422 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
PID control
Function Manual, 09/2016, A5E35300227-AB 423
Instructions
8.3 PID_Temp
PID control
424 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
PID control
Function Manual, 09/2016, A5E35300227-AB 425
Instructions
8.3 PID_Temp
PID control
426 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
PID control
Function Manual, 09/2016, A5E35300227-AB 427
Instructions
8.3 PID_Temp
PID control
428 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
PID control
Function Manual, 09/2016, A5E35300227-AB 429
Instructions
8.3 PID_Temp
PID control
430 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
PID control
Function Manual, 09/2016, A5E35300227-AB 431
Instructions
8.3 PID_Temp
PID control
432 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
PID control
Function Manual, 09/2016, A5E35300227-AB 433
Instructions
8.3 PID_Temp
PID control
434 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
PID control
Function Manual, 09/2016, A5E35300227-AB 435
Instructions
8.3 PID_Temp
PID control
436 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
PID control
Function Manual, 09/2016, A5E35300227-AB 437
Instructions
8.3 PID_Temp
PID control
438 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
Note
Change the tags listed in this table in "Inactive" mode to prevent malfunction of the
PID controller.
See also
PID_Temp ActivateRecoverMode tag (Page 453)
PID_Temp Warning tag (Page 455)
Multi-zone controlling with PID_Temp (Page 206)
PID control
Function Manual, 09/2016, A5E35300227-AB 439
Instructions
8.3 PID_Temp
Meaning of values
PID control
440 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
A jump change is output at the output value heating, the PID parameters for heating are calculated (Re-
tain.CtrlParams.Heat structure), and control to the setpoint then takes place in automatic mode.
If the process behavior strongly depends on the operating point, an adaptation of the delay time can be
activated at the setpoint with PIDSelfTune.SUT.AdaptDelayTime.
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 (Re-
tain.CtrlParams.Heat structure) and cooling (Retain.CtrlParams.Cool structure) are calculated. Then,
control to the setpoint takes place in automatic mode.
If the process behavior strongly depends on the operating point, an adaptation of the delay time can be
activated at the setpoint with PIDSelfTune.SUT.AdaptDelayTime.
Depending on the effect of the cooling actuator compared to the heating actuator, the quality of tuning
can be influenced by whether or not the heating and cooling outputs are operated simultaneously during
tuning. You can specify this with PIDSelfTune.SUT.CoolingMode.
Pretuning cooling:
A jump change is output at the output value cooling and the PID parameters for cooling are calculated
(Struktur Retain.CtrlParams.Cool). Then, control to the setpoint takes place 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.
PID control
Function Manual, 09/2016, A5E35300227-AB 441
Instructions
8.3 PID_Temp
A jump change is output at the output value heating, the PID parameters for heating are calculated (Re-
tain.CtrlParams.Heat structure), and control to the setpoint then takes place in automatic mode.
If the process behavior strongly depends on the operating point, an adaptation of the delay time can be
activated at the setpoint with PIDSelfTune.SUT.AdaptDelayTime.
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 (Re-
tain.CtrlParams.Heat structure) and cooling (Retain.CtrlParams.Cool structure) are calculated. Then,
control to the setpoint takes place in automatic mode.
If the process behavior strongly depends on the operating point, an adaptation of the delay time can be
activated at the setpoint with PIDSelfTune.SUT.AdaptDelayTime.
Depending on the effect of the cooling actuator compared to the heating actuator, the quality of tuning
can be influenced by whether or not the heating and cooling outputs are operated simultaneously during
tuning. You can specify this with PIDSelfTune.SUT.CoolingMode.
Pretuning cooling:
A jump change is output at the output value cooling and the PID parameters for cooling are calculated
(Struktur Retain.CtrlParams.Cool). Then, control to the setpoint takes place 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.
PID control
442 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
PID control
Function Manual, 09/2016, A5E35300227-AB 443
Instructions
8.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 significantly higher compared to the noise. This is most likely the case in operating modes "Inac-
tive" 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.
PID control
444 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
PID_Temp generates an oscillation of the process value with periodic changes at the output value heat-
ing 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 cool-
ing and calculates the PID parameters for cooling (Struktur Retain.CtrlParams.Cool).
Define a negative tuning offset cooling which is less than the PID output value (PidOutputSum) at the
setpoint in the steady state before you start tuning.
Offset for heating output (PIDSelfTune.TIR.OutputOffsetHeat) with fine tuning cooling.
Define a positive tuning offset heating which is greater than the PID output value (PidOutputSum) at the
setpoint in the steady state before you start tuning.
The defined offset is balanced by the PID algorithm so that the process value remains at the setpoint. The
height of the offset allows the PID output value to be adapted correspondingly so that it fulfills the require-
ment mentioned above.
To avoid larger overshoots of the process value when defining the offset, it can also be increased in several
steps.
If PID_Temp exits the fine tuning mode, the tuning offset is reset.
PID control
Function Manual, 09/2016, A5E35300227-AB 445
Instructions
8.3 PID_Temp
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.
ManualEnable = FALSE
Reset = FALSE
Automatic (State = 3), inactive (State = 0) or manual (State = 4) mode
PID control
446 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
The course of fine tuning is determined by the mode from which it is started:
Automatic mode (State = 3) with PIDSelfTune.TIR.RunIn = FALSE (default)
Start fine tuning from automatic mode if you wish to improve the existing PID parameters through tuning.
PID_Temp 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), manual mode (State = 4), or automatic mode (State = 3) with PIDSelf-
Tune.TIR.RunIn = TRUE
Attempts are made to reach the setpoint with the minimum or maximum output value:
with minimum or maximum output value heating for fine tuning heating
With minimum or maximum output value cooling for fine tuning cooling.
This can produce increased overshoot. Fine tuning starts when the setpoint is reached.
If the setpoint cannot be reached, PID_Temp does not automatically abort tuning.
or
Setpoint < CurrentSetpoint - CancelTuningLevel
The method for calculation of the PID parameters can be specified separately for heating and cooling with
PIDSelfTune.TIR.TuneRuleHeat and PIDSelfTune.TIR.TuneRuleCool.
Before the PID parameters are recalculated, they are backed up in the CtrlParamsBackUp structure and
can be reactivated with LoadBackUp.
The controller changes to automatic mode after successful fine tuning.
After unsuccessful fine tuning, the switch to the mode is determined by ActivateRecoverMode.
The "Fine tuning" phase is indicated with PIDSelfTune.TIR.State.
3 Automatic mode
In automatic mode, PID_Temp corrects the controlled system in accordance with the parameters specified.
The controller switches to automatic mode if one the following requirements is met:
Pretuning successfully completed
Fine tuning successfully completed
Changing of the Mode in-out parameter to the value 3 and a rising edge at ModeActivate.
The switchover from automatic mode to manual mode is only bumpless if carried out in the commissioning
editor.
The ActivateRecoverMode tag is taken into consideration in automatic mode.
PID control
Function Manual, 09/2016, A5E35300227-AB 447
Instructions
8.3 PID_Temp
ENO characteristics
If State = 0, then ENO = FALSE.
If State 0, then ENO = TRUE.
PID control
448 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
If ActivateRecoverMode = TRUE, the operating mode that is saved in the Mode parameter is
activated. When you start pretuning or fine tuning, PID_Temp has saved the value of State in
the Mode in-out parameter. This means PID_Temp switches to the mode from which tuning
was started.
If ActivateRecoverMode = FALSE, the system switches to "Inactive" operating mode.
See also
Output parameters of PID_Temp (Page 403)
In/out parameters of PID_Temp V2 (Page 405)
PID control
Function Manual, 09/2016, A5E35300227-AB 449
Instructions
8.3 PID_Temp
ErrorBits Description
(DW#16#...)
0000000 There is no error.
0000001 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.
0000002 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
outputs 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.
0000004 Error during fine tuning. Oscillation of the process value could not be maintained.
If PID_Temp is used as heating-cooling controller (Config.ActivateCooling = TRUE), to be able to gen-
erate actual value oscillation, 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 PIDSelf-
Tune.TIR.OutputOffsetHeat tags), see Fine tuning (Page 192).
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.
0000008 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.
0000010 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.
0000020 Pretuning is not permitted during fine tuning.
If ActivateRecoverMode = TRUE before the error occurred, PID_Temp remains in fine tuning mode.
0000040 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.
PID control
450 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
ErrorBits Description
(DW#16#...)
0000100 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.
0000200 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
outputs 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.
0000400 Calculation of output value failed. Check the PID parameters.
If automatic mode was active before the error occurred and ActivateRecoverMode = TRUE, PID_Temp
outputs 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.
0000800 Sampling time error: PID_Temp is not called within the sampling time of the cyclic interrupt OB.
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 213).
0001000 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
outputs 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.
0010000 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.
0020000 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.
PID control
Function Manual, 09/2016, A5E35300227-AB 451
Instructions
8.3 PID_Temp
ErrorBits Description
(DW#16#...)
0040000 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 current phase has no effect on the output value, tuning is not be canceled.
0200000 Error in master in the cascade: Slaves are not in automatic mode or have activated substitute setpoint
and prevent 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.
0400000 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.
0800000 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.
1000000 Error at start of tuning: Heat.EnableTuning and Cool.EnableTuning are not set or do not match the con-
figuration.
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.
2000000 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.
4000000 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.
8000000 Error during calculation of the PID parameters resulted in invalid parameters.
The invalid parameters are discarded and the original PID parameters are retained unchanged.
We can distinguish between the following cases:
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
452 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
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.
ActivateRecov- Description
erMode
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
Function Manual, 09/2016, A5E35300227-AB 453
Instructions
8.3 PID_Temp
ActivateRecov- Description
erMode
TRUE Manual mode
If one or several errors occur and manual mode was active before the error occurred, PID_Temp re-
mains in manual mode.
If the following error occurs in manual mode, as long as this error is pending, PID_Temp sets the
PID output value to SubstituteOutput:
0010000h: Invalid value at ManualValue parameter. Value has an invalid number format.
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.
ActivateRecov- Description
erMode
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.
PID control
454 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
Warning Description
(DW#16#....)
0000000 No warning pending.
0000001 The point of inflection was not found during pretuning.
0000004 The setpoint was limited to the configured limits.
0000008 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.
0000010 The operating mode could not be changed because Reset = TRUE or ManualEnable = TRUE.
0000020 The cycle time of the calling OB limits the sampling time of the PID algorithm.
Improve results by using shorter OB cycle times.
0000040 The process value exceeded one of its warning limits.
0000080 Invalid value at Mode. The operating mode is not switched.
0000100 The manual value was limited to the limits of the PID output value.
0000200 The specified rule for tuning is not supported. No PID parameters are calculated.
0001000 The substitute output value cannot be reached because it is outside the output value limits.
0004000 The specified selection of the output value for heating and/or cooling is not supported.
Only the output OutputHeat or OutputCool is used.
0008000 Invalid value at PIDSelfTune.SUT.AdaptDelayTime. The default value 0 is used.
0010000 Invalid value at PIDSelfTune.SUT.CoolingMode. The default value 0 is used.
0020000 The activation of cooling (Config.ActivateCooling tag) is not supported by the controller that is used as
master (Config.Cascade.IsMaster tag). PID_Temp works as heating controller.
Set the Config.ActivateCooling tag to FALSE.
0040000 Invalid value at Retain.CtrlParams.Heat.Gain, Retain.CtrlParams.Cool.Gain oder 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:
0000001h
0000004h
0000008h
0000040h
0000100h
All other warnings are cleared with a rising edge at Reset or ErrorAck.
PID control
Function Manual, 09/2016, A5E35300227-AB 455
Instructions
8.3 PID_Temp
PID control
456 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
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)
PID control
Function Manual, 09/2016, A5E35300227-AB 457
Instructions
8.3 PID_Temp
IntegralReset- Description
Mode
0 Smooth
The value of PIDCtrl.IOutputOld is pre-assigned so that the switchover is bumpless, which means "Au-
tomatic 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).
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
deviation:
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 in-
crease 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.
PID control
458 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.3 PID_Temp
IntegralReset- Description
Mode
3 Pre-assign
The value of PIDCtrl.IOutputOld is automatically pre-assigned as if PidOutputSum = OverwriteI-
nitialOutputValue 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
results 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 pro-
portional 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, 09/2016, A5E35300227-AB 459
Instructions
8.3 PID_Temp
Memory requirement
Memory requirement of an instance DB of the PID_Temp technology object as of Version
V1.0.
PID control
460 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.4 PID basic functions
8.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.
If you call the instruction CONT_C as a multiple instance DB, no technology object is
created. No parameter assignment interface or commissioning interface is available. You
must assign parameters for CONT_C directly in the multiple instance DB and commission it
via a watch table.
Error information
The error message word RET_VAL is not evaluated by the block.
PID control
Function Manual, 09/2016, A5E35300227-AB 461
Instructions
8.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
462 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.4 PID basic functions
Feedforward control
A disturbance variable can be added at the DISV input.
PID control
Function Manual, 09/2016, A5E35300227-AB 463
Instructions
8.4 PID basic functions
PID control
464 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.4 PID basic functions
Table 8- 13
PID control
Function Manual, 09/2016, A5E35300227-AB 465
Instructions
8.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
PID control
466 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.4 PID basic functions
Table 8- 14
PID control
Function Manual, 09/2016, A5E35300227-AB 467
Instructions
8.4 PID basic functions
8.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.
If you call the instruction CONT_S as a multiple instance DB, no technology object is
created. No parameter assignment interface or commissioning interface is available. You
must assign parameters for CONT_S directly in the multiple instance DB and commission it
via a watch table.
Error information
The error message word RET_VAL is not evaluated by the block.
PID control
468 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.4 PID basic functions
Setpoint branch
The setpoint is entered in floating-point format at the SP_INT input.
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
Function Manual, 09/2016, A5E35300227-AB 469
Instructions
8.4 PID basic functions
PID control
470 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.4 PID basic functions
Table 8- 15
PID control
Function Manual, 09/2016, A5E35300227-AB 471
Instructions
8.4 PID basic functions
Table 8- 16
PID control
472 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.4 PID basic functions
8.4.3 PULSEGEN
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.
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
Function Manual, 09/2016, A5E35300227-AB 473
Instructions
8.4 PID basic functions
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
474 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.4 PID basic functions
Block diagram
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.
PID control
Function Manual, 09/2016, A5E35300227-AB 475
Instructions
8.4 PID basic functions
To allow this, the block can synchronize the start of the period using the following procedure:
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.
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
476 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.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.
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:
The pulse duration is calculated from the input variable via a characteristic curve. The form
of the characteristic curve is defined by the minimum pulse duration or minimum interval and
the ratio factor. The normal value for the ratio factor is 1.
The "doglegs" in the curves are caused by the minimum pulse duration or minimum interval.
PID control
Function Manual, 09/2016, A5E35300227-AB 477
Instructions
8.4 PID basic functions
PID control
478 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.4 PID basic functions
The following figure shows the asymmetrical characteristic curve of the three-step controller
(ratio factor = 0.5):
PID control
Function Manual, 09/2016, A5E35300227-AB 479
Instructions
8.4 PID basic functions
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.
PID control
480 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.4 PID basic functions
Table 8- 17
PID control
Function Manual, 09/2016, A5E35300227-AB 481
Instructions
8.4 PID basic functions
Table 8- 18
PID control
482 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.4 PID basic functions
8.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.
Call
The instruction TCONT_CP must be called equidistant. 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.
If you call the instruction TCONT_CP as a multiple instance DB, no technology object is
created. No parameter assignment interface or commissioning interface is available. You
must assign parameters for TCONT_CP directly in the multiple instance DB and commission
it via a watch table.
See also
Operating principle of the pulse generator (Page 493)
Block diagram TCONT_CP (Page 496)
PID control
Function Manual, 09/2016, A5E35300227-AB 483
Instructions
8.4 PID basic functions
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
484 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.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.
PID control
Function Manual, 09/2016, A5E35300227-AB 485
Instructions
8.4 PID basic functions
PID Algorithm
The following figure shows the block diagram of the PID algorithm.
PID control
486 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.4 PID basic functions
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
PID control
Function Manual, 09/2016, A5E35300227-AB 487
Instructions
8.4 PID basic functions
PID control
488 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.4 PID basic functions
PID control
Function Manual, 09/2016, A5E35300227-AB 489
Instructions
8.4 PID basic functions
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.
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.
PID control
490 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.4 PID basic functions
Note
The MAN_ON parameter has no effect during tuning.
PID control
Function Manual, 09/2016, A5E35300227-AB 491
Instructions
8.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 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 493)
Block diagram TCONT_CP (Page 496)
PID control
492 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.4 PID basic functions
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
Function Manual, 09/2016, A5E35300227-AB 493
Instructions
8.4 PID basic functions
The following diagram illustrates two-step control with a unipolar manipulated variable range
(0% to 100%):
PID control
494 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.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 483)
Mode of operation TCONT_CP (Page 484)
Block diagram TCONT_CP (Page 496)
Input parameters TCONT_CP (Page 498)
Output parameters TCONT_CP (Page 499)
In/out parameters TCONT_CP (Page 500)
Static variables TCONT_CP (Page 501)
Parameter STATUS_H (Page 506)
Parameters STATUS_D (Page 507)
PID control
Function Manual, 09/2016, A5E35300227-AB 495
Instructions
8.4 PID basic functions
PID control
496 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.4 PID basic functions
See also
Description TCONT_CP (Page 483)
Mode of operation TCONT_CP (Page 484)
Operating principle of the pulse generator (Page 493)
Input parameters TCONT_CP (Page 498)
Output parameters TCONT_CP (Page 499)
In/out parameters TCONT_CP (Page 500)
Static variables TCONT_CP (Page 501)
Parameter STATUS_H (Page 506)
Parameters STATUS_D (Page 507)
PID control
Function Manual, 09/2016, A5E35300227-AB 497
Instructions
8.4 PID basic functions
Table 8- 19
See also
Operating principle of the pulse generator (Page 493)
Block diagram TCONT_CP (Page 496)
PID control
498 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.4 PID basic functions
Table 8- 20
See also
Operating principle of the pulse generator (Page 493)
Block diagram TCONT_CP (Page 496)
Parameter STATUS_H (Page 506)
Parameters STATUS_D (Page 507)
PID control
Function Manual, 09/2016, A5E35300227-AB 499
Instructions
8.4 PID basic functions
Table 8- 21
See also
Operating principle of the pulse generator (Page 493)
Block diagram TCONT_CP (Page 496)
PID control
500 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.4 PID basic functions
Table 8- 22
PID control
Function Manual, 09/2016, A5E35300227-AB 501
Instructions
8.4 PID basic functions
PV_PER * 0.1
Unit: C, F
PER_MODE = 1: PT100/NI100; climate
PV_PER * 0.01
Unit: C, F
PER_MODE = 2: Current/voltage
PV_PER * 100/27648
Unit: %
PVPER_ON 90.0 BOOL FALSE If the process value is to be read in from the I/Os, the PV_PER input
must be interconnected with the I/Os and the "Enable process value
I/Os" input must be set.
I_ITL_ON 90.1 BOOL FALSE The output of the integrator can be set at the I_ITLVAL input. The "Set I-
action" input must be set for this.
PULSE_ON 90.2 BOOL FALSE If PULSE_ON = TRUE is set, the pulse shaper is activated.
TUN_KEEP 90.3 BOOL FALSE The mode changes to automatic only when TUN_KEEP changes to
FALSE.
ER 92.0 REAL 0.0 The effective control deviation is output at the "Control deviation" output.
The valid values depend on the sensors used.
LMN_P 96.0 REAL 0.0 The "P-action" output contains the proportional action of the manipulated
tag.
LMN_I 100.0 REAL 0.0 The "integral action" output contains the integral action of the manipulat-
ed tag.
LMN_D 104.0 REAL 0.0 The "D-action" output contains the derivative action of the manipulated
tag.
PHASE 108.0 INT 0 The current phase of controller tuning is indicated at the PHASE output.
PHASE = 0: No tuning mode; automatic or manual mode
PHASE = 1: Ready to start tuning; check parameters, wait for excita-
tion, measure the sampling times
PHASE = 2: Actual tuning: Searching for point of inflection with con-
stant output value. Entering the sampling time in instance DB.
PHASE = 3: Calculating process parameters. Saving valid controller
parameters prior to tuning.
PHASE = 4: Controller design
PHASE = 5: Following up the controller to the new manipulated tag
PHASE = 7: Validating the process type
STATUS_H 110.0 INT 0 STATUS_H indicates the diagnostic value via the search for the point of
inflection during the heating process.
STATUS_D 112.0 INT 0 STATUS_D indicates the diagnostic value via the controller design dur-
ing the heating process.
PID control
502 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.4 PID basic functions
PID control
Function Manual, 09/2016, A5E35300227-AB 503
Instructions
8.4 PID basic functions
PID control
504 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.4 PID basic functions
See also
Operating principle of the pulse generator (Page 493)
Block diagram TCONT_CP (Page 496)
PID control
Function Manual, 09/2016, A5E35300227-AB 505
Instructions
8.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 493)
Block diagram TCONT_CP (Page 496)
PID control
506 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.4 PID basic functions
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 493)
Block diagram TCONT_CP (Page 496)
PID control
Function Manual, 09/2016, A5E35300227-AB 507
Instructions
8.4 PID basic functions
8.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 equidistant. To achieve this, use a cyclic interrupt
priority class (for example, OB35 for an S7-300). The sampling time is specified at the
CYCLE parameter.
If you call the instruction TCONT_S as a multiple instance DB, no technology object is
created. No parameter assignment interface or commissioning interface is available. You
must assign parameters for TCONT_S directly in the multiple instance DB and commission it
via a watch table.
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.
See also
Block diagram TCONT_S (Page 513)
PID control
508 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.4 PID basic functions
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, 09/2016, A5E35300227-AB 509
Instructions
8.4 PID basic functions
PID control
510 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.4 PID basic functions
Feedforward control
A disturbance variable can be added at the DISV input.
PID control
Function Manual, 09/2016, A5E35300227-AB 511
Instructions
8.4 PID basic functions
See also
Block diagram TCONT_S (Page 513)
PID control
512 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.4 PID basic functions
PID control
Function Manual, 09/2016, A5E35300227-AB 513
Instructions
8.4 PID basic functions
See also
Description TCONT_S (Page 508)
Mode of operation TCONT_S (Page 509)
Input paramters TCONT_S (Page 515)
Output parameters TCONT_S (Page 516)
In/out parameters TCONT_S (Page 516)
Static variables TCONT_S (Page 517)
PID control
514 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.4 PID basic functions
Table 8- 23
See also
Block diagram TCONT_S (Page 513)
PID control
Function Manual, 09/2016, A5E35300227-AB 515
Instructions
8.4 PID basic functions
Table 8- 24
See also
Block diagram TCONT_S (Page 513)
Table 8- 25
See also
Block diagram TCONT_S (Page 513)
PID control
516 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.4 PID basic functions
Table 8- 26
See also
Block diagram TCONT_S (Page 513)
PID control
Function Manual, 09/2016, A5E35300227-AB 517
Instructions
8.4 PID basic functions
8.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 461)
How CONT_C works (Page 462)
CONT_C block diagram (Page 464)
Input parameter CONT_C (Page 465)
Output parameters CONT_C (Page 467)
8.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 468)
Mode of operation CONT_S (Page 469)
Block diagram CONT_S (Page 470)
Input parameters CONT_S (Page 471)
Output parameters CONT_S (Page 472)
PID control
518 Function Manual, 09/2016, A5E35300227-AB
Instructions
8.4 PID basic functions
8.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 473)
Mode of operation PULSEGEN (Page 474)
Mode of operation PULSEGEN (Page 477)
Three-step control (Page 477)
Two-step control (Page 480)
Input parameters PULSEGEN (Page 481)
Output parameter PULSEGEN (Page 482)
PID control
Function Manual, 09/2016, A5E35300227-AB 519
Service & Support A
Online Support
The comprehensive online information platform supports you in all aspects of our Service &
Support at any time and from any location in the world.
You can find Online Support at the following address on the Internet.
PID control
520 Function Manual, 09/2016, A5E35300227-AB
Service & Support
Technical Consulting
Support in planning and designing your project: From detailed actual-state analysis,
definition of the goal and consultation on product and system questions right through to the
creation of the automation solution.
Technical Support
Expert advice on technical questions with a wide range of demand-optimized services for all
our products and systems.
You can find Technical Support at the following address on the Internet.
Training
Extend your competitive edge through practical know-how directly from the manufacturer.
You can find the training courses at the following address on the Internet.
Engineering Support
Support during project engineering and development with services fine-tuned to your
requirements, from configuration through to implementation of an automation project.
Field Service
Our Field Service offers you services for commissioning and maintenance to ensure that
your machines and plants are always available.
Spare parts
In every sector worldwide, plants and systems are required to operate with constantly
increasing reliability. We will provide you with the support you need to prevent a standstill
from occurring in the first place: with a worldwide network and optimum logistics chains.
Repairs
Downtimes cause problems in the plant as well as unnecessary costs. We can help you to
reduce both to a minimum with our worldwide repair facilities.
Optimization
During the service life of machines and plants, there is often a great potential for increasing
productivity or reducing costs.
To help you achieve this potential, we are offering a complete range of optimization services.
PID control
Function Manual, 09/2016, A5E35300227-AB 521
Service & Support
Modernization
You can also rely on our support when it comes to modernization with comprehensive
services from the planning phase all the way to commissioning.
Service programs
Our service programs are select service packages for an automation and drives system or
product group. The individual services are coordinated with each other to ensure smooth
coverage of the entire life cycle and support optimum use of your products and systems.
The services of a service program can be flexibly adapted at any time and used separately.
Examples of service programs:
Service contracts
Plant IT Security Services
Life Cycle Services for Drive Engineering
SIMATIC PCS 7 Life Cycle Services
SINUMERIK Manufacturing Excellence
SIMATIC Remote Support Services
Benefits at a glance:
Reduced downtimes for increased productivity
Optimized maintenance costs due to a tailored scope of services
Costs that can be calculated and therefore planned
Service reliability due to guaranteed response times and spare part delivery times
Customer service personnel will be supported and relieved of additional tasks
Comprehensive service from a single source, fewer interfaces and greater expertise
Contact
At your service locally, around the globe: your partner for consultation, sales, training,
service, support, spare parts... for the entire range of products from Industry Automation and
Drive Technologies.
You can find your personal contact in our contacts database on the Internet.
PID control
522 Function Manual, 09/2016, A5E35300227-AB
Index
PULSEGEN
Instruction, 473
C Mode of operation, 474
CONT_C
Block diagram, 464
S
Input parameters, 465
Mode of operation, 462 Software controller
Output parameters, 467 Configuring, 38
CONT_S Symbol
Block diagram, 470 For value comparison, 42
Input parameters, 471
Instruction, 468
Mode of operation, 469 T
Output parameters, 472
TCONT_CP
In/out parameters, 500
Input parameters, 498
P
Instruction, 483
PID_3Step Mode of operation, 484
In/out parameters, 330 Output parameters, 499
Input parameters, 327, 362 Static tags, 501
Instruction, 316, 353 TCONT_S
Output parameters, 329, 364 In/out parameters, 516
Static tags, 366 Input parameters, 515
PID_Compact Instruction, 508
In/out parameters, 263 Operating principle, 509
Input parameters, 260, 296 Output parameters, 516
Instruction, 292 Static tags, 517
Output parameters, 262, 297 Technology objects
Static tags, 264, 298 CONT_C, 214
PID_Temp CONT_S, 220
ActivateRecoverMode tag, 453 PID_3Step, 120
Cascade, 405 PID_Compact, 119
Cascading, 198 PID_Temp, 164
ErrorBits parameter, 450 TCONT_CP, 223
In/out parameters, 405 TCONT_S, 246
Input parameters, 401
Mode, 405
Multi-zone applications, 206 V
Operating principle, 395
Values
Output parameters, 403
Comparing, 42
PID_Temp state and mode parameters, 440
PwmPeriode, 456
Static tags, 407
Tag Warning, 455
PULSEGEN
Input parameters, 481
Output parameters, 482
PID control
Function Manual, 09/2016, A5E35300227-AB 523