summaryrefslogtreecommitdiff
path: root/Windows/spice/examples/inductive-systems
diff options
context:
space:
mode:
Diffstat (limited to 'Windows/spice/examples/inductive-systems')
-rw-r--r--Windows/spice/examples/inductive-systems/positive-definite-1.cir32
-rw-r--r--Windows/spice/examples/inductive-systems/positive-definite-2.cir31
-rw-r--r--Windows/spice/examples/inductive-systems/positive-definite-3.cir33
-rw-r--r--Windows/spice/examples/inductive-systems/positive-definite-4.cir80
4 files changed, 176 insertions, 0 deletions
diff --git a/Windows/spice/examples/inductive-systems/positive-definite-1.cir b/Windows/spice/examples/inductive-systems/positive-definite-1.cir
new file mode 100644
index 00000000..1d8257d5
--- /dev/null
+++ b/Windows/spice/examples/inductive-systems/positive-definite-1.cir
@@ -0,0 +1,32 @@
+* indentify non-viable inductive systems (2x2 case)
+
+* (compile (concat "../../../w32/src/ngspice " buffer-file-name) t)
+* (compile (concat "valgrind --track-origins=yes --leak-check=full --show-reachable=yes ../../../w32/src/ngspice " buffer-file-name) t)
+
+.subckt ind2 a1 a2 b1 b2 L11=0 L22=0 L12=0
+R1 a1 n1 1k
+L1 n1 a2 {L11}
+L2 n2 b2 {L22}
+R2 n2 a2 1k
+K12 L1 L2 {L12/sqrt(abs(L11*L22))}
+.ends
+
+v1 a 0 dc 1
+R1 a 0 1k
+R2 b 0 1k
+
+Xgood1 a 0 b 0 ind2 L11=1u L22=4u L12=1.98u
+Xbad2 a 0 b 0 ind2 L11=1u L22=4u L12=2.01u
+Xgood3 a 0 b 0 ind2 L11=1u L22=4u L12=-1.98u
+Xbad4 a 0 b 0 ind2 L11=1u L22=4u L12=-2.01u
+
+Xbad5 a 0 b 0 ind2 L11=1u L22=-4u L12=1n
+Xbad6 a 0 b 0 ind2 L11=-1u L22=4u L12=1n
+
+.control
+op
+remcirc
+quit 0
+.endc
+
+.end
diff --git a/Windows/spice/examples/inductive-systems/positive-definite-2.cir b/Windows/spice/examples/inductive-systems/positive-definite-2.cir
new file mode 100644
index 00000000..82bb9272
--- /dev/null
+++ b/Windows/spice/examples/inductive-systems/positive-definite-2.cir
@@ -0,0 +1,31 @@
+* indentify non-viable inductive systems (3xx case)
+
+* (compile (concat "../../../w32/src/ngspice " buffer-file-name) t)
+* (compile (concat "valgrind --track-origins=yes --leak-check=full --show-reachable=yes ../../../w32/src/ngspice " buffer-file-name) t)
+
+.subckt ind3 a b c L11=10u L22=11u L33=10u K12=0 K13=0 K23=0
+R1 a n1 1k
+R2 b n2 1k
+R4 c n3 1k
+L1 n1 0 {L11}
+L2 n2 0 {L22}
+L3 n3 0 {L33}
+K12 L1 L2 {K12}
+K13 L1 L3 {K13}
+K23 L2 L3 {K23}
+.ends
+
+Xgood1 a b c ind3
+Xgood2 a b c ind3 K12=0.96 K23=0.99 K13=0.98
+Xgood3 a b c ind3 K12=0.96 K23=0.99 K13=0.9898988607
+Xbad4 a b c ind3 K12=0.96 K23=0.99 K13=0.9898988608
+Xborder5 a b c ind3 K12=1 K23=1 K13=1
+Xbad6 a b c ind3 K12=1.01 K23=1 K13=1
+
+.control
+op
+remcirc
+quit 0
+.endc
+
+.end
diff --git a/Windows/spice/examples/inductive-systems/positive-definite-3.cir b/Windows/spice/examples/inductive-systems/positive-definite-3.cir
new file mode 100644
index 00000000..731bf761
--- /dev/null
+++ b/Windows/spice/examples/inductive-systems/positive-definite-3.cir
@@ -0,0 +1,33 @@
+* indentify non-viable inductive systems (4x4 case)
+
+* this excersices the "merging" case in muttemp.c
+
+* (compile (concat "../../../w32/src/ngspice " buffer-file-name) t)
+* (compile (concat "valgrind --track-origins=yes --leak-check=full --show-reachable=yes ../../../w32/src/ngspice " buffer-file-name) t)
+
+.subckt ind4 a b c d L11=0 L22=0 L33=0 L44=0 L12=0 L13=0 L14=0 L23=0 L24=0 L34=0
+R1 a 1 1k
+R2 b 2 1k
+R3 c 3 1k
+R4 d 4 1k
+L1 a 0 {L11}
+L2 b 0 {L22}
+L3 c 0 {L33}
+L4 d 0 {L44}
+K13 L1 L3 {L13/sqrt(abs(L11*L33))}
+K14 L1 L4 {L14/sqrt(abs(L11*L44))}
+K23 L2 L3 {L23/sqrt(abs(L22*L33))}
+K24 L2 L4 {L24/sqrt(abs(L22*L44))}
+K12 L1 L2 {L12/sqrt(abs(L11*L22))}
+K34 L3 L4 {L34/sqrt(abs(L33*L44))}
+.ends
+
+Xgood1 a b c d ind4 L11=1u L22=4u L33=3u L44=5u L12=1n L13=1n L14=1n L23=1n L24=1n L34=1n
+
+.control
+op
+remcirc
+quit 0
+.endc
+
+.end
diff --git a/Windows/spice/examples/inductive-systems/positive-definite-4.cir b/Windows/spice/examples/inductive-systems/positive-definite-4.cir
new file mode 100644
index 00000000..f1841c7d
--- /dev/null
+++ b/Windows/spice/examples/inductive-systems/positive-definite-4.cir
@@ -0,0 +1,80 @@
+* indentify non-viable inductive systems ("altering" case)
+
+* exercise "alter" and "indverbosity"
+
+* (compile (concat "../../../w32/src/ngspice " buffer-file-name) t)
+* (compile (concat "valgrind --track-origins=yes --leak-check=full --show-reachable=yes ../../../w32/src/ngspice " buffer-file-name) t)
+
+
+V1 x 0 dc=0 ac=1
+Rx x 1 1
+R1 2 0 1k
+R2 3 0 1k
+
+L1 1 0 10u
+L2 2 0 11u
+L3 3 0 10u
+
+k12 L1 L2 0
+k23 L2 L3 0
+k13 L1 L3 0
+
+R101 101 0 1k
+L101 101 0 1u
+L102 102 0 2u
+L103 103 0 3u
+K1012 L101 L102 0.1
+K1013 L101 L103 0.2
+
+.AC LIN 5k 1k 10MEG
+
+.control
+listing e
+
+echo coupling factors 0 0 0 -- ok
+op
+
+alter k12 0.96
+alter k23 0.99
+alter k13 0.98
+echo coupling factors 0.96 0.98 0.98 -- ok
+op
+
+alter k12 0.96
+alter k23 0.99
+alter k13 0.9898988607
+echo coupling factors 0.96 0.98 0.9898988607 -- ok
+op
+
+alter k12 0.96
+alter k23 0.99
+alter k13 0.9898988608
+echo coupling factors 0.96 0.98 0.9898988608 -- not ok
+op
+
+alter k12 1
+alter k23 1
+alter k13 1
+echo coupling factors 1 1 1 -- not ok
+op
+
+echo coupling factors 1.01 1 1 -- not ok
+alter k12 1.01
+set indverbosity = 2
+echo "op with indverbosity=2"
+op
+set indverbosity = 1
+echo "op with indverbosity=1"
+op
+set indverbosity = 0
+echo "op with indverbosity=0"
+op
+
+destroy all
+remcirc
+
+quit
+
+.endc
+
+.END