/ src / hal / components / clarke2.comp
clarke2.comp
 1  component clarke2 "Two input version of Clarke 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.\n.P\n\\fBclarke2\\fR implements
 5  a special case of the Clarke transform, which only needs two of the
 6  three input phases.  In a three wire three phase system, the sum of the
 7  three phase currents or voltages must always be zero.  As a result only
 8  two of the three are needed to completely define the current or voltage.
 9  \\fBclarke2\\fR assumes that the sum is zero, so it only uses phases A and
10  B of the input.  Since the H (homopolar) output will always be zero in
11  this case, it is not generated.""";
12  see_also """\\fBclarke3\\fR for the general case, \\fBclarkeinv\\fR for
13  the inverse transform.""";
14  pin in float a;
15  pin in float b "first two phases of three phase input";
16  pin out float x;
17  pin out float y "cartesian components of output";
18  function _;
19  license "GPL";
20  ;;
21  
22  /* for the details, google "clarke transform", or see section 3 of
23     http://focus.ti.com/lit/an/bpra048/bpra048.pdf and/or appendix B of
24     http://www.esat.kuleuven.be/electa/publications/fulltexts/pub_1610.pdf
25  */
26  
27  #define K1 (0.577350269189626)  /* 1/sqrt(3) */
28  #define K2 (1.154700538379250)  /* 2/sqrt(3) */
29  
30  FUNCTION(_) {
31      x = a;
32      y = K1*a + K2*b;
33  }