32 # define finite(x) _finite(x)
34 # define isnan(x) _isnan(x)
37 # define isinf(x) (!_finite(x) && !_isnan(x))
40 #if defined (__SVR4) && defined (__sun)
41 # define isinf(x) (!finite(x) && (x) == (x))
44 #define M_PI_2 1.5707963267948966192313216916397514
47 #define INFINITY -log (0.0);
65 void coplanar::getProperties()
87 double k1, kk1, kpk1, k2, k3, q1, q2, q3 = 0, qz, er0 = 0;
93 kpk1 = ellipk (
sqrt (1 - k1 * k1));
99 q3 = ellipk (k3) / ellipk (
sqrt (1 - k3 * k3));
101 er0 = 1 + q3 * qz * (er - 1);
102 zl_factor =
ZF0 / 2 * qz;
107 q2 = ellipk (k2) / ellipk (
sqrt (1 - k2 * k2));
108 er0 = 1 + (er - 1) / 2 * q2 / q1;
109 zl_factor =
ZF0 / 4 / q1;
114 double d, se, We, ke, qe;
115 d = (t * 1.25 /
M_PI) * (1 +
log (4 *
M_PI * w / t));
120 ke = We / (We + se + se);
121 qe = ellipk (ke) / ellipk (
sqrt (1 - ke * ke));
125 er0 = 1 + q3 * qz * (er - 1);
126 zl_factor =
ZF0 / 2 * qz;
130 zl_factor =
ZF0 / 4 / qe;
134 er0 = er0 - (0.7 * (er0 - 1) * t / s) / (q1 + (0.7 * t / s));
138 double sr_er =
sqrt (er);
139 double sr_er0 =
sqrt (er0);
142 double fte = (
C0 / 4) / (h *
sqrt (er - 1));
145 double p =
log (w / h);
146 double u = 0.54 - (0.64 - 0.015 * p) * p;
147 double v = 0.43 - (0.86 - 0.54 * p) * p;
148 double G =
exp (u *
log (w / s) + v);
154 double n = (1 - k1) * 8 *
M_PI / (t * (1 + k1));
159 double ac_factor = ac / (4 *
ZF0 * kk1 * kpk1 * (1 - k1 * k1));
160 double ad_factor = (er / (er - 1)) * tand *
M_PI /
C0;
164 double sr_er_f = sr_er0;
167 sr_er_f += (sr_er - sr_er0) / (1 + G *
pow (
f / fte, -1.8));
171 atten_cond = 20.0 /
log(10.0) * len
173 atten_dielectric = 20.0 /
log(10.0) * len
174 * ad_factor *
f * (sr_er_f * sr_er_f - 1) / sr_er_f;
176 ang_l = 2.0 *
M_PI * len * sr_er_f *
f /
C0;
178 er_eff = sr_er_f * sr_er_f;
179 Z0 = zl_factor / sr_er_f;
183 void coplanar::show_results()
209 #define MAX_ERROR 0.000001
214 double Z0_dest, Z0_current, Z0_result, increment, slope,
error;
229 error = fabs(Z0_dest - Z0_current);
234 increment = w / 100.0;
238 increment = s / 100.0;
248 slope = (Z0_result - Z0_current) / increment;
249 slope = (Z0_dest - Z0_current) / slope - increment;
262 error = fabs(Z0_dest - Z0_current);
289 #define NR_EPSI 2.2204460492503131e-16
294 void coplanar::ellipke (
double arg,
double &k,
double &
e) {
300 else if (isinf (arg) && arg < 0) {
305 double a,
b,
c,
f, s, fk = 1, fe = 1, t, da =
arg;
308 fk = 1 /
sqrt (1 - arg);
310 da = -arg / (1 -
arg);
317 for (i = 0; i < iMax; i++) {
341 double coplanar::ellipk (
double k) {
343 ellipke (k, r, lost);