Professional Documents
Culture Documents
Practices Guide
1
About Intellectual Property Right and Trademarks
Microsoft product screen shots reprinted with permission from Microsoft Corporation.
Windows is a registered trademark of Microsoft Corporation in the USA and other countries.
Company names and product names in this guide are the trademarks or registered trademarks
of their respective companies.
2
■ Introduction
This guide describes examples of using function blocks.
Omron does NOT warrant that the function blocks work properly at all times in actual programs and
machines. Please obtain the user’s manuals of the used devices and be sure to understand the important
precautions and reminders described on the manuals before attempting to start operation.
■ Intended Audience
This guide is intended for the following personnel, who must also have knowledge of electrical systems (an
electrical engineer or the equivalent).
• Personnel in charge of installing FA systems
• Personnel in charge of designing FA systems
• Personnel in charge of managing FA systems and facilities
■ Related Manuals
Cat. No. Model Manual name
W613 CP2E-E□□D□-□ CP Series CP2E CPU Unit Hardware User’s Manual
(CP2E) CP2E-S□□D□-□
CP2E-N□□D□-□
W614 CP2E-E□□D□-□ CP Series CP2E CPU Unit Software User’s Manual
(CP2E) CP2E-S□□D□-□
CP2E-N□□D□-□
W483 CP1E-E□□D□-□ CP Series CP1E/CP2E CPU Unit
(CP1E/CP2E) CP1E-N□□D□-□ Instructions Reference Manual
CP2E-E□□D□-□
CP2E-S□□D□-□
CP2E-N□□D□-□
W446 CXONE-AL□□D-V4 CX-Programmer Ver.9.□
Operation Manual
3
Practices Guide
4
1. PID Control with Autotuning Function Block
The PID Control with Autotuning Function Block executes PID control with autotuning using a temperature
sensor unit.
Process
value Set value (SV)
(PV)
PID
Initial set value Executing AT Automatic calculation by AT Manually set value
constants
Use the CP2E CPU Unit with the CP1W-TS□□□ Temperature Sensor Unit.
NB Series
CP2E-N,CP2E-S,CP2E-E Temperature Sensor Unit
Heater Temperature
SSR sensor
Specify target temperature,
monitor current temperature,
execute autotuning,
manually set PID constants,
monitor PID constants, etc.
5
1.2 Function Block to Use
The PID Control with Autotuning Function Block executes PID control, enabling stable temperature control.
• Set High limit of SV and PV and Low limit of SV and PV to the upper and lower limits of the input range of
the used temperature sensor unit. When Present value or Set value exceeds the upper or lower limit, FB
Error flag is turned ON and PID control stops.
6
• Control Period and High/Low limit of SV and PV cannot be changed after Boot flag is turned ON. Turn ON
Boot flag again when changing these parameters.
• PID constants are retained after autotuning is executed, PID constants are set using PID constants
change trigger, or power is interrupted.
2. Operating Procedure
Perform PID control with autotuning using the CP2E CPU Unit with the CP1W-TS□□□ Temperature Sensor
Unit.
3. Programming Example
Set value (SV) is the target temperature specified on the NB Series. PID control is performed using
temperature input from the temperature sensor unit as Process value (PV) to control external heating
equipment (e.g., heater) through an SSR connected to CIO 100.00 of the CP2E CPU Unit.
Temperature
SSR sensor
PID
Heater
Output ON/OFF
7
3.1 Wiring Example
Connect an SSR to the output terminal of the CP2E-N CPU Unit and a thermocouple to input 0 of the
temperature sensor unit.
2 Temperature ON F
unit OFF C
8
(2) Ladder Programming Using PID Control with Autotuning Function Block
Create a program for the PID temperature control.
9
(3) Thermocouple Open-circuit Detect program
Programming Example to Turn ON W10.00 When Open-circuit Is Detected for Thermocouple Input 1 of
CP1W-TS003
10
(4) Ladder Programming for Alarm
The alarm program is not included in the functions of this function block. Create a program if necessary.
In this example, create a program to output Alarm set value, which is a deviation from Set value (SV), to Alarm
output.
SV+H
Upper deviation set value (H)
Set value (SV)
Lower deviation set value (L) SV-L
SV+H
SV-L
While Alarm output is ON in this program, the PID Control with Autotuning Function Block continues PIC
control.
If you want to turn OFF Control output when Alarm output is turned ON, create a rung to turn OFF Boot flag
using Alarm output.
11
3.4 Setting PID Constants
1. Executing Autotuning (AT)
Autotuning (AT) automatically sets PID constants.
When Autotuning start trigger is turned ON, autotuning starts and Autotuning executing flag (AT_Busy) is
turned ON.
When autotuning is completed, AT_Busy is turned OFF, AT_Done is turned ON and calculated PID constants
are set.
Keep Autotuning start trigger ON until autotuning is completed. If it is turned OFF before completion of
autotuning, autotuning will be interrupted.
The PID constants are shown at Proportional band (P) output, Integral constant (I) output, and Derivative
constant (D) output. The set PID constants are retained when the power supply is interrupted.
12
2. Changing Proportional Band (P), Integral Constant (I), and Derivative Constant (D)
When changing the PID constants to different values,
turn ON and OFF PID constants change trigger after entering the values to Proportional band (P) input,
Integral constant (I) input, and Derivative constant (D) input.
The set PID constants are shown at Proportional band (P) output, Integral constant (I) output, and Derivative
constant (D) output.
The set PID constants are retained when the power supply is interrupted.
13
■ Practices Guide - Revision History
Revision code Date Revised content
A November 2019 Original production
14
Description of Functions
15
CPxx
100 PID temperature control: _CPxx100_ExecutePID
Basic Executes a PID temperature control with autotuning.
function
Symbol
P_On
_CPxx100_ExecutePID
(BOOL) (BOOL)
EN ENO
Boot flag (BOOL) (BOOL) Control output
ExecutePID CtrlOutput
Autotuning start trigger (BOOL) (BOOL) Autotuning executing flag
StartAT AT_Busy
PID constants change trigger (BOOL) (BOOL) Autotuning completed flag
ChangePID AT_Done
Control Period (UINT) (BOOL) FB Error flag
CtrlPeriod FB_Error
Process value (INT) (UINT) Proportional band (P) output
PV Out_P
Set value (INT) (UINT) Integral constant (I) output
SV Out_I
High limit of SV and PV (INT) (UINT) Derivative constant (D) output
HIghLmt Out_D
Low limit of SV and PV (INT)
LowLmt
Proportional band (P) input (UINT)
Input_P
Integral constant (I) input (UINT)
Input_I
Derivative constant (D) input (UINT)
Input_D
* : For details of PID control, refer to the CP1E/CP2E CPU Unit Instructions reference manual (Cat. No.
W483)
16
FB ・ The FB is processed over multiple cycles. ENO output variable can be used to check whether PID
precautions control is being executed.
・ Control Period, High limit and Low limit cannot be changed after Boot flag is turned ON.
When change these parameter, Boot flag is re-turned ON.
・ When Integral constant input is set &9999, integral operation is not executed. (PD operation)
When Derivative constant input is set &0, derivative operation is not executed. (PI operation)
・ Set without a decimal point a data including one decimal place.
Example : +250.0°C → +2500
・ Some settings can not be used in this FB depends on the temperature sensor unit.
Unit Input type Range (°C) Range (°F) When set to PV
CP1W-TS001/002 K (0) -200 to 1300 -300 to 2300 Cannot set to PV on this FB
K (1) 0.0 to 500.0 0.0 to 900.0 Can set input CH to PV
J (2) -100 to 850 -100 to 1500 Cannot set to PV on this FB
J (3) 0.0 to 400.0 0.0 to 750.0 Can set input CH to PV
CP1W-TS101/102 Pt100 -200.0 to 650.0 -300.0 to 1200.0 Can set input CH to PV
JPt100 -200.0 to 650.0 -300.0 to 1200.0 Can set input CH to PV
CP1W-TS003 K -200 to 1300.0 -300 to 2300.0 Can set input CH to PV
J -100 to 850.0 -100 to 1500.0 Can set input CH to PV
CP1W-TS004 K -200 to 1300.0 -300 to 2300.0 Can use input to PV
J -100 to 850.0 -100 to 1500.0 In this case, set data of
specified input number to PV.
This FB is used PIDAT and TPO instsuctions. So, this FB has same limitation as PIDAT and TPO.
For details of PID control, refer to the CP1E/CP2E CPU Unit Instructions reference manual (Cat. No.
W483).
PIDAT instruction’s parameters are as follows. These parameters cannot be changed.
・ Sampling period: 250 ms.
・ 2-PID parameter: =0.65.
・ PID constant change enable setting: At start of PID instruction execution and each sampling period
・ PID forward/reverse designation: Reverse action
・ Manipulated variable output limit control: Disabled (no limit control)
・ Manipulated variable output designation (when no integral operation is executed): Output 50%
・ Integral and derivative unit: Time (unit: 100 ms)
・ AT calculation Gain: 1.00 (Default)
・ Limit-cycle Hysteresis: 0.20% (Default)
TPO instruction’s parameters are as follows. These parameters cannot be changed.
・ Input read timing: Use the beginning value of the control period
・ Output limit control: Disabled
17
Application When bit A is turned ON, PID control is started to Set value 250°C. Pulse output cycle (Bit D) is 2s (&200).
example When Bit B is turned ON, autotuning will be started. Bit E is ON during executing autotuning. When finished
autotuning, Bit F will be turned ON. PID constants are set to D10, D11 and D12.
When changed PID constants manually, PID constants are set to D0, D1 and D2 and Bit C will be turned ON.
High/Low limit is set range (K: -200.0°C to +1300.0°C) of temperature sensor unit.
CtrlOutput PV
Bit D 2CH
Controlled
Device
SSR
Thermo
Heater couple
P_On
_CPxx100_ExecutePID
(BOOL) (BOOL)
EN ENO
Boot flag (BOOL) (BOOL) Control output
Bit A ExecutePID CtrlOutput Bit D
Autotuning start trigger (BOOL) (BOOL) Autotuning executing flag
Bit B StartAT AT_Busy Bit E
PID constants change trigger (BOOL) (BOOL) Autotuning completed flag
Bit C ChangePID AT_Done Bit F
Control Period (UINT) (BOOL) FB Error flag
&200 CtrlPeriod FB_Error Bit G
Process value (INT) (UINT) Proportional band (P) output
2 PV Out_P D10
Set value (INT) (UINT) Integral constant (I) output
&2500 SV Out_I D11
High limit of SV and PV (INT) (UINT) Derivative constant (D) output
+13000 HIghLmt Out_D D12
Low limit of SV and PV (INT)
-2000 LowLmt
Proportional band (P) input (UINT)
D0 Input_P
Integral constant (I) input (UINT)
D1 Input_I
Derivative constant (D) input (UINT)
D2 Input_D
18
◼ Variable Tables
Input Variables
Name Variable name Data type Default Range Description
EN EN BOOL 1 (ON): FB started.
0 (OFF): FB not started.
Boot flag ExecutePID BOOL 1 (ON): Execute PID control
0 (OFF): Not Execute PID control
Autotuning start StartAT BOOL 0 (OFF) to 1 (ON): Start autotuning
trigger 1 (ON) to 0 (OFF): Stop autotuning
PID constants ChangePID BOOL 0 (OFF) to 1 (ON): Change PID constants
change trigger manually
Control Period CtrlPeriod UINT &100 &100 to &9999 Control period of control output
&100 to &9999 : 1.00 to 99.99s
Process value PV INT +0 LowLmt to Specify input CH of temperature sensor
HighLmt unit.
Refer to “FB precautions”.
Set value SV INT +0 LowLmt to Specify target temperature
HighLmt Set without a decimal point a data
including one decimal place.
Example : +250.0°C → +2500
High limit of SV and HighLmt INT +23000 -300 to +23000 Specify high or low limit of temperature
PV sensor range. It should be set HighLmt >
Low limit of SV and LowLmt INT -3000 -300 to +23000 LowLmt. When PV and SV is out of
PV High/Low limit, FB_Error will be ON and
PID control will be stopped.
Set without a decimal point a data
including one decimal place.
Example : +1300.0°C → +13000
Proportional band Input_P UINT &80 &1 to &9999 Specify Proportional band to be set when
(P) input ChangePID will be turned ON.
&1 to &9999 : 0.1 to 999.9%
Integral constant (I) Input_I UINT &2330 &1 to &8191 Specify Integral constant to be set when
input &9999 ChangePID will be turned ON.
&1 to &8191 : 0.1 to 819.1s
&9999 : integral operation is not executed
Derivative constant Input_D UINT &400 &1 to &8191 Specify Derivative constant to be set
(D) input &0 when ChangePID will be turned ON.
&1 to &8191 : 0.1 to 819.1s
&0 : derivative operation is not executed
Output Variables
Name Variable name Data type Range Description
ENO ENO BOOL 1 (ON): FB processed normally.
0 (OFF): FB not processed or ended in an error.
FB busy flag FB_BUSY BOOL Automatically turns OFF when processing is completed.
Control output CtrlOutput BOOL Pulse outputs during executing PID control.
19
Detail of PID control
◼ Perform Autotuning after PID control is executed
PID control is executed with remained PID constants when ExecutePID is turned ON.
When StartAT is turned ON, autotuning is executed.
When autotuning is completed, PID control is executed with new PID constants calculated by autotuning.
Time chart
EN (P_On) ON
OFF
Boot flag ON
(ExecutePID) OFF
PID constants Remained PID constant New PID constants calculated by autotuning
(Out_P/Out_I/Out_D)
Control output ON
(CtrlOutput) OFF
PV
Time chart
EN (P_On) ON
OFF
Boot flag ON
(ExecutePID) OFF
PID constant Remained PID constants New PID constants calculated by autotuning
(Out_P/Out_I/Out_D)
Control output ON
(CtrlOutput) OFF
PV
20
◼ Interrupting Autotuning before completion
When StartAT is turned ON, autotuning is executed.
When autotuning is completed, PID control is executed with new PID constants calculated by autotuning.
When StartAT is turned OFF during autotuning executing, autotuning is stopped. PID control is executed with PID constants that
ware in effect before autotuning was started.
Time chart
EN (P_On) ON
OFF
Boot flag ON
(ExecutePID) OFF
Control output ON
(CtrlOutput) OFF
Time chart
EN (P_On) ON
OFF
Boot flag ON
(ExecutePID) OFF
Control output ON
(CtrlOutput) OFF
PV
21
◼ Version History
Version Date Contents
001 2019.11 New
Note
This manual is a reference that explains the function block functions.
It does not explain the operational limitations of Units, components, or combinations of Units and components. Always read
and understand the Operation Manuals for the system’s Units and other components before using them.
22