This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LAUNCHXL-F2800137: eSMO technical question

Part Number: LAUNCHXL-F2800137

Hi!

Im working with the observer called eSMO (sliding mode observer). 

Its a piece of code of the eSMO run function (PLL).

 

float32_t pllSine   = __sinpuf32(obj->thetaPll);
float32_t pllCosine = __cospuf32(obj->thetaPll);

obj->Ed = obj->Ealpha * pllCosine + obj->Ebeta  * pllSine;
obj->Eq = obj->Ebeta  * pllCosine - obj->Ealpha * pllSine;
obj->Eq_mag = sqrtf(obj->Ealpha * obj->Ealpha + obj->Ebeta * obj->Ebeta);

//0.1591549431 = 1/6.28 (1/(2*PI())
float32_t thetaErrSF = obj->thetaErrSF;

if(obj->Eq >= 0.0f) {
    thetaErrSF = -obj->thetaErrSF;
}

obj->thetaErr = obj->Ed * thetaErrSF / obj->Eq_mag;

and here you have a picture of the software architecture of the PLL from the "Dual Motor Control with Digital Interleaved PFC for HVAC Reference Design (Rev. A)" doc. Figure 2.20. Page 25.

From the Equation 61 from the same page of the same document we have:

epsilon = e_beta * cos (theta) - e_alpha * sin (theta).


Questions: 

1) In the piece of the code epsilon is represented by Ed or Eq? I assumed that it is Eq but in the last line of the piece of code thetaErr uses Ed.

obj->thetaErr = obj->Ed * thetaErrSF / obj->Eq_mag;
 
2) From the picture we see 

epsilon_error = epsilon * sign(Eq)  

Which mean that epsilon has a negative sign when Eq is negative.

But the code is changing the sign of epsilon when Eq is positive.  

if(obj->Eq >= 0.0f) {
thetaErrSF = -obj->thetaErrSF;
}

obj->thetaErr = obj->Ed * thetaErrSF / obj->Eq_mag;