lcrpidpara.
html
LoopConR - LCRPIDpara()
The function block is used for configuring the LCRPID() controller function block when the control parameters required for the
system are known or are manually determined.
It checks the entered control parameters and makes them available to the LCRPID() controller function block in the corresponding
format.
The LCRPIDTune() function block should be used instead of LCRPIDpara() if the control parameters should be determined
automatically (autotuning).
Note:
LCRPIDpara() requires much more processing time than LCRPID() to check and calculate the control parameters and should
therefore be called in a lower priority task class in some cases.
Note:
LCRPIDpara() cannot be used on CPUs of type CP15x and XP152.
Note:
In CopyMode the address of the parameter structure with the control parameters in internal representation changes, in this
case the LCRPIDPara() has to be called in the cyclic part.
Parameter
I/O Parameter Data Description
type
IN enable BOOL This function block is only executed if enable = TRUE. Otherwise, all outputs (including
ident!) are set to 0.
IN enter BOOL Control parameters are only checked and converted into an internal display when this input
is TRUE. Otherwise, modifications to the parameter inputs are ignored and computing time
can be saved.
IN WX_max REAL Maximum input value of the reference variable W and the controlled variable X. Must be
larger than WX_min.
WX_min and WX_max are used for scaling the internal calculations processed in the value
range between 0% and 100%. This prevents calculation inaccuracies by displaying
numbers with the data type REAL.
If WX_min is set to 0.0 and WX_max to 100.0, then W and X are not scaled.
(Default setting)
W and X are not limited to the range defined by WX_min and WX_max. The calculations
will however become less accurate the more they deviate from this value range.
Warning: As a rule, changing WX_min or WX_max entails changing the reinforcement on
the controller!
IN WX_min REAL Minimum input value of the reference variable W and the controlled variable X. Must be
less than WX_max.
WX_min and WX_max are used for scaling the internal calculations processed in the value
range between 0% and 100%. This prevents calculation inaccuracies by displaying
numbers with the data type REAL.
If WX_min is set to 0.0 and WX_max to 100.0, then W and X are not scaled.
(Default setting)
W and X are not limited to the range defined by WX_min and WX_max. The calculations
will however become less accurate the more they deviate from this value range.
lcrpidpara.html
Warning: As a rule, changing WX_min or WX_max entails changing the reinforcement on
the controller!
IN invert BOOL TRUE inverts the controller's direction of movement and can therefore implement negative
gains. A positive control deviation decreases the manipulated variable Y.
IN deadband REAL Dead band. The deadband limits are defined by (W – deadband) and (W + deadband).
Permitted values: 0..(WX_max – WX_min). Deadband is disabled when deadband = 0.
IN deadband_mode USINT Deadband mode:
LCRPID_DEADBAND_MODE_ZERO (0): If deadband mode is enabled (deadband > 0) and if
(W - deadband) < X < (W + deadband), then the controller remains active until X = W or
X = W. The control deviation is not set to e = 0 until the set value W is reached. Controller
output Y retains the value that was output when the set value was reached.
LCRPID_DEADBAND_MODE_STANDARD (1): If deadband mode is enabled (deadband > 0)
and if (W - deadband) < X < (W + deadband), the controller deviation e is set to 0
internally. Controller output Y retains the value that was output when the deadband mode
began.
LCRPID_DEADBAND_MODE_STANDARD_I (2): Sames as the mode
LCRPID_DEADBAND_MODE_STANDARD, however, after leaving the deadband, the integral
element calculates the control deviation e as 'W - X ± deadband' instead of 'W - X'.
IN dY_max REAL Maximum manipulated variable ramp (rate of change of the manipulated variable). Units:
% / seconds.
The ramp is disabled at 0 and does not require any computing time.
IN Kp REAL Proportional gain. Units: [%/%].
Permitted values: Kp > 0.0. Negative gains are configured by setting the input invert =
TRUE.
The control error e = W - X is also scaled when scaling the set value W and the actual
value X between WX_min and WX_max, whereby e = 100% is equal to a control deviation
of (W - X) = (WX_max - WX_min).
Kp [%/%] = k_p * (WX_max - WX_min)/100 must be defined to implement a proportional
gain k_p [%/(unit of W and X)], which is specified as a relationship between the
manipulated variable percentage and a control deviation in physical units of the controlled
variable.
Example for calculating Kp.
IN Tn REAL Integral action time (I-element). Units: Seconds.
The time span, which a constant control deviation must meet for the I-element to generate
the same manipulated variable as the P-element.
The integral element and jolt-free switching are disabled at 0 and do not require any
computing time.
IN Tv REAL Derivative action time (D-element). Units: Seconds.
The time span, which a increasing control deviation of 0 with a constant gradient must
meet for the P-element to generate the same manipulated variable as the D-element.
The derivative element is disabled at 0 and does not require any computing time.
Otherwise, Tv > Tf > 1.4 * dt (controller scan-time, cycle time) must be the case.
IN Tf REAL Filter time for the derivative element. Units: Seconds.
Must be specified if Tv is not equal to 0. If Tf is less than 1.4 * dt (controller scan time,
cycle time) during runtime, then the LC_WARN_Tx_DT warning is output to LCRPID() and
calculation takes place with the replacement value 1.4 * dt.
IN Kw REAL Set value attenuation.
The attenuator is disabled at 1 and does not require any computing time.
IN Kfbk REAL Windup damping.
The windup protection is disabled at 0 and does not require any computing time.
IN fbk_mode USINT Feedback mode for the manipulated variable:
LCRPID_FBK_MODE_INTERN: Internal.
LCRPID_FBK_MODE_EXTERN: External for release control.
LCRPID_FBK_MODE_EXT_SELECTOR: External for selector control. In this mode, the
integral element of the controller not select at the moment (Y_fbk ? Y) follows the Y_fbk
input according to the formula Yi = Y_fbk – Yp – Yd – A.
LCRPID_FBK_MODE_LIMIT_YI: The integral element is stopped if Yp + Yi + Yd ≥ Ymax - A
or Yp + Yi + Yd ≤ Ymin + A. Kfbk does not affect this type of windup protection.
LCRPID_FBK_MODE_SET_YI: External for release control, the integral element of the
controller not select at the moment (Y_fbk ≠ Y) follows the Y_fbk input.
lcrpidpara.html
IN d_mode USINT Differentiator mode:
LCRPID_D_MODE_X: Only -X (actual value)
LCRPID_D_MODE_E: e (control deviation, as for a standard PID controller)
OUT status UINT Function block status message, see Error Numbers (0 = no error).
OUT ident UDINT Ident for LCRPID().
Address of the parameter structure with the control parameters in internal representation.
Function description
The function block is used when the control parameters required for the system are known or are manually
determined.
LCRPIDpara() provides the corresponding parameters for the PID controller LCRPID() in internal representation via
the ident output.
The "invert" function inverts the affects and is used when a negative control gain must be implemented.
See the description of the LCRPID() function block for a parameter description of the PID controller.
Example for calculating Kp:
Temperature regulation in a temperature range from 0°C – 300°C is implemented, whereby a heater with a
maximum output of Pmax = 5 kW and a minimum output Pmin = 0 kW is used as actuator element.
The heater's output is defined by the manipulated variable Y, whereby Y_min = 0% equals a heater output of Pmin
and Y_max = 100% equals a heater output of Pmax. Therefore, the following is generally valid:
The proportional gain should be set to
WX_min = 0°C
WX_max = 300°C
Y_min = 0%
Y_max = 100%
Therefore, the Kp input should be configured to:
Examples
ANSI C
STRUCTURED TEXT
LADDER DIAGRAM