Index: Makefile =================================================================== --- Makefile (nonexistent) +++ Makefile (revision 31756) @@ -0,0 +1,6 @@ +all: + cd ../../src && $(MAKE) mod_lib_formula + +clean: + rm *.o *.so 2>/dev/null ; true + Index: Plug.tmpasm =================================================================== --- Plug.tmpasm (nonexistent) +++ Plug.tmpasm (revision 31756) @@ -0,0 +1,10 @@ +put /local/pcb/mod {lib_formula} +put /local/pcb/mod/OBJS [@ + $(PLUGDIR)/lib_formula/lib_formula.o +@] + +switch /local/pcb/lib_formula/controls + case {buildin} include /local/pcb/tmpasm/buildin; end; + case {plugin} include /local/pcb/tmpasm/plugin; end; + case {disable} include /local/pcb/tmpasm/disable; end; +end Index: impedance.c =================================================================== --- impedance.c (nonexistent) +++ impedance.c (revision 31756) @@ -0,0 +1,44 @@ +/* + * COPYRIGHT + * + * pcb-rnd, interactive printed circuit board design + * Copyright (C) 2020 Tibor 'Igor2' Palinkas + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Contact: + * Project page: http://repo.hu/projects/pcb-rnd + * lead developer: http://repo.hu/projects/pcb-rnd/contact.html + * mailing list: pcb-rnd (at) list.repo.hu (send "subscribe") + */ + +#include "config.h" +#include + +#define TOM(x) (RND_COORD_TO_MM(x) * 1000.0) +#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 w = TOM(trace_thick), 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 = qsrt(16 * SQR(h/weff) * SQR((14*Er+8)/(11*Er)) + ((Er+1)/(2*Er))*M_PI; + return N0 / (2*M_PI * sqrt(2) * sqrt(Er+1)) * log(1+4*(h/weff)*(x1+x2)); +} + Index: impedance.h =================================================================== --- impedance.h (nonexistent) +++ impedance.h (revision 31756) @@ -0,0 +1,2 @@ +double pcb_impedance_microstrip(rnd_coord_t trace_thick, rnd_coord_t trace_height, rnd_coord_t subst_height, double dielect); + Index: lib_formula.c =================================================================== --- lib_formula.c (nonexistent) +++ lib_formula.c (revision 31756) @@ -0,0 +1,44 @@ +/* + * COPYRIGHT + * + * pcb-rnd, interactive printed circuit board design + * Copyright (C) 2020 Tibor 'Igor2' Palinkas + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Contact: + * Project page: http://repo.hu/projects/pcb-rnd + * lead developer: http://repo.hu/projects/pcb-rnd/contact.html + * mailing list: pcb-rnd (at) list.repo.hu (send "subscribe") + */ + +#include "config.h" + +#include +#include + +#include "impedance.h" + +int pplg_check_ver_lib_formula(int ver_needed) { return 0; } + +void pplg_uninit_lib_formula(void) +{ +} + +int pplg_init_lib_formula(void) +{ + RND_API_CHK_VER; + return 0; +} Index: lib_formula.pup =================================================================== --- lib_formula.pup (nonexistent) +++ lib_formula.pup (revision 31756) @@ -0,0 +1,6 @@ +$class lib +$short mathematical forumlas +$long simple formulas, for efficient rule-of-thumb calculations +$state works +$package core +default buildin