Article translated with the assistance of AI tools. Images and parts of the content will still be reviewed.
This tutorial describes guidelines and procedures to perform a simulation of a PID control for the Nexto with a Trace monitoring the input (PV) and output (MV) of the PID block, which consist of two coolers.
Components
Software: Mastertool IEC XE 3.23
PLC: XP340
Cooler: 12V and 24V
Tutorial Sections
1. ARCHITECTURE
2. DEVELOPMENT
2.1. Configuring PID block
2.2. Input and output configuration
2.3. Application logic
2.4. Configuring Trace
2.5. Configuring PID values
2.5.1. Synthesis Method
2.5.2. PID calculation variables
1. ARCHITECTURE
In the architecture of this tutorial, the Ethernet port of the XP340 was connected to the Ethernet port of the computer through the NX9202 cable. On the 12V cooler, which will be the process variable PV, the positive is connected to the analog input AI0.V and the negative is connected to terminal C3. On the 24V cooler, which will be the manipulated variable MV, the positive is connected to the fast output Q14 and the negative is connected to terminal C3 as shown in the figure below:
2. DEVELOPMENT
In this tutorial, the steps to perform a practical example of a PID block control application for the Nexto Series controllers and a trace monitoring the variables will be shown. The PID will be configured through calculations, following the Synthesis Method.
In this test, we are using a fast PWM output on the manipulated variable (MV) of the PID block and depending on the application, it can be replaced by an analog output.
It is important to have the Nexto Series Manual at hand, allowing for consultation during the application steps. This document will guide you on technical characteristics, installation, programming, and configurations.
2.1. Configuring PID block
First, the NextoPID library was inserted. Double-click on Library Manager, go to Add Library and select NextoPID, as shown in the image below.
2.2. Input and output configuration
The analog input AI0 should be configured with a type of 0 – 10 Vdc and a 10s filter, in order to reduce noise in the graphs.
The fast output Q14 should be configured as VFO/PWM.
2.3. Application logic
The logic developed for this tutorial is as follows:
On line 1, we have a MOVE block that moves the frequency of the variable at the input of the block to the fast output Q14, which is a PWM output.
On line 2, “EnablePWM” enables the PWM output.
On line 3, we have a block that will convert the AI0 input from INT to REAL at the AI0_REAL output, since the variables of the PID block we are going to use are of type REAL.
On line 4, the inserted PID block is present.
On line 5, the _DutyCicle value, which is in REAL, will be converted to USINT, which is the expected input variable type for the PWM block.
2.4. Configuring Trace
To insert the Trace, right-click on Application, go to Add Object, and select Trace...
Double-click the created Trace and go to Configuration. In the Trace window, configure as follows:
To select the variables to be monitored in the trace, go to Add Variables and define them. In this example, the variables AI0, DutyCicle, and setpoint were selected.
2.5. Configuring PID values
The application will be available at the end of this tutorial.
Set the application to Run and download the trace.
2.5.1. Synthesis Method
With the block configured, we will adjust the proportional, integral, and derivative values so that the graph becomes stable. For this, we will use the Synthesis Method, which consists of using the formulas below:
Where:
- K = Static gain
- VA2 – VA1 = Step Variation
- VM2 – VM1 = Measurement Variation (process) at the Step
- T = System time constant
- Tr = Response time (Tc/4 or Tc/3)
- Tm = Dead time
- dt = Sampling time (PLC scan);
Note: The calculations will be done using an Excel table (available at the end of this tutorial).
2.5.2. PID calculation variables
The analog input AI0, theoretically should be zeroed, but it may have a small value due to a low voltage level in the cooler.
With the project in Run, the next step is to enable manual control and write 100 to the output.
The Trace will look as follows:
The Output (AI0) has an initial value of 0% and a final value of 100%. This happens because the DutyCicle is at 100%, setting the maximum value on the output.
Add a cursor at the indicated arrow symbol and position it in a range where the blue line of the graph is stabilized. We can get the approximate speed of 8861. The initial speed is 0.
To obtain the dead time, zoom in on the initial part of the graph. With both cursors positioned, we can measure the dead time of 2.182 seconds.
The sampling time refers to the speed of the Main Task. It can be accessed in MainTask in the device tree, in this case it is 0.02 seconds.
In the image below, to obtain the stabilization time, we should position the cursor at the beginning of the graph and at the point where it is stabilized (approximate). Observing the highlighted delta in the image below we have 184 seconds (3min4s) as the stabilization time.
The 63% helps define the integral time and can be obtained by calculation or by looking at the graph. The calculated way is done through the equations shown earlier (table at the end of this tutorial).
In the Excel table, we obtain the calculated 63% value of 5601 and by positioning the cursor at this value on the graph we arrive at 15.893 seconds as the Time Constant. Reducing the Dead Time we arrive at 13.69 seconds.
With all these points configured, the table should be similar to the one below, with the values depending on the user's case.
We can disable manual control and enable the PID. The PID should be adjusted according to the values obtained in the calculations. Thus, the graph should be similar to the one shown below:
Comments
0 comments
Please sign in to leave a comment.