# Designing SPM motor PI controller

Thread Starter

#### alpheratz

Joined Nov 10, 2019
17
Hello everyone! Please help me to understand better how to properly control an SPM motor to have a good speed step response.
I had a laboratory session. I had many of its parameters like $$\Lambda_{mg}, J, B, R, L, T_{s}$$ where J moment of inertia of the rotor, B viscous friction of the motor, R impedance of the stator, L inductance, Ts - switching period, $$\Lambda_{mg}$$ permanent magnet flux linkage.
These parameters some were given, some were measured. J, B were given so probably are a bit wrong. In the end with speed control it was unstable so we changed to some other values of gains for PI that were much less so they probably gave more phase margin but less gain. The problem is that we didn't get those "magical" gain values in theory. They were a lot lower.

What I'm asking you here is not exactly what could be the problem in my specific case but how usually one should proceed for this type of design?
Let me tell you what we did. We have two loops to control: one for current and one for speed, therefore two PI regulators. Current loop is the inner. We used two methods but the first was applied wrongly (because of lab assistants).

1. Nichols-Ziegler method applied for a simulink model of the motor. (I know, might sound stupid but this is what they suggested).
Obviously those results didn't work well especially for the speed step response where we had an oscillation. After that I heard it works when applied to the real controller by changing gain and measuring and not to a simulink model, so whatever.

2. Laplace domain solving after calculation of transfer functions with phase margin requirement. We did it too but it didn't work well (again only for current but not for speed) because we probably had to increase phase margin. I solved it for 60° for both controllers.
To give you an idea about the accuracy of the math model. It feels pretty accurate but anyway in reality there are a lot of other non observed transfer function that's why in practice Ziegler-Nichols could work better if used properly ...

Main question, would you do the same like we did or you know other ways better for this case? From theoretical point of view should I ask for like 80° phase margin in this case? I pay for it with a lower gain in central frequencies, is this a problem? (still higher than 1 obviously).

If you say it should have worked with the second case calculations, then I think they gave us wrong parameters for J and B or the model was too approximated. This is a 24V three phase SPM motor.

Last edited:
Thread Starter

#### alpheratz

Joined Nov 10, 2019
17
What I'm focused on now is trying to get new crossover points to increase stability through the second method but what I notice is that even for Simulink those values don't always work. I think it's because of discretization. In fact when I chose a low crossover frequency (few Hz) with a 60 or 80° marginal phase, the step response for the current is stable but slow (takes like 0.5s). I try to increase the bandwith (4kHz) and then I get unstable response. I know discretization effects are always felt more in high frequency especially for the phase.

Maybe it's not the case and I'm just exaggerating. It's a simulator so it should have a really high sample rate thus decreasing discretization effects.

Thread Starter

#### alpheratz

Joined Nov 10, 2019
17
What I'm focused on now is trying to get new crossover points to increase stability through the second method but what I notice is that even for Simulink those values don't always work. I think it's because of discretization. In fact when I chose a low crossover frequency (few Hz) with a 60 or 80° marginal phase, the step response for the current is stable but slow (takes like 0.5s). I try to increase the bandwith (4kHz) and then I get unstable response. I know discretization effects are always felt more in high frequency especially for the phase.

Maybe it's not the case and I'm just exaggerating. It's a simulator so it should have a really high sample rate thus decreasing discretization effects.
MISTAKE: I've just found a mistake in parameters so don't consider this post.

#### atferrari

Joined Jan 6, 2004
4,278
Edit the post. Nobody has answered yet.