Simple integral model

[From Bill Powers (950516.0530 MDT)]

Hans Blom (950516) --

RE: simple control model

I must say, you've done your best to make the model fail. I had specified
"reasonable" disturbances, and you came up with the most extreme ones you
could find, both as to magnitude and frequency.

In 1) d = 10 * round (sin (0.3 * iteration)), you present the model with a
series of square waves of +/- 10 units amplitude. The model does not do very
well with steps having a rise time of 20 units in 1 iteration, with the
reference signal set to only 10 units, although 1 iteration after each step
it has corrected the error completely and maintains the correction until the
next step.

In 2) d = (iteration - 10) mod 10, you present a series of sawtooth waves
with a rise time of 10 iterations (changing in steps of 1 unit per iteration)
and a fall time of 10 units in 1 iteration. The model keeps the error down to
1 unit during the rise, and limits the 10-unit error during the fall to a
single iteration.

In 3) d = iteration (start of very low frequency triangle waveform), you
present the control system with a disturbance that rises from 0 to 640 units
in 1-unit steps over 640 iterations. The error on the last iteration is 1.6
units, and on the first iteration is 1 unit. The 1 unit error is due to the
fact that the disturbance is increasing by 1 unit steps in each iteration.
The error is caused to rise by 0.6 additional units by the disturbance of 640
units (64 times the size of the reference signal). Without the opposing
output, the final error would have been 630 units, compared with the actual
1.6 units.

In 4) d = iteration^2 (start of quadratic periodical waveform), the error
increases in steps that start with 1 unit per iteration and end with 640
units per iteration. The final error is 1600 units, where without the
opposing output it would be 409,590 units.

Actually I think my control system did quite well, considering the extreme
behavior of the disturbances. In the "clincher" example (4) it was able to
keep the error to 0.0039 of what it would have been without the opposing
output. When the disturbance was rising in steps 1 unit per iteration, the
error was kept to 10% of the reference signal magnitude.

···

-----------------------------------
Most of the "large" errors you see are an artifact of setting the reference
signal to 10 units, which is only 10 times the minimum disturbance step. If
you set the reference signal to 1000 units, you will see quite a different
story.

In order to speak about "reasonable" disturbances, we have to discuss scaling
and how physical time is modeled. Before we get into that, however, I would
like to give you a chance to see the effect of simply changing the reference
signal to a larger value.

The appended program applies each of your disturbances to the control system
with its reference signal set to 1000 units instead of 10. Everything else is
the same, except that I have taken the liberty of dividing the fourth
disturbances by 160 to keep from overflowing the integers needed for the
plot. The maximum disturbance is still 4 times the size of the reference
signal in terms of effect on p and qi. I used both p and qi just to make a
formal parallel with our usual model.

After each plot, hit any key for the next one.
------------------------------------------------------------------------
program simpsys;

{
A simple integrating control system
}

uses dos,crt,graph,grutils;

var
    MaxX, MaxY, Xcenter, Ycenter: integer;
    p,qi,r,e,o,d: real;
    i,j: integer;
    ch: char;

procedure InitScreen;
begin
  ClrScr;
  InitGraphics;
  MaxX := GetMaxX; MaxY := GetMaxY;
  Xcenter := (MaxX+1) div 2;
  Ycenter := (MaxY+1) div 2;
  OutTextXY(20, MaxY-50, 'Press ESC to Quit...');
end;

procedure ctsys;
begin
p := qi;
e := r - p;
o := o + (1000.0 * e - o)/1001.0;
qi := o + d;
end;

begin
Initscreen;
r := 1000.0;
for j := 1 to 4 do
begin
  setcolor(lightred);
  outtextxy(0,100,'Reference level (1000)');
  setcolor(white);
  outtextxy(0,120,'p and qi');
  setcolor(lightgreen);
  outtextxy(0,140,'Disturbance');
  setcolor(white);
  for i := 0 to MaxX do
  begin
   d := i;
   case j of
    1: begin
        d := 10 * round(sin(0.3*i));
        if i = 0 then
        outtextxy(0,0,'d := 10 * round(sin(0.3*i))');
       end;
    2: begin
        d := (i - 10) mod 10;
        if i = 0 then
        outtextxy(0,0,'d := (i - 10) mod 10');
       end;
    3: begin
        d := i;
        if i = 0 then
        outtextxy(0,0,'d := i;');
       end;
    4: begin
        d := d*d/160.0;
        if i = 0 then
        outtextxy(0,0,'d := iteration*interation/160.0');
       end;
   end;
   ctsys;
   putpixel(i,maxy - 20 - round(0.4*r),lightred);
   putpixel(i,maxy - 20 - round(0.4*qi),white);
   putpixel(i,maxy - 20 - round(0.4*d),lightgreen);
   putpixel(i,maxy - 20,lightgray);
  end;
  ch :=readkey;
  clearviewport;
end;
restorecrtmode;
closegraph;
end.

[Martin Taylor 950516 11:00]

Bill Powers (950516.0530 MDT) and Hans Blom (950516)

The models you are throwing back and forth do not seem to be realistic
models of continuous systems. Much of their behaviour is likely to be
due to computational artefacts, which obscures the main message of
Hans's "difficult disturbances" and of Bill's model's (in?)ability to
compensate for them.

In a model that simulates a continuous waveform, you cannot represent a
step function legitimately. You cannot represent a waveform that has ANY
frequency components with a period less than two compute iterations, and
you can only deal with them if you use a filter that has an infinite
impulse response. If you are going to treat the sampled data raw, you have
to ensure that the highest frequency in any of the signals modelled has
a period very long compared to two samples--say 10 or 20 samples minimum.
Hans's disturbances are therefore, for the most part, illegitimate
waveforms to apply to Bill's model. The results say nothing about how
the modelled continuous control system behaves.

On the other hand, Bill's model is not representative of any real control
system, because real systems do not have infinite power available, and the
model assumes that numbers can grow without bound. But Bill finds that
unless he plays a trick, even his computer model lacks power and will fail
to control, because of the limited word length of his integer computation:

The appended program applies each of your disturbances to the control system
with its reference signal set to 1000 units instead of 10. Everything else is
the same, except that I have taken the liberty of dividing the fourth
disturbances by 160 to keep from overflowing the integers needed for the
plot.

The "real" control system that the model emulates would be unable to tell
the disturbances to reduce themselves by a factor of 160, just because its
muscles were not strong enough.

This "liberty" taken with the model makes Hans's point, that assumptions
about the disturbances are implicit in the structure of the control system.
Had Bill's "knowledge and prediction" (of the disturbances that the control
system would be asked to deal with) been more accurate, he might have
programmed the model with a longer word length.

The models do not speak to the "knowledge and prediction" of the high-bandwidt
disturbances, because such signals cannot legitimately be represented. But
the word-length limitation does mimic the limits that must exist on the
force designed (or grown into) control systems to counter disturbances in
the real world.

Martin