summaryrefslogtreecommitdiff
path: root/Windows/spice/examples/control_structs
diff options
context:
space:
mode:
Diffstat (limited to 'Windows/spice/examples/control_structs')
-rw-r--r--Windows/spice/examples/control_structs/foreach_bjt_ft.sp51
-rw-r--r--Windows/spice/examples/control_structs/if-batchmode.cir31
-rw-r--r--Windows/spice/examples/control_structs/if-test-1.cir78
-rw-r--r--Windows/spice/examples/control_structs/new-check-3.sp96
-rw-r--r--Windows/spice/examples/control_structs/new-check-4.sp111
-rw-r--r--Windows/spice/examples/control_structs/repeat3.sp148
-rw-r--r--Windows/spice/examples/control_structs/s-param.cir120
7 files changed, 0 insertions, 635 deletions
diff --git a/Windows/spice/examples/control_structs/foreach_bjt_ft.sp b/Windows/spice/examples/control_structs/foreach_bjt_ft.sp
deleted file mode 100644
index ef5e9d47..00000000
--- a/Windows/spice/examples/control_structs/foreach_bjt_ft.sp
+++ /dev/null
@@ -1,51 +0,0 @@
-BJT ft Test
-
-vce 1 0 dc 3.0
-vgain 1 c dc 0.0
-f 0 2 vgain -1000
-l 2 b 1g
-c 2 0 1g
-ib 0 b dc 0.0 ac 1.0
-ic 0 c 0.01
-q1 c b 0 bfs17
-
-.control
-foreach myic 0.5e-3 1e-3 5e-3 10e-3 50e-3 100e-3
- alter ic = $myic
- ac dec 10 10k 5g
-end
-*foreach mytf 50p 100p 150p 200p 250p 300p
-* altermod q.x1.q1 tf = $mytf
-* ac dec 10 10k 5g
-*end
-plot abs(ac1.vgain#branch) abs(ac2.vgain#branch) abs(ac3.vgain#branch) abs(ac4.vgain#branch) abs(ac5.vgain#branch) abs(ac6.vgain#branch) ylimit 0.1 100 loglog
-.endc
-
-*****************************************************************
-* SPICE2G6 MODEL OF THE NPN BIPOLAR TRANSISTOR BFS17 (SOT-23) *
-* REV: 98.1 DANALYSE GMBH BERLIN (27.07.1998) *
-*****************************************************************
-.SUBCKT BFS17C 1 2 3
-Q1 6 5 7 BFS17 1.000
-LC 1 6 0.350N
-L1 2 4 0.400N
-LB 4 5 0.500N
-L2 3 8 0.400N
-LE 8 7 0.600N
-CGBC 4 6 70.00F
-CGBE 4 8 0.150P
-CGCE 6 8 15.00F
-.ENDS
-.MODEL BFS17 NPN (level=1 IS=0.480F NF=1.008 BF=99.655 VAF=90.000 IKF=0.190
-+ ISE=7.490F NE=1.762 NR=1.010 BR=38.400 VAR=7.000 IKR=93.200M
-+ ISC=0.200F NC=1.042
-+ RB=1.500 IRB=0.100M RBM=1.200
-+ RE=0.500 RC=2.680
-+ CJE=1.325P VJE=0.700 MJE=0.220 FC=0.890
-+ CJC=1.050P VJC=0.610 MJC=0.240 XCJC=0.400
-+ TF=56.940P TR=1.000N PTF=21.000
-+ XTF=68.398 VTF=0.600 ITF=0.700
-+ XTB=1.600 EG=1.110 XTI=3.000
-+ KF=1.000F AF=1.000)
-
-.end
diff --git a/Windows/spice/examples/control_structs/if-batchmode.cir b/Windows/spice/examples/control_structs/if-batchmode.cir
deleted file mode 100644
index b26b345c..00000000
--- a/Windows/spice/examples/control_structs/if-batchmode.cir
+++ /dev/null
@@ -1,31 +0,0 @@
-use $batchmode
-
-* use $batchmode variable to steer control flow
-*
-* start either with
-* ngspice -b -r rawfile.raw if-batchmode.cir
-* or with
-* ngspice if-batchmode.cir
-
-v0 1 0 dc 1
-R1 1 2 1k
-C1 2 0 1u
-
-.tran 100u 10m uic
-.print tran all
-
-.control
-
-if $?batchmode
- echo "Info: batchmode has been set by command line option -b"
- echo
-else
- echo "Info: batchmode has not been set"
- echo
- unset ngdebug
- tran 100u 10m uic
- plot v(2)
-end
-
-.endc
-.end
diff --git a/Windows/spice/examples/control_structs/if-test-1.cir b/Windows/spice/examples/control_structs/if-test-1.cir
deleted file mode 100644
index 41927bdf..00000000
--- a/Windows/spice/examples/control_structs/if-test-1.cir
+++ /dev/null
@@ -1,78 +0,0 @@
-test if conditions
-
-* test behaviour in special circumstances
-
-v1 1 0 dc 42
-R1 1 0 1k
-
-
-.control
-
-echo "expect Error: missing if condition"
-* does not enter cp_istrue()
-if
- echo "FAIL: you should not see this"
-else
- echo "nonetheless evaluated as FALSE"
-end
-echo
-
-set testvar_b=""
-echo "expect |false|"
-* in cp_istrue(): wl!=NULL names==NULL v==NULL
-if $testvar_b
- echo "FAIL: you should not see this"
-else
- echo "|false|"
-end
-echo
-
-set testvar_c
-echo "expect testvar_c=|TRUE|"
-* in cp_istrue(): wl!=NULL names!=NULL v!=NULL
-if $testvar_c
- echo "testvar_c=|$testvar_c|"
-end
-echo
-
-echo "expect Error: testvar_d: no such variable."
-* in cp_istrue(): wl!=NULL then wl==NULL names==NULL v==NULL
-if $testvar_d
- echo "FAIL: you should not see this"
-else
- echo "nonetheless evaluated as FALSE"
-end
-echo
-
-echo "expect Error(parse.c--checkvalid): testvar_e: no such vector."
-* in cp_istrue(): wl!=NULL names==NULL v==NULL
-if testvar_e = 3.3
- echo "FAIL: you should not see this"
-else
- echo "nonetheless evaluated as FALSE"
-end
-echo
-
-let testvar_f = 3.5
-
-echo "expect |false|"
-if testvar_f = 3.3
- echo "FAIL: you should not see this"
-else
- echo "|false|"
-end
-echo
-
-echo "expect |true|"
-if testvar_f = 3.5
- echo "|true|"
-else
- echo "FAIL: you should not see this"
-end
-echo
-
-op
-print v(1)
-
-.endc
-.end
diff --git a/Windows/spice/examples/control_structs/new-check-3.sp b/Windows/spice/examples/control_structs/new-check-3.sp
deleted file mode 100644
index c85c19f6..00000000
--- a/Windows/spice/examples/control_structs/new-check-3.sp
+++ /dev/null
@@ -1,96 +0,0 @@
-new ft_getpnames parser check 3, try ternary
-
-* (compile (concat "tmp-1/ng-spice-rework/src/ngspice " buffer-file-name) t)
-
-VIN 1 0 DC=0
-
-.control
-
-dc VIN 0 10 5
-
-* trying the ternary
-
-let checks = 0
-
-let const0 = 0
-let const5 = 5
-let const6 = 6
-
-
-let tmp = const0 ? const5 : const6
-if tmp eq const6
- let checks = checks + 1
-else
- echo "ERROR:"
-end
-
-let tmp = const6 ? const5 : const6
-if tmp eq const5
- let checks = checks + 1
-else
- echo "ERROR:"
-end
-
-define foo(a,b,d) a ? b : d
-
-if foo(const0,const5,const6) eq const6
- let checks = checks + 1
-else
- echo "ERROR:"
-end
-
-if foo(const6,const5,const6) eq const5
- let checks = checks + 1
-else
- echo "ERROR:"
-end
-
-let vec7 = 7*unitvec(7)
-let vec8 = 8*unitvec(8)
-
-if length(const5 ? vec7 : vec8) eq 7
- let checks = checks + 1
-else
- echo "ERROR:"
-end
-
-if length(const0 ? vec7 : vec8) eq 8
- let checks = checks + 1
-else
- echo "ERROR:"
-end
-
-* FIXME, "1 ? 1:1" (without spaces around of ':') doesnt work,
-* "1:1" is a lexem, WHY !!!
-* ist that an old artifact, (ancient hierarchical name separator ':')
-*
-*print length(1?1:1)
-
-*if (1 ? 1:1) eq 1
-if (1 ? 1 : 1) eq 1
- let checks = checks + 1
-else
- echo "ERROR:"
-end
-
-print @vin[dc]
-
-* '"' survives, and will be processed in the ft_getpnames() lexer, that is PPlex()
-* where the string will be unqoted
-* thats used vor weired variable names, for example "zero(1)"
-let foo = "vec8"
-if foo eq vec8
- let checks = checks + 1
-else
- echo "ERROR:"
-end
-
-if checks eq 8
- echo "INFO: ok"
-else
- echo "ERROR:"
-end
-
-.endc
-
-.end
diff --git a/Windows/spice/examples/control_structs/new-check-4.sp b/Windows/spice/examples/control_structs/new-check-4.sp
deleted file mode 100644
index 7c241f23..00000000
--- a/Windows/spice/examples/control_structs/new-check-4.sp
+++ /dev/null
@@ -1,111 +0,0 @@
-demonstrate < etc in ft_getpnames
-
-* (compile (concat "tmp-1/ng-spice-rework/src/ngspice " buffer-file-name) t)
-
-VIN 1 0 DC=0
-
-.control
-
-dc VIN 0 10 5
-
-let checks = 0
-
-let const0 = 0
-let const5 = 5
-let const6 = 6
-
-* check some relational operators, which are in danger to mixed up
-* with csh semantic, that is IO redirection
-
-if const5 < const6
- let checks = checks + 1
-else
- echo "ERROR:"
-end
-
-if const6 > const5
- let checks = checks + 1
-else
- echo "ERROR:"
-end
-
-if const5 >= const5
- let checks = checks + 1
-else
- echo "ERROR:"
-end
-
-if const5 <= const5
- let checks = checks + 1
-else
- echo "ERROR:"
-end
-
-if const5 = const5
- let checks = checks + 1
-else
- echo "ERROR:"
-end
-
-* check some wired non-equality operators
-* note: there are some awkward tranformations ahead of the ft_getpnames lexer
-* transforming "><" into "> <"
-* and "<>" into "< >"
-* note: "!=" would have been in serious danger to be fooled up within
-* csh history mechanism
-
-if const6 <> const5
- let checks = checks + 1
-else
- echo "ERROR:"
-end
-
-if const6 >< const5
- let checks = checks + 1
-else
- echo "ERROR:"
-end
-
-
-* check some boolean operators, which are in danger to be mixed up
-* with csh semantic, `&' background '|' pipe '~' homedirectory
-
-if const5 & const5
- let checks = checks + 1
-else
- echo "ERROR:"
-end
-
-if const0 | const5
- let checks = checks + 1
-else
- echo "ERROR:"
-end
-
-if ~ const0
- let checks = checks + 1
-else
- echo "ERROR:"
-end
-
-* note:
-* "!=" would be in danger, '!' triggers the csh history mechanism
-*if const5 != const6
-* echo "just trying"
-*end
-
-
-* Note: csh semantics swallows the '>' and '<' operators
-* on most of the com lines
-* witnessed by
-let tmp = const5 > unwanted_output_file_1
-define foo(a,b) a > unwanted_output_file_2
-print const0 > unwanted_output_file_3
-
-if checks eq 10
- echo "INFO: ok"
-end
-
-.endc
-
-.end
diff --git a/Windows/spice/examples/control_structs/repeat3.sp b/Windows/spice/examples/control_structs/repeat3.sp
deleted file mode 100644
index 5650252a..00000000
--- a/Windows/spice/examples/control_structs/repeat3.sp
+++ /dev/null
@@ -1,148 +0,0 @@
-Test sequences for ngspice control structures
-*vectors are used (except foreach)
-*start in interactive mode
-
-.control
-
-* test for while, repeat, if, break
- let loop = 0
- while loop < 4
- let index = 0
- repeat
- let index = index + 1
- if index > 4
- break
- end
- end
- echo index "$&index" loop "$&loop"
- let loop = loop + 1
- end
-
-
-* test sequence for while, dowhile
- let loop = 0
- echo
- echo enter loop with "$&loop"
- dowhile loop < 3
- echo within dowhile loop "$&loop"
- let loop = loop + 1
- end
- echo after dowhile loop "$&loop"
- echo
- let loop = 0
- while loop < 3
- echo within while loop "$&loop"
- let loop = loop + 1
- end
- echo after while loop "$&loop"
- let loop = 3
- echo
- echo enter loop with "$&loop"
- dowhile loop < 3
- echo within dowhile loop "$&loop" $ output expected
- let loop = loop + 1
- end
- echo after dowhile loop "$&loop"
- echo
- let loop = 3
- while loop < 3
- echo within while loop "$&loop" $ no output expected
- let loop = loop + 1
- end
- echo after while loop "$&loop"
-
-
-* test sequence for foreach
- echo
- foreach outvar 0 0.5 1 1.5
- echo parameters: $outvar $ foreach parameters are variables, not vectors!
- end
-
-* test for if ... else ... end
- echo
- let loop = 0
- let index = 1
- dowhile loop < 10
- let index = index * 2
- if index < 128
- echo "$&index" lt 128
- else
- echo "$&index" ge 128
- end
- let loop = loop + 1
- end
-
-* simple test for label, goto
- echo
- let loop = 0
- label starthere
- echo start "$&loop"
- let loop = loop + 1
- if loop < 3
- goto starthere
- end
- echo end "$&loop"
-
-* test for label, nested goto
- echo
- let loop = 0
- label starthere1
- echo start nested "$&loop"
- let loop = loop + 1
- if loop < 3
- if loop < 3
- goto starthere1
- end
- end
- echo end "$&loop"
-
-* test for label, goto
- echo
- let index = 0
- label starthere2
- let loop = 0
- echo We are at start with index "$&index" and loop "$&loop"
- if index < 6
- label inhere
- let index = index + 1
- if loop < 3
- let loop = loop + 1
- if index > 1
- echo jump2
- goto starthere2
- end
- end
- echo jump
- goto inhere
- end
- echo We are at end with index "$&index" and loop "$&loop"
-
-* test goto in while loop
- echo
- let loop = 0
- if 1 $ outer loop to allow nested forward label 'endlabel'
- while loop < 10
- if loop > 5
- echo jump
- goto endlabel
- end
- let loop = loop + 1
- end
- echo before $ never reached
- label endlabel
- echo after "$&loop"
- end
-
-*test for using variables
-* simple test for label, goto
- echo
- set loop = 0
- label starthe
- echo start $loop
- let loop = $loop + 1 $ expression needs vector at lhs
- set loop = "$&loop" $ convert vector contents to variable
- if $loop < 3
- goto starthe
- end
- echo end $loop
-.endc
diff --git a/Windows/spice/examples/control_structs/s-param.cir b/Windows/spice/examples/control_structs/s-param.cir
deleted file mode 100644
index bff277f7..00000000
--- a/Windows/spice/examples/control_structs/s-param.cir
+++ /dev/null
@@ -1,120 +0,0 @@
-Test for Scattering Parameters
-** Two ports
-** Examples: Bipolar, Tschebyschef, RC
-
-.param Rbase=50 Vbias_in=0 Vbias_out=0
-
-*** The two-port circuit:
-** port 1: in 0
-** port 2: out 0
-** Bias on both ports through resistor Rbase (to obtain operating point)
-
-** Example RF Bipolar mrf5711
-** VCE 1 V, IE = 5mA
-** QXXXXXXX nc nb ne
-** model obtained from
-** http://141.69.160.32/~krausg/Spice_Model_CD/Vendor%20List/Motorola/Spice/RFBJT/
-*.include MRF5711.lib
-*XMRF5711 out in e MRF5711
-*Ie e 0 5m
-*Ce e 0 1
-
-** Example Tschebyschef Low Pass filter
-C1 in 0 33.2p
-L1 in 2 99.2n
-C2 2 0 57.2p
-L2 2 out 99.2n
-C3 out 0 33.2p
-
-** Example RC
-** see
-** http://www.allenhollister.com/allen/files/scatteringparameters.pdf
-*R2 in out 10
-*C1 out int5 30p
-*R1 int5 0 10
-
-*** End of circuit
-
-
-** The following subcircuit to be changed only by an experienced user!
-
-*** Driver and readout
-X1 in out S22 S12 S_PARAM
-
-.SUBCKT S_PARAM 22 66 5 7
-* Resistors emulate switches with Ron=0.001 and Roff=1e12
-* to switch driver to input and readout to output (and vice versa, see below)
-RS1 22 2 0.001
-RS2 66 6 0.001
-RS3 22 6 1e12
-RS4 66 2 1e12
-*Driver
-Vacdc 1 0 DC 'Vbias_in' AC 1 $ ac voltage and dc bias at input (applied through load resistor)
-R1 1 2 'Rbase'
-E1 3 0 2 0 2 $ amplify in port ac voltage by 2
-Vac 3 4 DC 0 AC 1 $ subtract driving ac voltage
-R_loop 4 5 0.001
-R3 5 0 1 $ ground return for measure node 5
-*Readout
-E2 7 0 6 0 2 $ amplify out port ac voltage by 2
-R4 6 8 'Rbase' $ load resistor at output (ac)
-Vdc 8 0 DC 'Vbias_out' AC 0 $ dc bias at output (applied through load resistor)
-.ends
-
-** Check the two ac lines below for being equal!
-.control
-set noaskquit
-set filetype=ascii
-*** measurement for s11 and s21
-op
-** save bias voltages to vector
-let Vdcnew=V(X1.1) $ former Vacdc
-let Vacdcnew=v(X1.8) $ former Vdc
-** first ac measurement (change this line only together with following ac line)
-*ac lin 20 0.1G 2G $ use for bip transistor
-ac lin 100 2.5MEG 250MEG $ use for Tschebyschef
-*ac lin 101 1k 10G $ use for RC
-**
-** switch input and output
-alter R.X1.RS1=1e12
-alter R.X1.RS2=1e12
-alter R.X1.RS3=0.001
-alter R.X1.RS4=0.001
-** switch bias voltages between in and out
-alter V.X1.Vacdc DC=op1.Vacdcnew
-alter V.X1.Vdc DC=op1.Vdcnew
-*** measurement for s12 and s22
-op
-** second ac measurement (change this line only together with ac line above)
-*ac lin 20 0.1G 2G $ use for bip transistor
-ac lin 100 2.5MEG 250MEG $ use for Tschebyschef
-*ac lin 101 1 10G $ use for RC
-**
-let s11=ac1.s22
-let s21=ac1.s12
-settype s-param S11 S21 S22 S12
-
-let S11db = db(s11)
-let S12db = db(s12)
-let S21db = db(s21)
-let S22db = db(s22)
-settype decibel S11db S21db S22db S12db
-
-let P11=180*ph(s11)/pi
-let P21=180*ph(s21)/pi
-let P22=180*ph(S22)/pi
-let P12=180*ph(S12)/pi
-settype phase P11 P21 P22 P12
-
-let Rbase=@R.X1.R4[Resistance]
-settype impedance Rbase
-
-*plot s11db s21db S22db S12db ylimit -50 0 xlog $ used with RC
-plot s11db s21db S22db S12db ylimit -0.5 0 $ used with Tschebyschef
-plot P11 P21 P22 P12
-plot smithgrid S11 S12
-*wrdata s3046 mag(S11) P11 mag(S21) P21 mag(S22) P22 mag(S12) P12 $ write simple table
-wrs2p s3046.s2p $ write touchstone vers. 1 file s3046.s2p
-.endc
-
-.end