1st-Order Differential Equations and Proportional Control

The questions below are due on Friday March 06, 2020; 10:00:00 AM.
 
You are not logged in.

Please Log In for full access to the web site.
Note that this link will take you to an external site (https://shimmer.mit.edu) to authenticate, and then you will be redirected back to this page.

Homogenous First-Order Equations

When we studied difference equations, we started with the first-order homogenous difference equation,

y[n] = \lambda y[n-1],
whose solution is given by
y[n] = \lambda^n y[0],
where we usually assume that y[0] is known. But the relation holds more generally. That is, given y at any value n_0,
y[n+n_0] = \lambda^{n} y[n_0].
The existence of a solution satisfying the difference equation and the initial condition is established,
if \;\; w[n] = \lambda^n, \;\;\; then \;\;\; w[n-1] = \frac{1}{\lambda} w[n],
and
w[0] = 1.

Solutions to first-order homogenous differential equations are quite similar. If

\frac{d y(t)}{dt} = \lambda y(t),
then
y(t) = e^{\lambda t} y(0),
where the initial condition, y(0), is usually assumed known. But the result holds more generally. That is,
y(t+T) = e^{\lambda t} y(T).
Existance is easily established by noting that
if \;\; w(t) = e^{\lambda t}, \;\;\; then \frac{d w(t)}{dt} = \lambda w(t),
and
w(0) = e^{\lambda 0} = 1.

Comparing DT and CT Natural Frequencies Recall that if

y[n] = \lambda y[n-1],
then \lambda is the natural frequency of the DT system. If \lambda < 0, then y[n] oscillates and if |\lambda| < 1, y[n] decays to zero.

If

\frac{d y(t)}{dt} = \lambda y(t),
then we say \lambda is a natural frequency of the CT system. The term "frequency" might seem odd, because for any real \lambda, y(t) never oscillates, but is a decaying or growing exponential, depending on the sign of \lambda, as in the figure below.

Figure 2: $e^{0.02t}$ (purple) and $e^{-0.02t}$ (yellow) versus $t$

As we saw for DT systems, and we saw in prelab03 for CT systems, higher order difference or differential equation systems have natural frequencies that are roots of polynomials, so even real equations can have complex natural frequencies. But we will return to the higher-order case later, for now, let us consider an example of proportional feedback leading to homogenous difference or differential equations.

Continously Crane

Figure 2: Crane traveling on a track and measuring

Let us return to the cargo crane traveling on track above a buried beacon, as shown in Figure 2. Suppose we must decide between two control systems, a discrete-time controller that measures distance to the beacon every \Delta T seconds, and a continuous-time controller that measures the distance continuously. One way to compare the two systems is to examine the problem of returning the crane as rapidly as possible to "home" position, that is, back to the beacon at d = 0. And for this comparison, we are going to assume that the crane has an internal feedback controller, one allows us to design a controller that senses position and controls crane velocity (as show in Figure 3 below).

Figure 3: Crane DT proportional controller.

Model

For our velocity-controlled crane with discrete-time sensor,

d[n] = d[n-1] + \Delta T \cdot v[n-1],
where d[n] = d(n \Delta T) is the distance from the beacon at time n \Delta T, and v[n-1] is the crane's constant velocity from from (n-1)\Delta T to n \Delta T.

If we use proportional control to return the robot back to the beacon (d=0), then the DT controller velocity at n \Delta T is given by

v[n] = -K_p d[n],
and the combination of controller and plant leads to a homogenous difference equation for d,
d[n] = (1-\Delta T K_p) d[n-1].

For the continous-time controller, crane distance and velocity are related by a derivative,

\frac{d}{dt} d(t) = v(t),
where d(t) and v(t) are the robot's distance and velocity at time t. If we use proportional control to return the robot to the beacon,
v(t) = -K_p d(t),
leading to a homogenous differential equation for d,
\frac{d}{dt} d(t) = -K_p d(t).
Note that the solution to the CT homogenous equation is
d(t) = d(0)e^{-K_p t}
where d(0) is the initial distance from the beacon. Note that
\lim_{t->\infty} d(t) = 0
for any K_p > 0. That is, for proportional control on a first-order CT system, THE FEEDBACK SYSTEM IS STABLE FOR ANY POSITIVE GAIN .

DT to CT Comparisons

Suppose the cranes are being independently monitored with remote LIDAR, which measures the distance between the crane and the beacon every ten seconds. A test was run using the CT controller with an unknown proportional gain K_p, in which two consecutive measurements from the LIDAR system (which we can denote as d(t) and d(t+10)) gave distances of 200 meters and then 10 meters between the beacon and the crane.

What was the third consecutive LIDAR measurement, d(t+20), and to within one percent, what was the controller gain, K_p, in meters per second?

d(t+20)=

Kp=

Suppose we want to test the DT controller with \Delta T = 0.1, then \Delta T = 0.5, and finally with \Delta T = 10 seconds. Determine the three values of K_p we should use if we want to match the measured performance to the CT system. That is, if d[n_0] = 200 meters, and n = \frac{10}{\Delta T}, then then d[n+n_0] = 10 meters (so n=100 for \Delta T = 0.1, n=20 for \Delta T = 0.5, and n=1 if \Delta T = 10). Determine the three gains, K_p, in meters per second (answers should be within one percent).

If \Delta T = 0.1, then K_p=

If \Delta T = 0.5, then K_p=

If \Delta T = 10, then K_p=

Check Yourself 1:

Suppose we know the same proportional gain, $K_p$, was used for a CT and a DT controller, and we know LIDAR monitor read $d(t) = 100$ and $d(t+10) = 10$ for the CT controller. What is the largest $\Delta T $ (of $\Delta T$'s that are an integral divisor of $10$) so that $d[n_0] = 100$, $d[n_0 + \frac{10}{\Delta T}] = 10 $ to within ten percent? This problem requires a bit of trial and error.

Fast and Slow Sampling limits

If \Delta T is small, so the sample rate for the DT system is fast, how close are the behavoirs of the DT and CT crane control systems? As we noted more generally above,

d(t+\Delta T) = e^{-K_p \Delta T} d(t),
so
d(n \Delta T) = (e^{-K_p \Delta T}) d((n-1)\Delta T).
We can compare the above "samples" of the CT system to the DT system's behavior
d[n] = (1 -K_p \Delta T) d[n-1].
If we define the difference between the sampled CT system and the DT system as an "error", e[n] \equiv d[n] - d(n \Delta T) , then we can write a difference equation for that error as
e[n] = \left[(1 - K_p \Delta T)-(e^{-K_p \Delta T})\right] e[n-1].
When |K_p \Delta T| << 1, we can Taylor expand the exponential and show that the term in brackets is of the order of (K_p \Delta T)^2, so the error will remain small. But for larger \Delta T's, the DT and CT systems have very different behavior.

For example, in the CT crane control problem, we can pick a gain, K_p, that will reduce the distance to the beacon by a factor of ten in one millisecond. What would that gain be?

The CT gain that reduces distance to beacon by factor of ten in one millisecond, K_p= :

For the CT case, fast response corresponds to a very negative natural frequency, and in the DT case, fast response corresponds to a natural frequency whose magnitude is near zero. We can pick a K_p for the DT case that will give us a natural frequency of exactly zero, and ensure a one-step return to the beacon. Such controllers are sometimes referred to as dead-band controllers. What is the value of the natural-frequency-zeroing K_p as a function of \Delta T? (use a python expression, and use 'dt' to for \Delta T.)

Enter a python expression for Kp as a function of dt.

Check Yourself 2:

How do the above $K_p$'s compare if the DT case has a one millisecond sample period? How do the distances from the beacon compare?

Dead-bang and Uncertainty

If \Delta T is small, then using the K_p which gives a DT natural frequency of zero can become impractically large. So it might seem like using a long \Delta T, like the \Delta T = 10 case above, would yield a zero natural frequency and a reasonable gain. But consider the crane velocity right before the update when moving from d[n_0] = 200 to d[n_0+1] = 5 meters. With K_p = 0.1, the velocity jumps from 20 meters per second to 0.5 meters per second, hardly smooth deceleration.

But there is a more serious issue associated with the dead-bang approach. What if someone puts much larger tires on the crane, so that the relation between velocity and position from proportional control gets scaled by an uncertain \gamma, as in

v[n] = \gamma(-K_p d[n]).
The resulting difference equation for distance from the beacon, including the uncertain \gamma is
d[n] = (1-\Delta T \gamma K_p) d[n-1].
If we pick K_p = \frac{1}{\Delta T}, but the uncertain \gamma is somewhere between 0.5 to 1.5, what will happen to d[n]? Will the crane be driven past the beacon and have to turn back? Will its position oscillate?

What would the CT system's response look like in this case?

First-Order CT Systems with inputs

For any system we are trying to control, we will presumably try to influence its outputs by changing its inputs, so lets add an input to the homogenous first-order CT model above.

\frac{d}{dt} y(t) = \lambda y(t) + b \; x(t)\;\;,
where \lambda and b \; are real coefficients, x(t) is a known input.

We are often interested in responses to step changes in input, as in

x(t) = 0\;\;\;t < t_0\\ x(t) = 1\;\;\;t \ge t_0
or more compactly,
x(t) = u(t-t_0),
where u(t) is the unit step defined as
u(t) = 0\;\;\;t < 0\\ u(t) = 1\;\;\;t \ge 0
If we assume that y(0) = 0 and x(t) = u(t), then y(t) = 0 \;\;\; t \lt t_0, but what happens after t_0?

Let us start with what we learned in prelab03, that there is a system function, H(s), that we can derive by noting that if x(t) = Xe^{st} for all time, thenthere is a solution of the form y(t) = Ye^{st}, and the system function, H(s), such that

Y = H(s) X.

For the above first order case, it is easy to see that H(s) is given by

H(s) = \frac{b}{s-\lambda}.
From prelab03, we also learned that the natural frequencies of a linear differential equation system are the roots of the denominator polynomial of H(s). For our first-order system with H(s) = \frac{b}{s-\lambda}, \lambda is the root of the denominator polynomial, and therefore is the natural frequency this case.

We also learned in prelab03 that in general for an initial condition problem, where we know y(t) for t = 0, the total solution for t \ge 0 is the sum of a homogenous solution and a particular solution. When applied to our first-order case, with only one natural frequency \lambda, we get

y(t) = Ae^{\lambda t} + H(s_0) Xe^{s_0t} = Ae^{\lambda t} + \frac{b}{s_0 - \lambda} Xe^{s_0t},
where x(t) = X e^{s_0 t} and A is determined from matching the initial condition for y.

If x(t) = u(t), then for t \ge 0, x(t) = e^{s_0t} for s_0 = 0. Since H(0) = \frac{b}{-\lambda},

y(t) = Ae^{\lambda t} + H(s_0) Xe^{s_0t} = \frac{b}{- \lambda} \left(1 - e^{\lambda t} \right),
where the rightmost equality is derived by selecting A to match y(0) = 0.

A plot of the step response for b = 10 and \lambda = -100 is given below. Note that the step response settles to \frac{b}{-\lambda} as t \rightarrow \infty, and has risen to about two-thirds of the steady-state at t \approx \frac{1}{-\lambda}.

What happens if x(t) = u(t-t_0)? If y(0) = 0 and x(t) = 0 for t \lt t_0, then y(t) = 0 for t \lt t_0 and

y(t) = \frac{b}{-\lambda}(1 - e^{\lambda (t-t_0)}) \;\;\; t \ge t_0.
It is easy to verify that the above y(t) satisfies the differential equation, or one could redo the analysis with a redefined time, \tilde{t} = t - t_0. But since there is no single s_0 that will make Xe^{s_0t} equal to u(t-t_0), we would have to consider representing x(t) with a weighted combination of exponentials. And the right mathematical tool to find those weighted combinations is the Laplace transform, as we will see in a few weeks.

Crane Control with Inputs

If we want to move the crane to positions other than the beacon position at d=0, we will need to specify a desired position along the track. The desired position, which we will denote as d_{in}(t), will become an input to our position controller, which will try to keep the drane position, d(t), close to the desired position d_{in}(t).

A proportional feedback approach to controlling the crane's position would be to make the crane velocity proportional to the difference between the desired and measured crane positions, as diagrammed for the DT case in the figure above. Then the velocity is given by

v(t) = K_p(d_{in}(t) - d(t)).
where K_p is the proportional gain and d_{in}(t) is the input, or desired, position at time t.

In order to determine how the performance of this proportional-feedback controller changes with as we increase or decrease gain, we substitute the control formula in to the distance-velocity relation for the crane,

\frac{d}{dt} d(t) = K_p \left( d_{in}(t) - d(t) \right),
and then reorganize as
\frac{d}{dt} d(t) = - K_p d(t) + K_p d_{in}(t).

Check Yourself 3:

If $d(0) = 5$ meters, and $d_{in}(t) = 1$, what is the exact solution for $d(t)$ as a function of $K_p$?

We will continue our investigation first-order systems with inputs, but switch to the context of operational amplifiers.