⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 foc_ti.h

📁 TI 的DSP2407A的无速度传感器永磁同步电机FOC控制程序
💻 H
字号:
/* ==============================================================================
System Name:  PMSM3_1  (QEP version)

File Name:	FOC_TI.H

Description:  Peripheral independent object for the implementation 
              of Sensored Field Orientation Control for a Three Phase 
              Permanent-Magnet Synchronous Motor using measured rotor angle.

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 30 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 __FOC_TI_H__
#define __FOC_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 <speed_fr.h>           /* Include header for the SPEED_MEAS 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 shaft_theta_elec;
        int shaft_direction;

/*------------------------------------------------------------------------------
    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 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;		

} FOC_TI;                   

typedef FOC_TI *FOC_TI_handle;
        
#define DEFAULT_SPEED_PU  		0x2000
#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_MEA_SPD			0x0000
#define DEFAULT_ABC				{0,0,0}
#define DEFAULT_DQ				{0,0}
#define DEFAULT_DQT				{0,0,0}
  
#define FOC_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_ZERO,               \
                DEFAULT_ZERO,               \
                DEFAULT_ABC, 				\
                DEFAULT_DQ, 				\
                DEFAULT_DQ, 				\
                DEFAULT_DQT, 				\
                DEFAULT_DQ, 				\
                DEFAULT_DQT, 				\
                SVGENDQ_DEFAULTS,       	\
                PIDREG3_DEFAULTS,       	\
                PIDREG3_DEFAULTS,       	\
                PIDREG3_DEFAULTS,       	\
                RMPCNTL_DEFAULTS, 			\
                RAMPGEN_DEFAULTS, 			\
                }
/*------------------------------------------------------------------------------
 Prototypes for functions implemented in FOC_TI.C  
------------------------------------------------------------------------------*/
void FOC_TI_Init(FOC_TI_handle);
void FOC_TI_Run(FOC_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 /* __FOC_TI_H__ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -