![Microchip Technology AN908 Using Manual Download Page 51](http://html1.mh-extra.com/html/microchip-technology/an908/an908_using-manual_1785807051.webp)
2004 Microchip Technology Inc.
DS00908A-page 51
AN908
CurModel.s
;*******************************************************************
; Routines: CurModel
;;*******************************************************************
; Common to all routines in file
.include "general.inc"
.include "curmodel.inc"
.include "park.inc"
;*******************************************************************
; CurModel
;
;Description:
;
;
;Physical constants:
;
fRotorTmConst
Rotor time constant in sec
;
;Physical form of equations:
;
Magnetizing current (amps):
;
Imag = Imag + (fLoopPeriod/fRotorTmConst)*(Id - Imag)
;
;
Slip speed in RPS:
;
VelSlipRPS = (1/fRotorTmConst) * Iq/Imag / (2*pi)
;
;
Rotor flux speed in RPS:
;
VelFluxRPS = iPoles * VelM VelSlipRPS
;
;
Rotor flux angle (radians):
;
AngFlux = A fLoopPeriod * 2 * pi * VelFluxRPS
;
;Scaled Variables:
;
qdImag
Magnetizing current scaled by maximum current (1.31)
;
qVelSlip
Mechnical Slip velocity in RPS scaled by fScaleMechRPS
;
qAngFlux
Flux angle scaled by pi
;
;Scaled Equations:
;
qdImag
= qKcur * (qId - qdImag)
;
qVelSlip
= qKslip * qIq/qdImag
;
qAngFlux
= qA qKdelta * (qV qVelSlip)
;
;Scaling factors:
;
qKcur
= (2^15) * (fLoopPeriod/fRotorTmConst)
;
qKdelta
= (2^15) * 2 * iPoles * fLoopPeriod * fScaleMechRPS
;
qKslip
= (2^15)/(2 * pi * fRotorTmConst * iPoles * fScaleMechRPS)
;
;
;Functional prototype:
;
; void CurModel( void )
;
;On Entry:
CurModelParm structure must contain qKcur, qKslip, iKpoles,
;
qKdelta, qVelMech, qMaxSlipVel
;
;On Exit:
CurModelParm will contain qAngFlux, qdImag and qVelSlip
;