# Control Engineering: Model parameter estimation for a motor which will be under various loads

I am creating a closed loop controller for a motor which is part of a robotic arm. I give it a required angle, the controller calculates a control input, the motor moves, a pot feedbacks the angle, repeat, and the arm ends up at the required angle.

I am using state variable feedback, with integral action, and in order to calculate the control gains required for stability and speed I need a mathematical model of my system.

To get this model I am using statistical model identification techniques. I am inputting a random control signal into the motor, and recording this and the angle of the arm at each sample time. I'll then have sample input and output data of my system, and I can use a mathematical optimization technique to find the model parameters that best fit this data.

My Question

When under actual operation, the robot arm will be lifting a variety of weights. Does this mean the model I found with no load (intrinsic load) is invalid?

How do I get a mathematical model of this system when the load on the motor can change?

• Usually control loops are tuned under around the operational conditions. But the PID loops are usually robust enough to take care of some deviations (especially with the right tuned integral part. The Proportional only won't handle it.). If you want to increase the robustness, use several nested loops (for position control, for example, you might want to implement an internal velocity loop. For the velocity loop - internal torque/current loop). – Eugene Sh. May 19 '15 at 14:53
• You could try RLS to get a transfer function model, probably with the matrix inversion lemma to speed up the computations. RLS can work with the normal operating signals and you may not need to apply a small perturbing input. – Chu May 19 '15 at 15:20
• Both great suggestions, thank you. I will look into both. @EugeneSH Could you please explain what the block diagram for this multi-loop system will look like (e.g). I'm just a bit confused to what you mean. Also, wouldn't having more control loops mean less robustness, because you have more control gains you need to calculate, hence you need to estimate more model parameters. Surely the less things estimated the better? No? – Blue7 May 19 '15 at 15:41
• Sounds like the comments are putting you on the right path. I just want to add that you should take a moment making sure that the difference in loads is big enough to worry about before running down this alley. For example, if the motor's internal torque is much bigger than that of the load change, or if you're really geared down by driving a big honking lead screw, your control system can tolerate a whole bunch of load variability. Probably not your case, but thought I'd put it out there. – Scott Seidman May 19 '15 at 15:46
• I guess I will have to put it as an answer, since too much words.. – Eugene Sh. May 19 '15 at 15:50

• Thanks. Can I just check I have understood this correctly: When implemented, the control algorithm for the outer loop could be: y=measure position; Z=add error to previous error; u_outer=(-f*y)+(k_I*Z). Where the error is calculated by subtracting the actual position from the desired position. The implemented control algorithm for the inner loop will be: y=measure speed; Z=add error to previous error; u_inner=(-f*y)+(k_I*Z). Where the error is calculated by subtracting the measured speed from u_outer. The final step is to write u_inner to the motor pin. Yes? – Blue7 May 20 '15 at 14:34
• I am not quite sure I understand your notation. What are Z, f, y, u ? But there is something that is not exact on the diagram - the outputs/feedbacks are connected as like they were the same quantity, but actually they are different measurements of actual position/velocity/torque. – Eugene Sh. May 20 '15 at 14:40
• My example control algorithm is assuming I am using PI control, where the proportional part is proportional to the output, and not the error, as it usually is (This is still a valid method of state variable feedback). My notation is pretty sloppy to be fair. For the outer loop y will be found by reading the absolute value of the multi-turn pot connected to the pulley (i.e this is the measured position). For the inner loop y is the speed of the motor, and can be found with (Position-lastPosition)/sampletime. Z is the integral of error term. u is the control input. f & k are gains – Blue7 May 20 '15 at 14:46
• I believe your (-f*y) terms should be f*e where e=ref-y is the error. But if ref is zero for outer loop, it's ok. But for inner one it's derived from the u_outer, so you can't assume it's zero. – Eugene Sh. May 20 '15 at 14:50