|
18 | 18 | import netdoping |
19 | 19 |
|
20 | 20 | def make_bias(contact): |
21 | | - def mycall(): |
22 | | - print("BIAS %s %1.15g" % (contact, get_circuit_node_value(solution="dcop", node=GetContactBiasName(contact)))) |
23 | | - return mycall |
| 21 | + def mycall(): |
| 22 | + print("BIAS %s %1.15g" % (contact, get_circuit_node_value(solution="dcop", node=GetContactBiasName(contact)))) |
| 23 | + return mycall |
24 | 24 |
|
25 | 25 | def make_sweep(contact_names, bias_names): |
26 | | - #cnames = ("base", "collector", "emitter") |
27 | | - def mycall(): |
28 | | - v=[] |
| 26 | + #cnames = ("base", "collector", "emitter") |
| 27 | + def mycall(): |
| 28 | + v=[] |
| 29 | + for c in contact_names: |
| 30 | + v.append("%1.15g" % get_circuit_node_value(solution="dcop", node=GetContactBiasName(c))) |
| 31 | + for b in bias_names: |
| 32 | + v.append("%1.15g" % -get_circuit_node_value(solution="dcop", node=b+".I")) |
| 33 | + print("CURVE: " + " ".join(v)) |
| 34 | + h = [] |
29 | 35 | for c in contact_names: |
30 | | - v.append("%1.15g" % get_circuit_node_value(solution="dcop", node=GetContactBiasName(c))) |
31 | | - for b in bias_names: |
32 | | - v.append("%1.15g" % -get_circuit_node_value(solution="dcop", node=b+".I")) |
33 | | - print("CURVE: " + " ".join(v)) |
34 | | - h = [] |
35 | | - for c in contact_names: |
36 | | - h.append("V(%s)" % c) |
37 | | - for c in contact_names: |
38 | | - h.append("I(%s)" % c) |
39 | | - print("HEADER: " + " ".join(h)) |
40 | | - return mycall |
| 36 | + h.append("V(%s)" % c) |
| 37 | + for c in contact_names: |
| 38 | + h.append("I(%s)" % c) |
| 39 | + print("HEADER: " + " ".join(h)) |
| 40 | + return mycall |
41 | 41 |
|
42 | 42 | def make_ac_callback(contact_names, bias_names, minf, maxf, ppd): |
43 | | - cnames = ("base", "collector", "emitter") |
44 | | - if (minf > maxf) or (minf <= 0.0) or (ppd <= 0): |
45 | | - raise NameError("minf must be less than maxf and greater than zero. ppd must be greater than 0") |
46 | | - ppde = pow(10, 1/ppd) |
47 | | - f = minf |
48 | | - freqs = [minf] |
49 | | - while f < maxf: |
50 | | - f *= ppde |
51 | | - if f > maxf: |
52 | | - f = maxf |
53 | | - freqs.append(f) |
54 | | - h = ["f"] |
55 | | - for c in contact_names: |
56 | | - h.append("V(%s)" % c) |
57 | | - for c in contact_names: |
58 | | - h.append("I(%s)" % c) |
59 | | - for c in contact_names: |
60 | | - h.append("IR(%s)" % c) |
61 | | - h.append("II(%s)" % c) |
62 | | - print("ACHEADER: " + " ".join(h)) |
63 | | - def ac_callback(): |
64 | | - # solve a few extra times for better ac sensitivity |
65 | | - solve(type="dc", absolute_error=1e10, relative_error=1e-2, maximum_iterations=40) |
66 | | - solve(type="dc", absolute_error=1e10, relative_error=1e-2, maximum_iterations=40) |
67 | | - solve(type="dc", absolute_error=1e10, relative_error=1e-2, maximum_iterations=40) |
68 | | - cinfo = [] |
| 43 | + cnames = ("base", "collector", "emitter") |
| 44 | + if (minf > maxf) or (minf <= 0.0) or (ppd <= 0): |
| 45 | + raise NameError("minf must be less than maxf and greater than zero. ppd must be greater than 0") |
| 46 | + ppde = pow(10, 1/ppd) |
| 47 | + f = minf |
| 48 | + freqs = [minf] |
| 49 | + while f < maxf: |
| 50 | + f *= ppde |
| 51 | + if f > maxf: |
| 52 | + f = maxf |
| 53 | + freqs.append(f) |
| 54 | + h = ["f"] |
| 55 | + for c in contact_names: |
| 56 | + h.append("V(%s)" % c) |
| 57 | + for c in contact_names: |
| 58 | + h.append("I(%s)" % c) |
69 | 59 | for c in contact_names: |
70 | | - cinfo.append("%1.15g" % get_circuit_node_value(solution="dcop", node=GetContactBiasName(c))) |
71 | | - for b in bias_names: |
72 | | - cinfo.append("%1.15g" % -get_circuit_node_value(solution="dcop", node=b+".I")) |
73 | | - for f in freqs: |
74 | | - v = ["%1.15g" % f] |
75 | | - v.extend(cinfo) |
76 | | - solve(type="ac", frequency=f) |
77 | | - for b in bias_names: |
78 | | - v.append("%1.15g" % -get_circuit_node_value(solution="ssac_real", node=b+".I")) |
79 | | - v.append("%1.15g" % -get_circuit_node_value(solution="ssac_imag", node=b+".I")) |
80 | | - print("AC: " + " ".join(v)) |
81 | | - return ac_callback |
| 60 | + h.append("IR(%s)" % c) |
| 61 | + h.append("II(%s)" % c) |
| 62 | + print("ACHEADER: " + " ".join(h)) |
| 63 | + def ac_callback(): |
| 64 | + # solve a few extra times for better ac sensitivity |
| 65 | + solve(type="dc", absolute_error=1e10, relative_error=1e-2, maximum_iterations=40) |
| 66 | + solve(type="dc", absolute_error=1e10, relative_error=1e-2, maximum_iterations=40) |
| 67 | + solve(type="dc", absolute_error=1e10, relative_error=1e-2, maximum_iterations=40) |
| 68 | + cinfo = [] |
| 69 | + for c in contact_names: |
| 70 | + cinfo.append("%1.15g" % get_circuit_node_value(solution="dcop", node=GetContactBiasName(c))) |
| 71 | + for b in bias_names: |
| 72 | + cinfo.append("%1.15g" % -get_circuit_node_value(solution="dcop", node=b+".I")) |
| 73 | + for f in freqs: |
| 74 | + v = ["%1.15g" % f] |
| 75 | + v.extend(cinfo) |
| 76 | + solve(type="ac", frequency=f) |
| 77 | + for b in bias_names: |
| 78 | + v.append("%1.15g" % -get_circuit_node_value(solution="ssac_real", node=b+".I")) |
| 79 | + v.append("%1.15g" % -get_circuit_node_value(solution="ssac_imag", node=b+".I")) |
| 80 | + print("AC: " + " ".join(v)) |
| 81 | + return ac_callback |
82 | 82 |
|
83 | 83 | def run(): |
84 | | - device="bjt" |
85 | | - region="bjt" |
86 | | - load_devices(file="bjt_dd_0.msh") |
87 | | - bjt_params.run(device, region) |
88 | | - netdoping.set_params(device, region) |
89 | | - SetSiliconParameters(device, region) |
| 84 | + device="bjt" |
| 85 | + region="bjt" |
| 86 | + load_devices(file="bjt_dd_0.msh") |
| 87 | + bjt_params.run(device, region) |
| 88 | + netdoping.set_params(device, region) |
| 89 | + SetSiliconParameters(device, region) |
90 | 90 |
|
91 | | - for c in ("base", "emitter", "collector"): |
92 | | - #set_parameter(device=device, region=region, name=GetContactBiasName(c), value=0.0) |
93 | | - CreateSiliconDriftDiffusionContact(device, region, c, "Jn", "Jp", True) |
94 | | - # use first initial of each contact name |
95 | | - circuit_element(name="V%s" % c[0], n1=GetContactBiasName(c), n2="0", value=0.0) |
| 91 | + for c in ("base", "emitter", "collector"): |
| 92 | + #set_parameter(device=device, region=region, name=GetContactBiasName(c), value=0.0) |
| 93 | + CreateSiliconDriftDiffusionContact(device, region, c, "Jn", "Jp", True) |
| 94 | + # use first initial of each contact name |
| 95 | + circuit_element(name="V%s" % c[0], n1=GetContactBiasName(c), n2="0", value=0.0) |
96 | 96 |
|
97 | | - solve(type="dc", absolute_error=1e6, relative_error=1e-1, maximum_iterations=40) |
98 | | - solve(type="dc", absolute_error=1e6, relative_error=1e-1, maximum_iterations=40) |
99 | | - solve(type="dc", absolute_error=1e6, relative_error=1e-1, maximum_iterations=40) |
| 97 | + solve(type="dc", absolute_error=1e6, relative_error=1e-1, maximum_iterations=40) |
| 98 | + solve(type="dc", absolute_error=1e6, relative_error=1e-1, maximum_iterations=40) |
| 99 | + solve(type="dc", absolute_error=1e6, relative_error=1e-1, maximum_iterations=40) |
100 | 100 |
|
101 | 101 |
|
0 commit comments