Challenge with variable k; revised PCT model

[From Bill Powers (950927.2100 MDT)]

Hans Blom (950927) --

I rearranged the steps in my model so the output is calculated first, then
the feedback effects. This has the same effect as using r[i+1] in the place
where you said I had made a mistake. I disabled the "randomize" step in both
your and my program, so the disturbance table would be the same for each. I
limited the iterations to maxtable - 1. I found the best value for the
integration factor (0.45) by trial and error (that's me playing the part of
E. coli). The result, for the maximum slowing factor of 0.2, was

Bill's model, RMS error: 59.42
Hans' model, RMS error: 58.98

So your model still controls better than my model, but not so much better.

I also did a plot of the actual k and the computed k for your model. Your
model produces a fluctuating value of k that doesn't have much resemblance to
the actual values of k. In fact, for the maximum slowing factor, the computed
values of k have a much smaller range of variation than the actual values,
and are systematically lower. To a first approximation, your model is using a
constant value of k with small random variations around the mean.

However, we had already established that your model with a constant k was
very similar to mine, so this is no surprise. An integrating control system,
which mine is, is not very sensitive to differences in k (or as I call it in
my program, b). Your model behaves much like an integrating control system
with a constant k. In fact, if you force k to a value of 2.3 in your new
model, the RMS error for slow = 0.2 goes up only to 63.7 (from 59.0). So you
aren't gaining much from the adaptation of k. The reciprocal of 2.3 is 0.435
(compare with my optimum value of b of 0.45).

For the smallest slowing factor of 0.01 (smoothest changes in disturbances),
my (corrected) model actually controls better than yours:

Bill's model, RMS error: 4.28
Hans' model, RMS error: 9.49

If we look at how closely the controlled variable follows the changes in
reference signal, these differences are trivial. Expressing the controlled
variable as a fraction of the reference signal, we get

            slow = 0.01 slow = 0.2
y/r, Hans: 0.990 0.9410
x/r Bill: 0.996 0.9416

The two methods achieve control of almost identical quality over the whole
range of disturbance bandwidths.

The close similarity between our results makes me wonder whether your
approach isn't actually just some obscure transformation of mine. The great
complexity of your program, however, defeats me; I'm not enough of a
mathematician to do a rigorous comparison.

Appended is the modified code for my model.

···

-----------------------------------------------------------------------
Best,

Bill P.
{=====================================================================}
sum := 0.0;
x := 0.0;
u := 0.0;
clearviewport;
b := 0.45;

               {RUN THE MODEL MAXTABLE TIMES}
{==============================================================}
for i := 0 to maxtable - 2 do
begin
  u := u + b * (r[i] - x); { CONTROL SYSTEM }
  k := 3.0 + 2.0*d2[i]/1000.0;
  x := k * u + d1[i]; { ENVIRONMENT}
  sum := sum + sqr(r[i] - x); { ACCUMULATE FOR RMS CALCULATION}
  begin
   putpixel(i div 10, vcenter - round(r[i]/4.0),white);
   putpixel(i div 10, vcenter - round(x/4.0),lightgreen);
   putpixel(i div 10, vcenter - round(k*50),lightblue);
   putpixel(i div 10, vcenter,white);
  end;
end;
{==============================================================}
numstr := 'slowing factor = ' + numstr;
outtextxy(450,380,numstr);
setcolor(lightgreen); outtextxy(600,420,'X');
setcolor(lightblue); outtextxy(600,440,'K');
setcolor(white); outtextxy(600,400,'REF');
outtextxy(300,450,'PRESS KEY TO CONTINUE');

sum := sqrt(sum / (maxtable + 1));
str(sum:6:4,numstr);
numstr := 'RMS ERR = ' + numstr;
outtextxy(435,360,numstr);
{=================================================================}