{
 "metadata": {
  "name": "",
  "signature": "sha256:4b08bbb242b14bb2e9d6b297d6c2efe9724a5525d0e315485c89f280e01ac4b8"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 16: Direct Broadcast Satellite Services"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.1, Page 474"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#Varaible Declaration\n",
      "\n",
      "EIRP=55  #EIRP for satellite(dBW)\n",
      "fD=12.5  #Downlink frequency(GHz)\n",
      "Pss=-101 #Receiving at ground station direction(degrees west)\n",
      "Rb=40*10**6  #Transmission Rate(Hz)\n",
      "D=18   #Diameter of antenna(inches)\n",
      "n=0.55 #Efficiency of antenna\n",
      "Tant=70 #Antenna noise(Kelvin)\n",
      "Teq=100 #Equivalent noise temperature at LNA(Kelvin)\n",
      "R=6371  #Radius of earth(Km)\n",
      "L=2   #Transmission losses(dB)\n",
      "aGSO=42164  #Circumference of earth(km)\n",
      "k=-228.6   #Boltzmann's constant (dB)\n",
      "PE=-90  #Longitude of Earth station(degrees west)\n",
      "LE=45   #Latitude of Earth station(degrees north)\n",
      "f=14    #Frequency(GHz)\n",
      "#Calculation\n",
      "B=PE-Pss\n",
      "b=math.acos(math.cos(B*3.142/180)*math.cos(LE*3.142/180))\n",
      "b=b*180/3.142\n",
      "A=math.asin(math.sin(abs(B)*3.142/180)/math.sin(b*3.142/180))\n",
      "A=A*180/3.142\n",
      "Az=180+A  #Azimuth angle of antenna(degrees)\n",
      "d=(R**2+aGSO**2-2*R*aGSO*math.cos(b*3.142/180))**0.5 #Range of antenna(km)\n",
      "El=math.acos(aGSO*math.sin(b*3.142/180)/d)  #Elevation angle of antenna(radians)\n",
      "El=El*180/3.142  #Elevation angle of antenna(degrees)\n",
      "Az=round(Az,1)\n",
      "El=round(El)\n",
      "d=round(d)\n",
      "FSL=32.4+20*math.log10(d)+20*math.log10(f*10**3)  #Free space loss(dB)\n",
      "LOSSES=FSL+L  #Total Transmission Losses\n",
      "Ts=Teq+Tant   #Total system noise temperature(Kelvin)\n",
      "T=10*math.log10(Ts)  #Total system noise temperature(dBK)\n",
      "G=n*(3.192*f*(D/float(12)))**2\n",
      "G=10*math.log10(G)  #Antenna Gain(dB)\n",
      "GTR=G-T   #G/T ratio(dB)\n",
      "CNR=EIRP+GTR-LOSSES-k  #Carrier to noise ratio(dB)\n",
      "Rb=10*math.log10(Rb) #Transmission Rate(dBHz)\n",
      "EbN0R=CNR-Rb   #Eb/N0 ratio at IRD(dB)\n",
      "EbN0R=round(EbN0R,1)\n",
      "#Results\n",
      "\n",
      "print \"The Azimuth angle of antenna is\",Az,\"degrees\"\n",
      "print \"The Elevaation Angle of Antenna is\",El,\"degrees\"\n",
      "print \"The Range of Antenna is\",d,\"km\"\n",
      "print \"The Eb/N0 ratio at IRD is\",EbN0R,\"dB\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Azimuth angle of antenna is 195.4 degrees\n",
        "The Elevaation Angle of Antenna is 37.0 degrees\n",
        "The Range of Antenna is 38020.0 km\n",
        "The Eb/N0 ratio at IRD is 10.3 dB\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.2, Page 480"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#Varaible Declaration\n",
      "\n",
      "R01=42  #Rainfall at earth station(mm/hr)\n",
      "p=0.01  #Percentage of time for which rain exceeds\n",
      "LE=45   #Latitue of earth station(degrees)\n",
      "hR=3.5   #Rain Height(km)\n",
      "h0=0    #Mean Sea level(km)\n",
      "Ta=272  #\n",
      "El=37   #Elevation angle of the antenna(degrees)\n",
      "Ts=170   #Total system noise temperature(Kelvin)\n",
      "NCR=2.3*10**-9 #Carrier to noise ratio\n",
      "fD=12.5 #Frequency of operation(GHz)\n",
      "f12=12   #Frequency 12GHz(GHz)\n",
      "f15=15   #Frequency 15GHz(GHz)\n",
      "#Coefficients for horizontal and vertical polarizations at 12GHz and 15GHz as given in Table 4.2\n",
      "\n",
      "ah12=0.0188\n",
      "av12=0.0168\n",
      "bh12=1.217\n",
      "bv12=1.2\n",
      "      \n",
      "ah15=0.0367\n",
      "av15=0.0335\n",
      "bh15=1.154\n",
      "bv15=1.128\n",
      "\n",
      "#Calculation\n",
      "\n",
      "#Using Interpolation to find coefficients at 12.5 GHz\n",
      "\n",
      "ah=round(ah12+(ah15-ah12)*(fD-f12)/(f15-f12),3)\n",
      "bh=round(bh12+(bh15-bh12)*(fD-f12)/(f15-f12),3)\n",
      "av=round(av12+(av15-av12)*(fD-f12)/(f15-f12),3)\n",
      "bv=round(bv12+(bv15-bv12)*(fD-f12)/(f15-f12),3)\n",
      "\n",
      "#Coefficients for circular polarization\n",
      "\n",
      "ac=(ah+av)/2\n",
      "ac=round(ac,3)\n",
      "bc=(ah*bh+av*bv)/(2*ac)\n",
      "bc=round(bc,3)\n",
      "Ls1=(hR-h0)/math.sin(El*3.142/180)     #Slant Path Length(km)\n",
      "Ls=round(Ls1,1)                        #Slant Path Length(km)\n",
      "LG=round(Ls*math.cos(El*3.142/180),1)  #Horizontal projection of slant path length(km)\n",
      "r011=90/(90+4*LG)                      #Reduction Factor\n",
      "r01=round(r011,1)                      #Reduction Factor\n",
      "L=round(Ls1*r01,1)                     #Effective path length(km)\n",
      "alpha=round(ac*R01**bc,3)  #Specific attenuation(dB/km)\n",
      "A=round(10**(alpha*L/float(10)),1) #Total Attenuation(dB)\n",
      "Trn=Ta*(1-1/A) #noise temperature with effect of rain\n",
      "Tscs=Ts\n",
      "NCrain=NCR*(A+(A-1)*Ta/Tscs) #Noise to carrier ratio due to rain\n",
      "CNrain=-10*math.log10(NCrain)#Noise to carrier ratio due to rain(dB)\n",
      "Rb=10*math.log10(40*10**6) #Transmission rate(dB)\n",
      "EbN0rain=round(CNrain-Rb,1) #Upper limit of Eb/N0 ratio in prescence of rain(dB)\n",
      "\n",
      "#Result\n",
      "\n",
      "print \"Hence the upper limit for Eb/N0 for given conditions is\",EbN0rain,\"dB\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Hence the upper limit for Eb/N0 for given conditions is -2.1 dB\n"
       ]
      }
     ],
     "prompt_number": 2
    }
   ],
   "metadata": {}
  }
 ]
}