Hello all,
I am trying to build a model of a double-balanced passive current mixer including IIP2 and Noise Figure. The implementation of the IIP2 worked but at noise simulations (qpnoise and pnoise) i got a NF 3db higher than set. The source code and setup is posted below.
When I choose maxclockorder higher than 2 I get 3.47db too much.
With pss/pnoise and referencesideband=-1 I achieve completely wrong results of about 270db noise figure.
With isource as input I get the correct pnoise_gain but no noise figure is calculated.
As output I used a port (also tried vdc) at the testif_mix pin in order to measure only lo*rf=if, so IP2 cannot be responsible for the wrong results. I am not sure if my noise simulation setup is correct, especially for current mixers.
Do you have any idea what is wrong and how I can fix it? Any help apreciated!
Thank you very much,
Jochen
p.s.: Forgot to mention that the 3 db remain even if I comment out the line with the noise source. With no additional (mixer) noise simulation should give 0db noise figure, I believe.
my simulation setup,
Code:parameters prf=-30 frf=1.9G fif=100M flo=frf-fif
PORT2 (net38 0) port r=50 num=2 dc=0 type=dc noisetemp=27
port1 (inp 0) port r=50 num=1 type=sine freq=frf dbm=prf noisetemp=27 fundname="frf"
V0 (lo 0) vsource type=pulse edgetype=halfsine val0=-1.0 val1=1.0 period=1/flo width=1/flo/2 fundname="flo"
R1 (if_ia 0) resistor r=1K isnoisy=no
R0 (if_ib 0) resistor r=1K isnoisy=no
I1 (inp 0 lo net38 if_ia if_ib) mixer iip2=30 gain_db=0 nf_db=10
simulatorOptions options reltol=1e-3 vabstol=1e-6 iabstol=1e-12 temp=27 \
tnom=27 scalem=1.0 scale=1.0 gmin=1e-12 rforce=1 maxnotes=5 maxwarns=5 \
digits=5 cols=80 pivrel=1e-3 sensfile="../psf/sens.output" \
checklimitdest=psf
qpss qpss funds=["flo" "frf"] maxharms=[4 3] errpreset=moderate saveinit=yes annotate=status
qpnoise qpnoise start=1 stop=2G dec=1 values=[1.9G] clockmaxharm=2 oprobe=PORT2 iprobe=port1 refsideband=
[1 0] annotate=status
saveOptions options save=allpub currents=all useprobes=yes
my mixer veriloga-model,
Code:// input has to be matched for correct ip2!
`include "constants.h"
`include "disciplines.h"
module mixer(mix_rf_a, mix_rf_b, lo_in, testif_mix, mix_if_a, mix_if_b);
inout mix_rf_a, mix_rf_b, lo_in, mix_if_a, mix_if_b, testif_mix;
electrical mix_rf_a, mix_rf_b, lo_in, mix_if_a, mix_if_b, testif_mix;
parameter real rin = 50.0;
parameter real iip2 = 10.0;
parameter real gain_db = 0;
parameter real nf_db = 10;
real iin, iout, iif, lo, a, b, amp_iip2, gain_lin, nf_lin, noise_current_sqrd;
analog begin
@(initial_step) begin
//amp_iip2 = sqrt(2*rin*0.001*pow(10,iip2/10.0)); // voltage equation
amp_iip2 = sqrt(2/rin*0.001*pow(10,iip2/10.0)); // 1/rin for current!
gain_lin = pow(10,gain_db/20);
nf_lin = pow(10, nf_db/10);
noise_current_sqrd = 4.0 *(nf_lin-1) *`P_K*$temperature /rin;
$display("noise-current-sqrd= %g", noise_current_sqrd);
a = gain_lin;
b = a / amp_iip2;
end
//reading input
iin = I(mix_rf_a, mix_rf_b);
lo = V(lo_in);
//mixing
iif = iin * lo;
I(testif_mix) <+ iif;
//applying nonlinearity, first mix then ip2 approach
iout = (a* `M_PI/2 -b*iif) *iif; //compensating T/2 conv-loss for correct ip2
I(mix_if_a, mix_if_b) <+ iout;
//Noise Current
I(mix_rf_a) <+ white_noise(noise_current_sqrd, "mixer_noise_current");
//Input resistance
V(mix_rf_a, mix_rf_b) <+ I(mix_rf_a, mix_rf_b) * rin;
end
endmodule