40 lines
872 B
C
40 lines
872 B
C
|
#ifndef TETA_CALC
|
|||
|
#define TETA_CALC
|
|||
|
|
|||
|
#include "IQmathLib.h"
|
|||
|
#include "pid_reg3.h"
|
|||
|
|
|||
|
void init_tetta_pid(void);
|
|||
|
void reset_tetta_pid(void);
|
|||
|
void calc_tetta(_iq Frot, int direction, _iq Ud, int direct_zadan, _iq *tetta_out, _iq *Fsl_out, _iq *Fstator_out, int mode, int reset);
|
|||
|
void calc_tetta_Id(_iq Frot, _iq Id, _iq Iq, _iq *tetta_out, _iq *Fsl_out, _iq *Fstator_out, int reset);
|
|||
|
void init_tetta_calc_struct(void);
|
|||
|
|
|||
|
// k_r = Ts / Tr_cm
|
|||
|
// Tr_cm = Lr / Rr
|
|||
|
// Lr - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
// Rr - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//
|
|||
|
// k_t = 1 / (Tr_cm * 2 * Pi * f_b)
|
|||
|
//
|
|||
|
// K = Ts * f_b
|
|||
|
// f_b - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (12 <20><>)
|
|||
|
// Ts - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (840 <20><>)
|
|||
|
|
|||
|
typedef struct {
|
|||
|
_iq Imds;
|
|||
|
_iq tetta;
|
|||
|
|
|||
|
_iq hz_to_angle;
|
|||
|
_iq k_r;
|
|||
|
_iq k_t;
|
|||
|
} TETTA_CALC;
|
|||
|
|
|||
|
#define TETTA_CALC_DEF {0,0,0,0,0}
|
|||
|
|
|||
|
extern TETTA_CALC tetta_calc;
|
|||
|
|
|||
|
extern PIDREG3 pidTetta;
|
|||
|
#endif //TETA_CALC
|
|||
|
|