Hello,
the equation AMCLIB_BemfObsrvDQ_Eq2 corresponds to the implemented observer structure which intentionally presumes that the phase error between the estimated quasi-synchronous frame gamma/delta and the synchronous rotor flux frame d/q is zero. If we assume that the feedback loop has converged to a steady state, the function will return zero angle theta_err, the term ed(n) in the AMCLIB_BemfObsrvDQ_Eq2 will be zero, and the term eq(n) will be proportional to the magnitude of the induced back-electromotive force. If, however, the two reference frames are not aligned (e.g. during a transient), the PI controllers will attempt to compensate the alignment error by increasing/decreasing ed(n)/eq(n) and the function will return non-zero value theta_err. The return value theta_err of the BEMF observer function is the only output that is needed for the feedback loop and can be used as an input for the angle tracking observer (AMCLIB_TrackObsrv). Outputs ed(n) and eq(n) (which are provided in the structure pEObsrv) can be used for debugging purposes or to detect fault states.
Function AMCLIB_BemfObsrvDQSetState is explained in the AMMCLib 1.1.31 User's Guide in the chapter 2.2.7.
If you are interested in obtaining the source code of AMMCLib, please contact the NXP sales by clicking the "Buy from NXP" button in the AMMCLib Offerings Table.