Control objective
Continuing with the tank temperature simulator, in this second part we will program a temperature PID control in TIA Portal 18.
The goal is to act on the inlet proportional valve to keep the tank at a given temperature. The test uses a Siemens PLC simulated in PLCSIM Advanced V5.0.
Control and process variables
Before inserting the PID, the main signals of the system must be clear:
- Tank temperature: process variable we want to regulate.
- Desired temperature or SP: setpoint for the tank.
- Inlet proportional valve: variable we act on to modify the heat exchange.
Add PID Compact in TIA Portal
Add a PID Compact as a technology object in the project. For this example it is enough and keeps the setup simple. TIA Portal also includes a temperature-specific PID, useful when more parameterization is needed, such as cooling and heating regulation.
The PID is called from an OB30 Cycle interrupt. This avoids loading the main OB1 cycle with the regulator calculations.
Then link the three main variables. In this case we use the normal inputs and outputs because the process input is temperature. The _PER signals are reserved for direct percentage variables.
PID parameterization
The PID block allows adjusting inputs, outputs, limits and parameters such as Kp, Ki and Kd. In this test we use the TIA Portal commissioning tool and let the auto-tune calculate the values.
Note about real systems
In real systems, especially with more inertia or delay, it may be necessary to review the parameters manually if the basic commissioning does not give the expected result.
Commissioning and sampling
With the sensor reading correctly and the valve already tested, open the PID commissioning window.
Go online and start sampling. The temperature values begin to appear in the graph, although the PID is not regulating yet.
Disable manual mode so that the control can run automatically. This checkbox must remain disabled for the regulator to act.
System auto-tuning
There are two main modes for tuning the PID:
- Pretuning: used when the desired value is far from the current value.
- Fine tuning: used when the process is already close to the setpoint.
In this example we tune the system around 30 °C and press Start Fine Tuning. The system starts opening and closing the valve to find the regulator parameters.
The process may take longer if the system has a lot of inertia, delay or large fluid volumes.
Important note about the operating point
A PID is tuned around an operating point. If the tank range is 0 to 100 °C and it is tuned around 30 °C, it will respond better near that area and worse the further it moves away from it.
Value verification
After tuning, check the values calculated by the tool and make sure they are loaded correctly into the PLC.
These values should be saved as startup values so the tuning is not lost after restarting the PLC.
Conclusions
- It helps commissioning: the TIA Portal assistant reduces the initial work for simple controls.
- It is not infallible: systems with high inertia, long delays or indirect regulation may need finer tuning or even cascade PID.