libdsp: initialize flux_link in params, remove flux_link from pmsm_phy_params
This commit is contained in:
parent
ca4790c429
commit
1366e14192
@ -383,7 +383,7 @@ struct motor_phy_params_f32_s
|
||||
{
|
||||
uint8_t p; /* Number of the motor pole pairs */
|
||||
float flux_link; /* Flux linkage */
|
||||
float res; /* Phase-to-neutral resistance */
|
||||
float res; /* Average phase-to-neutral resistance */
|
||||
float ind; /* Average phase-to-neutral inductance */
|
||||
float one_by_ind; /* Inverse phase-to-neutral inductance */
|
||||
float one_by_p; /* Inverse number of motor pole pairs */
|
||||
@ -395,7 +395,6 @@ struct pmsm_phy_params_f32_s
|
||||
{
|
||||
struct motor_phy_params_f32_s motor; /* Motor common PHY */
|
||||
float iner; /* Rotor inertia */
|
||||
float flux_link; /* Flux linkage */
|
||||
float ind_d; /* d-inductance */
|
||||
float ind_q; /* q-inductance */
|
||||
float one_by_iner; /* One by intertia */
|
||||
@ -583,7 +582,8 @@ float motor_angle_e_get(FAR struct motor_angle_f32_s *angle);
|
||||
/* Motor physical parameters */
|
||||
|
||||
void motor_phy_params_init(FAR struct motor_phy_params_f32_s *phy,
|
||||
uint8_t poles, float res, float ind);
|
||||
uint8_t poles, float res, float ind,
|
||||
float fluxlink);
|
||||
|
||||
/* PMSM physical parameters functions */
|
||||
|
||||
|
@ -294,9 +294,8 @@ struct foc_data_b16_s
|
||||
struct motor_phy_params_b16_s
|
||||
{
|
||||
uint8_t p; /* Number of the motor pole pairs */
|
||||
b16_t res; /* Phase-to-neutral temperature compensated
|
||||
* resistance
|
||||
*/
|
||||
b16_t flux_link; /* Flux linkage */
|
||||
b16_t res; /* Average phase-to-neutral resistance */
|
||||
b16_t ind; /* Average phase-to-neutral inductance */
|
||||
b16_t one_by_ind; /* Inverse phase-to-neutral inductance */
|
||||
b16_t one_by_p; /* Inverse number of motor pole pairs */
|
||||
@ -308,7 +307,6 @@ struct pmsm_phy_params_b16_s
|
||||
{
|
||||
struct motor_phy_params_b16_s motor; /* Motor common PHY */
|
||||
b16_t iner; /* Rotor inertia */
|
||||
b16_t flux_link; /* Flux linkage */
|
||||
b16_t ind_d; /* d-inductance */
|
||||
b16_t ind_q; /* q-inductance */
|
||||
b16_t one_by_iner; /* One by J */
|
||||
@ -467,7 +465,8 @@ b16_t motor_angle_e_get_b16(FAR struct motor_angle_b16_s *angle);
|
||||
/* Motor physical parameters */
|
||||
|
||||
void motor_phy_params_init_b16(FAR struct motor_phy_params_b16_s *phy,
|
||||
uint8_t poles, b16_t res, b16_t ind);
|
||||
uint8_t poles, b16_t res, b16_t ind,
|
||||
b16_t fluxlink);
|
||||
|
||||
/* PMSM physical parameters functions */
|
||||
|
||||
|
@ -355,6 +355,7 @@ float motor_angle_e_get(FAR struct motor_angle_f32_s *angle)
|
||||
* res - (in) average phase-to-neutral base motor resistance
|
||||
* (without temperature compensation)
|
||||
* ind - (in) average phase-to-neutral motor inductance
|
||||
* flux - (in) flux linkage
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
@ -362,13 +363,15 @@ float motor_angle_e_get(FAR struct motor_angle_f32_s *angle)
|
||||
****************************************************************************/
|
||||
|
||||
void motor_phy_params_init(FAR struct motor_phy_params_f32_s *phy,
|
||||
uint8_t poles, float res, float ind)
|
||||
uint8_t poles, float res, float ind,
|
||||
float flux_link)
|
||||
{
|
||||
LIBDSP_DEBUGASSERT(phy != NULL);
|
||||
|
||||
memset(phy, 0, sizeof(struct motor_phy_params_f32_s));
|
||||
|
||||
phy->p = poles;
|
||||
phy->flux_link = flux_link;
|
||||
phy->res = res;
|
||||
phy->ind = ind;
|
||||
phy->one_by_ind = (1.0f / ind);
|
||||
@ -406,12 +409,11 @@ void pmsm_phy_params_init(FAR struct pmsm_phy_params_f32_s *phy,
|
||||
|
||||
/* Initialize motor phy */
|
||||
|
||||
motor_phy_params_init(&phy->motor, poles, res, ind);
|
||||
motor_phy_params_init(&phy->motor, poles, res, ind, flux);
|
||||
|
||||
/* Iniitalize PMSM specific data */
|
||||
|
||||
phy->iner = iner;
|
||||
phy->flux_link = flux;
|
||||
phy->ind_d = ind_d;
|
||||
phy->ind_q = ind_q;
|
||||
phy->one_by_iner = (1.0f / iner);
|
||||
|
@ -307,6 +307,7 @@ b16_t motor_angle_e_get_b16(FAR struct motor_angle_b16_s *angle)
|
||||
* res - (in) average phase-to-neutral base motor resistance
|
||||
* (without temperature compensation)
|
||||
* ind - (in) average phase-to-neutral motor inductance
|
||||
* flux - (in) flux linkage
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
@ -314,13 +315,15 @@ b16_t motor_angle_e_get_b16(FAR struct motor_angle_b16_s *angle)
|
||||
****************************************************************************/
|
||||
|
||||
void motor_phy_params_init_b16(FAR struct motor_phy_params_b16_s *phy,
|
||||
uint8_t poles, b16_t res, b16_t ind)
|
||||
uint8_t poles, b16_t res, b16_t ind,
|
||||
b16_t flux_link)
|
||||
{
|
||||
LIBDSP_DEBUGASSERT(phy != NULL);
|
||||
|
||||
memset(phy, 0, sizeof(struct motor_phy_params_b16_s));
|
||||
|
||||
phy->p = poles;
|
||||
phy->flux_link = flux_link;
|
||||
phy->res = res;
|
||||
phy->ind = ind;
|
||||
phy->one_by_ind = b16divb16(b16ONE, ind);
|
||||
@ -358,12 +361,11 @@ void pmsm_phy_params_init_b16(FAR struct pmsm_phy_params_b16_s *phy,
|
||||
|
||||
/* Initialize motor phy */
|
||||
|
||||
motor_phy_params_init_b16(&phy->motor, poles, res, ind);
|
||||
motor_phy_params_init_b16(&phy->motor, poles, res, ind, flux);
|
||||
|
||||
/* Iniitalize PMSM specific data */
|
||||
|
||||
phy->iner = iner;
|
||||
phy->flux_link = flux;
|
||||
phy->ind_d = ind_d;
|
||||
phy->ind_q = ind_q;
|
||||
phy->one_by_iner = b16divb16(b16ONE, iner);
|
||||
|
@ -187,7 +187,7 @@ int pmsm_model_elec(FAR struct pmsm_model_f32_s *model,
|
||||
|
||||
tmp1 = model->phy.motor.res * model->state.i_dq.q;
|
||||
tmp2 = model->phy.ind_d * model->state.i_dq.d;
|
||||
tmp3 = tmp2 + model->phy.flux_link;
|
||||
tmp3 = tmp2 + model->phy.motor.flux_link;
|
||||
tmp4 = model->state.omega_e * tmp3;
|
||||
tmp5 = model->state.v_dq.q - tmp1 - tmp4;
|
||||
tmp6 = model->per * tmp5;
|
||||
@ -248,7 +248,7 @@ int pmsm_model_mech(FAR struct pmsm_model_f32_s *model, float load)
|
||||
|
||||
tmp1 = model->phy.ind_d - model->phy.ind_q;
|
||||
tmp2 = tmp1 * model->state.i_dq.d;
|
||||
tmp3 = model->phy.flux_link - tmp2;
|
||||
tmp3 = model->phy.motor.flux_link - tmp2;
|
||||
tmp4 = 1.5f * model->phy.motor.p;
|
||||
tmp5 = tmp4 * model->state.i_dq.q;
|
||||
|
||||
|
@ -100,7 +100,7 @@ int pmsm_model_elec_b16(FAR struct pmsm_model_b16_s *model,
|
||||
|
||||
tmp1 = b16mulb16(model->phy.motor.res, model->state.i_dq.q);
|
||||
tmp2 = b16mulb16(model->phy.ind_d, model->state.i_dq.d);
|
||||
tmp3 = tmp2 + model->phy.flux_link;
|
||||
tmp3 = tmp2 + model->phy.motor.flux_link;
|
||||
tmp4 = b16mulb16(model->state.omega_e, tmp3);
|
||||
tmp5 = model->state.v_dq.q - tmp1 - tmp4;
|
||||
tmp6 = b16mulb16(model->per, tmp5);
|
||||
@ -161,7 +161,7 @@ int pmsm_model_mech_b16(FAR struct pmsm_model_b16_s *model, b16_t load)
|
||||
|
||||
tmp1 = model->phy.ind_d - model->phy.ind_q;
|
||||
tmp2 = b16mulb16(tmp1, model->state.i_dq.d);
|
||||
tmp3 = model->phy.flux_link - tmp2;
|
||||
tmp3 = model->phy.motor.flux_link - tmp2;
|
||||
tmp4 = b16mulb16((b16ONE + b16HALF), itob16(model->phy.motor.p));
|
||||
tmp5 = b16mulb16(tmp4, model->state.i_dq.q);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user