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

📄 aci3_4.c

📁 异步电机矢量控制c源程序
💻 C
📖 第 1 页 / 共 3 页
字号:
    park1.Angle = rg1.Out;
 	park1.calc(&park1);

// ------------------------------------------------------------------------------
//    Connect inputs of the PID module and call the PID IQ controller
//    calculation function.
// ------------------------------------------------------------------------------  
    pid1_iq.Ref = _IQ(IqRef);
	pid1_iq.Fdb = park1.Qs;
	pid1_iq.calc(&pid1_iq);

// ------------------------------------------------------------------------------
//    Connect inputs of the PID module and call the PID ID controller
//    calculation function.
// ------------------------------------------------------------------------------  
    pid1_id.Ref = _IQ(IdRef);
	pid1_id.Fdb = park1.Ds;
	pid1_id.calc(&pid1_id);

// ------------------------------------------------------------------------------
//    Connect inputs of the INV_PARK module and call the inverse park transformation
//    calculation function.
// ------------------------------------------------------------------------------
    ipark1.Ds = pid1_id.Out;
    ipark1.Qs = pid1_iq.Out;	
    ipark1.Angle = rg1.Out;
    ipark1.calc(&ipark1);

// ------------------------------------------------------------------------------
//    Connect inputs of the ACI module and call the induction motor model
//    calculation function.
// ------------------------------------------------------------------------------
	aci1.Ualpha = ipark1.Alpha;
	aci1.Ubeta = ipark1.Beta;
	aci1.calc(&aci1);

// ------------------------------------------------------------------------------
//    Connect inputs of the ACI_FE module and call the flux estimation
//    calculation function.
// ------------------------------------------------------------------------------
 	fe1.UDsS = aci1.Ualpha;
	fe1.UQsS = aci1.Ubeta;
 	fe1.IDsS = aci1.Ialpha;
	fe1.IQsS = aci1.Ibeta;
 	fe1.calc(&fe1);

// ------------------------------------------------------------------------------
//    Connect inputs of the ACI_SE module and call the speed estimation
//    calculation function.
// ------------------------------------------------------------------------------
 	se1.IDsS = aci1.Ialpha;
	se1.IQsS = aci1.Ibeta;
 	se1.PsiDrS = fe1.PsiDrS;
	se1.PsiQrS = fe1.PsiQrS;
	se1.ThetaFlux = rg1.Out;
 	se1.calc(&se1);

// ------------------------------------------------------------------------------
//    Connect inputs of the PWMDAC module 
// ------------------------------------------------------------------------------	
    PwmDacCh1 = (int16)_IQtoIQ15(aci1.Ialpha);
    PwmDacCh2 = (int16)_IQtoIQ15(fe1.ThetaFlux);    
    PwmDacCh3 = (int16)_IQtoIQ15(aci1.Torque);
     
// ------------------------------------------------------------------------------
//    Connect inputs of the DATALOG module 
// ------------------------------------------------------------------------------
    DlogCh1 = (int16)_IQtoIQ15(aci1.Ialpha);
    DlogCh2 = (int16)_IQtoIQ15(aci1.Wr);
    DlogCh3 = (int16)_IQtoIQ15(fe1.ThetaFlux);
    DlogCh4 = (int16)_IQtoIQ15(rg1.Out);

#endif // (BUILDLEVEL==LEVEL4)


// ***************** LEVEL5 ***************** 
#if (BUILDLEVEL==LEVEL5)

// ------------------------------------------------------------------------------
//    Connect inputs of the PARK module and call the park transformation
//    calculation function.
// ------------------------------------------------------------------------------
    park1.Alpha = aci1.Ialpha;
    park1.Beta = aci1.Ibeta;
    park1.Angle = fe1.ThetaFlux;
 	park1.calc(&park1);

// ------------------------------------------------------------------------------
//    Connect inputs of the PID module and call the PID speed controller
//    calculation function.
// ------------------------------------------------------------------------------  
    pid1_spd.Ref = _IQ(SpeedRef);
	pid1_spd.Fdb = aci1.Wr;
	pid1_spd.calc(&pid1_spd);

// ------------------------------------------------------------------------------
//    Connect inputs of the PID module and call the PID IQ controller
//    calculation function.
// ------------------------------------------------------------------------------  
    pid1_iq.Ref = pid1_spd.Out;
	pid1_iq.Fdb = park1.Qs;
	pid1_iq.calc(&pid1_iq);

// ------------------------------------------------------------------------------
//    Connect inputs of the PID module and call the PID ID controller
//    calculation function.
// ------------------------------------------------------------------------------  
    pid1_id.Ref = _IQ(IdRef);
	pid1_id.Fdb = park1.Ds;
	pid1_id.calc(&pid1_id);

// ------------------------------------------------------------------------------
//    Connect inputs of the INV_PARK module and call the inverse park transformation
//    calculation function.
// ------------------------------------------------------------------------------
    ipark1.Ds = pid1_id.Out;
    ipark1.Qs = pid1_iq.Out;	
    ipark1.Angle = fe1.ThetaFlux;
    ipark1.calc(&ipark1);

// ------------------------------------------------------------------------------
//    Connect inputs of the ACI module and call the induction motor model
//    calculation function.
// ------------------------------------------------------------------------------
	aci1.Ualpha = ipark1.Alpha;
	aci1.Ubeta = ipark1.Beta;
	aci1.calc(&aci1);

// ------------------------------------------------------------------------------
//    Connect inputs of the ACI_FE module and call the flux estimation
//    calculation function.
// ------------------------------------------------------------------------------
 	fe1.UDsS = aci1.Ualpha;
	fe1.UQsS = aci1.Ubeta;
 	fe1.IDsS = aci1.Ialpha;
	fe1.IQsS = aci1.Ibeta;
 	fe1.calc(&fe1);    

// ------------------------------------------------------------------------------
//    Connect inputs of the PWMDAC module 
// ------------------------------------------------------------------------------	
    PwmDacCh1 = (int16)_IQtoIQ15(aci1.Ialpha);
    PwmDacCh2 = (int16)_IQtoIQ15(fe1.ThetaFlux);    
    PwmDacCh3 = (int16)_IQtoIQ15(aci1.Torque);    

// ------------------------------------------------------------------------------
//    Connect inputs of the DATALOG module 
// ------------------------------------------------------------------------------
    DlogCh1 = (int16)_IQtoIQ15(aci1.Ialpha);
    DlogCh2 = (int16)_IQtoIQ15(fe1.ThetaFlux);
    DlogCh3 = (int16)_IQtoIQ15(pid1_spd.Ref);
    DlogCh4 = (int16)_IQtoIQ15(pid1_spd.Fdb);

#endif // (BUILDLEVEL==LEVEL5)


// ***************** LEVEL6 ***************** 
#if (BUILDLEVEL==LEVEL6)

// ------------------------------------------------------------------------------
//    Connect inputs of the PARK module and call the park transformation
//    calculation function.
// ------------------------------------------------------------------------------
    park1.Alpha = aci1.Ialpha;
    park1.Beta = aci1.Ibeta;
    park1.Angle = fe1.ThetaFlux;
 	park1.calc(&park1);

// ------------------------------------------------------------------------------
//    Connect inputs of the PID module and call the PID speed controller
//    calculation function.
// ------------------------------------------------------------------------------  
    pid1_spd.Ref = _IQ(SpeedRef);
	pid1_spd.Fdb = se1.WrHat;
	pid1_spd.calc(&pid1_spd);

// ------------------------------------------------------------------------------
//    Connect inputs of the PID module and call the PID IQ controller
//    calculation function.
// ------------------------------------------------------------------------------  
    pid1_iq.Ref = pid1_spd.Out;
	pid1_iq.Fdb = park1.Qs;
	pid1_iq.calc(&pid1_iq);

// ------------------------------------------------------------------------------
//    Connect inputs of the PID module and call the PID ID controller
//    calculation function.
// ------------------------------------------------------------------------------  
    pid1_id.Ref = _IQ(IdRef);
	pid1_id.Fdb = park1.Ds;
	pid1_id.calc(&pid1_id);

// ------------------------------------------------------------------------------
//    Connect inputs of the INV_PARK module and call the inverse park transformation
//    calculation function.
// ------------------------------------------------------------------------------
    ipark1.Ds = pid1_id.Out;
    ipark1.Qs = pid1_iq.Out;	
    ipark1.Angle = fe1.ThetaFlux;
    ipark1.calc(&ipark1);

// ------------------------------------------------------------------------------
//    Connect inputs of the ACI module and call the induction motor model
//    calculation function.
// ------------------------------------------------------------------------------
	aci1.Ualpha = ipark1.Alpha;
	aci1.Ubeta = ipark1.Beta;
	aci1.calc(&aci1);

// ------------------------------------------------------------------------------
//    Connect inputs of the ACI_FE module and call the flux estimation
//    calculation function.
// ------------------------------------------------------------------------------
 	fe1.UDsS = aci1.Ualpha;
	fe1.UQsS = aci1.Ubeta;
 	fe1.IDsS = aci1.Ialpha;
	fe1.IQsS = aci1.Ibeta;
 	fe1.calc(&fe1);

// ------------------------------------------------------------------------------
//    Connect inputs of the ACI_SE module and call the speed estimation
//    calculation function.
// ------------------------------------------------------------------------------
 	se1.IDsS = aci1.Ialpha;
	se1.IQsS = aci1.Ibeta;
 	se1.PsiDrS = fe1.PsiDrS;
	se1.PsiQrS = fe1.PsiQrS;
	se1.ThetaFlux = fe1.ThetaFlux;
 	se1.calc(&se1);

// ------------------------------------------------------------------------------
//    Connect inputs of the PWMDAC module 
// ------------------------------------------------------------------------------	
    PwmDacCh1 = (int16)_IQtoIQ15(aci1.Ialpha);
    PwmDacCh2 = (int16)_IQtoIQ15(fe1.ThetaFlux);    
    PwmDacCh3 = (int16)_IQtoIQ15(aci1.Torque);    

// ------------------------------------------------------------------------------
//    Connect inputs of the DATALOG module 
// ------------------------------------------------------------------------------
    DlogCh1 = (int16)_IQtoIQ15(aci1.Ialpha);
    DlogCh2 = (int16)_IQtoIQ15(fe1.ThetaFlux);
    DlogCh3 = (int16)_IQtoIQ15(pid1_spd.Ref);
    DlogCh4 = (int16)_IQtoIQ15(pid1_spd.Fdb);

#endif // (BUILDLEVEL==LEVEL6)


// ------------------------------------------------------------------------------
//    Call the PWMDAC update function.
// ------------------------------------------------------------------------------
	pwmdac1.update(&pwmdac1);  

// ------------------------------------------------------------------------------
//    Call the DATALOG update function.
// ------------------------------------------------------------------------------
    dlog.update(&dlog);


#if (DSP_TARGET==F2808)
// Enable more interrupts from this timer
	EPwm1Regs.ETCLR.bit.INT = 1;

// Acknowledge interrupt to recieve more interrupts from PIE group 3
	PieCtrlRegs.PIEACK.all = PIEACK_GROUP3;
#endif


#if (DSP_TARGET==F2812)
// Enable more interrupts from this timer
	EvaRegs.EVAIMRA.bit.T1UFINT = 1;
	
// Note: To be safe, use a mask value to write to the entire
	// EVAIFRA register.  Writing to one bit will cause a read-modify-write
	// operation that may have the result of writing 1's to clear 
	// bits other then those intended. 
    EvaRegs.EVAIFRA.all = BIT9;

// Acknowledge interrupt to recieve more interrupts from PIE group 2
	PieCtrlRegs.PIEACK.all = PIEACK_GROUP2;
#endif

}

//===========================================================================
// No more.
//===========================================================================

⌨️ 快捷键说明

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