r'$V_{OUT}=$' + '{:.2f}V'.format(vo_dc)) eee51.add_hline_text(ax2, ic1[index]/g51.milli, 50, \ r'$I_C=$' + '{:.2f}mA'.format(ic1[index]/g51.milli)) eee51.label_plot(plt_cfg, fig, ax) plt.savefig('amp_ce_cm_transfer2.png') # get the gain via the slope of the transfer curve gain_ss = np.diff(vout) / np.diff(vin) ro1_calc = abs(npn_2n3904['VA']) / ic1[index] ro2_calc = abs(pnp_2n3906['VA']) / ic1[index] gm1_calc = ic1[index] / (npn_2n3904['n'] * g51.VT) gain_calc = -gm1_calc * eee51.r_parallel([ro1_calc, ro2_calc]) # define the plot parameters plt_cfg = { 'grid_linestyle': 'dotted', 'title': r'Common Emitter Amplifier Small Signal Gain', 'xlabel': r'$v_{in}$ [mV]', 'ylabel': r'Gain $A_v = \frac{\partial v_{out}}{\partial v_{in}}$', 'legend_loc': 'upper left', 'add_legend': True, 'legend_title': None } # plot the amplifier transfer characteristics fig = plt.figure() ax = fig.add_subplot(1, 1, 1)
eee51.add_vline_text(ax, 0, 0, r'$V_{BE}$ = ' + \ '{:.1f}mV'.format(reqd_vbe/g51.milli)) eee51.add_hline_text(ax, vo_dc, -75, \ r'$V_{OUT}=$' + '{:.2f}V'.format(vo_dc)) eee51.label_plot(plt_cfg, fig, ax) plt.savefig('2N2222A_ce_transfer.png') # get the gain via the slope of the transfer curve gain_ss = np.diff(vout) / np.diff(vin) ro_calc = abs(g51.bjt_VA) / ic[index] gm_calc = ic[index] / (bjt_n * g51.VT) gain_calc = -gm_calc * eee51.r_parallel([Rc, ro_calc]) # define the plot parameters plt_cfg = { 'grid_linestyle': 'dotted', 'title': r'Common Emitter Amplifier Small Signal Gain', 'xlabel': r'$v_{in}$ [mV]', 'ylabel': r'Gain $A_v = \frac{\partial v_{out}}{\partial v_{in}}$', 'legend_loc': 'upper left', 'add_legend': True, 'legend_title': None } # plot the amplifier transfer characteristics fig = plt.figure() ax = fig.add_subplot(1, 1, 1)
r'$I_{C1}=$' + '{:.3f}mA'.format(ic1[index]/g51.milli), \ verticalalignment='top') eee51.label_plot(plt_cfg, fig, ax) plt.savefig('amp_2stage_transfer.png') # get the gain via the slope of the transfer curve gain_ss = np.diff(vout)/np.diff(vin) ro1_calc = abs(npn_2n3904['VA']) / ic1[index] ro2_calc = abs(pnp_2n3906['VA']) / ic1[index] gm1_calc = ic1[index]/(npn_2n3904['n'] * g51.VT) gain1_calc = -gm1_calc * eee51.r_parallel([ro1_calc, ro2_calc]) gm5_calc = ic5[index]/(npn_2n3904['n'] * g51.VT) ro5_calc = abs(npn_2n3904['VA']) / ic5[index] ro6_calc = abs(pnp_2n3906['VA']) / ic5[index] gain2_calc = -gm5_calc * eee51.r_parallel([ro5_calc, ro6_calc]) gain_2stage = gain1_calc * gain2_calc # define the plot parameters plt_cfg = { 'grid_linestyle' : 'dotted', 'title' : r'Common Emitter Amplifier Small Signal Gain', 'xlabel' : r'$v_{in}$ [$\mu$V]', 'ylabel' : r'Gain $A_v = \frac{\partial v_{out}}{\partial v_{in}}$',
'{:.1f}'.format(0.0)) eee51.label_plot(plt_cfg, fig, ax) plt.savefig('diff_amp1_transfer_sim.png') gain_values = [[], [], []] for vod_value, gain_value in zip(vod_values, gain_values): # get the gain via the slope of the transfer curve gain_ss = np.diff(vod_value) / np.diff(vid) gain_value.append(gain_ss) gm1 = specs['ic1'] / g51.VT ro1 = abs(npn_2n3904['VA']) / specs['ic1'] RL = 1.5e3 gain_calc = -gm1 * eee51.r_parallel([ro1, RL]) index, val = eee51.find_in_data(vid, 0) # define the plot parameters plt_cfg = { 'grid_linestyle': 'dotted', 'title': r'Small Signal Differential Gain', 'xlabel': r'$V_{id}$ [mV]', 'ylabel': r'Gain $A_{dm} = \frac{\partial v_{od}}{\partial v_{id}}$', 'legend_loc': 'upper right', 'add_legend': True, 'legend_title': None } # plot the amplifier transfer characteristics
Vce6 = Vx - Ic6 * Re6 Vbe6 = eee51.bjt_find_vbe(Ic6, Vce6, \ npn_2n3904['Is'], npn_2n3904['n'], npn_2n3904['VA']) Ic8 = 2 * Ic6 / npn_2n3904['beta_1mA'] Vbe8 = eee51.bjt_find_vbe(Ic8, Vcc - Vbe6 - (Re6 * Ic6), \ npn_2n3904['Is'], npn_2n3904['n'], npn_2n3904['VA']) Vc7 = Vbe8 + Vbe6 + (Re6 * Ic6) Rmdiff = (Vcc - Vc7) / Ic6 gm1d = Ic1 / (g51.VT * npn_2n3904['n']) ro2d = abs(npn_2n3904['VA']) / Ic1 ro4d = abs(pnp_2n3906['VA']) / Ic1 adm = gm1d * eee51.r_parallel([ro2d, ro4d]) Rod = eee51.r_parallel([ro2d, ro4d]) # CE amplifier bias def f2(Re1, Ic1, Vo1, Vcc, bjt): Vbe1 = eee51.bjt_find_vbe(Ic1, Vcc - (Re1 * Ic1) - (Vcc/2), \ bjt['Is'], bjt['n'], bjt['VA']) Re = (Vcc - (Vo1 + Vbe1)) / Ic1 return Re - Re1 Ic1 = 1e-3 f2_args = (Ic1, Vo1, Vcc, pnp_2n3906)