Index: impedance.c =================================================================== --- impedance.c (revision 31757) +++ impedance.c (revision 31758) @@ -27,18 +27,18 @@ #include "config.h" #include -#define TOM(x) (RND_COORD_TO_MM(x) / 1000.0) +#define TOM(x) RND_COORD_TO_MM(x) #define SQR(x) ((x)*(x)) #define N0 377 -double pcb_impedance_microstrip(rnd_coord_t trace_thick, rnd_coord_t trace_height, rnd_coord_t subst_height, double dielect) +double pcb_impedance_microstrip(rnd_coord_t trace_width, rnd_coord_t trace_height, rnd_coord_t subst_height, double dielect) { - double w = TOM(trace_thick), t = TOM(trace_height), h = TOM(subst_height), Er = dielect; + double w = TOM(trace_width), t = TOM(trace_height), h = TOM(subst_height), Er = dielect; double weff, x1, x2; weff = w + (t/M_PI) * log(4*M_E / sqrt(SQR(t/h)+SQR(t/(w*M_PI+1.1*t*M_PI)))) * (Er+1)/(2*Er); x1 = 4 * ((14*Er+8)/(11*Er)) * (h/weff); - x2 = sqrt(16 * SQR(h/weff) * SQR((14*Er+8)/(11*Er)) + ((Er+1)/(2*Er))*M_PI); + x2 = sqrt(16 * SQR(h/weff) * SQR((14*Er+8)/(11*Er)) + ((Er+1)/(2*Er))*M_PI*M_PI); return N0 / (2*M_PI * sqrt(2) * sqrt(Er+1)) * log(1+4*(h/weff)*(x1+x2)); } Index: impedance.h =================================================================== --- impedance.h (revision 31757) +++ impedance.h (revision 31758) @@ -1,2 +1,2 @@ -double pcb_impedance_microstrip(rnd_coord_t trace_thick, rnd_coord_t trace_height, rnd_coord_t subst_height, double dielect); +double pcb_impedance_microstrip(rnd_coord_t trace_width, rnd_coord_t trace_height, rnd_coord_t subst_height, double dielect);