% wireless communication Midterm III (CDMA Link Budget) 2005

% Problem 1_
% Find the cell radius for transmission from the mobile to the base station
% give the following:
%power of the mobile pm = 600 mW
% power allocated to the pilot channel = 15%
% the interference must be at least 7 dB below the energy in each bit
% The noise figure of the cell = 5 dB
% bandwidth = 2 MHz
% chip rate = 1 MHz
% data rate = 100 kHz
% The cell is in use 40% of the time.
% Two high-gain directional antennas are used to transmit over the same
% path as the cell.  The transmitting antenna sends 0 dBm of power, and
% -120 dBm is received by the other antenna.  
% Path loss exponent = 4, environment is typical outdoor environment (T =
% 290 degrees K)

pm = 10*log10(600) % (27.7815 dBm) power of the mobile
EbIt = 7 % (dB)
F = 5 % (dB) noise figure
Bw = 2e6 % (Hz) bandwidth
Rc = 1e6 % (Hz) chip rate
R = 100e3 % (Hz) data rate
p = 0.40 % cell loading (fraction)
Lo = -120 % dB (loss at 1 m + antenna gains)
gamma = 4 % path loss exponent

% from example 10.7
Gp = 10*log(Rc/R) % ( 23.0259 dB) processing gain
SIR = EbIt - Gp  % (  -16.0259 dB) signal to interference ratio
T = 290 % (degrees K) typical for outdoor/indoor environment
kb = 1.38006e-23 % Botzmann's constant
NoBw = (10^(F/10)) * T * kb * Bw * 1000 % (mW) noise
NoBw = 10*log10(NoBw) % (  -105.9667 dBm)
Tr = SIR - NoBw - pm - 10*log10(1-p) % ( 64.3779 dB) 
% From equation 10.30 
% Lp = Tr - antenna gains
% Lp - (Lo + antenna gains) = Tr - Lo
r = 10^((Tr - Lo)/(10*gamma)) % ( 4.0686e+004 m) size of cell

% Problem 2:
% How much other cell interference can you tolerate for the IS-95 system
% described below.  INCLUDE units in W and dB in your answer.
% IS-95 BW = 1.23e6 % (Hz)
% R (IS-95) = 9.6e3 % (pbs)
% Power of the mobile Pm = 100 mW 
% miscellaneous losses = - 8 dB
% Two dipole antennas are used to measure that the power transmitted over 1
% m is 0 dBm.  When the base station and mobile antennas are used with the
% same input power levels and same distance, 10 dBm is measured.
% Gm + Gp = 10 dB
% Path loss = 150 dB
% Normal indoor operating environment, depth of fade = 20 dB, T = 290 K
% Noise figure of base station = 5 dB
% System is used 40% of the time.
% number of mobile users is 25

% From example 10.1
Bw = 1.23e6 % (Hz) IS-95
R = 9.6e3 % (Hz) bps
Pm = 10*log(100) % (dBm)
Lmisc = 8 % (dB)
G = 10 % (dB) Gm+Gb
Gdipole = 1.64; Gdipole = 10*log10(Gdipole);
G = G + 2*Gdipole
Lp = 150 % (dB)
Mfade = 20 % (dB)
F = 5 % (dB)
F = 10^(5/10)
T = 290 % (degrees K)
kb = 1.380062e-23 
vf = 0.4
M = 25

S = Pm - Lmisc + G - Lp - Mfade % signal strength (-117.6 dBm, because Pm is in dBm)
S = 10^(S/10) % 1.7173e-012 mW
No = F * T * kb * 1e3 % 2.0011e-017(mW)
% (calculation not needed) EbIt = (Bw/R)*(S / (No*Bw + (M-1)*vf*S)) 
%From equation 10.1
Ioc = (M-1)*S*vf % 1.6487e-011 mW 
Ioc = 10*log10(Ioc) % -107.8287 dBm = -107 - 30 = -137 dBW

% Problem 3
% HOw many users can an IS95 cell support given the following
% conditions:
% Probability that a call will be blocked = 2%  pout = .02
% Fading Margin = 20 dB
% Path Loss Exponent = 4 (allows us to use table 10.1)
% standard Deviation of the path loss = 4
% Cell uses 2-way soft handoff (from Table 10.1 Intercell inferference factor f = 0.47)
% IS-95 Standard:
%      Data rate = 9.6 kbps
%      Minimum Eb/It  = 7 dB 
%      Chip Rate = 1.23 MHz
% The system is active 40% of the time vf = 0.4
% 1/N = 10 (see definition between eqn 10.33 and 10.34 p. 286)
% Standard Deviation of Power Control = 3 dB

% From Example 10.5
pout = .02
%From Figure F.2 of Rappaport text 
Q = 2.0 
Rc = 1.23e6 % (Hz) Chip Rate
R = 9.6e3 % (Hz) Data rate
Gp = Rc/R % processing Gain 128.1250
EbIt = 10^(7/10) % convert from dB to linear 5.0119
N = 0.1 % given
del = (Gp/EbIt)*(1-N) % 23.0079
beta = .2303 % defined
sig = 10^(3/10) % Standard Deviation of Power Control, convert from dB to linear 1.9953
alpha = exp(beta*sig)^2/2 % 1.2534
alpha3= alpha^3
B = (Q)^2 / del % 0.1739
F = (1/alpha)*(1+ (alpha3*B/2)*(1-sqrt(1+4/(alpha3*B)))) % 0.4480
f = 0.47 % from table 10.1, 2way SHO, sig =4, exponent = 4
vf = 0.4
lam_u = del*F/(vf*(1+f)) % 17.4 Erlangs
% From Erlang B Chart (Traffic intensity = 17.4, P Blocking = .02
Channels = 23 % (about)



