
// USER CODE BEGIN (MAIN_Header,1)

// USER CODE END


// USER CODE BEGIN (MAIN_Header,2)

// USER CODE END


// USER CODE BEGIN (MAIN_Header,3)

// USER CODE END


// USER CODE BEGIN (MAIN_Header,4)

// USER CODE END


// USER CODE BEGIN (MAIN_Header,5)

// USER CODE END


// USER CODE BEGIN (MAIN_Header,6)

// USER CODE END


// USER CODE BEGIN (MAIN_Header,7)

// USER CODE END


// USER CODE BEGIN (MAIN_Header,8)

// USER CODE END


// USER CODE BEGIN (MAIN_Header,9)

// USER CODE END

// USER CODE BEGIN (MAIN_Header,10)
 // MAIN_HEADER_10_IAF_CODE_BEGIN
	#if DAVECG_ControlAlgoKBS.KEIL

	#define  C_BDATA 	int bdata
	#define  C_SBIT 	sbit
	#define  C_SDATA    sdata
	#define  INLINE  	__inline
   	#define  C_ATBIT(var, bit_pos)  =(var)^(bit_pos)

	#endif  //End of Keil

	#if DAVECG_ControlAlgoKBS.TASKING

	#define  C_BDATA 	_bita
	#define  C_SBIT 	_bit
	#define  C_SDATA    _system
	#define  INLINE  	_inline
   	#define  C_ATBIT(var, bit_pos)  _atbit(var,bit_pos)
	
	#endif   //End of TASKING

typedef struct                             
{                                                                                
	sword  Kp;                                        
	sword  Ki; 
	slong  Ibuf; 
	sword  Yimax;                                         
	sword  Yimin; 
    sword  Ymax;                                          
	sword  Ymin;                                          
} PI_Parameter;

typedef struct                                         
{                                                                                
    sword  Z1;                                        
	sword  Z2;  
	sword  Ymax;                                          
	sword  Ymin; 
	slong  Ibuf;
		                                        
} PT1_Parameter;

typedef struct
{
	sword 			Ia,Ib,Ialpha,Ibeta,Id,Iq;
	sword		    Valpha,Vbeta,Vd,Vq;
	sword			Falpha,Fbeta;
	uword			Famp;
	sword			UserSpeedRef;
	sword			Speed, SpeedRef;
	sword			Stator_R, Stator_L;
	sword			Angle,AngleStore;
	sword			Iqref,Idref,IqStartRef;
	sword			RampCounter;	
	PT1_Parameter 	PT1_Alpha;
	PT1_Parameter 	PT1_Beta;
	PT1_Parameter 	SpeedFilter;
	PI_Parameter	PI_Speed;
	PI_Parameter	PI_Id;
	PI_Parameter	PI_Iq;

}cFOC;

typedef struct
{
	uword 	T1,T2;
	uword 	T1Store,T2Store;
	uword	Sector,Sectormem;
	uword	Amplitude;
	sword	Angle;	
}cSVM;

typedef struct
{
	sword 	VF_Offset;
	sword	VF_Const;
	sword	Angle;	
}cVF;

#if DAVECG_ControlAlgoKBS.KEIL
extern cVF	sdata	Startup0;
extern cSVM	sdata	SVM0;
extern cFOC	sdata	FOC0;
#endif

#if DAVECG_ControlAlgoKBS.TASKING
extern cVF		Startup0;
extern cSVM		SVM0;
extern cFOC		FOC0;
#endif  //End of Tasking


// MAIN_HEADER_10_IAF_CODE_END
// USER CODE END

