How to Control the Temperature of a Heater using a PID Loop
This tutorial will demonstrate how to configure a PID to control the temperature of a heater using an RTD Sensor and the Digital Output from a Maple PLC.
Software Required
Hardware Required
- Maple Modular PLC’S – Any Maple Modular PLC can be used.
- IO-SA0400 – RTD Module – (If you are unfamiliar with the RTD Module configuration please refer to the How to Read Temperature using an RTD Sensor tutorial page.
- RTD Sensors – You can configure PT100, PT1000, JPT100, NI1000 RTD Sensors in MapleLogic.
Wiring Diagram
PID Control Configurations
If you are unfamiliar with a PID please refer to the What is a PID Controller? tutorial page. PID Control Program Selection
- Right Click on Program and select “New Program”.
- Select “PID Control” under Special Configuration.
- Click OK
- The PID Control Window will open.
Number of Loops – Loops Per Scan – Starting PID Control Registers
- Configure the number of loops to operate the PID. To control an object, 1 PID operation loops is used. You can use up to 32 loops.
- In the case of several loops at sampling intervals, set up the number of loops for one scan.
- Choose the initial register for you PID (ex. D0). Choose the PID Calculation starting address (ex. D100)
Operation Type: Forward Action and Reverse Action
- Forward Action is when the Process Value or PV is HIGHER than the Set Value or SV, it will increase the Manipulation Value or MV.
- Reverse Action is when the Process Value or PV is LOWER than the Set Value of SV, it will increase the Manipulation Value or MV.
- Forward Action is used for heating.
- Reverse Action is used for cooling.
Sampling Time or Sampling Interval
This is used to setup the PID calculation. Its the interval of the Process Value change while the Manipulation Value is at maximum status.
Hunting – The process of trying to reach the target value.
Kp or Proportional Gain (Refer to Proportional Control)
Configures the Proportional Gain. If the hunting value is severe, reduce the proportional value.
Ki or Integral Gain (Refer to Integral Control)
Configures the Integral Gain. If the integral gain value is large, hunting gets reduced and the time to stabilize can be prolonged.
Kd or Derivative Gain (Refer to Derivative Control)
Configures the Derivative Gain. This value is used when there is severe disturbance or the system has a quick reaction.
Manipulative Value Low Limit + High Limit + Change Rate
For the Manipulative Value, because we’re dealing with a digital output signals, this can be represented as 0 meaning the heater is off or 16,000 which means the heater is on. You could also change the low to 0 and high to 1 meaning it’s on.
MV Low Limit – This sets up the lowest manipulated value for the PID operation. If using this function, the MV can never be lower than the fixed minimum value.
Example: 0
MV High Limit – This sets up the highest manipulated value for the PID operation. If using this function, the MV can never be higher than the fixed maximum value.
Example: 16,000
MV Change Rate Limit – This sets the MV change rate limit, which compares with the change rate of current MV and the previous MV. When the change of the MV is greater than the fixed MV change rate limit, the output value is outputted as the fixed variation rate limit.
Example: 16,000
On/Off Time
On Time in a heating example, is the time the heater is turned on to increase the temperature.
Off time is the time when the heater is off allowing the system to cool or stabalize.
Set Value (SV)
This is one of the most important settings in your PID configuration because this is your target value (temperature in this example) to reach. Set this to your desired target value.
Example: 180 = 18°C
Process Value (PV)
This is the current value (temperature) of the controlled unit being read from the IO card which in this case is an RTD Module (IO-SA0400).
FROM H0001 1 D00101 1 = Instruction to read from the RTD Module
FROM = Analog Input reading (RTD Module)
H0001 = Slot 1 of the PLC Chassis
1 = Buffer Memory for using Channel 1 on the RTD Module
D00101 = Storing Memory in D101
1 = It’s 1 Word
Manipulated Value (MV)
This is the result value of the PID operation that needs to be outputted (temperature) to the control unit (heater).
This Output will be communicated by using a Ladder Diagram instruction.
In this example the Manipulated Value is the Digital Output, so it’s either On or Off. If the temperature is below the set value it will be ON and if the temperature is at the set value or above the set value it will be OFF.
Relay Tuning and Self-Learning
This option must be turned on. PID relay tuning, also known as relay feedback tuning, is a heuristic method for determining initial tuning parameters for a PID controller. This method involves using a relay as a feedback device to automatically find the ultimate gain and ultimate period of the system.
Self-Learning allows the PID to learn the trend of your system much faster. This is ideal to have the most proficient PID.
Ladder Diagram
- (F10) triggers a compare instruction; If the temperature is less than 18°C, it will turn ON Y10 (Heater). If the temperature is over 18°C, Y10 (heater) will turn OFF.
PID Online with PLC
PID Loop Initialized
- Once you are online with the PLC, the PID Loop will be initialized and live values will be shown under the Current Value.
- The Process Value will display the temperature being read from the RTD Sensor.
- The temperature is at 18.4°C and over 18°C (set value) therefore the MV will be 0, meaning that the heater is OFF.
Click “Mon View” to monitor your PID Program and view the PID trend.
PID Auto Tuning – Heater turns ON
We can use Auto-Tuning to teach the PID to turn the heater ON if the temperature drops below 18°C and how long it takes to heat back up to 18°C and then how long it takes to cool off and click the heater back ON.
- To Auto-Tune your PID, the temperature has to be below the set value (18°C).
- Enter 180 (18°C) into the Set Value. Click OK.
- In the image above the temperature drops to 17.6°C, below 18°C, therefore the heater turns ON (Y10).
- The PID Auto Tune will now attempt to reach the set value.
To see the PID Auto Tune, please watch the video at the top of the tutorial page.
PID at Target Value and Auto Tune Complete.
- Once Auto tuning is complete, it will reach the Target Value or Set Value around 18°C and the heater will turn OFF.
- Click YES to complete the Auto Tuning.
Sample Project
The project shown above was designed for the specific hardware mentioned at the beginning of the tutorial and is intended to provide you guidance when programming your unit. If you are using models other than the ones specified in this sample project, similar steps can be duplicated within your own project.
Download MapleLogic Sample Project
Resources & Documentation
Maple PLC/MapleLogic Resources
More
Tutorials
Sample Projects
See our Support Center for a complete list of Quick Start and Installation Guides