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

📄 aci_se.asm

📁 TI公司24X系列DSP控制永磁同步电机PMSM
💻 ASM
字号:
;=======================================================================
; File Name:	aci_se.asm			      
;
; Module Name: 	ACI_SE	
;
; Initialization Routine: ACI_SE_INIT
;
; Originator:	Digital Control Systems Group
;			Texas Instruments
;
; Description:  Open-Loop Speed Estimator of Induction Motor 	    	
;
;
;			          |~~~~~~~~~~~~~~~~~~~~|
;	 psi_dr_se o----->|Q15	  	   	       |
;	 psi_qr_se o----->|Q15              Q15|----->o wr_hat_se 
;	theta_r_se o----->|Q15    ACI_SE	 Q0|----->o wr_hat_rpm_se
;	   i_ds_se o----->|Q15		  	       |
;      i_qs_se o----->|Q15                 |
;	         	      |____________________|
;
; Target dependency:	C2xx core only
;
;===========================================================================
; History:
;---------------------------------------------------------------------------
; 11-02-2000	Release	Rev 1.00	
;===========================================================================
;(To use this Module, copy this section to main system file)
;		.ref	ACI_SE,ACI_SE_INIT				;function call
;		.ref	psi_dr_se,psi_qr_se,theta_r_se	;Inputs
;		.ref	i_ds_se,i_qs_se					;Inputs
;		.ref	wr_hat_se,wr_hat_rpm_se			;Outputs
;===========================================================================
;Module definitions for external reference.
		.def	ACI_SE,ACI_SE_INIT				;function call
		.def	psi_dr_se,psi_qr_se,theta_r_se	;Inputs
		.def	i_ds_se,i_qs_se					;Inputs
		.def	wr_hat_se,wr_hat_rpm_se			;Outputs
;===========================================================================
motor1      .set    0			; 1-Hp motor (WEG)
motor2  	.set 	0			; 1-Hp motor (Dayton)
motor3 		.set	1			; 1/4-Hp motor (Dayton)

  .if (motor1) 
K1_se_		.set	517			; for K1_se (Q15)
K2_se_		.set	10667		; for K2_se (Q6) 
K3_se_		.set	30831		; for K3_se (Q15)	
K4_se_		.set	1937	    ; for K4_se (Q15)
  .endif

  .if (motor2)
K1_se_		.set	368			; for K1_se (Q15)
K2_se_		.set	10667		; for K2_se (Q6) 
K3_se_		.set	30831		; for K3_se (Q15)	
K4_se_		.set	1937	    ; for K4_se (Q15)	
  .endif

  .if (motor3) 
K1_se_		.set	776			; for K1_se (Q15)
K2_se_		.set	10667		; for K2_se (Q6) 
K3_se_		.set	30831		; for K3_se (Q15)	
K4_se_		.set	1937	    ; for K4_se (Q15)
  .endif                            

BASE_RPM_SE_ 	 .set 	3600		; Base rpm speed (Q0)	
DIFF_MAX_LIMIT   .set   7333h       ; The maximum limit to differentiate theta_r_se (Q15)
DIFF_MIN_LIMIT   .set   0CCDh       ; The minimum limit to differentiate theta_r_se (Q15)
         
		.include	x24x_app.h
            
i_ds_se         .usect	"se_aci",1 	; Stationary d-axis stator current      (Q15)
i_qs_se			.usect	"se_aci",1 	; Stationary q-axis stator current      (Q15)
psi_dr_se       .usect	"se_aci",1 	; Stationary d-axis rotor flux          (Q15)
psi_qr_se       .usect	"se_aci",1 	; Stationary q-axis rotor flux          (Q15)
theta_r_se      .usect	"se_aci",1 	; Rotor flux angle                      (Q15)
wr_hat_se       .usect	"se_aci",1 	; Estimated rotor speed                 (Q15)
wr_hat_rpm_se   .usect	"se_aci",1  ; Estimated rotor speed in rpm          (Q0)
K1_se			.usect	"se_aci",1	; Constant using in speed computation   (Q15) 
K2_se			.usect	"se_aci",1	; Constant using in differentiator      (Q6)
K3_se			.usect	"se_aci",1	; Constant using in low-pass filter     (Q15)
K4_se			.usect	"se_aci",1	; Constant using in low-pass filter     (Q15)
base_rpm_se     .usect	"se_aci",1  ; Base speed in rpm                        (Q0)
w_sl            .usect	"se_aci",1	; Estimated slip speed                    (Q15)
psi_r_2			.usect	"se_aci",1	; Stationary squared rotor flux           (Q15)		
theta_r_old     .usect	"se_aci",1	; Previous rotor flux angle               (Q15)
w_psi_r         .usect	"se_aci",1	; Estimated synchronous rotor flux speed  (Q15)
min_theta       .usect	"se_aci",1  ; Minimum limit for diffirential rotor flux angle (Q15)
max_theta       .usect	"se_aci",1  ; Maximum limit for diffirential rotor flux angle (Q15)
tmp1_se			.usect	"se_aci",1	; Temporary variable

;=========================
ACI_SE_INIT:
;=========================    
	LDP		#K1_se    
    SPLK	#K1_se_,K1_se  	    	; K1 = 1/(Wb*Tr)               (Q15)
	SPLK	#K2_se_,K2_se	     	; K2 = 1/(fb*T)                (Q6)
  	SPLK	#K3_se_,K3_se       	; K3 = Tau/(Tau+T)             (Q15)
  	SPLK	#K4_se_,K4_se       	; K4 = T/(Tau+T)               (Q15)
	SPLK	#BASE_RPM_SE_,base_rpm_se ; Initialize the base speed  (Q0)	
    SPLK	#DIFF_MAX_LIMIT,max_theta ; Initialize the max limit of rotor flux angle  (Q15)	
    SPLK	#DIFF_MIN_LIMIT,min_theta ; Initialize the min limit of rotor flux angle  (Q15)    
    SPLK	#0h,w_psi_r             ; Initialize the rotor flux speed (Q15)
    SPLK	#0h,theta_r_old         ; Initialize the rotor flux angle  (Q15)
 
    RET
                   
;=========================
ACI_SE:
;=========================    
   		SPM		0 				; Reset product mode 
		SETC	SXM				; Set sign extension mode
		SETC	OVM				; Set overflow mode

		LDP		#i_qs_se

; tmp1_se = K1*(psi_dr_se*i_qs_se - psi_qr_se*i_ds_se)       
		LT		i_qs_se			; TREG = i_qs_se               (Q15)
		MPY		psi_dr_se		; PREG = psi_dr_se*i_qs_se	   (Q30)
		PAC						; ACC = psi_dr_se*i_qs_se	   (Q30)
        LT		i_ds_se			; TREG = i_ds_se               (Q15)
		MPY		psi_qr_se		; PREG = psi_qr_se*i_ds_se	   (Q30)
		SPAC					; ACC = psi_dr_se*i_qs_se-psi_qr_se*i_ds_se  (Q30)
		SACH	tmp1_se,1		; tmp1_se = psi_dr_se*i_qs_se-psi_qr_se*i_ds_se  (Q15)			
		LT		K1_se			; TREG = K1						(Q15)
		MPY		tmp1_se			; PREG = K1*(psi_dr_se*i_qs_se-psi_qr_se*i_ds_se)  (Q30)
		PAC						; ACC = K1*(psi_dr_se*i_qs_se-psi_qr_se*i_ds_se)  (Q30)				
        SACH	tmp1_se,1		; tmp1_se = K1*(psi_dr_se*i_qs_se-psi_qr_se*i_ds_se)  (Q15)
; psi_r_2 =  psi_dr_se^2+psi_qr_se^2
        LT		psi_dr_se		; TREG = psi_dr_se              (Q15)
        MPY		psi_dr_se		; PREG = psi_dr_se^2			(Q30)
        PAC						; ACC = psi_dr_se^2	     		(Q30)
        LT		psi_qr_se		; TREG = psi_qr_se              (Q15)
        MPY		psi_qr_se		; PREG = psi_qr_se^2			(Q30)
        APAC					; ACC = psi_dr_se^2+psi_qr_se^2	(Q30)
        SACH	psi_r_2,1		; psi_r_2 = psi_dr_se^2+psi_qr_se^2	(Q15)
; w_sl(k) = K1*(psi_dr_se*i_qs_se - psi_qr_se*i_ds_se)/psi_r_2 
        LACC	tmp1_se,15		; ACC = tmp1_se left shifted by 15  (w_sl=Q15)
		RPT		#15				; Repeat SUBC 16 times
        SUBC	psi_r_2			; Dividing tmp1_se/psi_r_2
        SACL	w_sl			; w_sl = tmp1_se/psi_r_2         (Q15)

; Differentiator
; Check theta_r_se is within the differentiable range (min_theta,max_theta)
		LACC	max_theta
		SUB		theta_r_se
		BCND	LESS_MAX,GT		; Branch to LESS_MAX if max_theta > theta_r_se 
        B		SKIP_DIFF
LESS_MAX
    	LACC	min_theta
    	SUB		theta_r_se
    	BCND	MORE_MIN,LT    ; Branch to MORE_MIN if min_theta < theta_r_se 
        B		SKIP_DIFF
MORE_MIN	
		; Differentiating the rotor flux angle 
		; if min_theta < theta_r_se < max_theta
		LT		K2_se			; TREG = K2                (Q6)
		MPY		theta_r_se      ; PREG = K2*theta_r(k)     (Q21)
		PAC						; ACC = K2*theta_r(k)      (Q21)
		MPY		theta_r_old     ; PREG = K2*theta_r(k-1)   (Q21)
		SPAC					; ACC = K2*theta_r(k)-K2*theta_r(k-1)   (Q21)
		SFL               		; ACC = K2*theta_r(k)-K2*theta_r(k-1)   (Q22)
		SFL               		; ACC = K2*theta_r(k)-K2*theta_r(k-1)   (Q23)
		SFL               		; ACC = K2*theta_r(k)-K2*theta_r(k-1)   (Q24)
		SACH	tmp1_se,7       ; tmp1_se = K2*theta_r(k)-K2*theta_r(k-1)   (Q15)
		; Low-pass filter
		LT		K3_se			; TREG = K3                (Q15)
		MPY		w_psi_r         ; PREG = K3*w_psi_r(k-1)   (Q30)
        PAC						; ACC =  K3*w_psi_r(k-1)   (Q30)
        LT		K4_se			; TREG = K4                (Q15)
        MPY		tmp1_se         ; PREG = K4*tmp1_se        (Q30)
        APAC					; ACC = K3*w_psi_r(k-1)+K4*tmp1_se  (Q30)
        SACH	w_psi_r,1       ; w_psi_r(k) = K3*w_psi_r(k-1)+K4*tmp1_se  (Q15)
SKIP_DIFF

; Update the rotor flux angle
		LACC	theta_r_se		; ACC = theta_r_se              (Q15)
		SACL	theta_r_old     ; theta_r_old = theta_r_se      (Q15)
; wr_hat_se = w_psi_r - w_sl
		LACC	w_psi_r			; ACC = w_psi_r	                 (Q15)
		SUB		w_sl			; ACC = w_psi_r-w_sl             (Q15)	
		SACL	wr_hat_se		; wr_hat_se = w_psi_r-w_sl       (Q15)
; Change motor speed from pu value to rpm value (Q15 -> Q0)
		LT		base_rpm_se		; TREG = base_rpm_se             (Q0)
		MPY	    wr_hat_se    	; PREG = base_rpm_se*wr_hat_se   (Q15)
		PAC						; ACC = base_rpm_se*wr_hat_se    (Q15)	
		SACH	wr_hat_rpm_se,1	; wr_hat_rpm_se = base_rpm_se*wr_hat_se (Q0)
       
	    RET
 

⌨️ 快捷键说明

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