Capsim Block Documentation
Model a nonlinear Power Amplifier specifying 1dB compression, gain and backoff. Real input/output.
Port | Type | Name | |
---|---|---|---|
0 | float | inStream |
Port | Type | Name | |
---|---|---|---|
0 | float | outStream |
Num | Type | Name | Initial Value | Description |
---|---|---|---|---|
0 | float | sumOut | ||
1 | float | aGain | ||
2 | float | bGain | ||
3 | float | cmp | ||
4 | float | rout | ||
5 | float | rin | ||
6 | float | bov | ||
7 | float | rhoInMax | ||
8 | float | rhoOutMax | ||
9 | int | counter |
float rho, avgPower, pNat,outPowerDBm; double tmpIn; double thirdOrder; double tmpRe, tmpIm; double tmpOutRe, tmpOutIm; |
---|
rout = sourceR; rin = sourceR; /* * Calculate voltage gain from power gain */ aGain = (pow(10.0, (G/20.0))); /* * Calculate 1dB compression in voltage from dBm */ cmp = sqrt(pow(10.0, out1dB/10)*2*rout*0.001)/aGain; printf("cmp=%f\n",cmp); /* * Scale input for input backoff */ bov=(pow(10.0, (bo/20.0))); /* * Calculate third order term */ bGain = (0.108749)/(cmp*cmp); /* * Calculate soft-limiting input threshold */ rhoInMax = cmp*s; printf("rhoInMax=%f\n",rhoInMax); /* * Calculate output limiting ceiling */ rhoOutMax = aGain*s*cmp*(1-bGain*pow((cmp*s),2)); printf("rhoOutMax=%f\n",rhoOutMax); counter = 0; sumOut = 0.0; |
---|
while( AVAIL(0) ) { IT_IN(0); counter++; tmpIn = inStream(0); tmpIn *= bov; rho=fabs(tmpIn); if (rho < rhoInMax) { /* third_order(y) = in(y)*a*(1 - b*in(y)^2); */ tmpRe=tmpIn*tmpIn; tmpRe = aGain*(1.0 - bGain*tmpRe); tmpOutRe=tmpIn*tmpRe; thirdOrder = tmpOutRe; } else { /* third_order(y) = rhoOutMax*sign(in(y)); */ thirdOrder = rhoOutMax * tmpIn/rho; } if (IT_OUT(0)){ KrnOverflow("patx",0); return(99); } outStream(0) = thirdOrder; /* Estimate Output Power */ sumOut += thirdOrder*thirdOrder; if(counter == windowLength) { pNat = sumOut/(float)windowLength; outPowerDBm=10*log10(10*pNat); printf("OBO=%f\n",(out1dB - outPowerDBm)); } } |
---|
/* * (c) XCAD Corporation, Portland, Oregon, All Rights Reserved * Acknowledgemnet: Dr. Yoon. */ |
---|