Other Parts Discussed in Thread: DRV8301, MOTORWARE
Hi all,
I'm having some difficulties running instaspin-foc at moderately (~1 kHz) speeds; above around 800Hz the current controller requires a very high setpoint current to increase the (unloaded) motor, the motor speed rapidly increases to 1100Hz, and the motor speed reported by FAST decreases to around 750Hz. I'm using a custom hardware platform, fairly similar to the DRV8301 high current kit. I've set up instaspin with the following settings;
IQ_FS_FREQ_Hz; 2000
IQ_FS_VOLT_V; 80
ADC_FS_VOLT_V; 68
IQ_FS_CURRENT_A; 700
ADC_FS_CURRENT_A; 330 (aiming for peak motor currents of around +-120A)
NUM_CURRENT_SENSORS; 3
SYS_FREQ; 90 MHz
PWM_FREQ; 60 kHz
MAX_DUTY_CYCLE; 1.309401076758503
NUM_PWM_TICKS_PER_ISR_TICK; 3
ISR ticker per CTRL/CURRENT/EST tick; 1
CTRL ticks per SPEED/TRAJ tick; 20
VOLT_FILTER_POLE_Hz; 328
From what I've been able to determine this seems like a reasonable set-up, with FAST running at 20kHz and a maximum electrical motor frequency of 1/10'th of this (in practice I'm expecting to, at most, go to around 1400Hz).
The motor I'm using is a relatively generic low-inductance hobby PMSM motor with identified parameters of Rs = 9mR, Ls = 10uH, flux = 0.016VpHz, and 7 pole pairs. I'm running at a DC bus voltage of 30V for now, which would suggest that I would be able to achieve around at least ~1440Hz.
For testing purposes I'm using a very soft, purely proportional, controller with a mechanically unloaded motor. (I have performed the same tests with a torque-mode controller and arrived to the same results.)The table below summarizes some simple measurements performed. At speeds below 780Hz instaspin functions as expected, this behaviour is only apparent at these speeds. As the setpoint increases the speed reported by FAST starts to differ (and is less than) the actual speed as measured with an external tachometer. When commanding a speed of 875Hz, the motor speed rapidly increases up to 1100Hz, while the speed reported by FAST *decreases* (which leads to an increased output from the P controller).
| Setpoint speed [Hz] | Speed reported by FAST [Hz] | Externally measured motor speed [Hz] | Setpoint Iq current |
| 787 | 770 | 770 | 2.1 |
| 815 | 793 | 830 | 2.1 |
| 845 | 816 | 885 | 2.1 |
| 875 | 816 | 1108 | 4.5 |
If anyone could shed some light on this I'd appreciate it greatly; I believe I've set up instaspin to work at these relatively moderate speeds, but clearly something has eluded me. For what it's worth, I am using the default current controller PI gains, defined as;
calcPIgains(){
...
_iq Kp_Id = _IQ((0.25*Ls_d*fullScaleCurrent)/(ctrlPeriod_sec*fullScaleVoltage));
_iq Ki_Id = _IQ(RoverLs_d*ctrlPeriod_sec);
_iq Kp_Iq = _IQ((0.25*Ls_q*fullScaleCurrent)/(ctrlPeriod_sec*fullScaleVoltage));
_iq Ki_Iq = _IQ(RoverLs_q*ctrlPeriod_sec);
...
}
and
CTRL_recalcKpKi(){
...
_iq Kp = _IQ(0.05*Lhf*USER_IQ_FULL_SCALE_CURRENT_A/(USER_CTRL_PERIOD_sec*USER_IQ_FULL_SCALE_VOLTAGE_V));
_iq Ki = _IQ(RhfoverLhf*USER_CTRL_PERIOD_sec);
_iq Kp_spd = _IQ(0.005*USER_IQ_FULL_SCALE_FREQ_Hz*gUserParams.maxCurrent/USER_IQ_FULL_SCALE_CURRENT_A);
...
}