25 #include "PowSwingByInv.h"
28 void PowSwingByInv (
const double Vin,
const double Vout,
const double alpha,
29 double &DV,
double &rp)
31 const int maxiter = 30;
36 const double tolerance = 1e-8;
38 double aIN = 1.0/pow(Vin,2);
39 double aOUT = 1.0/pow(Vout,2);
42 while ((err > tolerance)&&(i < maxiter))
45 f = asin(aIN/(aIN + rp)) + asin(aOUT/(aOUT + rp)) - alpha;
46 df = -aIN/sqrt((rp + 2 * aIN) * rp)/(aIN+rp) -
47 aOUT/sqrt((rp + 2 * aOUT) * rp)/(aOUT+rp);
51 err = fabs(rp_new - rp);
59 DV = fabs (sqrt(Vout*Vout + (2.0/rp)) - sqrt(Vin*Vin + (2.0/rp)));