[MCPWM_FOC] Fix mislabeled variable

It's not estimated RPM, it's estimated rad/sec.
This commit is contained in:
Kenn Sebesta 2021-10-27 14:09:10 -04:00
parent 8de85899b7
commit 0e58e29072
1 changed files with 4 additions and 4 deletions

View File

@ -4612,7 +4612,7 @@ static void terminal_tmp(int argc, const char **argv) {
R += R * 0.00386 * (t - conf_now->foc_temp_comp_base_temp);
}
float rpm_est = 0.0;
float omega_est = 0.0;
float res_est = 0.0;
float samples = 0.0;
@ -4620,17 +4620,17 @@ static void terminal_tmp(int argc, const char **argv) {
// float linkage = conf_now->foc_motor_flux_linkage;
float linkage = sqrtf(SQ(m_motor_1.m_observer_x1) + SQ(m_motor_1.m_observer_x2));
rpm_est += (motor_state->vq - R * motor_state->iq) / linkage;
omega_est += (motor_state->vq - R * motor_state->iq) / linkage;
res_est += -(motor_state->speed_rad_s * linkage - motor_state->vq) / motor_state->iq;
samples += 1.0;
chThdSleep(1);
}
rpm_est /= samples;
omega_est /= samples;
res_est /= samples;
commands_printf("RPM: %.2f, EST: %.2f", (double)mcpwm_foc_get_rpm(), (double)(RADPS2RPM_f(rpm_est));
commands_printf("RPM: %.2f, EST: %.2f", (double)mcpwm_foc_get_rpm(), (double)(RADPS2RPM_f(omega_est));
commands_printf("R: %.2f, EST: %.2f", (double)(R * 1000.0), (double)(res_est * 1000.0));
}