您好!
我在使用高压太阳能逆变器直流交流转换套件,里面有CNTL_2P2Z,请问怎么能改变CNTL_2P2Z_Ref:n 的值呢?
谢谢!
Eric Ma:”我在使用高压太阳能逆变器直流交流转换套件,里面有CNTL_2P2Z,请问怎么能改变CNTL_2P2Z_Ref:n 的值呢?“
Eric:
C:\ti\controlSUITE\libs\app_libs\digital_power\f2803x_v3.5\Doc
您好!
我在使用高压太阳能逆变器直流交流转换套件,里面有CNTL_2P2Z,请问怎么能改变CNTL_2P2Z_Ref:n 的值呢?
谢谢!
user5034040:
回复 Eric Ma:
您好!非常非常感谢您的回复,我读了您发给我所在地址的文档,但是我所使用的套件它的CNTL_2P2Z的程序是这样的,和文档中的编程方式不太相同,我不知应该怎么更改ref的值。
;———————————————————————————-
; FILE:SOLAR_CNTL_2P2Z.asm
;
; Description: 2nd Order Control Law Macro Module
;
; Version:2.0
;
;Target:F2802x / F2803x
;
;———————————————————————————-
;Copyright Texas Instruments2010
;———————————————————————————-
;Revision History:
;———————————————————————————-
;Date| Description
;———————————————————————————-
;06/15/10| Release 2.0(MB)
;———————————————————————————-
;=============================
SOLAR_CNTL_2P2Z_INIT .macro n
;=============================
; allocate memory space for data & terminal pointers分配存储器
_CNTL_2P2Z_Ref:n: .usect"CNTL_2P2Z_Section",2,1,1; reference input terminal指令一个未初始化段
_CNTL_2P2Z_Fdbk:n: .usect"CNTL_2P2Z_Section",2,1,1; feedback input terminal
_CNTL_2P2Z_Out:n: .usect"CNTL_2P2Z_Section",2,1,1; output terminal
_CNTL_2P2Z_Coef:n: .usect"CNTL_2P2Z_Section",2,1,1; coefficients & saturation limits (14 words)
_CNTL_2P2Z_DBUFF:n: .usect"CNTL_2P2Z_InternalData",10,1,1; internal Data BUFF
; publish terminal pointers for access from the C environment.def_CNTL_2P2Z_Ref:n:.def_CNTL_2P2Z_Fdbk:n:.def_CNTL_2P2Z_Out:n:.def_CNTL_2P2Z_Coef:n:.def_CNTL_2P2Z_DBUFF:n:
; set terminal pointers to ZeroNetMOVL XAR2, #ZeroNetMOVW DP, #_CNTL_2P2Z_Ref:n:MOVL @_CNTL_2P2Z_Ref:n:, XAR2MOVW DP, #_CNTL_2P2Z_Fdbk:n:MOVL @_CNTL_2P2Z_Fdbk:n:, XAR2MOVW DP, #_CNTL_2P2Z_Out:n:MOVL @_CNTL_2P2Z_Out:n:, XAR2
; zero data bufferMOVW DP, #_CNTL_2P2Z_DBUFF:n:MOVLXAR2,#_CNTL_2P2Z_DBUFF:n:RPT#9; 10 times|| MOV*XAR2++, #0.endm
;====================================
SOLAR_CNTL_2P2Z_RESET .macro n
;====================================
; zero data bufferMOVW DP, #_CNTL_2P2Z_DBUFF:n:MOVLXAR2,#_CNTL_2P2Z_DBUFF:n:RPT#9; 10 times|| MOV*XAR2++, #0.endm
;———————————————————————————-
;=============================
SOLAR_CNTL_2P2Z .macro n
;=============================
; set up address pointersMOVW DP, #_CNTL_2P2Z_Ref:n:MOVLXAR0, @_CNTL_2P2Z_Ref:n:; net pointer to Ref (XAR0)MOVW DP,#_CNTL_2P2Z_Fdbk:n:MOVLXAR1, @_CNTL_2P2Z_Fdbk:n:; net pointer to Fdbk (XAR1)MOVW DP,#_CNTL_2P2Z_DBUFF:n:MOVL XAR4, #_CNTL_2P2Z_DBUFF:n:; pointer to the DBUFF array (used internally by the module)
; calculate error (Ref – Fdbk)MOVL ACC, *XAR0; ACC = Ref (Q24) = Q(24)SUBL ACC, *XAR1; ACC = Ref(Q24) – Fdbk(Q24)= error(Q24)LSLACC, #6; Logical left shift by 6,Q{24}<<6 -> Q{30}
;store error in DBUFF ;MOVL *+XAR4[4], ACC; e(n) = ACC = error Q{30} MOVL *+XAR4[6], ACC; e(n) = ACC = error Q{30} MOVAR0,#8SUBLACC, *+XAR4[AR0]ADDLACC, *+XAR4[6]MOVL*+XAR4[4], ACCMOVW DP,#_CNTL_2P2Z_Out:n:MOVLXAR2, @_CNTL_2P2Z_Out:n:; net pointer to Out (XAR2)MOVW DP,#_CNTL_2P2Z_Coef:n:MOVLXAR3, @_CNTL_2P2Z_Coef:n:; net pointer to Coef (XAR3)ZAPA
; compute 2P2Z filterMOVAR0,#8MOVL XT, *+XAR4[AR0]; XT= e(n-2)QMPYL P, XT, *XAR3++; P= e(n-2)Q30*B2{Q26} = I8Q24MOVDL XT, *+XAR4[6]; XT= e(n-1), e(n-2) = e(n-1)QMPYAL P, XT, *XAR3++; P= e(n-1)Q30*B1{Q26} = Q24, ACC=e(n-2)*B2;MOVDL XT, *+XAR4[4]; XT= e(n), e(n-1) = e(n) MOVL XT, *+XAR4[4]; XT= e(n)QMPYAL P, XT, *XAR3++; P= e(n)Q30*B0{Q26}= Q24, ACC = e(n-2)*B2 + e(n-1)*B1 MOVL XT,*+XAR4[2]; XT= u(n-2)QMPYAL P, XT, *XAR3++; P= u(n-2)*A2, ACC = e(n-2)*B2 + e(n-1)*B1 + e(n)*B0MOVDL XT,*+XAR4[0]; XT= u(n-1), u(n-2) = u(n-1)QMPYAL P, XT, *XAR3++; P= u(n-1)*A1, ACC = e(n-2)*B2 + e(n-1)*B1 + e(n)*B0 + u(n-2)*A2ADDL ACC, @P; ACC = e(n-2)*B2 + e(n-1)*B1 + e(n)*B0 + u(n-2)*A2 + u(n-1)*A1
; scale u(n):Q24, saturate (max>u(n)>min0), and save historyMINL ACC, *XAR3++; saturate to < max (Q24)MAXL ACC, *XAR3; saturate to > min (Q24)
; write controller result to output terminal (Q24)MOVL *XAR2, ACC; output control effort to terminal net
; Convert the u(n) to Q30 format and store in the data bufferLSLACC, #6; Logical left shift by 6, Q{24}<<6 -> Q{30}MOVL *XAR4, ACC; u(n-1) = u(n) = ACC
.endm
; end of file
您好!
我在使用高压太阳能逆变器直流交流转换套件,里面有CNTL_2P2Z,请问怎么能改变CNTL_2P2Z_Ref:n 的值呢?
谢谢!
user5034040:
回复 Eric Ma:
您好!在main函数里面所有的CNTL_2P2Z都没对Ref进行初始化,我可以在对应的CNTL_2P2Z:4下面增加一句Ref=_IQ24(0.1)来改变Ref的值吗?谢谢你!
CNTL_2P2Z_CoefStruct1.b2 = _IQ26(-0.3682);CNTL_2P2Z_CoefStruct1.b1 = _IQ26(0.01121);CNTL_2P2Z_CoefStruct1.b0 = _IQ26(0.3794);CNTL_2P2Z_CoefStruct1.a2= _IQ26(-0.869);CNTL_2P2Z_CoefStruct1.a1= _IQ26(1.869);CNTL_2P2Z_CoefStruct1.max = _IQ24(0.0);//4ACNTL_2P2Z_CoefStruct1.min = _IQ24(-0.4);
//Current loop for 52e-6 sample timeCNTL_2P2Z_CoefStruct2.b2 = _IQ26(-0.3938);CNTL_2P2Z_CoefStruct2.b1 = _IQ26(0.1314);CNTL_2P2Z_CoefStruct2.b0 = _IQ26(0.5253);CNTL_2P2Z_CoefStruct2.a2= _IQ26(-0.01);CNTL_2P2Z_CoefStruct2.a1= _IQ26(1.01);CNTL_2P2Z_CoefStruct2.max = _IQ24(0.4);CNTL_2P2Z_CoefStruct2.min = _IQ24(-0.4);//400//Notch filter for 60Hz system, sample rate 416e-6sCNTL_2P2Z_CoefStruct3.b2 = _IQ26(0.9);CNTL_2P2Z_CoefStruct3.b1 = _IQ26(-1.712);CNTL_2P2Z_CoefStruct3.b0 = _IQ26(0.9);CNTL_2P2Z_CoefStruct3.a2= _IQ26(-0.8);CNTL_2P2Z_CoefStruct3.a1= _IQ26(1.712);CNTL_2P2Z_CoefStruct3.max = _IQ24(0.99);// radCNTL_2P2Z_CoefStruct3.min = _IQ24(-0.99);// rad//PLL controller , sample rate 416e-6CNTL_2P2Z_CoefStruct4.b2 = _IQ26(-0.01723);CNTL_2P2Z_CoefStruct4.b1 = _IQ26(0.0004355);CNTL_2P2Z_CoefStruct4.b0 = _IQ26(0.01767);CNTL_2P2Z_CoefStruct4.a2= _IQ26(-0.864);CNTL_2P2Z_CoefStruct4.a1= _IQ26(1.864);CNTL_2P2Z_CoefStruct4.max = _IQ24(0.06);// 50HzCNTL_2P2Z_CoefStruct4.min = _IQ24(-0.06);// -50Hz
您好!
我在使用高压太阳能逆变器直流交流转换套件,里面有CNTL_2P2Z,请问怎么能改变CNTL_2P2Z_Ref:n 的值呢?
谢谢!
Eric Ma:
回复 user5034040:
对啊
你可以参考这个例程里面的初始化设置:
C:\ti\controlSUITE\development_kits\HV_SOLAR_DC_AC_v1.1\SolarHv_DCAC_PiccoloB_Rev_02
//2P2Z net//Voltage loop CNTL_2P2Z_Ref1 = &dwBus_Voltage_Ref; CNTL_2P2Z_Out1 = &dwBus_Voltage_Loop_Out_1;CNTL_2P2Z_Fdbk1 = &dwBus_Voltage_Fbk; CNTL_2P2Z_Coef1 = &CNTL_2P2Z_CoefStruct1.b2;
//Current loopCNTL_2P2Z_Ref2 = &dwInv_Curr_Ref;CNTL_2P2Z_Out2 = &dwInv_Curr_LoopOut;CNTL_2P2Z_Fdbk2 = &dwInv_Current_1;CNTL_2P2Z_Coef2 = &CNTL_2P2Z_CoefStruct2.b2;
Eric