foc/foc_feedforward.c: vdq_comp->q should use idq->d

fix typo in calculations for vdq_comp->q. It should use idq->d not idq->q.

Reported in https://github.com/apache/nuttx-apps/issues/3047

Signed-off-by: raiden00pl <raiden00@railab.me>
This commit is contained in:
raiden00pl 2025-04-03 09:48:53 +02:00 committed by Xiang Xiao
parent cf1d5bb08b
commit 5d4b720596
2 changed files with 2 additions and 2 deletions

View file

@ -63,7 +63,7 @@ int foc_feedforward_pmsm_b16(FAR struct motor_phy_params_b16_s *phy,
vdq_comp->q = -b16mulb16(vel_now,
(phy->flux_link + b16mulb16(phy->ind,
idq->q)));
idq->d)));
vdq_comp->d = b16mulb16(b16mulb16(vel_now, phy->ind), idq->q);
return OK;

View file

@ -61,7 +61,7 @@ int foc_feedforward_pmsm_f32(FAR struct motor_phy_params_f32_s *phy,
* so vq compensation must be negative here.
*/
vdq_comp->q = -vel_now * (phy->flux_link + phy->ind * idq->q);
vdq_comp->q = -vel_now * (phy->flux_link + phy->ind * idq->d);
vdq_comp->d = vel_now * phy->ind * idq->q;
return OK;