[From Bruce Abbott (2014.03.21.1035 EDT)]
Bruce Abbott (2014.03.20.1540 EDT) –
BA: That online Processing IDE is wonderful! Using it exposed a flaw in my reasoning: the output of the level 2 controller should set the reference for a level 1 control system that controls, not cursor position, but rather, rate of change in cursor position. This is because the output of the level 2 controller is proportional to the error in cursor position rather than indicating the absolute position the cursor should move toward. I’ve redone the program to match the new model, but for some reason the online Processing IDE won’t let me copy it. I’m heading out the door right now so I’ll post it later.
Here is a revised diagram for the new tracking model:

And here is the Processing-language code:
// Two-level tracking control system
//----------------------------------
float i1=100, i1v=0, p1, r1, e1, o1;
float i2a, i2b=100, p2, r2, e2, o2;
float k1=.05, k2=100, s1=1;
float dt = .01;
void setup ()
{
size(100, 400);
}
void draw ()
{
background(255);
i2a = mouseY;
fill(255,0,0);
rect(30,i2a,20,5);
rect(70,i2a,20,5);
// level 2: relationship level
r2 = 0;
p2 = i2a - i2b;
e2 = r2 - p2;
o2 = k2*e2;
// level 1: cursor velocity control
r1 = -o2;
p1 = i1v;
e1 = r1 - p1;
o1 += k1e1dt;
i1v = o1;
i2b = i1+i1v;
fill(0,255,0);
rect(50,i2b,20,5);
}
Just remove the existing code in the online Processing IDE (http://semmy.me/ide/ ) and paste in the new code. (After pasting, check to be sure that a couple of extra brackets did not get appended at bottom; I have found that these cause an error.
In the new model, the level 1 cursor velocity control increases or decreases the cursor’s vertical velocity as needed to close the distance between the target position and cursor position. The physical cursor position changes as a result. Cursor position is sensed and converted to a perceptual signal just as the target position is, and both perceptions are fed into the level 2 relationship controller’s input function.
I changed the appearances of target and cursor a bit to resemble their appearance in the Delphi demo.
Bruce

