An Introduction to PID Programming in Siemens TIA Portal
Introduction
In industrial automation, achieving precise and stable control of various processes is often a critical requirement. One common challenge is the need for effective regulation, especially in scenarios where maintaining a specific parameter such as temperature, pressure, or flow rate is essential. This is where Proportional-Integral-Derivative (PID) control comes into play. PID controllers are widely used to ensure that a system's output reaches and maintains a desired setpoint by continuously adjusting control inputs. However, configuring and programming PID controllers can be a complex task, demanding careful consideration of various factors.
Fortunately, Siemens' TIA Portal offers a comprehensive solution to simplify the implementation of PID control in your automation projects. Within TIA Portal, you'll find a ready-to-use PID function that streamlines the PID programming process. This integrated PID functionality allows you to efficiently set up and configure PID controllers for various applications, making your automation projects more efficient and precise
In this tutorial, you will learn how to set up and program PID control using TIA Portal. We will begin by creating a new project and exploring the necessary organizational blocks for PID control. Then, we'll dive into the configuration of the PID controller, covering fundamental settings such as controller type, input/output parameters, process value settings, and advanced settings. Finally, we'll walk you through the final steps of programming, including the creation of PLC tags and their integration into the PID control instruction.Â
Prerequisites
To follow this tutorial, you will need an installation of TIA Portal. We will use the latest versions to date (v18), but you can use any other version. No additional hardware or software is required.
PID programming setup
Start by creating a new TIA Porta project using your chosen 1200 or 1500 CPU. Here, we will be using a 1511-1 PN CPU. Once done, click on “Add new block” in the program blocks section of the project tree.
In the case of PID applications, we need the regulation to be executed constantly and regularly. For this, we use “Cycle interrupts” Organization Blocks. This type of OB is called and executed at a set frequency, interrupting any other current execution.
On the “Add new block” window, select “Organization block”, select “Cycle interrupt”, give the block a name, and click on “OK”.
By default, the cycle time is set at 100,000 µs (Executed each second). We will keep this value but don’t hesitate to change this value to adapt to your actual system.
Once the block is created, we come to its programming interface where we will add PID instructions.
You can find these instructions in the instruction section by opening the “Technology” part. Inside the “PID control” folder, you will find a “Compact PID” subfolder containing three types of instructions:Â
- PID_Compact: Universal instruction used to program any type of PID application.
- PID_3Step: Instruction adapted to 3-valve regulation applications.
- PID_Temp: instruction adapted to temperature regulations applications (heating and cooling).
For this tutorial, we will showcase the PID_Compact instruction for its universal nature. Select a “PID_Compact” instruction and drag it to the first network.Â
You will be asked to create an instance DB associated with the PID_Compact instruction. Then, click on “OK”.
Once done, the PID_Compact instruction will appear in the workspace. In short, there are three main interface elements: Setpoint, Input, and Output. You can notice that there are two types of inputs (Inpus and Input_PER) and three types of outputs (Output, Output_PER, and Output_PWM). You can only use one type of Input and one type of Output. Not all of them at once. You can define which input and output to use in the PID configuration.
- Setpoint: Setpoint input of the regulation.
- Input: Actual process input value (Already scaled).
- Input_PE: Peripheral process input coming directly from the analog input of the sensor (Not scaled).
- Output: Actual process output value (Already scaled).
- Output_PER: Peripheral process output coming directly from the analog output (Not scaled).
- Output_PWM: Output used in PWM mode.
- State, Error, and ErrorBits: Monitoring and diagnostics outputs.
Input and Output are used when you are working with already scaled values. Input_PER and output_PER are used when you want to work with the analog data directly from the analog inputs and outputs.
PID configuration
We are done setting up the PID instruction, we can head now to the configuring. Open the “Technology objects” section in the project tree. You will notice that a PID_Compact section has been created. Here, you can access the PID’s configuration and commissioning sections.Â
In this tutorial, we will focus exclusively on the configuration side. The Commissioning part will be covered in the PID tuning tutorial.
Open the “Configuration” in the PID_Compact section.Â
Basic settings
The first section of the basic settings is the controller type. Here, you can define which physical quantity will be regulated (Temperature, pressure, flow… etc.), which unit to use, and the PID’s operating mode.
In our case, we will pretend that we want to regulate pressure (In bars) Open the quantities list and select “Pressure”.
Next, select “bar” as the unit.
In an actual process situation, we want the PID to work automatically. For this, select “Automatic mode” in the “Set mode to” section.
The controller type configuration is now complete.
Now, let’s head to the next section of the basic settings; The Input/output parameters. Here, you can define which type of Input and Output to use (From the ones covered previously). By default, the parameters are set to the PER Input and Output.
We will consider that we are working with actual values in our system. We need to set the parameters to “Input” and “Output”. Open the Input section and select “Input”.
Then, select “Output” in the output section.
The Input/output parameters are now complete.
Process value settings
Let’s move on to the next section of the configuration; The process value settings. Here, you can define the process value limits and the process value scaling.
Open the “Process value limits” section. Here, you can define the maximum and minimum reachable process values. Typically, you would introduce your sensor’s measurement range. Here, we are considering that our sensor operates between 0 and 120 bars.
Next is the Process value scaling section. Here, you can define the scaling of the PER Input and Output as you would use the SCALE/UNSCALE functions with analog inputs and outputs. This section is enabled only when using a PER Input or Output. Since we are using regular Input and Output, This section is disabled.Â
To enable this section, change the Input section of the Input/output parameters to “Input_PER” (You could also do the same for the Output)
If you come back to the Process value scaling section, you will find that it became enabled and you can edit the high and low values (works exactly the same as the SCALE/UNSCALE functions).Â
Advanced settings
The last section of the PID configuration is the Advanced settings. First, open the “Process value monitoring” section. Here, you can define the warning limits of your process value for monitoring. For example, we set up the high limit to 100 bar and the low limit to 20 bar. If the process value exceeds the high limit, it will trigger a high limit warning. If the process value goes below the low limit, it will trigger a low limit warning.
Next is the PWM limits, Here, you can define the minimum and maximum ON/OFF times of the moduled pulse width.
After that is the “Output value limits” section. Here, you can define the maximum and minimum Output values. They are scaled as a percentage of the Process value.
The last section of the Advanced settings is the PID parameters. Here, you can define the Proportional, Integral, and Derivative parameters of your PID controller. By default, this section does not allow manual modifications.
To enable the manual editing, check the “Enable manual entry” checkbox. This will allow you to edit the P, I, and D parameters according to your specifications.
Finalizing the PID programming
We are done configuring the PID controller, we can head to the programming finalization. To do this, we will create PLC tags and introduce them in the PID_Compact instruction created earlier.
First, open the default tag table and create the following tags. Since we are using the regular Input and Output (with the actual values), be sure to define the data types as Reals.
Once done, add them to the PID_Compact instruction as shown in the following figure.
We have configured the PID controller with the Input and Output interfaces. These values are already scaled independently from the internal scaling of the instruction. The PID controller reads the Process value in the Input interface and corrects the Output interface according to the Setpoint.
Conclusion
In this tutorial, you learned how to set up and program PID control in Siemens' TIA Portal, simplifying a complex and critical aspect of industrial automation. We began by creating a new project, introducing cycle interrupt blocks, and exploring the PID function blocks available within TIA Portal. We then delved into the configuration process, covering controller type, input/output parameters, process value settings, and advanced settings. Finally, we concluded with the integration of PLC tags into the PID control instruction. Through these steps, you've gained the knowledge and skills needed to implement PID control effectively within the TIA Portal environment.
Integrating a PID compact in TIA Portal has proven to be remarkably straightforward and efficient. With its user-friendly interface and readily available function blocks, TIA Portal simplifies the setup of PID controllers in industrial projects. This integration streamlines the entire process, from initial configuration to real-time monitoring, empowering engineers and operators to achieve precise control and optimal performance in their industrial applications. As industries continue to demand enhanced automation and control capabilities, TIA Portal stands as a valuable tool in simplifying complex tasks like PID control, ultimately contributing to increased efficiency and productivity in industrial environments.
‍