The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Design Languages >> Verilog-AMS >> Variable Gain with table_model
https://designers-guide.org/forum/YaBB.pl?num=1162227410

Message started by bessib on Oct 30th, 2006, 8:56am

Title: Variable Gain with table_model
Post by bessib on Oct 30th, 2006, 8:56am

Hello,

i want to model Gain Compression of a mixer caused by insufficient LO-Power with the table_model function. Here is my script and the table file:

             V(in)  <+ 50*I(in);                                                                                   //50Ohms input
           Power_LO_Vsquared = pow(V(LO),2)/50;                                                   //determining LO-Power
           Power_LO_dBm = abs(10*log(1e-30+Power_LO_Vsquared/1e-3));              //conversion to dBm
           Gain_tbl_dB = $table_model(Power_LO_dBm, "mixer_gain_temp2.tbl","");   //loading Gain from file
           Gain_tbl_V = pow(10,Gain_tbl_dB/20);                                                     //conversion of Gain
           V(out) <+ Gain_tbl_V*V(in);                                                                    //weighting Input with Gain

#mixer_gain_temp2.tbl
#
#LO-Power(dBm)              Gain(dB)
0                        2.6
1                        3.6
2                        6
3                        5.6
4                        6.6
5                        7.6
6                        8.4
7                        9.2

The script reads out the correct Gain but unfortunately there must be a problem in mulitplying the Gain with the input voltage.
Can anyone help me?

Thanks!

Title: Re: Variable Gain with table_model
Post by Ken Kundert on Oct 30th, 2006, 12:00pm

In line 2 V(LO) would be the instantaneous LO voltage. Probably not what you want.

-Ken

Title: Re: Variable Gain with table_model
Post by bessib on Nov 2nd, 2006, 7:47am

Thanks for your reply, Ken. Is there a way to extract the peakvalue of the voltage as a variable of type real?

Bessi

Title: Re: Variable Gain with table_model
Post by Geoffrey_Coram on Nov 2nd, 2006, 12:40pm

If you do, I think you'll end up with hidden state, the bane of RF simulations ...  But you are asking for some way to remember the past history of the model.  If you can save it to a node, rather than a real, then you might be OK.

Title: Re: Variable Gain with table_model
Post by Ken Kundert on Nov 2nd, 2006, 8:39pm

Rectify and filter.

-Ken

The Designer's Guide Community Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.