📄 characterization.ocn
字号:
; -----------------------------------------------------------
;
; Additional material to the book
; Modeling and Simulation for RF System Design
;
; THIS CODE IS LICENSED TO YOU "AS IT IS" AND WITH NO WARRANTIES,
; EXPRESSED OR IMPLIED. THE AUTHORS SPECIFICALLY DISCLAIM ALL IMPLIED
; WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
; THEY MUST NOT HAVE ANY RESPONSIBILITY FOR ANY DAMAGES, FINANCIAL OR
; LEGAL CLAIMS WHATEVER.
; -----------------------------------------------------------
;
; Name: OCEAN script for the characterization of an LNA
;
; Source: characterization.ocn
; -----------------------------------------------------------
;
; All path, net and port names must be adapted before own use.
; -----------------------------------------------------------
; environment settings
simulator('spectre)
design("./simulation/LNA_PB_lab/spectre/schematic/netlist/netlist")
resultsDir("./simulation/LNA_PB_lab/spectre/schematic")
; analysis settings and design variables for gain measurement
analysis('pss ?fund "900M" ?harms "1" ?errpreset "moderate")
desVar("frf2" 0)
desVar("frf1" 900M)
desVar("prf" -40)
desVar("switch_pos" 1)
save('i "/PORT0/PLUS" "/PORT1/PLUS" "/PORT2/PLUS")
temp(27)
; simulation start
run()
; plot power gain
selectResults('pss_fd)
newWindow()
powergain = db10((let(((vn (v("/net6") - 0.0))) spectralPower((vn / resultParam("PORT2:r")) vn)) / harmonic(spectralPower(-i("/PORT0/PLUS") (v("/net08") - 0.0)) '1)))
plot( powergain ?expr '("Power Gain"))
; deletes analysis settings of first simulation run
delete('analysis)
; analysis settings and design variables for noise measurement
analysis('pss ?fund "900M" ?harms "1" ?errpreset "moderate")
analysis('pnoise ?start "700M" ?stop "1.2G" ?maxsideband "10" ?p "/net6" ?n "" ?oprobe "" ?iprobe "/PORT1" ?refsideband "0")
desVar("frf2" 0)
desVar("frf1" 900M)
desVar("prf" -40)
desVar("switch_pos" 2)
; simulation start
run()
; plot noise figure
selectResults('pnoise)
newWindow()
noisefigure = getData("NF")
plot(noisefigure ?expr '("Noise Figure"))
; deletes analysis settings of second simulation run
delete('analysis)
; analysis settings and design variables for IIP3 measurement
analysis('pss ?fund "10M" ?harms "100" ?errpreset "moderate" ?param "prf" ?start "-50" ?stop "0" ?step "1")
desVar("frf2" 910M)
desVar("frf1" 900M)
desVar("prf" -40)
desVar("switch_pos" 1)
; simulation start
run()
; plots IP3 curves and prints output for IP3 value
selectResults('pss_fd)
newWindow()
ip3Plot(v("/net6") 89 91 -45)
spurWave=dB20(harmonic(v("/net6") 89))
refWave=dB20(harmonic(v("/net6") 91))
ip3_loc=ipn(spurWave refWave 3 1 -45 -45)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -