| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- #ifndef _NV_Storage_H__
- #define _NV_Storage_H__
- #include "os/os_types.h"
- #pragma pack (push,1)
- typedef struct {
- float s_maxIdq;
- float s_minIdq;
- float s_maxiDC;
- float s_maxvDC;
- float s_maxRPM;
- float s_maxEpmRPM;
- float s_maxTorque;
- float s_maxBrkCurrent;
- float s_LimitiDC;
- float n_modulation;
- float n_PhaseFilterCeof;
- float n_currentBand; //电流环带宽
- float n_TrqVelLimGain;
- float spd_kp;
- float spd_ki;
- float trq_kp;
- float trq_ki;
- float fw_baseSpd; //弱磁基速
- float fw_kp;
- float fw_ki;
- u16 crc16;
- }foc_params_t;
- typedef struct {
- u8 poles;
- float r;
- float ld;
- float lq;
- float flux_linkage;
- float back_emf;
- s32 hall_table[8];
- float offset;
- float est_pll_band; //normal工作模式下的pll带宽
- float pos_lock_pll_band; //电机锁定模式下的pll带宽
- u16 crc16;
- }motor_params_t;
- #define MAX_TRQ_POINTS 60
- #define MAX_SPD_POINTS 100
- typedef struct {
- s16 d[MAX_TRQ_POINTS][MAX_SPD_POINTS];
- s16 q[MAX_TRQ_POINTS][MAX_SPD_POINTS];
- u16 crc16;
- }torque_lut_t;
- #pragma pack(pop)
- #define motorParam_idx_0 3
- #define motorParam_idx_1 (motorParam_idx_0 + 1)
- #define focParam_idx_0 (motorParam_idx_0 + 2)
- #define focParam_idx_1 (motorParam_idx_0 + 3)
- void nv_storage_init(void);
- motor_params_t *nv_get_motor_params(void);
- foc_params_t *nv_get_foc_params(void);
- void nv_save_angle_offset(float offset);
- void nv_save_motor_params(void);
- void nv_read_motor_params(void);
- void nv_save_foc_params(void);
- void nv_read_foc_params(void);
- void nv_save_hall_table(s32 *hall_table);
- #endif /* _NV_Storage_H__ */
|