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

📄 userparms.h

📁 dsPIC对于交流感应电机矢量控制的应用笔记的源代码(中文)
💻 H
字号:
#ifndef UserParms_H
#define UserParms_H

//#define TORQUE_MODE
#define	DIAGNOSTICS

//**************  Oscillator **************

#define dFoscExt        7372800         // External Crystal or Clock Frequency (Hz)
#define dPLL            8               // PLL ratio
#define dLoopTimeInSec  0.00005          // PWM Period - 50 uSec, 20Khz PWM
#define dDeadTimeSec    0.000002         // Deadtime in seconds
#define	dDispLoopTime	0.100			// Display and button polling loop period in sec

// Derived
#define dFosc       (dFoscExt*dPLL)     // Clock frequency (Hz)
#define dFcy        (dFosc/4)           // Instruction cycle frequency (Hz)
#define dTcy        (1.0/dFcy)          // Instruction cycle period (sec)
#define dDeadTime   (int)(dDeadTimeSec*dFcy) // Dead time in dTcys

#define dLoopInTcy  (dLoopTimeInSec/dTcy)   // Basic loop period in units of Tcy

// Number of control loops that must execute before the button and display
// routine is executed.
#define	dDispLoopCnt	(dDispLoopTime/dLoopTimeInSec)

//**************  Motor Parameters **************
#define diPoles         1       // Number of pole pairs
#define diCntsPerRev    2000    // Encoder counts per revolution
#define diNomRPM        3600    // Name Plate Motor RPM
#define dfRotorTmConst  0.078   // Rotor time constant in sec, from manufacturer

//************** Open Loop **************
#define dqOL_VelMech    2150    // 900 RPM for test

//************** Measurement **************
#define diIrpPerCalc    30      // PWM loops per velocity calculation

//************** PI Coefficients **************

// This definition can be used to bypass the velocity control loop.
// If TORQUE_MODE is defined, then the potentiometer demand value
// is passed directly to the Q (torque) control loop.
//#define	TORQUE_MODE

//******** D Control Loop Coefficients *******
#define     dDqKp           0x2000;     // 
#define     dDqKi           0x0100;     //        
#define     dDqKc           0x0100;     // 
#define     dDqOutMax       0x5A82;     //

//******** Q Control Loop Coefficients *******
#define     dQqKp           0x2000;     // 
#define     dQqKi           0x0100;     // 
#define     dQqKc           0x0100;     // 
#define     dQqOutMax       0x5A82;     //

//*** Velocity Control Loop Coefficients *****
#define     dQrefqKp        0x4000    // 
#define     dQrefqKi        0x0800;     // 
#define     dQrefqKc        0x0800;     // 
#define     dQrefqOutMax    0x3FFF;     // 

//************** ADC Scaling **************
// Scaling constants: Determined by calibration or hardware design. 

#define     dqK             0x3FFF;     // equivalent to 0.4999
#define     dqKa            0x3FFF;     // equivalent to 0.4999
#define     dqKb            0x3FFF;     // equivalent to 0.4999

//************** Field Weakening **************

// Field Weakening constant for constant torque range
#define     dqK1            3750;       // Flux reference value

#endif

⌨️ 快捷键说明

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