clarke3.comp
1 component clarke3 "Clarke (3 phase to cartesian) transform"; 2 description """The Clarke transform can be used to translate a vector 3 quantity from a three phase system (three components 120 degrees 4 apart) to a two phase Cartesian system (plus a homopolar component 5 if the three phases don't sum to zero).\n.P\n\\fBclarke3\\fR implements 6 the general case of the transform, using all three phases. If the 7 three phases are known to sum to zero, see \\fBclarke2\\fR for a 8 simpler version."""; 9 see_also """\\fBclarke2\\fR for the 'a+b+c=0' case, \\fBclarkeinv\\fR for 10 the inverse transform."""; 11 pin in float a; 12 pin in float b; 13 pin in float c "three phase input vector"; 14 pin out float x; 15 pin out float y "cartesian components of output"; 16 pin out float h "homopolar component of output"; 17 function _; 18 license "GPL"; 19 ;; 20 21 /* for the details, google "clarke transform", or see section 3 of 22 http://focus.ti.com/lit/an/bpra048/bpra048.pdf and/or appendix B of 23 http://www.esat.kuleuven.be/electa/publications/fulltexts/pub_1610.pdf 24 */ 25 26 #define K1 (0.666666666666667) /* 2/3 */ 27 #define K2 (0.333333333333333) /* 1/3 */ 28 #define K3 (0.577350269189626) /* 1/sqrt(3) */ 29 #define K4 (0.471404520791032) /* sqrt(2)/3 */ 30 31 FUNCTION(_) { 32 x = K1*a - K2*(b+c); 33 y = K3*(b-c); 34 h = K4*(a+b+c); 35 } 36 37 38 #if 0 39 #define K1 (2.0/3.0) 40 #define K2 (1.0/3.0) 41 #define K3 1.154700538 /* 2/sqrt(3) */ 42 43 FUNCTION(_) { 44 x = K1 * a - K2 * (b - c); 45 y = K3 * (b - c); 46 h = K1 * (a + b + c); 47 } 48 #endif