pancho_hideboo
|
Hi.
You can do them using Ocean Script.
The following is examples. This is inductor case. But it is easy also for capacitor case. Read documents about details of Ocean.
=======================================
awvSetOptionValue('dateStamp t) awvSetOptionValue('displayGrids t) awvSetOptionValue("cursorPrecision" 9) awvSetOptionValue("displayAxesBy125" t) pi = acos(-1.0) date = getCurrentTime()
;base_dir = getWorkingDir() base_dir = "~" ;; circuit_dir = "sim_ind" sim_data = "schematic" result_dir = strcat(base_dir, "/simulation/", circuit_dir, "/spectre/", sim_data) openResults( strcat(result_dir, "/psf") ) selectResult("sp-sp")
y11 = yp(1 1) y22 = yp(2 2)
Q1 = imag(1/y11)/real(1/y11) Q2 = imag(1/y22)/real(1/y22)
L1 = imag(1/y11)/(2*pi*xval(y11)) L2 = imag(1/y22)/(2*pi*xval(y22))
fx = 3.0GHz
printf("Q1@%gGHz=%g\n", fx/1G, value(Q1, fx)) printf("Q2@%gGHz=%g\n", fx/1G, value(Q2, fx)) printf("L1@%gGHz=%g[nH]\n", fx/1G, value(L1, fx)/1n) printf("L2@%gGHz=%g[nH]\n", fx/1G, value(L2, fx)/1n)
wid = newWindow() addTitle("Quality Factor of Inductor")
bid = currentSubwindow(1) addSubwindowTitle( sprintf(nil, "Q1=%g , Q2=%g at %gGHz", value(Q1, fx), value(Q2, fx), fx/1G )) plot( Q1 ?expr '("Q1") ) plot( Q2 ?expr '("Q2") ) xLimit(list(1G, 10G)) awvSetXAxisLabel(wid "frequency [Hz]" ?subwindow bid) awvSetYAxisLabel(wid 1 "Quality Factor of Inductor" ?subwindow bid)
addSubwindow() bid = currentSubwindow(2) addSubwindowTitle( sprintf(nil, "L1=%g[nH] , L2=%g[nH] at %gGHz", value(L1, fx)/1n, value(L2, fx)/1n, fx/1G )) plot( L1 ?expr '("L1") ) plot( L2 ?expr '("L2") ) ;xLimit(list(68u, 77u)) awvSetXAxisLabel(wid "frequency [Hz]" ?subwindow bid) awvSetYAxisLabel(wid 1 "Inductance [Henry]" ?subwindow bid)
|