Пример #1
0
vf_driver = VFdriver(N=50,
                     poletype='linlogcmplx',
                     weightparam='common_sqrt',
                     Niter1=7,
                     Niter2=4,
                     asymp='D',
                     logx=False,
                     plot=False
                     )
poles=None
SER, rmserr, bigYfit = vf_driver.vfdriver(bigY, s, poles)

plot_figure_11(s, bigY, bigYfit, SER)

# Passivity Enforcement
rp_driver = RPdriver(parametertype='y',
                     s_pass=2*np.pi*1j*np.linspace(0, 2e5, 1001).T,
                     ylim=np.array((-2e-3, 2e-3)))
SER, bigYfit_passive, opts3 = rp_driver.rpdriver(SER, s)

plot_figure_11(s, bigY, bigYfit_passive, SER)

poles = SER['poles']
residues = SER['C']
Ns = poles.shape[0]
Nc = int(residues.shape[1] / Ns)
poles = poles.reshape((1, -1))
residues = residues.reshape((Nc ** 2, Ns))
create_netlist_file(poles, residues)

Пример #2
0
poles = poles.reshape((1, -1))

# Parameters for Vector Fitting
weight = 1/np.sqrt(np.abs(f))

Niter=5
rms = np.zeros((Niter, 1))
for iter in range(Niter):
    print(f'Iteration: {iter}')
    vector_fitter = VectorFit3(asymp='NONE',
                               phaseplot=(iter == Niter - 1),
                               errplot=False,
                               complex_ss=False,
                               logx=True, logy=True,
                               skipres=(iter != Niter - 1),
                               spy2=(iter == Niter - 1))
    SER, poles, rmserr, fit = vector_fitter.do_fit(f, s, poles, weight)
    rms[iter,0] = rmserr

create_netlist_file(poles, SER['C'])

# Use the following code if running a final comparison between the original simulation output and
# the netlist simulation output.
# Note: final_s and final_f were taken from an ADS simulation running the netlist
# generated with create_netlist_file. This is only an example of how one would make the comparison
# final_s = np.load('output_from_4port_simulation_netlist_s.npy')
# final_f = np.load('output_from_4port_simulation_netlist_f.npy')
#
# plot_magnitude_phase_VF_format(s_original, f_original, final_f, final_f.shape[0], Ns, "Original", "Final", "example_4_port_ADS")
#