improve flux linkage identification method
improve flux linkage identification method
This commit is contained in:
parent
511d9d59de
commit
bd82e8d39f
@ -48,6 +48,10 @@ struct foc_routine_ident_cb_f32_s
|
|||||||
|
|
||||||
FAR void *priv_speed;
|
FAR void *priv_speed;
|
||||||
|
|
||||||
|
/* Private data for kpki callbacks */
|
||||||
|
|
||||||
|
FAR void *priv_kpki;
|
||||||
|
|
||||||
/* Openloop angle zero callback */
|
/* Openloop angle zero callback */
|
||||||
|
|
||||||
CODE int (*zero)(FAR void *priv);
|
CODE int (*zero)(FAR void *priv);
|
||||||
@ -59,6 +63,10 @@ struct foc_routine_ident_cb_f32_s
|
|||||||
/* Identification openloop speed callback */
|
/* Identification openloop speed callback */
|
||||||
|
|
||||||
CODE float (*speed)(FAR void *priv, float des, float now);
|
CODE float (*speed)(FAR void *priv, float des, float now);
|
||||||
|
|
||||||
|
/* Identification calculate kp and ki callback */
|
||||||
|
|
||||||
|
CODE int (*kpki)(FAR void *priv, float res, float ind, float per);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -70,7 +78,7 @@ struct foc_routine_ident_cfg_f32_s
|
|||||||
struct foc_routine_ident_cb_f32_s cb; /* Identification routine callbacks */
|
struct foc_routine_ident_cb_f32_s cb; /* Identification routine callbacks */
|
||||||
|
|
||||||
float flux_vel; /* Flux linkage measurement velocity */
|
float flux_vel; /* Flux linkage measurement velocity */
|
||||||
float flux_volt; /* Flux linkage measurement voltage */
|
float flux_curr; /* Flux linkage measurement current */
|
||||||
int flux_steps; /* Flux linkage measurement steps */
|
int flux_steps; /* Flux linkage measurement steps */
|
||||||
#endif
|
#endif
|
||||||
float per; /* Routine period in sec */
|
float per; /* Routine period in sec */
|
||||||
|
@ -407,13 +407,13 @@ int foc_ident_fluxlink_run_f32(FAR struct foc_ident_f32_s *ident,
|
|||||||
ident->cfg.flux_vel, ident->vel);
|
ident->cfg.flux_vel, ident->vel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Force q axis voltage = ident->cfg.flux_volt */
|
/* Force q axis current = ident->cfg.flux_curr */
|
||||||
|
|
||||||
out->dq_ref.q = ident->cfg.flux_volt;
|
out->dq_ref.q = ident->cfg.flux_curr;
|
||||||
out->dq_ref.d = 0.0f;
|
out->dq_ref.d = 0.0f;
|
||||||
out->vdq_comp.q = 0.0f;
|
out->vdq_comp.q = 0.0f;
|
||||||
out->vdq_comp.d = 0.0f;
|
out->vdq_comp.d = 0.0f;
|
||||||
out->foc_mode = FOC_HANDLER_MODE_VOLTAGE;
|
out->foc_mode = FOC_HANDLER_MODE_CURRENT;
|
||||||
|
|
||||||
/* Increase counter */
|
/* Increase counter */
|
||||||
|
|
||||||
@ -437,7 +437,7 @@ int foc_ident_fluxlink_run_f32(FAR struct foc_ident_f32_s *ident,
|
|||||||
/* Get flux linkage */
|
/* Get flux linkage */
|
||||||
|
|
||||||
ident->final.flux = (volt_avg - ident->final.res * curr_avg) /
|
ident->final.flux = (volt_avg - ident->final.res * curr_avg) /
|
||||||
ident->vel;
|
ident->vel - ident->final.ind * curr_avg;
|
||||||
|
|
||||||
/* Force IDLE state */
|
/* Force IDLE state */
|
||||||
|
|
||||||
@ -578,7 +578,7 @@ int foc_routine_ident_cfg_f32(FAR foc_routine_f32_t *r, FAR void *cfg)
|
|||||||
|
|
||||||
if (i->cfg.res_current <= 0.0f || i->cfg.ind_volt <= 0.0f
|
if (i->cfg.res_current <= 0.0f || i->cfg.ind_volt <= 0.0f
|
||||||
#ifdef CONFIG_INDUSTRY_FOC_IDENT_FLUX
|
#ifdef CONFIG_INDUSTRY_FOC_IDENT_FLUX
|
||||||
|| i->cfg.flux_volt <= 0.0f
|
|| i->cfg.flux_curr <= 0.0f
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -628,6 +628,9 @@ int foc_routine_ident_run_f32(FAR foc_routine_f32_t *r,
|
|||||||
|
|
||||||
DEBUGASSERT(r->data);
|
DEBUGASSERT(r->data);
|
||||||
i = r->data;
|
i = r->data;
|
||||||
|
#ifdef CONFIG_INDUSTRY_FOC_IDENT_FLUX
|
||||||
|
DEBUGASSERT(i->cfg.cb.kpki != NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Force IDLE state at default */
|
/* Force IDLE state at default */
|
||||||
|
|
||||||
@ -650,12 +653,23 @@ int foc_routine_ident_run_f32(FAR foc_routine_f32_t *r,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case FOC_IDENT_RUN_IDLE1:
|
|
||||||
case FOC_IDENT_RUN_IDLE2:
|
|
||||||
case FOC_IDENT_RUN_IDLE3:
|
case FOC_IDENT_RUN_IDLE3:
|
||||||
#ifdef CONFIG_INDUSTRY_FOC_IDENT_FLUX
|
#ifdef CONFIG_INDUSTRY_FOC_IDENT_FLUX
|
||||||
|
if (i->cntr == 0)
|
||||||
|
{
|
||||||
|
ret = i->cfg.cb.kpki(i->cfg.cb.priv_kpki, i->final.res,
|
||||||
|
i->final.ind, i->cfg.per);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
FOCLIBERR("ERROR: ident kpki callback failed %d!\n", ret);
|
||||||
|
goto errout;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
case FOC_IDENT_RUN_IDLE4:
|
case FOC_IDENT_RUN_IDLE4:
|
||||||
#endif
|
#endif
|
||||||
|
case FOC_IDENT_RUN_IDLE1:
|
||||||
|
case FOC_IDENT_RUN_IDLE2:
|
||||||
{
|
{
|
||||||
/* De-energetize motor */
|
/* De-energetize motor */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user