STEP7 PID Self Tuner PDF
STEP7 PID Self Tuner PDF
Getting Started 1
Description of the Function
Blocks 2
Examples 3
SIMATIC
Technical Specifications 4
PID Self-Tuner
User Manual
Danger
! indicates that death, severe personal injury or substantial property damage will result if
proper precautions are not taken.
Warning
! indicates that death, severe personal injury or substantial property damage can result if
proper precautions are not taken.
Caution
! indicates that minor personal injury or property damage can result if proper precautions are
not taken.
Note
draws your attention to particularly important information on the product, handling the
product, or to a particular part of the documentation.
Qualified Personnel Only qualified personnel should be allowed to install and work on this equipment.
Qualified persons are defined as persons who are authorized to commission, to ground, and
to tag circuits, equipment, and systems in accordance with established safety practices and
standards.
Warning
! This device and its components may only be used for the applications described in the
catalog or the technical description, and only in connection with devices or components
from other manufacturers which have been approved or recommended by Siemens.
This product can only function correctly and safely if it is transported, stored, set up, and
installed correctly, and operated and maintained as recommended.
Trademarks SIMATIC, SIMATIC NET and SIMATIC HMI are registered trademarks of
SIEMENS AG.
Third parties using for their own purposes any other names in this document which refer to
trademarks might infringe upon the rights of the trademark owners.
PID Self-Tuner
C79000-G7076-C825-01 i
PID Self-Tuner
ii C79000-G7076-C825-01
Getting Started 1
Aims You want to control a temperature process that is driven by a semiconductor
relay using SIMATIC S7 PID Control and want the PID controller parameters
to be set online using the PID Self–Tuner.
To complete your application quickly, work through the steps outlined below
one after the other.
Creating a New Create a new project in the SIMATIC manager and insert a SIMATIC 300 or
Project a SIMATIC 400 station. You can then configure your station with the
appropriate modules in Hardware Configuration. At this point, you can
already set the cycle time for OB35 to 20 ms.
Copying a Working n the SIMATIC manager, you can now copy the working example 3 “initial
Example to your tuning of a continuous controller with pulse generator” into your project from
Project TunPIDEx. Download your project to the CPU and familiarize yourself with
the example as described in Section 3.1.3.
Wiring the Process Wire the sensor that measures the process variable to be controlled to the
for the analog input module. In your project, you must assign the appropriate
Manipulated and peripheral input word PIWx to the PV_PER input for the CONT_C call. The
Process Variables PVPER_ON parameter must be set to TRUE. Now check your process value
in the curve recorder or in a VAT. You can normalize the process variable
with the parameters PV_FAC and PV_OFF.
PID Self-Tuner
C79000-G7076-C825-01 1-1
Getting Started
Wire the digital output module to the semiconductor relay that controls the
heating. In your project you must assign the appropriate output bit (Qx.y) to
the QPOS_P output for the PULSEGEN call in OB35. Check the heating of
the process in the manual mode. In the variable declaration table VAT
TUNING_C you can set MAN_ON to TRUE and set individual manipulated
values in MAN.
Process Analysis .Apply a manipulated value jump for example from 0% to 30% to the heating
and record the step response of the process variable with the curve recorder
of PID Control. Check the operating range of the PID Self–Tuner. This is
described in Section 2.1.
Startup/Test Allow the process to cool to ambient temperature. Switch the parameter
“DI_TUNING_C”.TUN_ON to TRUE in the variable declaration table VAT
TUNING_C. Wait until the process variable is more or less constant and then
apply a setpoint jump with the parameter “DI_CONT_C”.SP_INT.
After the process settles to the operating point, you can test the control
response of the initial controller settings based on small setpoint jumps
around the operating point or by applying disturbances.
PID Self-Tuner
1-2 C79000-G7076-C825-01
Description of the Function Blocks 2
What Does this This chapter contains a detailed description of the function blocks of the PID
Chapter Describe? Self-Tuner.
PID Self-Tuner
C79000-G7076-C825-01 2-1
Description of the Function Blocks
Advantages and With the PID Self-Tuner, you can trim the following SIMATIC S7 and
Areas of SIMATIC C7 PID controllers:
Application
Transient The process must have a stable, asymptotic transient response with time lag.
Response
After a step change in the manipulated variable (LMN) the process variable
must change to a steady state as shown in Figure 2-1. This therefore excludes
processes that have an oscillating response without control and processes that
are not self-regulating (integrator in the process).
PID Self-Tuner
2-2 C79000-G7076-C825-01
Description of the Function Blocks
Process response to
a manipulated value step change
Point of inflection
t
ta
tu
Time Lags The process must not involve large time lags.
The range of application can be specified based on the ratio of the delay time
tu and settling time ta. The time lag includes any existing dead time. The
initial setting or adaptation is designed for the following range:
1
tu < ta
10
Most temperature processes are within this range and both a PI or a PID
controller can be designed for this range.
For the following range:
1 1
ta < tu < ta
10 3
The initial setting of a usable PID controller is still possible. With such a
range, the duration of the learning phase can be significantly increased and
overshoot can occur during the learning phase particularly with combinations
of high process gain and small test step changes.
Linearity and The process must have an adequately linear response over an adequately
Operating Range large operating range.
This means that both during identification and during normal controlled
operation, non-linear effects within the operating range can be ignored. It is,
however possible to re-identify the process when the operating point changes
if the adaptive process is repeated in the close vicinity of the new operating
point and providing that the non-linearity does not occur during the
adaptation.
PID Self-Tuner
C79000-G7076-C825-01 2-3
Description of the Function Blocks
Monopolar It must be possible to control the process with a monopolar actuating signal.
Actuating Signal
Processes requiring active heating and active cooling for temperature control
cannot currently be optimized with the PID Self-Tuner.
Quality of the The quality of the measured signals must be adequate, in other words the
Measured Signals signal-to-noise ratio must be high enough.
Processes with a In processes with control valves with an integral action, there are further
Control Valve with requirements in addition to those above:
Integral Action
The motor actuating time of the control valve must be less than the time
required to find a point of inflection following a step change in the
manipulated value (see also Figure 2-1).
If this is not the case, the process involved is often a flow control in which
only the control valve is effective as the dominating process action. The use
of the PID Self-Tuner is then not advisable. You can the set the PI step
controller according to the following rule of thumb:
GAIN = 1, TI = control valve actuating time
PID Self-Tuner
2-4 C79000-G7076-C825-01
Description of the Function Blocks
Note
With a step controller without a position feedback signal, it must be
permissible for the process that the control valve can be opened completely
to determine the motor actuating time.
In a step controller with position feedback, you yourself can decide how far
the valve is opened using the parameter LHLM_TUN.
PID Self-Tuner
C79000-G7076-C825-01 2-5
Description of the Function Blocks
2.2 FB “TUNING_C”
Input Parameters
PID Self-Tuner
2-6 C79000-G7076-C825-01
Description of the Function Blocks
Output Parameters
In/Out Parameters
PID Self-Tuner
C79000-G7076-C825-01 2-7
Description of the Function Blocks
“Initial Controller If TUN_ON = TRUE and this is followed by a setpoint step change
Tuning” Mode MIN_STEP in a positive direction, you start process identification with
controller optimization. If you want to cancel the initial tuning, you must
reset TUN_ON to FALSE or change to the manual mode (MAN_ON =
TRUE) if the process identification has already started following a step
change in the setpoint. The step change in the setpoint during initial tuning
changes from the setpoint of the cold process to a point close to the operating
point. During initial tuning, no further setpoint step changes are permitted.
Warm process
SP state
(operating point)
LHLM_TUN PV
LMN
Point of inflection
Cold process
state
t
TUN_ON
t
PID Self-Tuner
2-8 C79000-G7076-C825-01
Description of the Function Blocks
If the block has detected a steady state or if the time is 10 TI (TI: reset
time of the PI controller set in PHASE = 3) has elapsed since the setpoint
step change, an improved controller design is started and the tuner moves
on to PHASE = 4. If PID_ON = TRUE, a PID controller is designed,
otherwise a PI controller. With difficult processes, the block always
designs a PI controller regardless of PID_ON. The value calculated for
GAIN during the initial tuning is therefore limited so that the loop gain of
the open loop (the product of the controller gain and process gain) is
between 0.4 and 15.
PHASE = 4:
In this phase, the controller operates with its optimized parameters.
PID Self-Tuner
C79000-G7076-C825-01 2-9
Description of the Function Blocks
Note
If you set TUN_ON = TRUE and apply a setpoint step change higher than
MIN_STEP, the controller parameters and internal variables are reset. Any
controller parameters already acquired are therefore lost.
“Controller If you have already tuned your PI or PID controller and only want to
Adaptation to an optimize it, you use the “Controller Adaptation to an Identified Process”
Identified Process” mode.
Mode
If ADAPT_ON = TRUE and this is followed by a setpoint step change, this
triggers a process identification with controller optimization. If you want to
cancel the adaptation, you must reset ADAPT_ON to FALSE or change to
the manual mode (MAN_ON = TRUE) if process identification has already
started following a setpoint step change. Adaptation uses a much smaller
setpoint step change than the initial tuning, nevertheless you must make sure
that the condition setpoint step change MIN_STEP is met. The setpoint
step change during adaptation is in the vicinity of the operating point. During
adaptation, no further setpoint step changes are permitted.
SP
Warm process
PV state
(operating point)
Point of inflection
ADAPT_ON
t
PID Self-Tuner
2-10 C79000-G7076-C825-01
Description of the Function Blocks
Note
Before adaptation is possible at the operating point, the initial tuning must
be repeated starting from the cold process.
“Variable The tuned PI or PID controllers have a good response to disturbances. When
Controller controlling temperature processes (usually when the cold process is heated
Structure” Mode very quickly) they must, however, be supported by further control
mechanisms to avoid overshoot. You can disable the variable structure with
STRUC_ON = FALSE. In the default setting, the variable structure is
enabled. The block automatically selects between two control mechanisms:
PHASE = 5:
With a positive setpoint step change >= MIN_STEP, the I action of the
controller is temporarily disabled and the gain somewhat increased, in
other words a pure P(D) controller is used. Close to the setpoint, the I
action is re-enabled and the gain reduced again.
PHASE = 6:
Processes with a high time lag cannot be controlled well with P(D). For
this reason, following a positive setpoint step change >= MIN_STEP, the
steady manipulated variable (LMN) required for the new setpoint is
output. Close to the setpoint, the block switches back smoothly to the PI
or PID controller mode.
PID Self-Tuner
C79000-G7076-C825-01 2-11
Description of the Function Blocks
Note
If you do not achieve good results with positive setpoint step changes (for
example in heating processes due to a slow transient response), you can
disable the variable structure with STRUC_ON=FALSE assuming that slight
overshoot is acceptable.
“Manual If you set the input MAN_ON to TRUE, the output QMAN_ON is set to
Controller” Mode TRUE and MAN_OUT to MAN. This changes the PID controller to the
manual mode (PHASE = 7).
The manual mode has priority over all other modes.
Any initial tuning, adaptation or structure change currently in progress is
canceled. When you disable the manual mode (MAN_ON = FALSE), the
controller changes to the automatic mode (PHASE = 4) and continues using
the existing controller parameters. If no controller parameters were set during
the initial tuning, the controller remains in the manual mode and outputs the
value zero (PHASE = 1).
Modifying If you want to change the controller parameters GAIN, TI, TD or TM_LAG
Controller following initial tuning or adaptation, you can overwrite the corresponding
Parameters output parameters in the TUNING_C block, for example using “monitor and
modify variable” under STEP 7.
If oscillations occur in the closed control loop or if there is overshoot
following setpoint step changes, you can reduce the controller gain (for
example to GAIN * 0.8) and increase the reset time TI (for example to
TI*1.5).
If the analog manipulated variable (LMN) of the continuous controller is
converted to binary actuating signals with a pulse generator, quantization
effects can cause small permanent oscillations. You can eliminate these by
extending the controller deadband DEADB_W. If FB TUNING_C is
interconnected with FB PID_CS of the controller module FM355/455, you
must also set the QWRITE output bit.
Note
If you repeat initial tuning or adaptation, the controller parameters are
overwritten. If you want to retain the controller parameters and no longer
modify them, make sure that TUN_ON and ADAPT_ON always have the
value FALSE.
Setting the The sampling time should not be higher than 10% of the calculated reset time
Sampling Time of the controller. You can set the sampling time with the CYCLE parameter
of FB TUNING_C and of the controller. This must match the time difference
between two FB TUNING_C calls (cycle time of the cyclic interrupt OB
bearing in mind the counter settings).
PID Self-Tuner
2-12 C79000-G7076-C825-01
Description of the Function Blocks
Complete Restart If the input TUN_ON has the value TRUE or if there was no initial tuning
prior to a complete restart, initial tuning of the PID controller is performed in
the subsequent cycles. The PHASE output is set to 1.
If the TUN_ON has the value FALSE and if an initial tuning has already been
performed, the PID controller continues to use its old parameters in the
subsequent cycles. The PHASE output is set to 4.
PID Self-Tuner
C79000-G7076-C825-01 2-13
Description of the Function Blocks
2.3 FB “TUNING_S”
Input Parameters
PID Self-Tuner
2-14 C79000-G7076-C825-01
Description of the Function Blocks
Output Parameters
PID Self-Tuner
C79000-G7076-C825-01 2-15
Description of the Function Blocks
In/Out Parameters
PID Self-Tuner
2-16 C79000-G7076-C825-01
Description of the Function Blocks
“Initial Controller If TUN_ON = TRUE and this is followed by a setpoint step change
Tuning” Mode MIN_STEP in a positive direction, you start process identification with
controller optimization. If you want to cancel the initial tuning, you must
reset TUN_ON to FALSE or change to the manual mode (MAN_ON = TRUE
or LMNS) if the process identification has already started following a step
change in the setpoint. The step change in the setpoint during initial tuning
changes from the setpoint of the cold process to a point close to the operating
point. During initial tuning, no further setpoint step changes are permitted.
Cold process
state Point of inflection
t
MTR_TM
TUN_ON
t
PID Self-Tuner
C79000-G7076-C825-01 2-17
Description of the Function Blocks
If the block has detected a steady state or if the time is 8 TI (TI: reset
time of the PI controller set in PHASE = 3) has elapsed since the setpoint
step change, an improved controller design is started and the tuner moves
on to PHASE = 4. If PID_ON = TRUE, a PID controller is designed,
otherwise a PI controller. The default setting of PID_ON is FALSE since
in the majority of cases a PI controller is used in step controls. With
difficult processes, the block always designs a PI controller. The value
calculated for GAIN during the initial tuning is therefore limited so that
the gain of the open loop (the product of the controller gain and process
gain) is in the range between 0.4 and 15.
PHASE = 4:
In this phase, the controller operates with its optimized parameters.
Note
If you set TUN_ON = TRUE and apply a setpoint step change higher than
MIN_STEP, the controller parameters and internal variables are reset. Any
controller parameters already acquired are therefore lost.
PID Self-Tuner
2-18 C79000-G7076-C825-01
Description of the Function Blocks
“Controller The adaptation is only active for a step controller with position feedback
Adaptation to an (LMNR_ON=TRUE).
Identified Process”
Mode If ADAPT_ON = TRUE and this is followed by a setpoint step change, this
triggers a process identification with controller optimization. If you want to
cancel the adaptation, you must reset ADAPT_ON to FALSE or change to
the manual mode (LMNS_ON = TRUE or MAN_ON = TRUE) if the process
identification has already started following a step change in the setpoint.
Adaptation uses a much smaller setpoint step change than the initial tuning,
nevertheless you must make sure that the condition setpoint step change >
MIN_STEP is met. The setpoint step change during adaptation is in the
vicinity of the operating point. During adaptation, no further setpoint step
changes are permitted.
SP
Warm process
PV state
Point of inflection
(operating point)
ADAPT_ON
t
PID Self-Tuner
C79000-G7076-C825-01 2-19
Description of the Function Blocks
Note
Before adaptation is possible at the operating point, the initial tuning must
be repeated starting from the cold process.
“Variable The variable structure mode is only active for a step controller with position
Controller feedback (LMNR_ON=TRUE).
Structure” Mode
The tuned step controllers have a good response to disturbances. When
controlling temperature processes (usually when the cold process is heated
very quickly) they must, however, be supported by further control
mechanisms to avoid overshoot. You can disable the variable structure with
STRUC_ON = FALSE. In the default setting, the variable structure is
enabled. With a step controller with position feedback, the block
automatically selects between two control mechanisms:
PHASE = 5:
With a positive setpoint step change ≥ MIN_STEP, the I action of the
controller is temporarily disabled and the gain somewhat increased, in
other words a pure P(D) controller is used. Close to the setpoint, the I
action is re-enabled and the gain reduced again.
PHASE = 6:
With long time lags, following a positive setpoint step change
>=MIN_STEP, the steady manipulated variable required for the new
setpoint is output. Close to the setpoint, the block switches back smoothly
to the PI or PID controller mode.
With a step controller without position feedback, only the first control
mechanism is possible (PHASE = 5).
PID Self-Tuner
2-20 C79000-G7076-C825-01
Description of the Function Blocks
Note
If you do not achieve good results with positive setpoint step changes (for
example in heating processes due to a slow transient response), you can
disable the variable structure with STRUC_ON=FALSE assuming that slight
overshoot is acceptable.
“Manual The manual controller mode corresponds to PHASE = 7. If you use a step
Controller” Mode controller with position feedback (LMNR_ON = TRUE), you can switch to
the manual mode with LMNS_ON = TRUE or with MAN_ON = TRUE. If
you use a step controller without position feedback (LMNR_ON = FALSE),
you can only switch to the manual mode with LMNS_ON = TRUE. If you
set the input MAN_ON to TRUE, the output QMAN_ON has the value
TRUE and the output MAN_OUT has the value of MAN. If you set the input
LMNS_ON to TRUE, the QLMNUP is set to LMNUP and the output
QLMNDN to LMNDN. The manual mode has priority over all other
modes. Any initial tuning, adaptation or structure change currently in
progress is canceled. When you disable the manual mode (LMNS_ON =
FALSE or MAN_ON = FALSE), the controller changes to the automatic
mode (PHASE = 4) and continues using the existing controller parameters. If
no controller parameters were set during the initial tuning, the controller
remains in the manual mode and waits for a setpoint step change for the
initial tuning (PHASE = 1).
Modifying If you want to change the controller parameters GAIN, TI, TD, TM_LAG or
Controller MTR_TM and DEADB_W following an initial tuning or adaptation, you can
Parameters overwrite the corresponding output parameters in the TUNING_S block, for
example using “monitor and modify variable” under STEP 7.
If oscillations occur in the closed control loop or if there is overshoot
following setpoint step changes, you can reduce the controller gain (for
example to GAIN 0.8) and increase the reset time TI (for example to TI
1.5).
Small permanent oscillations of the process value occur with the step
controller due to quantization of the position feedback signal. You can
eliminate these by extending the deadband at output DEADB_W.
If the FB TUNING_S is interconnected with the FB PID_CS of the controller
module FM355/455, you must also set the QWRITE output bit.
Note
If you repeat the initial tuning or adaptation, the controller parameters are
overwritten. If you want to retain the controller parameters and no longer
modify them, make sure that TUN_ON and ADAPT_ON are always off.
PID Self-Tuner
C79000-G7076-C825-01 2-21
Description of the Function Blocks
Setting the The sampling time should not be higher than 10% of the calculated reset
Sampling Time time. You can set the sampling time with the CYCLE parameter of FB
TUNING_S and of the controller. It must match the time difference between
two FB TUNING_S calls (cycle time of the cyclic interrupt OB, taking into
account the counter settings).
Complete Restart If the TUN_ON input has the value TRUE or if no initial tuning has been run
during a complete restart, an initial tuning of the step controller is performed
in the subsequent cycles. The PHASE output is set to 1.
If the TUN_ON input has the value FALSE and if initial tuning has already been
performed, the step controller continues to use its old parameters in the
subsequent cycles. The PHASE output is set to 4.
PID Self-Tuner
2-22 C79000-G7076-C825-01
Examples 3
About this This chapter contains examples of PID controllers whose parameters were set
Chapter... with the blocks of the PID self–tuner.
PID Self-Tuner
C79000-G7076-C825-01 3-1
Example
Control Loop Figure 3-1 shows the complete control loop of Example 1 .
TUNING_S
PROC_S
Process with PV
CONT_S
integrating actuator
SP
QLMNUP
QLMNDN
“PROC_S” The block simulates an integrating control valve with a third–order time lag.
Process
QLMNR_HS
QLMNR_LS
GAIN
DISV
INV_UP
INV_DOWN OUTV
LMNR_HLM TM_LAG1 TM_LAG2 TM_LAG3
MTR_TM
LMNR_LLM
The block forms a series circuit consisting of an integrating control valve and
three first–order time lags. The output of the control valve always has the
disturbance value DISV added to it. The motor actuating time MTR_TM is
the time required by the valve to move from limit stop to limit stop.
During a complete restart, the output variable OUTV and internal memory
values are all set to 0.
PID Self-Tuner
3-2 C79000-G7076-C825-01
Example
Initial Tuning To perform the initial tuning, follow the steps outlined below:
1. Insert a SIMATIC 300/400 station in your project and set the cycle time
of OB35 to 20 ms in “Hardware Configuration”.
2. Using the SIMATIC Manager, download the program “EXAMPL01” to
your CPU from the project “TunPIDEx”.
3. Using the start button, start the “PID Control Parameter Assignment” tool
under STEP 7 and open the “DI_CONT_S” block online. Under
“Settings...” set the following values for the curve recorder:
4. Open the variable declaration table “VAT1” and set a setpoint step change
from 0 to 50 with the parameter “SP_INT”.
PID Self-Tuner
C79000-G7076-C825-01 3-3
Example
Control Loop Figure 3-3 shows the complete control loop of example 2.
TUNING_C
PROC_C
CONT_C Process PV
SP LMN
DISV GAIN
INV OUTV
The block forms a series circuit of three first–order time lags. At input INV,
the disturbance variable DISV is always added.
During a complete restart, the output variable OUTV and the internal
memory values are all set to the value (INV + DISV)GAIN.
PID Self-Tuner
3-4 C79000-G7076-C825-01
Example
Initial Tuning To perform the initial tuning, follow the steps outlined below:
1. Using the SIMATIC Manager, download the program “EXAMPL02” to
your CPU from the “TunPIDEx” project.
2. Using the start button, start the “PID Control Parameter Assignment” tool
under STEP 7 and open the “DI_CONT_S” block online. Under
“Settings...” set the following values for the curve recorder:
3. Open the variable declaration table “VAT1” and set a setpoint step change
from 0 to 50 with the parameter “SP_INT”.
PID Self-Tuner
C79000-G7076-C825-01 3-5
Example
Control Loop Figure 3-5 shows the complete control loop of example 3 .
TUNING_C
PROC_P
CONT_C PULSEGEN Process PV
SP LMN QPOS_P
Program Structure To control a process using a pulse output, two different cycles are required
when Controlling since the pulse generator must be called at least 50 to 100 times during one
with a Pulse controller sampling period. Since some CPUs only have OB35 as the cyclic
Generator interrupt OB, the sequence is organized as follows:
You define a counter for each control channel. You call the pulse generator in
OB35 and increment the counter. In OB1, you query the counter and call the
controller and adaptation block only when their cycle time has elapsed. Since
OB1 can be interrupted by OB35, you can specify a faster cycle for pulse
generation than the calculation time of the controller and adaptation block. In
the complete restart OB (OB100), you assign different start values to the
counters so that the controllers are not all started at the same time.
“PROC_P” The block simulates a continuous control valve with a digital input and a
Process third–order time lag.
PID Self-Tuner
3-6 C79000-G7076-C825-01
Example
The block converts the binary input values of the pulse duration modulation
into continuous analog values and after feeding forward the disturbance
variable, delays the output signal with three first–order time lags.
During a complete restart, the output variable OUTV and the internal
memory values are set to 0.
Initial Tuning To perform the initial tuning, follow the steps outlined below:
1. Insert a SIMATIC 300/400 station in your project and set the cycle time
of OB35 to 20 ms in “Hardware Configuration”.
2. Using the SIMATIC Manager, download the program “EXAMPL01” to
your CPU from the project “TunPIDEx”.
3. Using the start button, start the “PID Control Parameter Assignment” tool
under STEP 7 and open the “DI_CONT_S” block online. Under
“Settings...” set the following values for the curve recorder:
4. Open the variable declaration table “VAT1” and set a setpoint step change
from 0 to 50 with the parameter “SP_INT”.
PID Self-Tuner
C79000-G7076-C825-01 3-7
Example
TUNING_C CONT_C
SP_INT
PV PV
LMN LMN
SP
MAN_OUT
MAN
GAIN GAIN
TI TI
TD TD
TM_LAG TM_LAG
QMAN_ON MAN_ON
QI_SEL I_SEL
QD_SEL D_SEL
PID Self-Tuner
3-8 C79000-G7076-C825-01
Example
SCL Example of In the following SCL example, the “PID_C” block from the “Standard PID
PID_C Control” optional package is used as the PID controller.
Note
The controller parameters to be influenced are not all available on the input
bar. They must therefore be connected explicitly as static local data.
SCL Explanation
//Cyclic interrupt
ORGANIZATION_BLOCK OB35
//...
BEGIN
TUNING_C.DI_TUNING_C(
SP := DI_PID_C.SP,
PV := DI_PID_C.PV,
LMN := DI_PID_C.LMN);
DI_PID_C.GAIN := DI_TUNING_C.GAIN;
DI_PID_C.TI := DI_TUNING_C.TI;
DI_PID_C.TD := DI_TUNING_C.TD;
DI_PID_C.TM_LAG := DI_TUNING_C.TM_LAG;
DI_PID_C.I_SEL := DI_TUNING_C.QI_SEL;
DI_PID_C.D_SEL := DI_TUNING_C.QD_SEL;
DI_PID_C.MAN_ON := DI_TUNING_C.QMAN_ON;
DI_PID_C.MAN := DI_TUNING_C.MAN_OUT;
PID_C.DI_PID_C();
END_ORGANIZATION_BLOCK
PID Self-Tuner
C79000-G7076-C825-01 3-9
Example
SCL Example of In the following SCL example, the “PID_S” block from the “Standard PID
PID_S Control” optional package is used as the PID controller.
Note
The controller parameters to be influenced are not all available on the input
bar. They must therefore be connected explicitly as static local data.
SCL Explanation
//Cyclic interrupt
ORGANIZATION_BLOCK OB35
//...
BEGIN
TUNING_S.DI_TUNING_S(
SP := DI_PID_S.SP,
PV := DI_PID_S.PV,
LMNR := DI_PID_S.LMNR_IN,
C_LMNUP := DI_PID_S.QLMNUP,
C_LMNDN := DI_PID_S.QLMNDN,
LMNR_HS := DI_PID_S.LMNR_HS,
LMNR_ON := DI_PID_S.LMNR_ON,
PULSE_TM := DI_PID_S.PULSE_TM);
DI_PID_S.GAIN := DI_TUNING_S.GAIN;
DI_PID_S.TI := DI_TUNING_S.TI;
DI_PID_S.TD := DI_TUNING_S.TD;
DI_PID_S.TM_LAG := DI_TUNING_S.TM_LAG;
DI_PID_S.I_SEL := DI_TUNING_S.QI_SEL;
DI_PID_S.D_SEL := DI_TUNING_S.QD_SEL;
DI_PID_S.MTR_TM := DI_TUNING_S.MTR_TM;
DI_PID_S.DEADB_W := DI_TUNING_S.DEADB_W;
DI_PID_S.LMNS_ON := DI_TUNING_S.QLMNS_ON;
DI_PID_S.LMNUP := DI_TUNING_S.QLMNUP;
DI_PID_S.LMNDN := DI_TUNING_S.QLMNDN;
DI_PID_S.MAN_ON := DI_TUNING_S.QMAN_ON;
DI_PID_S.MAN := DI_TUNING_S.MAN_OUT;
DI_PID_S.LMNR_ON := DI_TUNING_S.LMNR_ON;
PID_S.DI_PID_S();
END_ORGANIZATION_BLOCK
PID Self-Tuner
3-10 C79000-G7076-C825-01
Example
STL Example of In the following STL example, the blocks “PID” and “LMNGEN_C” from
PID and the “Modular PID Control” optional package are used as the PID controller.
LMNGEN_C
STL Explanation
//Cyclic interrupt OB
FUNCTION_BLOCK FBx
BEGIN
Segment 1:
L #DI_LMNGEN_C.LMN
T DI_TUNING_C.LMN
CALL TUNING_C, DI_TUNING_C
SP := ...
PV := ...
CALL #DI_PID
GAIN := DI_TUNING_C.GAIN
TI := DI_TUNING_C.TI
TD := DI_TUNING_C.TD
TM_LAG := DI_TUNING_C.TM_LAG
I_SEL := DI_TUNING_C.QI_SEL
D_SEL := DI_TUNING_C.QD_SEL
CALL #DI_LMNGEN_C
MAN := DI_TUNING_C.MAN_OUT
MAN_ON := DI_TUNING_C.QMAN_ON
BE
END_FUNCTION_BLOCK
PID Self-Tuner
C79000-G7076-C825-01 3-11
Example
STL Example of In the following STL example, the blocks “PID” and “LMNGEN_S” from
PID and the “Modular PID Control” optional package are used as the PID controller.
LMNGEN_S
STL Explanation
//Cyclic interrupt OB
FUNCTION_BLOCK FBx
BEGIN
Segment 1:
L #DI_LMNGEN_S.LMNR
T DI_TUNING_S.LMNR
L #DI_LMNGEN_S.QLMNUP
T DI_TUNING_S.C_LMNUP
L #DI_LMNGEN_S.QLMNDN
T DI_TUNING_S.C_LMNDN
L #DI_LMNGEN_S.LMNR_HS
T DI_TUNING_S.LMNR_HS
L #DI_LMNGEN_S.LMNR_ON
T DI_TUNING_S.LMNR_ON
L #DI_LMNGEN_S.PULSE_TM
T DI_TUNING_S.PULSE_TM
CALL #DI_PID
GAIN := DI_TUNING_S.GAIN
TI := DI_TUNING_S.TI
TD := DI_TUNING_S.TD
TM_LAG := DI_TUNING_S.TM_LAG
DEADB_W := DI_TUNING_S.DEADB_W
I_SEL := DI_TUNING_S.QI_SEL
D_SEL := DI_TUNING_S.QD_SEL
CALL #DI_LMNGEN_S
MTR_TM := DI_TUNING_S.MTR_TM
LMNS_ON := DI_TUNING_S.QLMNS_ON
LMNUP := DI_TUNING_S.QLMNUP
PID Self-Tuner
3-12 C79000-G7076-C825-01
Example
LMNDN := DI_TUNING_S.QLMNDN
MAN := DI_TUNING_S.MAN_OUT
MAN_ON := DI_TUNING_S.QMAN_ON
BE
END_FUNCTION_BLOCK
PID Self-Tuner
C79000-G7076-C825-01 3-13
Example
STL Example of In the following STL example, the FBs “TUNING_C” and “PID_CS” are
TUNING_C and used.
PID_CS
Note
The sampling time of FB “TUNING_C” and FB “PID_CS” should
approximately match the sampling time of the controller in the FM.
STL Explanation
//Cyclic interrupt
ORGANIZATION_BLOCK OB35
//local variable
bool bTemp
BEGIN
Segment 1:
SET
= bTemp
CALL PID_CS, DI_PID_CS
READ_VAR := bTemp
CALL TUNING_C, DI_TUNING_C
SP := DI_PID_CS.SP
PV := DI_PID_CS.PV
LMN := DI_PID_CS.LMN
L DI_TUNING_C.TI
DTR
L 0.001
*R
T DI_PID_CS.TI
L DI_TUNING_C.TD
DTR
L 0.001
*R
T DI_PID_CS.TD
L DI_TUNING_C.TM_LAG
DTR
L 0.001
*R
PID Self-Tuner
3-14 C79000-G7076-C825-01
Example
T DI_PID_CS.TM_LAG
CALL PID_CS, DI_PID_CS
GAIN := DI_TUNING_C.GAIN
LMN_RE := DI_TUNING_C.MAN_OUT
LMN_REON:= DI_TUNING_C.QMAN_ON
LOAD_PAR:= DI_TUNING_C.QWRITE
LOAD_OP := DI_TUNING_C.QWRITE
BE
END_ORGANIZATION_BLOCK
STL Example of In the following STL example, the FBs “TUNING_S” and “PID_CS” are
TUNING_S and used.
PID_CS
Note
The sampling time of FB “TUNING_S” and FB “PID_CS” should
approximately match the sampling time of the controller in the FM.
STL Explanation
//Cyclic interrupt
ORGANIZATION_BLOCK OB35
//local variable
bool bTemp
BEGIN
Segment 1:
SET
= bTemp
L DI_PID_CS.PULSE_TM
L 1000.0
*R
RND
T DI_TUNING_S.PULSE_TM
PID Self-Tuner
C79000-G7076-C825-01 3-15
Example
END_ORGANIZATION_BLOCK
PID Self-Tuner
3-16 C79000-G7076-C825-01
Example
Cooling Control as In a pure cooling control, the setpoint and process variable connected to
a Special Form of “TUNING_C” or “TUNING_S” are multiplied by (–1). At the same time, the
Heating Control controller gain calculated by “TUNING_C” or “TUNING_S” is multiplied by
(–1) before it is applied to the controller. The blocks “TUNING_C” or
“TUNING_S” themselves then operate in just the same way as during heating
control.
TUNING_C GAIN
TUNING_S
(–1)
(–1) (–1)
Controller Process
SP LMN
QLMNUP PV
QLMNDN
Example of the
Interconnections
in SCL
SCL Explanation
TUNING_C.DI_TUNING_C(
SP := –DI_CONT_C.SP_INT,
PV := –DI_CONT_C.PV,
LMN := DI_CONT_C.LMN);
CONT_C.DI_CONT_C(
GAIN := –DI_TUNING_C.GAIN,
TI := DI_TUNING_C.TI,
TD := DI_TUNING_C.TD,
TM_LAG := DI_TUNING_C.TM_LAG,
MAN := DI_TUNING_C.MAN_OUT,
MAN_ON := DI_TUNING_C.QMAN_ON,
I_SEL := DI_TUNING_C.QI_SEL,
D_SEL := DI_TUNING_C.QD_SEL);
PID Self-Tuner
C79000-G7076-C825-01 3-17
Example
PID Self-Tuner
3-18 C79000-G7076-C825-01
Technical Specifications 4
Run Times The numeric values in the table below are the run times in milliseocnds.
TUNING_C TUNING_S
FB 39 FB 40
CPU 313 1.22 1.22
CPU 314 1.24 1.24
CPU 315
1.06 1.07
CPU 315-2DP
CPU 412-1
CPU 413-1 0.15 0.15
CPU 413-2DP
CPU 414-1
0.10 0.10
CPU 414-2DP
CPU 416-1
0.05 0.05
CPU 416-2DP
Memory
Requirements
PID Self-Tuner
C79000-G7076-C825-01 4-1
Technische Daten
PID Self-Tuner
4-2 C79000-G7076-C825-01
Siemens AG
A&D AS E 146
Östliche Rheinbrückenstr. 50
D-76181 Karlsruhe
Federal Republic of Germany
From:
Your Name: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Your Title: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Company Name: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Street: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
City, Zip Code_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Country: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Phone: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
❒ Automotive ❒ Pharmaceutical
❒ Chemical ❒ Plastic
❒ Electrical Machinery ❒ Pulp and Paper
❒ Food ❒ Textiles
❒ Instrument and Control ❒ Transportation
❒ Nonelectrical Machinery ❒ Other _ _ _ _ _ _ _ _ _ _ _
❒ Petrochemical
✄
PID Self-Tuner
C79000-G7076-C825-01 1
Remarks Form
Your comments and recommendations will help us to improve the quality and usefulness
of our publications. Please take the first available opportunity to fill out this questionnaire
and return it to Siemens.
Please give each of the following questions your own personal mark within the range
from 1 (very good) to 5 (poor).
1. Do the contents meet your requirements?
2. Is the information you need easy to find?
3. Is the text easy to understand?
4. Does the level of technical detail meet your requirements?
5. Please rate the quality of the graphics/tables:
Additional comments:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
PID Self-Tuner
2 C79000-G7076-C825-01