PID Special Program

The PID special program is designed to conveniently use the PID operation function, which is the CPU built-in function.

 

Registering the PID program

Select "File -> New Program" menu.

 

image-20240329-044611.png

 

Input Program Name, Program ID, and For Run Edit(step).
Click the [OK] button.

 

Writing a PID program

Example of writing a program : Configuration diagram of the control system

 

image-20240329-044620.png

 

This sample program takes measurement of the temperature inside a room using the RTD sensor, and controls 4 – 20mA output to keep the room temperature as settings. Temperature is measure using the channel 1 of the RTD module, and the output is controlled using the channel 1 of the DA card.

 

 

Number of entire loop(Total Loop)
Sets the number of loops that execute PID operation.
One PID operation loop should be used to control one controlling object. Up to 32 controlling objects can be set. Set "1" since there is only 1 controlling object. (1 ~ 32)

Number of execution loops for 1 scan(1 Scan Loop)
Sets the number of execution loops in 1 scan when there are several loops.
Set "1" as the number of execution loops for 1 scan since the number of entire loop is 1.

PIDINIT starting area(PIDINIT Start)
Parameters to be referred by PIDINIT command are saved from the specified area. The first loop uses 22 loops including the number of entire loop and execution loops for 1 scan. From second loop, 20 words area is used whenever a new loop is added. In the above figure, D00000 ~ D00021 area is set for the PIDINIT parameter area.

PIDCAL starting area(PIDCAL Start)
Parameters to be referred by PIDCAL command and PIDCAL result value are saved from the specified area. 20 words area is additionally used whenever a new loop is added. In the above figure, D00100 ~ D00119 area is set for the PIDCAL parameter area. Be careful that the area overlaps the PIDINIT area.

Current loop(Now Sel LooPp)
Select the loop to edit or monitor among the entire loop.
"1" is set for the current loop field since there is one loop.

Select operation formula (0: Forward operation, 1: Reverse operation)
Forward operation: Operation that makes the measurement value to be close to the target value by outputting the movement volume (MV), if the measurement value (PV) is smaller than the target value (SV). Heating operation belongs to this operation type.

Reverse operation: Operation that makes the PV to be close to the target value by outputting the MV, if the PV is greater than the SV. Cooling operation belongs to this operation type.

Select Forward operation (0) since heating is currently controlled.

Sampling time
Sets the interval of executing PID operation. The interval should be set shorter for the system that the measurement value instantly responds to output variation.
Since it is set to 1 second in the above example, PID operation is performed at 1 second interval and the MV changes. (0.01 ~ 60)

Proportional integer (Kp)
Constant value that is multiplies by the deviation (Sv –Pv) in the proportional operation "Mv = Kp * (Sv – Pv)", which performs proportional operation of PID control.
If the proportional integer (kp) is greater in the above formula, the PV reaches the SV faster. However, if this value is too big, it can negatively affects stabilized control due to vibration.
In the above example, this value is set to 8000. It should be adjusted according to the system while running the program. (0.01 ~ 100)

Integral integer (Ki)
The integral operation "Mv = P * E + P * 1/Ki *∫Edt" adds/deducts the deviation value to/from the manipulation value depending on the time in order to remove the deviation, if the difference (E) occurs between Sv and Pv. (0.0 ~ 3000)
Proportional operation for the small difference does not significantly affect the change of the manipulation value. Therefore, perform integral operation to obtain the difference removal effect.
In the above example, this value is set to 2000. It should be adjusted according to the system while running the program, like the proportional integer.

Differential integer (Kd)
The differential operation "Mv = Kp * E + Kp * dE/dt" suppresses occurrence of the difference by computing the manipulation value that is proportional to speed change, in order to remove the difference if it occurs due to the change of Sv or disturbance.
Differential time or differential integer is the time that the manipulation value of differential operation becomes that of proportional operation since occurrence of the difference by differential operation.
In the above example, this value is set to 0, which means no differential operation control. (0.00 ~ 300)

Filter coefficient (Filter)
Sets the extent that the filter effect is applied for the measurement value (PV) that is entered from the A/D card. (0.00 ~ 1)

Lower limit of MV (MV Low Limite)
Sets the lower limit of the MV that is calculated by PID operation at the time of automatic PID operation.
If the MV is smaller than the lower MV limit (MVLL), the MVLL will be applied as the MV.
In the above example, the MVLL is set to 0. Therefore, the MV smaller than 0 will not be displayed in the automatic operation mode. (0 ~ 16000)

Upper limit of MV (MV High Limite)
Sets the upper limit of the MV that is calculated by PID operation at the time of automatic PID operation.
If the MV is greater than the lower MV limit (MVLL), the MVLL will be applied as the MV.
In the above example, the MVLL is set to 16000. Therefore, the MV bigger than 16000 will not be displayed in the automatic operation mode. (0 ~ 16000)

Variation ratio limitation of MV (MV Change Limite)
The value set in this field will be applied, if MV variation is bigger than the variation ration limitation of MV, when compares MV of the previous scan with that of this scan. (0 ~ 16000)
In the above example, the variation ration limitation of MV is set to 6000. Therefore, the variation amount will be set to 6000 if the operation result is bigger than 6000.

Automatic MV transfer (0: Use, 1: No use)
Use: If the user changes the PID control mode from automatic to manual, the MV calculated in the automatic mode will be applied to the manual MV (MVman).
No use: The value set as MVman will be applied to the MV in the manual mode.

In the above example, this field is set to Use (1), MVman is equal to MV in the automatic operation mode.

SV ramp (0: No use, 1~1000)
To suppress occurrence of overshoot due to abrupt change of the Sv, and control stably, if the Sv is changed, the change is divided into the setting stage, and applied incrementally by increasing/decreasing it by the sampling interval (Ts).
If set to 00" and Sv changes, Sv is incrementally applied internally at the interval of Ts (sampling interval: 1 second), and it reaches the modified setting value after (Sv slope function: 100)*Ts (time).
In the above example, it is set to". Therefore, this function will be disabled.

ON/OFF control time(On/Off time)
Sets the On/Off interval time to control PID using On/.Off control function. (If set to On, the upper MV will be displayed as the MV.)
If the On/Off control time is set, the setting value becomes the on/off interval.
The ratio of On/Off in one interval is set by the current MV.
For example, if the setting value is 0.1 and the current MV is 80000, the On state will be kept for 0.05 second and Off will be kept for 0.05 second. Or, if the MV is set to 32000, the On state will be kept for 0.02 second, and Off state will be kept for 0.08 second.
In the above example, it is set to ". Therefore, this function will be disabled.

Setting value (SV)
Input the target value to control.
For example, if 0 ~ 100% is used as the digital value of 0 ~ 16000, set 8000 in order to set 50%.
In the above example, the temperature value is controlled. Therefore, input temperature to set * 10. For example, if temperature is 35.5℃, input 355. (0 ~ 16000)

Procure value (PV)
The current measurement value of the controlling object. The value can be read from the analog input card by the user, and the value can be updated periodically.
Double click the measurement value. (0 ~ 16000)

 

 

Specify the base that the RTD card to read its value is mounted. (Input 0, since it is the local base.)
Specify the slot that the TRD card is mounted. (Input 0, since it is the slot #0.)
Set the RTD card memory area to read. (Input 1 to use the ℃ value in the channel 1 of the TRD module. See the user memory area of the special card.)

When you click the [OK] button, you can see the complete "FROM" command.

MV (0 ~ 16000)
MV is the result value of PID operation. The user can display it on the controlling object using the analog output card.
Double click the MV.

 

 

Specify the base that the D/A card for output is mounted. (Input 0, since it is a local base.)
Specify the slot that the D/A card is mounted. (Input 1, since it is the slot #1.)
Set the D/A card memory area to write the value. (Input 1, since the D/A module channel #1 will be used. See the user memory area of the special card.)

When you click the [OK] button, you can see the complete "To" command.

Measurement value after filtering (PVnf)
A filter is used to prevent the temporary difference due to noise of the PV. The PV is filtered and saved in the measurement value after filtering (PVnf) area. At this time, if the filtering coefficient is 0, a filter is not applied to the PV.

MV Manual
If the PID mode is manual, PID is not controlled, and the value set as MVman will be displayed as the MV.

Auto/Manual selection
Selects whether the controlling object will be controlled automatically using PID, or the value set in the MVman area will be displayed.

PIDINIT state
Displays the error state occurred while initializing PID operation.

Save, Compile, and Download
Click the [Save] button if parameter setting is complete.

Select "CICON menu -> Tools -> Compile+Link".
Select "CICON menu -> Online -> Link+Download+Monitor" to download the program down to PLC.

If working is complete normally, the monitoring mode will be selected.
If you click the [Stop Monitoring] button, monitoring will be stopped and the editing mode will be selected.

Monitoring
The monitoring result value will be displayed on the window during monitoring.
If you double click the current value during monitoring, you can modify the value in the specified device area.
The modified value will be applied to PID control from the following scan.

To change the parameter during operation.
Check whether monitoring is in progress. (The current value is displayed during monitoring.)
Double click the current value of the parameter to modify.

 

 

Input the value that fits into the input value range, since it is displayed on the window together with the specified device.

PID AutoTuning
You can easily find parameters (proportional, integral, and differential integer) that are appropriate for the system, using the automatic PID tuning function.

[Note] Before starting automatic tuning, the environment should not affect the output value as much as possible. In the above example, normal temperature is recommended that the heater is not running.

Download the currently working PID program down to PLC.
Click the [Monitor] button in the PID program to enter into the monitoring mode.
Click the [Auto Tuning] button.

 

 

 

Input the setting value. (The setting value should be greater than the measurement value for the forward control, in order to complete auto tuning normally. On the contrary, it should be smaller than the measurement value, in case of the reverse control.)\
The input value in the above example (forward direction) should be greater than the value that is being measured currently. It is recommended to input the temperature set most frequently (50℃).

Click the [OK] button.

 

 

Auto Tuning is in Progress, and Auto Tuning Command is Received fields are turned on in blue color, and auto tuning is started.
The output value is fixed at the upper limit value during auto tuning.
The system response characteristic at the maximum output is checked when processing parameters.
When auto tuning is completed, Auto Tuning is in Progress, and Auto Tuning Command is Received fields are turned off, and parameters calculated by auto tuning will be displayed on current values of Proportional Integer, Integral Integer, and Differential Integer.

 

 

You will see that the current value of proportional integer and integral integer is changed.

[Note] Parameters calculated by automatic tuning on this occasion are not applied to other system. The system characteristic can also vary if the heater output or sensor location is changed in the system.
Check the message in the "Auto Tuning Complete" message window, and click the [Yes] button to apply the result value to the program.
Alternatively, click the [No] button and select the completed loop and then, click the [Read Now Value] button to apply the result value (Now value) of the selected loop to the program.

Setting values that are modified through saving, compilation, and download will be applied to PLD control.
PID auto tuning is performed for each loop. Loops other than the one performing tuning will perform normal PID control.

Linkage with the trend
Click the [Trend] button at the top of the program to populate the Trend window that shows loop setting value, measurement value, and manipulation volume.

 

 

Green line: Manipulation volume
Red line: Setting value
Yellow line: Measurement value

The above figure shows the screen that monitors the trend of forward direction heating control.

Converting PID program to LD
Click the [LD Convert] button to convert the PID program to LD.

[Note] Once the program is converted to LD, it cannot be restored.