{
 "metadata": {
  "name": "",
  "signature": "sha256:cf5342643c702b9d8304367e59517c8b40b2c0d171b088582d18b96d8620a619"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 3: The Geostationary Orbit"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.1, Page 71"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#Variable Declaration\n",
      "\n",
      "Pss=-90   #Location of geostationary satellite(degrees)\n",
      "PE=-100   #Longitude of the earth station antenna(degrees)\n",
      "LE=35     #Latitude of the earth station antenna(degrees)\n",
      "\n",
      "#Calculation\n",
      "\n",
      "B=PE-Pss   #Angle between planes containing a and c(degrees)\n",
      "b=math.acos(math.cos(B)*math.cos(LE)) #Angle of plane containing b(radians)\n",
      "A=math.asin(math.sin(abs(B*3.142/180))/math.sin(b)) #Angle between planes containing b and c (radians)\n",
      "\n",
      "A=A*180/3.142  #Converting A into degrees\n",
      "#LE>0 and B<0 by observation\n",
      "Az=round(180-A,2)  #Azimuth angle(degrees)\n",
      "\n",
      "#Result\n",
      "\n",
      "print \"The azimuth angle for the given earth station antenna is\", Az,\"degrees\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The azimuth angle for the given earth station antenna is 164.55 degrees\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.2, Page 73"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable Declaration\n",
      "\n",
      "R=6371  #Radius of earth (km)\n",
      "aGSO= 42164  #Circumference of earth(km)\n",
      "b=0.632 #values of b from Example 3.1 (radians)\n",
      "#Calculation\n",
      "import math\n",
      "d=math.sqrt(R**2+aGSO**2-2*R*aGSO*math.cos(b)) #Range of earth station antenna (km)\n",
      "El=math.acos(aGSO*math.sin(b)/d)*180/math.pi  #Elevation angle(degrees)\n",
      "d=round(d)\n",
      "El=round(El)\n",
      "#Results\n",
      "\n",
      "print \"The range of earth station antenna is\", d,\"km\"\n",
      "print \"Elevation angle is\", El,\"degrees\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The range of earth station antenna is 37214.0 km\n",
        "Elevation angle is 48.0 degrees\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.3, Page 77"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#Variable Declaration\n",
      "\n",
      "LE=49  #Latitude of earth station(degrees)\n",
      "aGSO=42164  #Circumference of earth(km)\n",
      "R=6371  #Radius of earth(km)\n",
      "\n",
      "#Calculation\n",
      "d=(R**2+aGSO**2-2*R*aGSO*math.cos(LE*3.142/180))**0.5  #Range of earth station antenna\n",
      "\n",
      "El0=math.acos(aGSO*math.sin(LE*3.142/180)/d)  #Elevation angle(radians)\n",
      "\n",
      "El0=El0*180/3.142  #Converting El0 to degrees\n",
      "\n",
      "delta=round(90-El0-LE)  #Angle of tilt required for polar mount\n",
      "\n",
      "#Results\n",
      "\n",
      "\n",
      "print \"The Angle of tilt required for polar mount is\", delta,\"degrees\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Angle of tilt required for polar mount is 7.0 degrees\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.4, Page 78"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#Variable Declaration\n",
      "\n",
      "LE=48.42  #Latitude of earth station(degrees)\n",
      "PE=-89.26 #Longitute of earth station(degrees)\n",
      "Elmin=5  #Minimum angle of elevation(degrees)\n",
      "aGSO=42164  #Circumference of earth(km)\n",
      "R=6371  #Radius of earth(km)\n",
      "\n",
      "#Calculation\n",
      "\n",
      "Smin=90+Elmin\n",
      "S=math.asin(R*math.sin(Smin*3.142/180)/aGSO)*180/math.pi  #Angle subtended at the satellite(degrees)\n",
      "\n",
      "b=180-Smin-S   #Angle of plane containing b(degrees)\n",
      "B=math.acos(math.cos(b*3.142/180)/math.cos(LE*3.142/180))*180/math.pi#Angle between the planes containing a and c(degrees)\n",
      "\n",
      "#Results\n",
      "\n",
      "print \"The satellite limit east of the earth station is at\", round(PE+B),\"Degrees approximately\"\n",
      "print \"The satellite limit west of the earth station is at\", round(PE-B),\"Degrees approximately\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The satellite limit east of the earth station is at -20.0 Degrees approximately\n",
        "The satellite limit west of the earth station is at -158.0 Degrees approximately\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.5, Page 80"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#Variable Declaration\n",
      "y=2000       #year\n",
      "d=223.153    #day\n",
      "n=1.002716   #mean motion(1/day)\n",
      "w=272.5299   #rate of regression of nodes(degrees)\n",
      "e=0.000352   #Eccentricity\n",
      "W=247.9161   #Rate of regression of line of apsides(degrees)\n",
      "M=158.0516   #Mean Anomaly at given time\n",
      "JD00=2451543.5  #Julian days for Jan 0.0 2000\n",
      "\n",
      "#Calculation\n",
      "\n",
      "JD=JD00+d  #Julian days for given day\n",
      "JDref=2415020   #Reference Julian days\n",
      "JC=36525\n",
      "T=round((JD-JDref)/JC,4)  #Time in julian Centuries\n",
      "UT=d-223  #Universal Time, fraction of the day\n",
      "GST=(99.6910+36000.7689*T+0.004*T**2)*3.142/180  #GST(radians)\n",
      "UT=2*math.pi*UT #Universal time converted to fraction of earth rotation (radians)\n",
      "\n",
      "GST=(GST+UT)*180/3.1421\n",
      "\n",
      "\n",
      "GST=(math.fmod(GST,360))#using fmod multiplr revolutions are removed (degrees)\n",
      "GST=round(GST,3)\n",
      "v=M+2*e*M  #True Anomaly(degrees)\n",
      "\n",
      "Pssmean=W+w+M-GST #longitude for INTELSAT(degrees)\n",
      "Pssmean=math.fmod(Pssmean,360) #fmod removes multiple revolutions\n",
      "Pss=w+W+v-GST#longitude for INTELSAT(degrees)\n",
      "Pss=math.fmod(Pss,360)#fmod removes multiple revolutions\n",
      "\n",
      "#Results\n",
      "print \"The longitude of INTELSAT 805 is\", round(Pss,3),\"Degrees\"\n",
      "print \"The average longitude of INTELSAT 805 is\", round(Pssmean,3),\"Degrees\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The longitude of INTELSAT 805 is 304.625 Degrees\n",
        "The average longitude of INTELSAT 805 is 304.514 Degrees\n"
       ]
      }
     ],
     "prompt_number": 1
    }
   ],
   "metadata": {}
  }
 ]
}