|
|
@@ -3,7 +3,7 @@
|
|
|
#include "PMSM_FOC_Core.h"
|
|
|
#include "smo_observer.h"
|
|
|
|
|
|
-//#define USE_ARCTAN 1
|
|
|
+#define USE_ARCTAN 0
|
|
|
static smo_observer_t smo;
|
|
|
static void smo_observer(float uAlpha, float uBeta, float iAlpha, float iBeta);
|
|
|
#ifdef USE_ARCTAN
|
|
|
@@ -15,7 +15,7 @@ void smo_observer_init(float pll_bandwith, float lpf_wc, float Ksmo, float Ksta)
|
|
|
smo.ts = FOC_CTRL_US;
|
|
|
smo.bandwith = pll_bandwith;
|
|
|
smo.pll_kp = pll_bandwith * 2;
|
|
|
- smo.pll_ki = SQ(smo.pll_kp);
|
|
|
+ smo.pll_ki = SQ(pll_bandwith);
|
|
|
smo.pll_max_rad_pers = CONFIG_MAX_MOT_RPM/30.0f * M_PI * nv_get_motor_params()->poles;
|
|
|
smo.lpf_wc = lpf_wc;
|
|
|
smo.lpf_ceof = (lpf_wc*FOC_CTRL_US);
|
|
|
@@ -112,7 +112,7 @@ static void smo_arctan(void) {
|
|
|
smo.pll.out = smo.est_rad_pers;
|
|
|
}
|
|
|
smo.est_rad_pers_filted = smo.est_rad_pers;
|
|
|
- smo.est_angle_out = smo.est_angle + fast_atan_2(smo.est_rad_pers_filted, smo.lpf_wc*2*M_PI);
|
|
|
+ smo.est_angle_out = smo.est_angle + fast_atan_2(smo.est_rad_pers_filted, smo.lpf_wc);
|
|
|
angle_clamp(smo.est_angle_out);
|
|
|
smo.est_rpm = (30.0f * smo.est_rad_pers_filted/M_PI/smo.motor_poles);
|
|
|
if (smo.est_rpm > CONFIG_MAX_MOT_RPM) {
|
|
|
@@ -139,7 +139,6 @@ static void smo_pll(void) {
|
|
|
smo.est_angle += smo.ts * smo.est_rad_pers; //角速度积分
|
|
|
|
|
|
smo.est_rad_pers_filted = do_lpf(smo.est_rad_pers_filted, smo.est_rad_pers, smo.lpf_ceof); //对速度低通滤波
|
|
|
-
|
|
|
angle_clamp(smo.est_angle);
|
|
|
smo.est_rpm = (30.0f * smo.est_rad_pers_filted/M_PI/smo.motor_poles);
|
|
|
if (smo.est_rpm > CONFIG_MAX_MOT_RPM) {
|
|
|
@@ -148,7 +147,6 @@ static void smo_pll(void) {
|
|
|
smo.est_rpm = 0;
|
|
|
}
|
|
|
smo.est_angle_out = smo.est_angle;
|
|
|
- angle_clamp(smo.est_angle_out);
|
|
|
}
|
|
|
#endif
|
|
|
|