iQ-F PID controller function block
Tech Tip
1. Function Block
This function block is a iQ-F PID instruction implementation for ease of use with all functionality and parameters as inputs of fb. There is also an added manual mode for setting the exact Manipulated Value with PID turned off. It can be use for easier configuration of PID regulation in iQ-F PLC.
2. Settings
To start PID regulation you need to set the parameters described below
2.1 Basic PID inputs and outputs:
Set Value is value you want to achieve in regulation, Process Value is the actual value of the regulated object and Manipulated Value is the output of the regulator.
2.2 Operation direction:
Forward operation is an operation that increases the output value (MV) when the measured value (PV) becomes larger than the target value (SV). This operation is used when performing cooling control:
Backward operation is an operation that increases the output value (MV) when the measured value (PV) becomes smaller than the target value (SV). This operation is used when performing heating control.
This option is settable from i_bOperationDirection input. “0” is Forward (cooling) operation and “1” is Backward (heating) operation:
2.3 Modes:
When enabling the function block with i_bEN input you need to select and enable one of the operation modes:
2.3.1 Manual mode
In this mode value written to i_wManualSetValue is set to o_wManipulatedValue.
2.3.2 Auto mode
In this mode, o_wManipulatedValue is calculated by PID regulator.
2.4 Sampling time:
To properly use PID regulation you need to set sample frequency. In this function block you set sampling time in miliseconds. Sampling time should be at least as fast as Nyquist rate which is twice as fast as the response rate of the controlling system. But preferably sampling time should be 5 to 10 times faster then system frequency.
2.5 Overshoot Suppression Processing:
This input enables additional processing counteracting overshoot occurrence
2.6 Manipulated Value Settings:
2.6.1 Limits
To limit manipulated value you need to set upper and lower limit values (ULV, LLV). When you set 1000 in ULV and 0 in LLV it means that Manipulated value will not exceed 1000 nor drop below 0:
2.6.2 Alarms
When you want to know when the Manipulated Value reaches the exact value you need to set the Upper and Lower Limit Alarm:
When the Manipulated Value reaches the alarm threshold will be turned on:
2.7 Input filter:
The input filter (α) is a software filter to reduce the fluctuation of the measured value (PV) caused by noise. The effect of noise can be reduced by setting this time constant of the filter according to the control target characteristics and noise level. If the input filter value is too small, the filter effect is small. If the input filter value is too large, the input response is bad. Setting range: 0 to 99 (%).
2.8 Regulation constants:
Before turning PID regulation ON for the first time you need to set some values in registers connected to these inputs. After autotuning they will be overwritten:
3. Autotuning:
3.1 Autotuning parameters:
Before starting autotuning you need to set basic parameters like autotuning method (limit cycle or step response method), hysteresis (in limit cycle method), lower and upper-value limit in autotuning and wait time setting from end of tunning cycle to start PID control
3.2 Autotuning method:
This function block supports two autotuning methods: limit cycle and step response. To select a method you need to use i_bATMethod:
3.2.1 Limit cycle method:
When in the limit cycle method, changes in the input value in two-position control (in which the output Upper Limit Value (ULV) and output Lower Limit Value (LLV) are switched according to the deviation) are measured, and then constants in the PID control are obtained.
To properly configure lthis method you need to declare four parameters, one of them is histeresis:
It says how much Process Value will rise and fall during autotuning. Hysteresis is declared by i_wATSHPV input:
Next, you need to set upper and lower limit values for autotuning which limit Manipulated Value during autotuning:
Last parameter of this method is the wait setting form end of tuning cycle to start of PID control (KW):
3.2.2 Step response method:
In the step response method, by giving stepped output from 0 to 100 % to the control system, three constants in the PID control are obtained from the operation characteristics (maximum ramp (R) and dead time (L) and the input value variation. The stepped output may be obtained from 0 to 75% or from 0 to 50 %.
3.3 Starting autotuning
To start the tuning process firstly you need to start standard PID control and then turn on i_bStartAutoTuning input.
When autotuning will start, output o_bInAutoTuning will turn on:
When autotuning will end, output o_bAutoTuningComplete will turn on:
3.4 Example autotuning results
Example autotuning results using the limit cycle method (red line is Set Value and the white line is Process Value) are presented below:
4. Example project
In the attachment, there is an example project for simulating PID regulation of temperature. There’s also included PID_IQF structure for this function block. Temperature is simulated with a second inertia model to create the more realistic environment:
Original support article: https://www.fasupportme.com/portal/en/kb/articles/iq-f-pid-controller-function-block