None
Your friend has been patiently waiting for a design for an automatic dam control system. They've provided you specifications for the design and now you are going to have to use your knowledge of transfer functions, including steady state and transient behavior, to design a closed-loop controller to regulate the dam's turbine speed.
In your last notebook you were introduced to the "canonical" form of a system under feedback control, which is shown in the diagram below:
In the diagram above, as labeled, the system has the following key pieces:
We saw in the last reading that the canonical feedback control system has a closed-loop transfer function:
\begin{equation} \frac{y(s)}{u(s)} = \frac{CG}{1+CGH} \end{equation}But what does this really mean? Note that the controller transfer function, chosen by the engineer, shows up in both the numerator and the denominator of the closed loop transfer function. This means that the addition of the controller and feedback to the plant changes the dynamics of the plant output. This is precisely what we want, if our goal is to improve system performance. In simple terms, $C(s)$ is a transfer function that "makes decisions" about how hard to "push" the plant based on the difference between where the system is at any given instant ($y(s)H(s)$), and where the operator wants the system to be ($r(s)$).
In this course, we will focus on variants of the PID or "proportional-integral-derivative" controller, which has the following general transfer function:
\begin{equation} C(s) = \frac{u(s)}{e(s)}= K_p + K_i\frac{1}{s} + K_ds \end{equation}The PID controller responds to the error proportionally (P-control), and/or the error's derivative proportionally (D-control), and/or the error's integral proportionally (I-control). PID control almost always includes a P-control element in the form of $K_p$, but often, $K_i$ and/or $K_d$ can be set to zero depending on the needs of the engineer and/or the plant. This week, we will focus on how variants of this general design work for simple first and second order systems. We'll use simplified examples and the so-called "direct method" of determining closed-loop system performance (see, for more information, chapters 3 and 4 of Schaum's Outline of Feedback and Control Systems or Sections 13.1-13.3 of Dynamic Modeling and Control of Engineering Systems) to build an understanding of how each type of controller works before diving into some more involved design tools that will allow us to apply these controllers effectively to more complex systems.
When synthesizing P(I)(D) controllers, we can have a number of different design goals. Some of these are listed below:
Of course, following this design process, you should try to validate your design by implementing it on the real system and see if it performs as expected.
Much of what we'll discuss roughly follows the material in Chapter 10 of Schaum's Outline of Feedback and Control Systems. We will deal with how to handle most of these design goals as needed, but it is helpful to know where we are going. To begin our journey, let's take a closer look at so-called "P-control," which is a special case of PID control with $K_d$ and $K_i$ set to 0.
Proportional control is the simplest form of the PID feedback control paradigm. This controller 'pushes' on the plant proportionally to the error between the reference input and the plant output. As the system gets closer to the desired value of the output, the controller pushes less and less hard. You might think of this controller like a "spring" that drives the plant to the desired output. For a proportional controller, the controller transfer function is a constant $K_p$. Formally, we write:
\begin{equation} \frac{u(s)}{e(s)}=C(s) = K_p \end{equation}Knowing the units of your controller's gain(s) is extremely important. Often $e(s)$ and $u(s)$ will often have different units. This means that the value of $K_p$ will assume the units needed to make a dimensional analysis work out.
For example, if $e(s)$ is a distance error measured in meters, and $u(s)$ is a voltage input to a motor measured in Volts, then the controller's proportional constant $k_p$ must have units of $\frac{V}{m}$.
Fixed Assumptions
Consider a plant $P(s) = \frac{1}{s+1}$. Design a proportional controller to make this system track a step input, and achieve steady-state in less than 1 second. The system uses a sensor that measures the plant's output $y(s)$ perfectly with a gain of $1$. After designing your controller, find the maximum controller output $u(s)$ needed for a unit step input, and find the system's steady-state error between reference input and system output.
Process
To decipher the design goal, note that we often assume that a first-order system reaches steady state in roughly 5 time constants. Therefore, we can say that we'd like our system to have a time constant of 0.2 seconds or less.
Because the problem also states that the sensing in the system is 'perfect,' we can say that $H(s)=1$ as this means the output will feed back to the system without any modifications.
We will chose a proportional controller to this system and use the canonical form of the closed loop transfer function developed from block diagram simplification. Substituting the proprotional control law and our plant into this form of $\frac{y(s)}{r(s)}$ yields
\begin{equation} \frac{y(s)}{r(s)} = \frac{K_p\frac{1}{s+1}}{1+K_p\frac{1}{s+1}} \end{equation}Clearing the fractions in the numerator and denominator by multiplying the transfer function by $\frac{s+1}{s+1}$ yields the final equation for the system's closed loop transfer function:
\begin{equation} G_{cl}(s) = \frac{y(s)}{r(s)} = \frac{K_p}{s+1+K_p} \end{equation}Now, we have to determine what value of $K_p$ will allow us to reach our design goal of $\tau<0.2s$.
Note that a first order system response can be represented generically as $\frac{A}{s+a}$. Examining the denominator, we can use it to write the characteristic equation of the system and determine the root of the equation which is the system eigenvalue.
\begin{equation} s+a=0, s=-a \end{equation}The time constant can be determined from $\tau=\frac{1}{a}$, where $-a$ represents the system eigenvalue.
In the case of our controller, we can meet the design constraints by having a time constant of 0.2 seconds so we want a system with $-a=-5$. Solving the system's closed-loop characteristic equation means solving:
\begin{equation} s+1+K_p=0 \end{equation}This yields a system eigenvalue $-a=-1-K_p$, so for our example, we know that $K_p=4$ will satisfy our design requirement. Let's simulate the closed-loop system's response to a step input on $r(s)$.
s = tf('s');
t = 0:.001:1.5;%go a little past where we said the system should be at steady state
G1 = 1/(s+1);
Kp = 4;
Gcl = G1*Kp/(1+G1*Kp);
[ysim,tsim]=step(Gcl,t);%simulate without plotting so we store variables.
figure
plot(tsim,ysim,'k')
xlabel('Time (s)')
ylabel('System Output (?)')
As you can see, our controlled system does a pretty good job of getting to steady-state by 1 second, but there's a problem... one of our design goals was for the system to track the reference input $r(s)$. Because $r(s)$ was a unit step, we might have expected that our system would reach a steady-state value of 1, but it doesn't! To show how the system's error progresses over time, we can simply take the constant value of $r(s)$ (which in this case was just 1) and subtract the system's output under closed loop control from $r(s)$, since the error signal $e(s)=r(s)-y(s)H(s)$. Alternatively, we could use some block diagram algebra to find the transfer function $\frac{e(s)}{r(s)}$ directly. I'll leave the details of this to you to try (highly recommended for practice!), but if we do the reduction, we find that the transfer function $\frac{e(s)}{r(s)}$ for our controlled system is:
\begin{equation} \frac{e(s)}{r(s)} = \frac{s+1}{s+5} \end{equation}Applying the final value theorem can get us an answer about how much steady-state error we will have in response to a unit step input:
\begin{equation} \lim_{t\rightarrow \infty} e(t) = \lim_{s\rightarrow 0} s e(s) = \lim_{s\rightarrow 0} s\frac{1}{s}\frac{s+1}{s+5} = 0.2 \end{equation}So it appears that our controller, while it does meet the requirement to reach steady state within 1 second, doesn't do a great job of tracking our reference input! Unless we're ok with $20\%$ tracking error even for a simple step input, we'll need something else to do better. Let's plot the system's error response using MATLAB/Octave:
%create our TF from e to y
G_e_y = (s+1)/(s+5);
%now see how it responds to a step input
[yey,tey] = step(G_e_y,t);
figure
plot(t,yey,'k')
xlabel('Time (s)')
ylabel('tracking error')
It appears that the error acts as we'd expect. The error signal could also have been found by simply subtracting $y$ from $r$ given our original step response. To see how much system input would have been required to achieve this step response from our controller, we need to plot the step response of the transfer function $\frac{u(s)}{r(s)}$, or in this case, we can simply multiply $e(s)$ by $K_p$. This implies that the maximum controller output needed for the unit step is $4$ "units." These units could be voltage if our controller drove an electric motor, pump, solenoid, or similar electromechanical device, for instance.
In this exercise, you will use what you now know about block diagrams, and combine it with your linearized model relating penstock valve position to turbine speed to design a proportional control system to regulate turbine speed by modulating the valve position.
This means that our design will only be valid for small requests in changing turbine speed from the turbie's NOP.
A simulator is provided for you below.
To confirm that your model fits the turbine's behavior near an NOP, re-produce the validation step from Week 4 Monday. If your model did not work well then, this is your chance to improve it. If (and only if) you do make model changes, paste them in the markdown cell below. If you do not make changes, simply reproduce your results from Week 4 Monday, section 2.2.2 in the code cell below. You must show model agreement with data on one set of axes for the following experiment:
Using the simulator, set the initial condition by beginning with the dam overflowing and the valve open at 40% before data collection begins. Allow the turbine to come to a steady state speed. Once the system is at steady state, the user presses a button, the valve percentage should be increased to 50% while data are collected for 5 seconds. Be sure the electrical system is disconnected for this test
YOUR ANSWER HERE
% YOUR CODE HERE
error('No Answer Given!')
Design a P-controller for the dam system. You know that the "correct" valve position is somewhere around 40% to achieve the total turbine speed $\Omega$ you want the dam to run at. However, you want to be more precise than this, so you implement a proportional feedback controller to help regulate the turbine's speed.
Your P-controller should modulate the change in valve position above or below 40%, which we called $\Delta u_v$ in Week 4 Monday, to slightly open or close the valve to achieve a desired turbine speed.
Your controller design goal should be to achieve a steady-state error between desired and true change in turbine speed, or $e=\Delta \Omega_d - \Delta \Omega$ of less than 20% of the requested change for a step change in desired turbine speed of 2 rad/s. All changes should occur relative to an NOP defined by a nominal valve position of $\bar{u}_v = 40\%$.
Present your hand-calculations to achieve this controller design in the markdown cell below.
YOUR ANSWER HERE
In addition to the variables such as VALVE
, VALVEPERCENT
, and REC
that you have become accustomed to using in the simulator, you now also have the ability to access the turbine's speed in radians/second by calling the variable OMEGARS
. You also now have access to a global variable called Kp
, which is initially set to 0. You can set Kp
to any value you like inside your simulator code. Finally, you now have access to a global variable called OMEGADES
, which is initially set to 0. You can set this value to anything you like to represent the desired speed for your turbine in rad/s.
These new variables will allow you to implement closed-loop control by setting VALVEPERCENT according to the current turbine speed!
The data file's structure is the same as it was for your last assignment, except that VALVEPERCENT has been added as a 7th column.
column | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
---|---|---|---|---|---|---|---|
data | time | gauge height (ft) | Pressure at penstock valve (kPa) | turbine speed (RPM) | generator volts | house volts | valve percent |
In the markdown cell below, update your data collection code to implement proportional control on valve position according to the current turbine speed. The operation should be as follows:
OMEGADES
and the actual turbine speed OMEGARS
.You should only need to update your block 4 code, so no new FSM design is required-- just a direct modification to the code will be sufficient. Properly format and paste your updated code below.
YOUR ANSWER HERE
Using the updated control code above, implement your control law on the dam. Collect data with the valve position initially open to $\bar{u}_v = 40\%$. When X1 is pressed, the desired speed should be increased by 2.0 rad/s over the turbine steady state angular velocity at the 40% valve setting.
Then, simulate your closed-loop system's behavior in response to the step change in desired turbine speed. You can use have MATLAB/Octave simulate the responses using your transfer functions and the step()
command. Plot the simulated closed-loop response and your collected data on one set of axes.
% YOUR CODE HERE
error('No Answer Given!')
In the markdown cells below, evaluate your model. Answer the following two questions.
YOUR ANSWER HERE
YOUR ANSWER HERE