Exemplo n.º 1
0
    for line in f:
        vbe.append(float(line.split()[0]))
        ic.append(float(line.split()[1]))
        ic2.append(float(line.split()[3]))
        ib2.append(float(line.split()[5]))

# convert to mV and mA
ic_mA = eee51.scale_vec(ic, g51.milli)
vbe_mV = eee51.scale_vec(vbe, g51.milli)

bjt_beta = [a / b for a, b in zip(ic2, ib2)]

# bjt parameters from our dc characterization
bjt_Is = 6.924988420125876e-13
bjt_n = 1.2610858394025979
g51.update_bjt_VA(-15.550605626760145)
g51.update_bjt_vce(specs['vce'])

# calculate the vbe needed for vce = 2.5V
reqd_vbe = eee51.bjt_find_vbe(specs['ic'], specs['vce'], \
        bjt_Is, bjt_n, g51.bjt_VA)

# generate the ic for the ideal bjt model
# using our values for Is, n, and VA at vce = 2.5V

ic_ideal = [eee51.ideal_bjt_transfer(v, bjt_Is, bjt_n) for v in vbe]
ic_ideal_mA = eee51.scale_vec(ic_ideal, g51.milli)

# define the plot parameters
plt_cfg = {
    'grid_linestyle': 'dotted',
Exemplo n.º 2
0
ind4, vce4 = eee51.find_in_data(vce, 4)

line_m = []  # declare an array of 'slopes'
line_b = []  # declare an array of 'y-intercepts'
line_VA = []  # declare an array of 'x-intercepts' or in this case, VA

# use curve_fit to get the slopes and y-intercepts then caculate VA
for j, v in enumerate(vbe):
    popt, pcov = curve_fit(eee51.line_eq, vce[ind1:ind4], ic[j][ind1:ind4])
    line_m.append(popt[0])
    line_b.append(popt[1])
    line_VA.append(-popt[1] / popt[0])

# declare the x values for plotting the curve-fitted lines
line_x = np.linspace(math.floor(min(line_VA)), max(vce), 100)
g51.update_bjt_VA(mean(line_VA))
# use the mean value of VA
# yay! we got an estimate for VA

# define the plot parameters
plt_cfg = {
    'grid_linestyle': 'dotted',
    'title': 'BJT 2N2222A Output Characteristics (sim)',
    'xlabel': r'$V_{CE}$ [V]',
    'ylabel': r'$I_C$ [mA]',
    'legend_loc': 'upper left',
    'add_legend': False
}

# plot the output characteristics
fig = plt.figure()