With formal report (2 sessions). Due : Friday Week 11. Aim: To implement PID algorithm on the process rig. 1- Apply PD (Proportional - Derivative) algorithm to ...
Electronic Design and Automation PLC Practical - PID Control With formal report (2 sessions) Due : Friday Week 11 Aim: To implement PID algorithm on the process rig. 1- Apply PD (Proportional - Derivative) algorithm to the process rig and find out the improvements
on the system behaviour. 2- Similarly, apply PI (Proportional - Integral) algorithm and observe the improvements. 3- Combine PD and PI to create PID algorithm. Explain the improvements on the system behaviour. 4- Compare your results with theory and discuss them.
The PID algorithm should be checked by the instructor when finished. A penalty of 50% applies to the project report for unchecked results. For testing, adjust the drain vale as explained in the Proportional Control practical.
Hints: • Start with a working program for proportional algorithm from the previous prac. It is highly recommended using the variable numbers as proposed in the table at the end. • Derivative is dE/dt (E for Error). You can approximate it by ∆E/∆t. For ∆t=1 second, the derivative, ∆E, is the difference between two error values in one-second interval (Ei - Ei-1). After obtaining ∆E, you should multiply it by the derivative gain, KD (in the range 5 to 10) and add the result to the proportional term. Assume that the previous error is zero at the beginning. The effect of derivative can be observed only for a short time when the set level is increased. • Integral is ∫Edt or approximately ∑Ei∆t. For ∆t=1 second, integral is ∑Ei. Hence, you can obtain the error values (Ei) in one-second intervals and add them together to obtain the integral value. You need to multiply the summation by integral gain, KI, which is less than 1. Values of 0.1 (1000/10000) to 0.9 (9000/10000) are suitable. In this PLC, the only instruction that can multiply by a fraction is the SCL instruction. Therefore, you should assign a value in the range 1000-9000 to KI and use the SCL instruction for multiplication (also see the next paragraph). • The register that holds ∑Ei will easily overflow. As KI is less than one, it would be better to keep ∑(KIEi) rather than KI∑Ei. Hence, first multiply Ei by KI using SCL to calculate KIEi, and then add the product to the summation to get ∑(KIEi). For KI less than one, the overflow will not occur too soon. Note that both positive and negative errors should be included in the summation. Furthermore, the summation should not grow beyond an upper limit of 9000 to 12000; otherwise, it would be the dominant parameter in the voltage applied to the pump and will decrease the usefulness of the PID algorithm. As negative summation dose not improve the behaviour of the system, the lower limit should be zero. • You need to perform the calculations every second. Activate a timer using TON instruction to measure one-second interval. When the timing is finished, perform the calculation, and reset the timer by RES (Reset) instruction to start it again. Timer should only work if the pump is running. • Proportional algorithm should be updated at every PLC scan, but derivative and integral should be updated every second. • In each of the algorithms, if the sum of all appropriate terms (proportional, derivative/integral) is negative, zero should be sent to the pump. You can check the sign of N7:5, which is the sum of all the terms. • Pump offset should be added to the sum of terms before sending to the pump.
CSEM@Flinders
EDA
PID Control
• As the program gets bigger, it becomes more difficult to edit and trace. It is recommended that you combine related terms together and put them in parallel under one rung. For example, all of the calculations for derivative can be performed in one rung only. • The system parameters such as gains, limits and offset, can be only tuned by trial and error. Therefore, you should write your program in a way that they could be modified online. To do this, the parameters should be stored in registers and initialized at the beginning using ONS (One Shot) instruction (refer to the hints at the end of the previous prac). Values of the gains, offset and upper limit could be initialised directly without any other condition; however, previous error and integration sum should be initialised every time pump is started. • The program will look complicated when finished. Hence, make sure that you write enough comments for each rung just when you create it, not when the program is finished. Use short but meaningful comments. You can edit the descriptions and comments in the database file. To activate this file, right click on any instruction that already has a description, and choose Go to DataBase. For items not already in this file, you may use Add New Record option. You can also select DataBase from the project tree. • When observing the screen, you can maximise the window and reduce the size of the instructions by Zoom In option. In this way, you can see more instructions on the screen. Your printout will also look much nicer if you reduce the size on the screen, or reduce it using print preview. • You may write the program in a way that you can easily switch between algorithms (P, PD, PI, PID) online. An easy way to do this is to set KD or KI to zero to exclude them from the PID algorithm. • You should use the LEDs to show the status of the process appropriately (such as green when error is less than ±100) Use subroutines whenever possible Assigning registers: It is recommended that you assign the registers according to the following table. All the system parameters are in this table and you can view them in the Integer file window. You can adjust the number of columns in this window to 3 to match the table. Do not forget to label the registers according to their functions in the program in order to locate them easily in this window. You can change the adjustable parameters while the system is running. Note that with few exceptions, the parameters in each column are similar. For example, error values are in column 1, adjustable parameters in column 2, and gain-error products and their sum in column 3. Moreover, there are computational relationships in rows or columns. Addition/subtraction is performed in the first and third columns and multiplication is done in the 3rd and 5th rows. This arrangement makes it easier to locate or trace the parameters on the computer screen. N7:0 Set Level
I:2.0
N7:1 Pump Offset
N7:2 Sum+Pump Offset To Pump Speed (O:2.0)
N7:3 Tank Level N7:6 Error
Adjusted I:2.1
E or Ei
N7:9 Previous Error
Ei-1
N7:4 (not used)
N7:5 KPE+KD∆E+∑(KIE)
N7:7 KP
N7:8 KPE
N7:10 Upper limit for ∑(KIE) N7:11 KPE+KD∆E
N7:12 Change in Error ∆E
N7:13 KD
N7:14 KD∆E
N7:15 KIE
N7:16 KI
N7:17 ∑(KIE)
Shaded parameters should be initialized by ONS at the beginning. When pump is started, use a separate ONS to clear N7:9 and N7: 17 Warning! This practical is designed to help you understand the control concepts as well as the PLC programming and automation. By doing it step by step, you will learn gradually. In addition, help is available in the lab most of the time. However, by using resources that are not your work, you will not achieve these goals and if observed, will result in a zero in the project mark without prior notice. CSEM@Flinders
EDA
PID Control