The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Modeling >> Behavioral Models >> Amplifier model in C++ for simulationg in CppSim
https://designers-guide.org/forum/YaBB.pl?num=1180534692

Message started by fjp@micrel.no on May 30th, 2007, 7:18am

Title: Amplifier model in C++ for simulationg in CppSim
Post by fjp@micrel.no on May 30th, 2007, 7:18am

Hi,

I'm making a C++ model for an amplifier for simulation using CppSim. By reading "Modeling RF Systems", I can make a model that takes IIP2 and IIP3 into account, but I'm not sure how to model noise using the rand() function. Any suggestions?

What I got so far is shown below. The code and syntax adhers to CppSim rules.

init:
     a = pow(10, gain/20);
     b = a/(pow(10, iip2/10)*2*50*0.001);
     c = a*(4/3)/(pow(10, iip3/10)*2*50*0.001);
     rnf = pow(10, nf/10);
     noise_voltage_squared = 2*(rnf-1)*1.3806504e-23*300*50;
code:
     in_noisy = ((rand()/RAND_MAX)*noise_voltage_squared) - 0.5 + in;
     out = dcout + (a*in_noisy) - (b*in_noisy*in_noisy) - (c*in_noisy*in_noisy*in_noisy);


Best regards,
Fred-J.

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