Diff. Eqns with Inputs and Proportional Control

The questions below are due on Friday September 15, 2023; 09:59: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.

Crane Control with Inputs
Figure 1: Crane traveling on a track and measuring distance to a Beacon.

Let us return to the cargo crane traveling on track above a buried beacon, as shown in the figure above. Let us assume that the crane measures distance to a beacon every ΔT seconds, with negative distances left of the beacon and positive distances to the right. In addition we will assume that we can set the crane's velocity, though that likely requires the crane to have an internal velocity feedback loop (not unlike a car with cruise control, where one can specify a speed, and the car adjusts its acceleration to maintain that speed).

If we try to control the crane's position by adjusting its velocity, and the crane has an internal velocity controller, then the combination can be summarized in the block diagram below.

Crane proportional controller.

To model how the crane moves along its track, we will represent the crane's measured distance and specified velocity as sequences, d and v respectively, where d[n] and v[n] are the nth measured distance and specified velocity. We can relate d to v with

d[n]=d[n1]+ΔTv[n1],
where d[n] and d[n1] are the measured distances along the crane's track at sample time n and n1, respectively, v[n1] is the crane velocity at the time of sample n1, and ΔT is the time between samples. Note that the above equation is exact only if the velocity is constant between sample n1 and sample n.

We denote the desired crane position (also the input to our position controller), as the sequence din, and a proportional feedback approach to control would be to set the crane velocity proportional to the difference between the desired and measured crane positions, as diagrammed in the Figure above. Then the velocity is given by

v[n]=Kp(din[n]d[n]).
where Kp is the proportional gain and din is the input, or desired, position.

In order to determine the performance of this proportional-feedback approach as a function of gain, we substitute the control formula in to the distance-velocity relation for the crane,

d[n]=d[n1]+ΔTKp(din[n1]d[n1]),
and then simplify,
d[n]=(1ΔTKp)d[n1]+ΔTKpdin[n1],
to arrive at a first-order LDE with an input, din.

We know how to solve homogenous LDEs (LDEs with no external input), but we now need to learn about including inputs.

First Order LDE's with Inputs

For any system we are trying to control, we will presumably try to influence its outputs by changing its inputs, so we will need to add an input to the homogenous LDE models we already know. In the first-order case, the general form of an LDE with an input is

y[n]=λy[n1]+γu[n1],
where λ and γ are real coefficients, the sequence u is a known input, and the sequence y is the output we need to determine.

General Solution

Performing a process known as "plugging and chugging", we can write

y[1]=λy[0]+γu[0],
y[2]=λy[1]+γu[1]=λ2y[0]+λγu[0]+γu[1],
y[3]=λy[2]+γu[2]=λ3y[0]+γ(λ2u[0]+λu[1]+u[2]),
and so on. From the three steps above, it is easy to see the general pattern,
y[n]=λny[0]+γm=0m=n1λ(n1)mu[m].

ZIR, ZSR and Linearity

We can easily see the linearity of the difference equation from the above general form. First, suppose we have three "building-block" solutions to our general first-order equation:

an equation with zero input,

ya[n]=λya[n1]
whose general solution is
ya[n]=λnya[0];
an equation with a zero initial condition and an non-zero input,
yb[0]=0yb[n]=λyb[n1]+γub[n1],
whose general solution is
yb[n]=γm=0m=n1λ(n1)mub[m],
and another equation with a zero initial condition and a different non-zero input,
yc[0]=0yc[n]=λyc[n1]+γuc[n1],
whose general solution is
yc[n]=γm=0m=n1λ(n1)muc[m].

Now suppose

yt[n]=λyt[n1]+γ(Bub[n1]+Cuc[n1]),
with intial condition yt[0]=Aya[0], where A, B, and C are three arbitrary scalar weights. Then the general solution for yt[n] is given by
yt[n]=λnAyt[0]+γm=0m=n1λ(n1)m(Bub[m]+Cuc[m]),
or reorganizing,
yt[n]=Aλnyt[0]+Bγm=0m=n1λ(n1)mub[m]+Cγm=0m=n1λ(n1)muc[m].
Substituting the "building-block" solutions for ya, yb and yc, we can readily see that yt[n] is a weighted combination of ya[n], yb[n], and yc[n],
yt[n]=Aya[n]+Byb[n]+Cyc[n],
which verifies the linearity.

Note that ya has a nonzero initial condition and its difference equation had zero input, so ya is referred to as a ZIR (for zero-input-response). Also note that the difference equations for yb and yc have non-zero inputs but their initial conditions are both zero, so we refer to them as ZSRs (for zero-state-response). In general, one can determine the response to very complicated inputs by decomposing those inputs into sums of much simpler inputs whose ZSR you might already know. So it is helpful to have a library of ZIRs and ZSRs for several "building-block" inputs, and in the sections below, we calculate a few common ones: the ZIR, the ZSR to a unit sample input, and the ZSR to a unit step input.

Zero Input Case

A robot that measures obstacle distances ten times a second is placed five meters from a wall. The robot is programmed to move with a velocity negatively proportional to the distance from the wall. We set the velocity negatively proportional to distance to the wall because a robot moving with a positive velocity is moving away from the wall. As the robot gets closer to the wall, it should slow down, but what really happens?

To model how the robot moves towards the wall, we start by representing its distance measurements as a sequence, d, where d[n] is the nth measured distance and d[0]=5. The difference between d[n] and d[n1] can be related to the robot's velocity and the time between measurements,

d[n]=d[n1]+ΔTv[n1]=d[n1]+0.1v[n1]
where ΔT=0.1 is time between distance measurements, and v[n1] is the robot velocity at the time of sample n1.

Since the robot's velocity was programmed to be negatively proportional to its distance to the wall,

v[n1]=Kpd[n1],
where Kp is the proportional feedback gain. Combining equations leads to a first-order LDE for d[n],
d[n]=d[n1]+0.1v[n1]
=d[n1]0.1Kpd[n1]
=(10.1Kp)d[n1]
where (10.1Kp)=λ is the LDE's natural frequency.

If we do not want the robot to crash into the wall, or equivalently, if we do not want d[n] to become negative, we now know that the first-order LDE's natural frequency must be non-negative. In addition, if we want d[n] to decay to zero (so that we end up next to the wall), the natural frequency must be less than one. Ensuring that 0λ<1, or equivalently, that 0(10.1Kp)<1, yields constraints on Kp as in

0<0.1Kp1
0<Kp10

Consider the following questions carefully before moving on to the next section:

  • What happens if Kp is very near but >0?
  • What happens if Kp is exactly 10?
  • What happens if Kp is 11?

Unit Sample Input Case

A delayed unit sample with delay n0 is given by

u[n]=0nn0u[n]=1,n=n0,
for which we use the compact notation u[n]=δ[nn0].

As a formal matter, systems described by LDEs are completely characterized by the output due to a unit sample input, referred to as the unit sample response, but that is a digression for us. Formality aside, we can reason about systems by examining their response to a unit sample.

If y[0]=0, and the input is a delayed unit sample, u[n]=δ[nn0], then y[n] has a familiar power series form that can be derived in a few steps.

For nn0, y[n]=0, and for n=n0+1,

y[n0+1]=γu[n0]=γδ[n0n0]=γ

For n>n0+1, u[n]=0 and therefore y[n]=λy[n1], the generating difference equation for the power series. Iterating yields

y[n]=(λ)nn0γλn>n0.
a form very similar to the solution of the homogenous case with non-zero initial conditions.

In the stable case, that is if |λ|<1,

limny[n]=y[]=0.

Unit Step Input Case

A delayed unit step with delay n0 is given by

u[n]=00n<n0u[n]=1,nn0,

for which we use the compact notation u[n]=us[nn0]

Given a unit step input, u[n]=us[nn0], and y[0] is still zero, then y[n]=0nn0 and y[n0+1] must equal γu[n0]=γus[n0n0]=γ. For n>n0+1, u[n]=1 and therefore

y[n]=λy[n1]+γ.

If we write out the terms, we can see the pattern,

y[n]=0, for n=n0
y[n]=γ, for n=n0+1
y[n]=λγ+γ, for n=n0+2
y[n]=λ2γ+λγ+γ, for n=n0+3.

Iterating yields a representation of y as a power series sum,

y[n]=m=n0+1n(λ)mn0γλn>n0.

In the stable case, that is |λ|<1,

limny[n]y[]=γ1λ

which can be seen by summing the series.

Determining the large N limit

For the stable case, |λ|<1, if the input eventually becomes constant, such as in the delayed unit step, we are often only interested in behavior for large n. If so, there is an easier approach to determining y[], a surprisingly useful trick more generally.

Suppose u[n]=1 for n>n0 and |λ|<1. In this stable, constant input, case, y[n] and y[n1] both approach y[] for large n, so

y[]=λy[]+γ,
and solving for y[],
y[]=γ1λ.

There are many ideas hidden in the above simple formula, and they are best exposed by answering questions.

Questions:

  1. Given γ>0 and u[n]=us[n], if λ=1 does y[n] remain bounded?
  2. For the λ=1 case, does y[] exist?
  3. Does y[n] remain bounded if λ=1?
  4. Given γ>0, and u[n]=us[n], what value of λ minimizes y[] when it exists, and what is that minimum value.

Answers:

  1. Yes, y[n] is bounded.
  2. No, y[] does not exist as y[n] alternates between 0 and γ forever.
  3. If λ=1, y[n] is unbounded, and y[] does not exist.
  4. Setting λ very close to 1 minimizes y[], which is bounded from below by γ2. But then y[n] oscillates and decays very slowly.

And one last use of y[], we use it to construct the entire step response. If y[0]=0, u[n]=us[nn0], and |λ|<1, then y[n]=0 for nn0 and

y[n]=(1λnn0)y[]n>n0.

In the Figures below we show the behavior of the step response for several different values for λ. Notice the large n values in the plots. For example, even if λ<0, the large n value is still positive.

Delayed step response for λ=0.9 and n0=3.
Delayed step response for λ=0.3 and n0=3.
Delayed step response for λ=0.3 and n0=3.
Unit step (no delay) response for λ=0.9 and n0=0.
Exercises

For the following problems,

v[n]=λv[n1]+u[n],
where u[n] denotes the unit step, and
u[n]=0forn<0
and
u[n]=1forn0.

A:

B:

C:

D:

E:

F:

For which plots above is |λ|=1? (Enter the letters below, separated by commas.)

For which plots above is λ<0? (Enter the letters of the plots separated by commas below:)

For which plots above is |λ|<0.5? (Enter the letters of the plots separated by commas below):

For what value of λ is the limit as n of v[n] equal to:

5:

100:

56:

59:
Consider a feedback system in which v is being controlled so that it tracks w, where
w[n]={0if n5,1if n>5

A model for a proportional feedback system is given by the difference equation

v[n]=v[n1]+ΔTKp(w[n1]v[n1])
where ΔT=0.01 is the time between samples. A difference equation of this form could be a model for velocity control, where v is the velocity and Kp(w[n1]v[n1]) is the acceleration due to proportional feedback. Below are plots of the response of the system for different values of the proportional gain Kp:

A:

B:

C:

D:

E:

F:

G:

H:

Enter the letter of the plot above that corresponds to v[n] when Kp=10

Enter the letter of the plot above that corresponds to v[n] when Kp=50:

Enter the letter of the plot above that corresponds to v[n] for Kp=150:

Enter the letter of the plot above that corresponds to v[n] when Kp=200: