matlab_23550/Inu/Src2/VectorControl/teta_calc.h
2024-12-27 10:50:32 +03:00

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 - èíäóêòèâíîñòü ðîòîðà
// Rr - ñîïðîòèâëåíèå ðîòîðà
//
// k_t = 1 / (Tr_cm * 2 * Pi * f_b)
//
// K = Ts * f_b
// f_b - áàçîâàÿ ýëåêòðè÷åñêàÿ ÷àñòîòà (12 Ãö)
// Ts - ïåðèîä ðàñ÷¸òà (840 Ãö)
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