📄 sfoc_ti.h
字号:
/* ==============================================================================
System Name: PMSM3_2 (QEP version)
File Name: SFOC_TI.H
Description: Header file for Peripheral independent object for the implementation
of Sensorless Field Orientation Control for a Three Phase Permanent-Magnet
Synchronous Motor using Sliding mode rotor angle observer.
Originator: Digital control systems Group - Texas Instruments
Target dependency: x240/1/2/3/07
To Select the target device see target.h file.
Note that the PWM/sampling frequency in C system is running at 15 kHz, which
is different from the PWM/samping frequency in ASM system (i.e., 20 kHz) as
indicated in the PMSM3-2 system documentation. Also, this PWM/samping frequency
in both ASM and C systems are based on x2407 with 40 MHz clock. If the x243 with
20 MHz clock is used, then the PWM/samping frequency may be decreased accordingly.
=====================================================================================
History:
-------------------------------------------------------------------------------------
03-01-2001 Release Rev 1.0
================================================================================= */
#ifndef __SDFOC_TI_H__
#define __SDFOC_TI_H__
#include <svgen.h> /* Include header for the SVGENDQ object */
#include <pid_reg3.h> /* Include header for the PIDREG3 object */
#include <rmp_cntl.h> /* Include header for the RMPCNTL object */
#include <rampgen.h> /* Include header for the RAMPGEN object */
#include <smopos.h> /* Include header for the SMOPOS object */
#include <speed_fr.h> /* Include header for the SPEED_MEAS object */
#include <volt_cal.h> /* Include header for the PHASEVOLTAGE object */
#ifndef TRUE
#define FALSE 0
#define TRUE 1
#endif
/*-------------------------------------------------------------------------------
Miscellaneous Items.
-------------------------------------------------------------------------------*/
typedef struct {int a,b,c ;} triad;
typedef struct {int d,q ;} dq;
typedef struct {int D,Q,theta ;} DQt;
/*------------------------------------------------------------------------------
Define the structure of the SDFOC_TI Object. This object has all the data
necessary for one instance of a sensorless direct FOC system.
------------------------------------------------------------------------------*/
typedef struct {
/*------------------------------------------------------------------------------
Declarations for the 'terminal variables' for the Algorithm. The framework
should communicate such quantities as freq_testing, etc to the algorithm by
modifying these terminal variables. It is not recommended that the framework
directly modify the internal varibles of the algorithm.
------------------------------------------------------------------------------*/
int GPR0;
int GPR1;
int GPR2;
int speed_ref;
int speed_ref_rpm;
int Id_ref;
int Iq_ref;
int Vd_testing;
int Vq_testing;
int lockrtr_flg; /* used in build 4 */
int Mea_spd;
int Est_spd;
int shaft_theta_elec;
int shaft_direction;
int Vbus;
/*------------------------------------------------------------------------------
Declare currents variable. The structure object is defined in this header file.
------------------------------------------------------------------------------*/
triad current_abc;
dq current_dq;
dq current_DQ;
DQt current_dqt;
/*------------------------------------------------------------------------------
Declare voltages variable. The structure object is defined in this header file.
------------------------------------------------------------------------------*/
dq voltage_dq;
DQt voltage_DQt;
/*------------------------------------------------------------------------------
Declaration for the space vector generation module. The defaults are set in
SVGEN.H
------------------------------------------------------------------------------*/
SVGENDQ svgen;
/*------------------------------------------------------------------------------
Declaration for the PID controller object. The defaults are set in
PID_REG3.H
------------------------------------------------------------------------------*/
PIDREG3 pid_id;
/*------------------------------------------------------------------------------
Declaration for the PID controller object. The defaults are set in
PID_REG3.H
------------------------------------------------------------------------------*/
PIDREG3 pid_iq;
/*------------------------------------------------------------------------------
Declaration for the PID controller object. The defaults are set in
PID_REG3.H
------------------------------------------------------------------------------*/
PIDREG3 pid_spd;
/*------------------------------------------------------------------------------
Declaration for the sliding mode rotor angle observer module.
The defaults are set in SMOPOS.H
------------------------------------------------------------------------------*/
SMOPOS smo;
/*------------------------------------------------------------------------------
Declaration for the ramp control module. The defaults are set in
RMP_CNTL.H
------------------------------------------------------------------------------*/
RMPCNTL rmpc;
/*------------------------------------------------------------------------------
Declaration for the ramp generator module. The defaults are set in
RAMPGEN.H
------------------------------------------------------------------------------*/
RAMPGEN rg;
/*------------------------------------------------------------------------------
Declaration for the speed calculation module based on the estimated angle.
The defaults are set in SPEED_FR.H
------------------------------------------------------------------------------*/
SPEED_MEAS speed;
/*------------------------------------------------------------------------------
Declaration for the voltage reconstruction module. The defaults are set in
VOLT_CAL.H
------------------------------------------------------------------------------*/
PHASEVOLTAGE volt;
} SFOC_TI;
typedef SFOC_TI *SFOC_TI_handle;
#define DEFAULT_SPEED_PU 0x1000
#define DEFAULT_SPEED_RPM 0
#define DEFAULT_ID_REF 0x0000
#define DEFAULT_IQ_REF 0x2000
#define DEFAULT_VD_TESTING 0x0000
#define DEFAULT_VQ_TESTING 0x1500
#define DEFAULT_LOCKRTR_FLG 0
#define DEFAULT_ZERO 0
#define DEFAULT_ONE 1
#define DEFAULT_MEA_SPD 0x0000
#define DEFAULT_EST_SPD 0x0000
#define DEFAULT_ABC {0,0,0}
#define DEFAULT_DQ {0,0}
#define DEFAULT_DQT {0,0,0}
#define SFOC_TI_INITVALS \
{ \
0,0,0, \
DEFAULT_SPEED_PU, \
DEFAULT_SPEED_RPM, \
DEFAULT_ID_REF, \
DEFAULT_IQ_REF, \
DEFAULT_VD_TESTING, \
DEFAULT_VQ_TESTING, \
DEFAULT_LOCKRTR_FLG, \
DEFAULT_MEA_SPD, \
DEFAULT_EST_SPD, \
DEFAULT_ZERO, \
DEFAULT_ZERO, \
DEFAULT_ZERO, \
DEFAULT_ABC, \
DEFAULT_DQ, \
DEFAULT_DQ, \
DEFAULT_DQT, \
DEFAULT_DQ, \
DEFAULT_DQT, \
SVGENDQ_DEFAULTS, \
PIDREG3_DEFAULTS, \
PIDREG3_DEFAULTS, \
PIDREG3_DEFAULTS, \
SMOPOS_DEFAULTS, \
RMPCNTL_DEFAULTS, \
RAMPGEN_DEFAULTS, \
SPEED_FR_MEAS_DEFAULTS, \
PHASEVOLTAGE_DEFAULTS \
}
/*------------------------------------------------------------------------------
Prototypes for functions implemented in SFOC_TI.C
------------------------------------------------------------------------------*/
void SFOC_TI_Init(SFOC_TI_handle);
void SFOC_TI_Run(SFOC_TI_handle);
/*------------------------------------------------------------------------------
Prototypes for following function implemented in mul_q.asm
------------------------------------------------------------------------------*/
int mul_q(int,int,int,int,int); /* Multiplication of any two Q numbers */
#endif /* __SFOC_TI_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -