From d92569742f1efcd03bfcc15c753e66384006106c Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Wed, 24 Jan 2024 10:11:44 +0100 Subject: [PATCH] Add a transformer with parameters on the .subckt line --- examples/various/transformers1.cir | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/examples/various/transformers1.cir b/examples/various/transformers1.cir index 552be7550..cf26601b4 100644 --- a/examples/various/transformers1.cir +++ b/examples/various/transformers1.cir @@ -6,6 +6,8 @@ V1 1 0 dc 0 ac 1 sin (0 1 1k) Xtr1 1 0 2 0 tr1 +Xtr1a 1 0 32 0 tr1a psr=1m ssr=1m lp=1m ls=4m kt=0.98 + Xtr2 1 0 12 0 tr2 Xtr3 1 0 22 0 tr3 @@ -22,6 +24,16 @@ Xtr3 1 0 22 0 tr3 K1 L1 L2 0.98 ; coupling constant .ends +* transformer 1a +* ngspice manual 3.3.10, with parameters replacing fixed values +.subckt tr1a p1 p2 s1 s2 psr=1m ssr=1m lp=100u ls=100u kt=1 + Rp1 p1 pint1 {psr} ; primary series resistance + Rs1 s1 sint1 {ssr} ; secondary series resistance + L1 pint1 p2 {lp} ; primary inductance + L2 sint1 s2 {ls} ; secondary inductance + K1 L1 L2 {kt} ; coupling constant +.ends + * transformer 2 * ngspice manual 12.2.20 and 12.2.21 * px primary nodes, sx secondary nodes of electric circuit @@ -53,7 +65,7 @@ Xtr3 1 0 22 0 tr3 .control run set xbrushwidth=2 -plot V(1) v(2) V(1)+5 V(12)+5 V(1)+10 V(22)+10 +plot V(1) v(2) V(1)+5 V(12)+5 V(1)+10 V(22)+10 V(1)+15 V(32)+15 .endc .end