Update processing script.
This commit is contained in:
parent
b32dfd2a36
commit
1ca79fc52b
@ -102,18 +102,34 @@ def find_onoff(ident, script, model, mos, l):
|
|||||||
vds = l.get_data('vds')
|
vds = l.get_data('vds')
|
||||||
current_lo = l.get_data('I(vds)', 0)
|
current_lo = l.get_data('I(vds)', 0)
|
||||||
current_hi = l.get_data('I(vds)', l.case_count - 1)
|
current_hi = l.get_data('I(vds)', l.case_count - 1)
|
||||||
print(ident, current_lo[-5], current_hi[-5])
|
if mos == "nmos":
|
||||||
|
print(ident, -current_lo[-1] * 1000, -current_hi[-1] * 1000, current_hi[-1]/current_lo[-1])
|
||||||
|
if mos == "pmos":
|
||||||
|
print(ident, current_lo[0] * 1000, current_hi[0] * 1000, current_lo[0]/current_hi[0])
|
||||||
|
|
||||||
def find_gm(ident, script, model, mos, l):
|
def find_gm(ident, script, model, mos, l):
|
||||||
vds = l.get_data('vds')
|
vds = l.get_data('vds')
|
||||||
gms = []
|
gms = []
|
||||||
for i in range(l.case_count):
|
if mos == "nmos":
|
||||||
if i == 0: continue
|
vgs1 = l.get_data('I(vds)', l.case_count - 2)
|
||||||
max_diff = max(
|
vgs2 = l.get_data('I(vds)', l.case_count - 1)
|
||||||
[ abs(curr - prev) for (curr, prev) in
|
gm = (vgs2[-1]-vgs1[-1])/(simulations[model][0]/12)
|
||||||
zip(l.get_data('I(vds)', i), l.get_data('I(vds)', i-1)) ])
|
print(ident, -gm * 1000, "mA/V")
|
||||||
gms.append(max_diff/(simulations[model][0]/12))
|
vds = l.get_data('vds', l.case_count - 1)
|
||||||
print(ident, max(gms) * 10000)
|
ids = l.get_data('I(vds)', l.case_count - 1)
|
||||||
|
ro = (vds[-5] - vds[-1])/(ids[-5] - ids[-1])
|
||||||
|
print(ident, -ro, "O")
|
||||||
|
print(ident, gm * ro)
|
||||||
|
if mos == "pmos":
|
||||||
|
vgs1 = l.get_data('I(vds)', 0)
|
||||||
|
vgs2 = l.get_data('I(vds)', 1)
|
||||||
|
gm = (vgs2[0]-vgs1[0])/(simulations[model][0]/12)
|
||||||
|
print(ident, -gm * 1000, "mA/V")
|
||||||
|
vds = l.get_data('vds', 0)
|
||||||
|
ids = l.get_data('I(vds)', 0)
|
||||||
|
ro = (vds[50] - vds[0])/(ids[50] - ids[0])
|
||||||
|
print(ident, -ro, "O")
|
||||||
|
print(ident, gm * ro)
|
||||||
|
|
||||||
def render_current(ident, script, model, mos, l):
|
def render_current(ident, script, model, mos, l):
|
||||||
vds = l.get_data('vds')
|
vds = l.get_data('vds')
|
||||||
@ -123,8 +139,8 @@ def render_current(ident, script, model, mos, l):
|
|||||||
plt.savefig(ident + "_current.png", dpi=192)
|
plt.savefig(ident + "_current.png", dpi=192)
|
||||||
plt.close()
|
plt.close()
|
||||||
|
|
||||||
def run_sim(script, model, mos, callback):
|
def run_sim(script, model, mos, callback, file_type = "dc"):
|
||||||
scriptname = "t_{}_{}".format(model, mos)
|
scriptname = "{}_{}_{}".format(file_type, model, mos)
|
||||||
with open(scriptname + ".cir", "w") as f:
|
with open(scriptname + ".cir", "w") as f:
|
||||||
f.write(simulations[model][1].format(simulations[model][0]))
|
f.write(simulations[model][1].format(simulations[model][0]))
|
||||||
if mos is not None: f.write(moss[mos])
|
if mos is not None: f.write(moss[mos])
|
||||||
@ -139,9 +155,16 @@ def run_sim(script, model, mos, callback):
|
|||||||
callback(scriptname, script, model, mos, l)
|
callback(scriptname, script, model, mos, l)
|
||||||
|
|
||||||
|
|
||||||
|
print(" --- gm, ro --- ")
|
||||||
|
for mos in moss.keys():
|
||||||
|
for node in simulations.keys():
|
||||||
|
run_sim(script_dc, node, mos, find_gm)
|
||||||
|
|
||||||
|
print(" --- onoff --- ")
|
||||||
for mos in moss.keys():
|
for mos in moss.keys():
|
||||||
for node in simulations.keys():
|
for node in simulations.keys():
|
||||||
run_sim(script_dc, node, mos, find_onoff)
|
run_sim(script_dc, node, mos, find_onoff)
|
||||||
|
|
||||||
|
print(" --- period --- ")
|
||||||
for node in simulations.keys():
|
for node in simulations.keys():
|
||||||
run_sim(script_ring, node, None, find_period)
|
run_sim(script_ring, node, None, find_period, "t")
|
||||||
|
Loading…
Reference in New Issue
Block a user