Laboratory Book Control Systems LAB POLICY: Date: Student: Student’s Signature: ________________ Lab Report grades:___ Items Grade Assigned 1 Title Page, including lab number, date, student name, ... and references 5 2 3 4 5 6 7 Introduction Theoretical concepts System solution in lab view/block diagram Simulation Results Conclusion and recommendation Demo Total 5 20 25 15 10 20 100 The student’s grade Lab 1 DC Servo Motor: Open-Lopp and Closed-Loop Systems 1.1. LAB OBJECTIVE In this lab you will implement position control using simple proportional controllers. The response of the system to a step input will be experimentally determined and compared with theoretical values. 1.2. BACKGROUND 1.2.1. Block diagram of open-loop system Figure 1 Block diagram of open-loop position control system of a DC servomotor. The block diagram of an open-loop position control system is shown in Figure 1. The system transfer function is given by: πΎπ πΎπ π©(π ) = π (π ) π (ππ π + 1) 1.2.2. Step Response of open-loop system Consider a second order system of the form as given above with: Km = 10 Tm = 0.25 Kp = 0.1 Design a VI that looks like the panel below to show the time domain step response of the above transfer function for an open-loop system. Find: The DC gain of the plant transfer function? For a unit step input, what is the final value of the output? What is the corresponding steady-state error value? Is it large or small? What is the rise time? Draw the step response of closed loop system for different gain values of πΎπ = πΎπππ = 0.1 , πΎπ < πΎπππ (Kp=0.01) and πΎπ > πΎπππ (Kp=1). 5 3 Step Response x 10 2.5 Amplitude 2 1.5 1 0.5 0 0 0.5 1 1.5 Time (sec) 1.3.1. Block diagram of closed loop system 2 2.5 3 4 x 10 Figure 2 Block diagram of closed-loop position control system of a DC servomotor. The block diagram of a closed loop position control system is shown in Figure 2. The system transfer function is given by: πΎπ πΎπ π©(π ) = 2 π (π ) π ππ + π + πΎπ πΎπ 1.2.2. Step Response Depending on system parameters and the controller gain that we use, the step response could be oscillatory (under damped), critically damped or over damped. Critical damping condition For critical damping, the denominator of the closed loop transfer function should have equal roots. The roots will be equal if and only if 1 − 4πΎπ πΎπ ππ = 0 Or πΎπππ = πΎπ = 1 4πΎπ ππ Consider a second order system of the form as given above with Km = 10 and Tm = 0.25. 1 Then πΎπ = πΎπππ = 4πΎ π = 0.1 for critical damping. π π Draw the step response of closed loop system for different gain values of πΎπ = πΎπππ = 0.1 , πΎπ < πΎπππ (Kp=0.01) and πΎπ > πΎπππ (Kp=1). Step Response 1.2 1 Amplitude 0.8 0.6 0.4 0.2 0 0 5 10 15 20 25 Time (sec) 30 35 40 45 50 Lab 2 Design of Controllers: Proportional Integral (PI), Proportional Derivative (PD) and Proportional-IntegralDerivative (PID) Controllers 2.1. LAB OBJECTIVE The objective of this lab is to design and implement a PID (Proportional-Integral- Derivative) controller and to study the effect of integral and derivative control actions on the system. We will also learn about the importance of the bandwidth of a controller. 2.2. BACKGROUND 2.2.1. Closed-Loop Bandwidth The frequency range of input signals that a closed-loop system can track successfully without significant attenuation is called the closed-loop bandwidth of the system. It is defined as the frequency at which output amplitude/input amplitude becomes 2 / 1(or -3 dB). Example: Consider the proportional control system shown below. Let K m = 5.5, T m = 0.13, K p = 10. B B B B B B Figure 1. Block diagram of closed-loop proportional control system that controls the shaft position of a DC servomotor. The closed loop transfer function is given by: πΎπ πΎπ π©(π ) = 2 π (π ) π ππ + π + πΎπ πΎπ 2.2.3. Position control Figure 2. Position control loop Figure 2 shows a position control loop for the lab DC servomotor. A variety of control strategies, represented by the Laplace function G(s), can be used to control the shaft position. We have already seen proportional (P) control. In this section we will consider three other types of control that use not only the error of the shaft position, but also the integral and/or the derivative of this error. The three additional types of control to be considered include PI, PD, and PID control. 2.2.3.1. PI controller Proportional-integral (PI) control considers both the magnitude of the system error and the integral of this error. For the DC servomotor, by integrating the error of the shaft position over time, scaling the integral, and adding this term to the control voltage, steady-state errors in position can be eliminated that P control alone may not be able to cancel. This is the primary reason to add integral control action, to eliminate steady state error. The drawback of adding integral action is that it may have a destabilizing influence on the system response if K i is not properly selected 2.2.3.2. PD controller ii Proportional-derivative (PD) control considers both the magnitude of the system error and the derivative of this error. Derivative control has the effect of adding damping to a system, and, thus, has a stabilizing influence on the system response. U 2.2.3.3. PID controller Proportional-integral-derivative control (PID) combines the stabilizing influence of the derivative term and the reduction in steady-state error from the integral term. 2.2.3.4. Ziegler-Nichols rule for tuning a PID controller The Ziegler-Nichols tuning rule is widely used to tune PID controller gains in process control systems. For a PID controller of the form U The parameters K p , T i , and T d are calculated using the following design criteria. Ziegler-Nichols design rule B B B B B B π π πΎππ and ππππ are obtained by experiment. πΎππ is the critical gain where the shaft exhibits sustained π oscillations (marginal stability) πππ designates the period of these oscillations. For the PID control law given in Section 2.2.3.3, K p = K p , K i = K p /T i , and K d = K p T d . B B B B B B B B B B B B B B B B 2.3. PRELAB 1. Modify the LabView program you wrote in the Lab 1 prelab (question 1) so that the reference displacement signal is a sine wave instead of a step input. Use a magnitude of 250 counts and a frequency of 5 Hz. Use K of 0.004. You will vary the frequency of the reference signal and p observe tracking performance. 2. Determine the gain values for a PI controller and a PID controller using the Ziegler- Nichols π tuning rule. Use the values for πΎππ and ππππ that you experimentally determined in Lab 1. 3. Write a LabView program to implement PI position control. Use gain values obtained from Question 2. Use a step input of 500 counts. 4. Write a LabView program to implement PID position control. Use gain values obtained from Question 2. Use a step input of 500 counts. 2.4. LAB PROCEDURE 2.4.1. Exercise 1 Implement Prelab Question 1. Vary the reference signal frequency according to the following table. Plot the experimental response using your labView program. Determine the value of the output magnitude from the plots obtained. You already know the input amplitude. 2.4.2. Exercise 2 Design and implement PI position controller (Prelab Question 3). Plot the experimental step response. 2.4.3. Exercise 3 Design and implement PID position controller (Prelab Question 4). Plot the experimental step response. 2.5. Exercise 4 Compare the experimental step response curve that you obtained for position control experiments with P, PI and PID controllers. Comment on the steady state error value, oscillatory behavior (stability), and speed of response (rise time). If necessary show your reasoning on the plots. Lab 3 Design and tuning of MultiTanksFluid Level Process Controller 1. Introduction The purpose of this laboratory exercise is to give insight into elementary concepts and principles in automatic control. We shall also get closer acquainted with the PID controller, the industrially most commonly occurring controller. The lab process consists of a pump and two serially connected tanks. A PID controller is implemented in a PC and by means of this we shall control the water level in the tanks. Preparations To get out as much as possible of the lab you shall know the following concepts: ο ο ο ο open and closed loop system block diagram reference value, process output, control signal stationary error You shall also have read through this lab manual, including the appendix on the user interface. 2. Elementary Concepts This section deals with important concepts in automatic control. We shall also acquaint ourselves with the properties of the process by manually controlling the water level in the tanks. What is Good Control? The reason one wants to control a process is to have it behave in a preferred way. This could involve the process to become more exact, more reliable or more economic. In certain cases processes are unstable and good control is necessary to prevent them from breaking (which could cause large damage). Good control, consequently, means different things for different applications. When it comes to the tank process in this lab, the following requirements on the control could be suitable: ο We obviously want the real tank level to coincide with our reference (so that process output = reference value). ο If the reference value is changed we want the tank level to adjust to the new reference fast and without large overshoots. ο The control ought to handle disturbances in the form of load disturbances, when the process is affected by an external signal, and measurement noise, when the measurement of the process output contains some sort of error or disturbance. ο Finally, we don’t want the control signal to the pump to be too “jerky” because this causes unnecessary wear. These properties are usually important in most applications. Can you think of any other requirements one could impose on good control? Examination of the Process Assignment 2.1 Acquaint yourself with the lab equipment. How can we introduce load disturbances? Is there any measurement noise in the process and can we affect its extent? Mark the process and the controller together with control signal and process output in figure 2 below. Block Diagram Representation To describe a control system it can often be suitable to use block diagrams. A block diagram is a schematic drawing of a system, where one has abstracted away all properties of the different subsystems, except those one is interested in. In this case we are interested in the relation between reference value, measured process output and control signal. Aided by block diagrams, one can easier understand and analyze a process. It is of great importance to understand the relation between the real process and the block diagram. Assignment 2.2 Draw a block diagram for the lab setup when a controller controls the level in one of the tanks. Mark the process, control signal and measured process output also here. Convince yourself that you understand the relation between the components in the block diagram and the different parts of the real process. Open Loop Control We differentiate between open loop control (program control, feed forward) and closed loop control (feedback). In open loop control, as opposed to closed loop control, the value of the control signal does not depend on the measured process output. The control signal is instead based on a model or tables similar to the one below. For the tank process open loop control means that we should control the tank level without knowing the present level. Before we experiment with open loop control we first have to construct a simple model of the tank process. Log in according to your lab assistant’s instructions. Set the controller to manual mode. You can now directly affect the control signal, yourself, (i.e. the voltage to the pump) and thereby the flow to the upper tank. Assignment 2.3 Adjust the control signal so that the level in the upper tank settles at approximately 5 cm. Note the corresponding control signal in the table below. Repeat the experiment for the levels 10 cm and 15 cm, respectively. Draw a diagram where the control signal is given as a function of the level. (Don’t forget that the curve should pass through the origin!) Can you explain the shape of the curve? You may assume that the flow is proportional to the control signal. Assignment 2.4 Adjust the control signal to the pump so that the level in the upper tank settles at 10 cm. Try, guided by your model from the previous assignment, to change the level by approximately 3 cm when your partner obscures the upper tank. What happens if your partner opens the valve without informing you? Closed Loop Control Now you have access to the measured process output, i.e. the real tank level, and your visual impressions can be fed back to control the tank level, cf. figure 4. Assignment 2.5 Again, try to change the level by 3 cm. What is limiting how fast you can change the level? Observe that you should still control the tank manually! Next, try to keep the tank level constant while your partner generates load disturbances. What is preferable, open or closed loop control? Why? In the remainder of the lab we stick to closed loop control. Comparison between the Upper and Lower Tanks We shall now study how control of the upper tank differs from control of the lower tank. Assignment 2.6 Switch to the lower tank and repeat the experiments from assignment 2.5. Obscure the upper tank! What is limiting the speed? Which tank is easier to control? Why? 3. Control We shall now use different controllers to control the levels in the tanks. A controller compares the reference value with the measured process output and computes an “appropriate” control signal. P-control To start with, we incorporate a proportional controller (P-controller). The control signal u is calculated according to the following relation where r is the reference value and y is the measured process output. In our case this means that the voltage to the pump is proportional to the control error e=r-y. The constant K is usually called the gain of the controller. Assignment 3.1 We shall now examine how the properties of the controller depend on the gain K. Return to the upper tank and set the reference value to approximately 8 cm prior to each experiment. Examine how well the tank level follows changes in the reference value. Start with K =10. Increase the reference value by 3 cm. Wait until the level is constant and subsequently reset the reference value. Is there a difference in behavior between positive and negative change in reference value? Repeat the experiment with K = 3 and K = 30. How do control error and speed depend on the gain K? Increase K to 40 and repeat the above changes in reference value. Does the result differ from what we obtained with K = 30? Explain! Study how the system behaves when load disturbances are introduced. Generate both step disturbances (in the upper tank) by means of the valve and impulse disturbances by pouring water directly into the upper tank. How does the behavior change when K is varied? How is the system affected by measurement noise? Vary the gain K and study especially the appearance of the control signal. Give a reasonable value for K. Assignment 3.2 Now experiment with P-control of the lower tank. Repeat the experiments of assignment 3.1. Try for example K = 3, 10, 30. Assignment 3.3 Discuss the difference between P-control of the upper and lower tank. Are the results satisfactional? Any problems with the control? Give reasonable values of K for both cases. What constitutes an upper limit on K, for the two cases, respectively? To Think About How could one estimate a reasonable start value for K if it was not given? How could one modify the control law of the P-controller so that the stationary error vanishes? PI-control A problem with P-control is, as we have seen, that one can end up with a persisting control error. To counteract this, it is natural to increase the control signal as long as the reference value is smaller than the process output. A way to do this is to let the control signal depend also on the integral of the control error. In a PI-controller, the control signal u is calculated according to the relation where e is the control error, e = r−y. The voltage to the pump is now given as the sum of two terms. The first consists of a constant K times the control error and this term is usually called the P-part of the controller (cf. P-controller). The second term is given by a constant K/Ti times the integral of the control error. This part of the sum is consequently called the I-part (integral part) of the controller, and it changes as long as the measured process output differs from the reference value, cf. figure 5. Ti is called the integral time because it has the dimension time. Observe that Ti does not influence the integration limits. If the control signal u saturates (reaches its max- or min value) and there is a persisting control error e, the integral part could impose a problem. It continues to grow and wants to “go at it even harder” despite that the maximal control action is already issued. When the control error has vanished and it is time to crank down the control signal, it remains on its maximum because the integral has grown and obtained a too large value. This phenomenon, which can result in large overshoots or even instability, is known as integrator wind-up. The lab software therefore has a so called anti wind-up protection scheme, counteracting this. Assignment 3.4 Experiment with PI-control of the upper tank. Vary the integral time Ti and study how the responses to reference value changes and load disturbances are affected. Set K = 10 and change Ti from 50 down to 5. Assignment 3.5 Experiment with different values on K and Ti. Give a suitable setting for a PIcontroller of the upper tank. Which are the pros / cons compared to P-control? Assignment 3.6 Try PI-control of the lower tank. Can you find suitable values of K and Ti? PID-control Sometimes additional information about the process is required to obtain good control. For example the derivative of the control error gives an estimate of future values of the error, see figure 6. By letting the control signal depend also on the derivative of the control error, one obtains a control signal which increases when the error increases and decreases when the error decreases. This results in “smoother” control as one approaches the reference value. If we extend the PI-controller to include derivative action, we obtain a PID-controller where the control signal u is given by ππ The output of the controller now consists of a P-part, an I-part and a D-part (πΎππ ππ‘ ). Td is called the derivative time of the controller. It can be interpreted as a prediction horizon, see figure 6. Assignment 3.7 First try to control the upper tank with a PID-controller. Start with the best values found for K and Ti when experimenting with PI-control of the upper tank. Does control performance increase or decrease when adding the D-part? Explanation? Assignment 3.8 Try to find a good PID-setting for level control of the lower tank. Start with the best values of K and Ti found for PI-control of the lower tank. Examine the influence of the Dpart by varying Td from 5 to 50. Conclusion? 4. Tuning Methods We have now seen how the P-, I- and D-parts affect the behavior of the control system. This is of course of great importance, but when tuning the controller one also wants to know what initial values of K, Ti and Td should be chosen in order to avoid an all too lengthy tuning process. If dealing with a slow process, one could need to wait for hours, or even days, to evaluate whether the control works satisfactory. Model Based Controller Design If we have access to a mathematical model of the process, we can exploit it to calculate the controller parameters. This is usually called model based controller design and is treated in lab 2. Experimental Methods A different way to obtain controller parameters is to conduct simple experiments to gain knowledge of the process dynamics (behavior). Subsequently, known rules of thumb are used to tune the controller. The experimental methods do not guarantee good controller settings but often give reasonable initial values for the controller parameters. Today there exists a large number of different experimental methods for tuning PID-parameters. The perhaps most known, but not necessarily best, are the Ziegler-Nichols methods. Auto Tuning Today some commercial PID-controllers have built in tuning functions for automatic controller tuning. These functions are often based on some experimental method, cf. the above section. Assignment 4.1 Demonstration The lab assistant shows how an industrial controller can be used to control the tank process. Especially, auto tuning of the controller is demonstrated. 5. Summary Assignment 5.1 Summarize the most important differences between open loop control (feed forward, program control) and closed loop control (feedback). Assignment 5.2 Discuss pros and cons of P-, PI- and PID-control of the upper and lower tank, respectively. Especially, answer the following questions and fill out the below table. How is the control performance affected if the gain K is small / large? (How is the answer affected by reference value changes and load disturbances? How is the control signal affected? How is the stationary error affected?) How is the control performance affected if the integral time Ti is small / big? How is the control performance affected if the derivative time Td is small / big? Difference between the upper and lower tank? Table of suitable controller settings (bring this to lab 2!) User Interface for Labs 1 and 2 Here follows a short description of the user interface of the software which is used during the tank labs. The interface consists of two windows: the “Process window” and the “Controller window”. The Process Window This window gives an overview of the lab setup and shows how the various process objects are interconnected, see figure 7. To the right of the center line, real world objects are shown. We find for example a picture of the pump and animations of the water tanks together with blocks corresponding to the level sensors. To the left of the center line are the objects which have been implemented in the computer. Most important is the PID controller, but here are also different controls and switches. On the centerline, which constitutes a border between computer and reality, we find blocks which represent D/A- and A/D converters. These convert signals in Volts to digital numbers and vice versa (10 V corresponds to the digital number 1). By moving the cursor to locations in the window, where there are measurable entities, (electric conductor, tanks with water levels and outflows, etc.) one can see their present values in the “Probe box”, bottom right. By using the mouse and keyboard the following operations can be carried out: Manual / PID. By clicking on the upper switch one chooses between manual- and PID-control of the pump. The current control mode is indicated by the window title and the routing of the virtual wires. Upper / lower tank. By clicking on the lower switch, one can choose whether the controller should control the upper or lower tank, i.e. if the process output measurement should be taken from the upper or lower tank. Also current tank selection is indicated by the window title and the routing of the virtual wires. Reference value. The control marked r is used to set the reference value (between 0 and 1). The value is changed by pulling the triangle to the desired position with the mouse. Alternatively, one can click in the box where the present value is shown and enter a new value. Manual control. The control marked um is used to control the pump when it is driven manually. The value is changed in the same way as the reference value, cf. the above item. Optimal. This function only works when controlling the lower tank. A time optimal controller is used to change the level in the lower tank to the reference value. The function can be used fast ”reset” of the process between two experiments. The Controller Window This window shows the interconnections within the controller. Additionally, reference value and control signal are shown in two diagrams. At the upper left a block diagram of the controller is shown. By clicking the different blocks one can activate the P-, I- and D-parts independent of each other. In figure 8 the P- and I-parts are active, and we have a PI controller. The control marked r is used as before to set the reference value. At the lower left there are three controls for changing the controller parameters K, Ti and Td. Also the title of this window indicates whether the upper or lower tank is chosen and whether the pump is controlled manually or by the controller. To the right, two plot windows are shown. In the upper the reference value r is shown, while the lower shows the control signal u together with its components P, I and D. The length of the time axis corresponds to 100 seconds when the upper tank is chosen and 400 seconds when the lower tank is chosen. Observe that the upper plot can be frozen using the button “Freeze Plot”. Semester Projects Here are a list of projects for teams of 2or 3 students per project. 1. 2. 3. 4. 5. 6. 7. 8. 9. Project Proposal: (Due September 20th and 22nd ) General Formal Technical Proposal Requirements (10 Points) Bound One-inch margins, 12pt type Theme that carries through entire document All figures have titles at the bottom (Figure X. WIP Block Diagram.) All tables have titles at the top (Table X. WIP Major Deliverables.) Figures and Tables must be referenced in the document prior to their presentation, but the presentation should be as close to the first reference as possible. EXAMPLE -- As shown in Figure 1, the project will have three distinct……… NEVER use “above” or “below” in referencing a figure or table. Use color to help the reader. Don’t overuse color and never use anything but black type Each major Section should begin at the top of a new page Cover Page Project Name Project Sponsor Project Advisor Team/Company Name Name of each team member (must be on this page) Date Name and Signature of Reviewer Section I – Introduction (10 Points) A. General – Focus the reader’s attention to the importance / relevance of the problem / opportunity that has mandated the project. Start with big-picture view and narrow this to the level of the project. (2 points) B. Background – Provide the reader with information that describes the current environment and what events have caused the creation of the project. (2 Points) C. Technical Challenge – Present the major technical challenges that will need to be addressed by the project team in order to accomplish the scope of work, on time, and on budget. Use the Technical Merit Factor Table to summarize the weight assessment performed by the project team. Remember these are maximum weights – a small amount of software development is not deserving of 0.3. (2 Points) D. Benefits – Explain why this project is being conducted and what it will provide as the overall benefits to the sponsor and other stakeholders. Clearly indicate IP ownership of all intellectual property/know-how that is created as part of this project. (2 Points) E. Proposal Structure – Briefly describe how the proposal is organized. (2 Points) Section II – Project Scope (20 Points) Explain the objectives of the project. What will the project provide and what will it not provide. Explain any assumptions that have been made in planning the project. Present and describe your conceptual design using a high-level diagram that depicts general requirements for hardware, software, integration, and testing. As part of this section, include your test matrix with a discussion of how the series of tests will validate that all functional requirements have been achieved. Discussion should also describe the transition of your test matrix into a test plan which will be used to generate the test report. Section III – Statement of Work (50 Points) A. Project Design – Expand the conceptual design to provide functional block diagrams with more detailed information and figures as you present your functional design. Demonstrate understanding of design/development requirements by discussing signal characterization and algorithms to be implemented. (15 points) B. Work to be Performed – Use a Work Breakdown Structure and describe the project in terms of tasks and subtasks. WBS should indicate the inter-relationship of subtasks to tasks. Also include a Responsibility Assignment Matrix to clearly delineate each team member’s responsibility on a task-by-task basis and the number of man-hours that will be expended by each team member. (5 Points) C. Precedence Diagram. Using a Network Logic Diagram fully explain the process used to determine overall project duration and the critical path for your project. Explain what total float is and how this will impact the management of critical path tasks. Present your critical path and discuss the tasks that appear on this path. (5 Points) D. Task Schedule - Use Gantt Charts to establish the actual time line for all project tasks. The Gantt Chart information for project length, critical path and tasks must totally agree with information obtained using other project management tools. Present the summary graph of all level “0” phases and then a additional chart for each phase of the project. (5 Points) E. Milestones – At each Technical Assistance Team meeting, new milestones should represent demonstrations of work accomplished during the past week. Articulate the major milestones that will be achieved and when these milestones are scheduled to be completed. A timeline of the milestones, together with a detailed explanation of each milestone, is required. (5 Points) F. Deliverables – List and provide detailed description for ALL deliverables that will come from the project. Give a clear picture of the deliverable so that stakeholders have a good understanding of what will be received in form and quality. Because deliverables will be used as one of the primary project management tools during the execution phase of the project, this section should receive considerable attention – with ALL deliverables being presented and described in detail. A summary chart indicating each deliverable, the individual with primary responsibility and the due date associated with each deliverable must be included. In addition, a separate timeoriented graph of all deliverables must be included in the proposal. (10 Points) G. Sponsor Requirements – Present any additional requirements that the SPONSOR has generated that will directly or indirectly impact your project scope, its time, or its costs. These requirements are in addition to those imposed by this course. An example would be presenting a paper on the results of your project at a national show or conference. If no additional requirements have been generated, a statement must be included to that effect. (5 Points) Section IV - Team Organization and Qualifications (10 Points) A. Hierarchy Chart - Develop an organizational chart for your team and describe the primary duties and responsibilities of each member. B. Member Qualifications – Describe each team member’s qualifications and experience that justifies this individual’s participation in the project. Include resumes for each member as an appendix to your proposal. Take some liberty in this section to “upgrade” each team member’s experience and qualifications Project deliverables: ο¨ Complete professional documentation ο¨ All NI Simulation Printout ο¨ Hardware ο¨ Fully functional demo ο¨ Formal presentation in class ο¨ Video of the working demo (3-5 min)