{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 2: Orbits and Lauching Methods" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.10: Find_the_Julian_day_for_13h_UT_on_18December_2000.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Variable Declaration\n", "y=2000 //year\n", "mon=12 //month\n", "dy=18 //day\n", "hours=13 //hours of the day\n", "minutes=0 //Minutes of the day\n", "seconds=0 //Seconds of the day\n", "//Calculation\n", "d=dy+(hours/24)+(minutes/(24*60))+seconds //Days in December \n", "if mon<=2 then\n", " y=y-1\n", " mon=mon+12\n", "else\n", " y=y\n", " mon=mon\n", "end\n", "A=floor(y/100) //Converting years to days\n", "B=2-A+floor(A/4) //Converting years to days\n", "C=floor(365.25*y) //rounding the days \n", "D=floor(30.6001*(mon+1)) //Converting months to days\n", "JD=B+C+D+d+1720994.5 //Adding reeference to number of days\n", "//Result\n", "printf('The Julian day of given day is : %.4f Days',JD)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.11: Find_the_time_in_Julian_centuries_from_the_reference_time.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Variable Declaration\n", "JDref=2415020 //Reference Julian days\n", "JC=36525\n", "JD=2451897.0417 //Julian days with reference from Example 2.10\n", "//Calculation\n", "T=(JD-JDref)/JC //Time in julian Centuries\n", "//Result\n", "printf('The time for given date is : %.8f Julian Centuries',T)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.12: Calculate_the_time_of_perigee_passage_for_the_NASA_elements.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "//Variable Declaration\n", "\n", "n=14.23304826 //Mean Motion (rev/day)\n", "M0=246.6853 //Mean Anomaly (degrees)\n", "t0=223.79688452 //Time of anomaly\n", "\n", "//Calculation\n", "\n", "T = (t0-(M0/(n*360))) //Time of perigee passage\n", "\n", "//Result\n", "printf('The time of perigee passage for NASA elements is : %.4f days',T)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.13: calculate_the_eccentric_anomaly.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "//Variable Declaration\n", "M=205 //Mean anomaly(degrees)\n", "e=0.0025 //Eccentricity\n", "E=%pi //Initial guess value for eccentric anomaly\n", "\n", "//Calculation\n", "\n", "function [y] = f(E)\n", " y=M-E+e*sin(E)\n", "endfunction\n", "E=fsolve(3.142,f)\n", "\n", "printf('The Eccentric anomaly is: %.4f degrees',E)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.14: Calculate_teh_true_anomaly_and_the_magnitude_of_the_radius_vector.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Variable Declaration\n", "pi = %pi\n", "n=14.2171401*2*%pi/86400 //Mean motion (rad/sec)\n", "M=204.9779+0.001*180*5/pi //Mean anomaly(rad)\n", "e=9.5981*10**-3 //Eccentricity\n", "a=7194.9 //Semimajor axis(km)\n", "//Calculation\n", "v=(M*pi/180)+2*e*sin(M*pi/180)+(5*e**2*sin(2*M*pi)/(4*180)) //True Anomaly (radians)\n", "v=v*180/%pi //True anomaly(degrees)\n", "r=a*(1-e**2)/(1+e*cos(v)) //Magnitude of radius vector after 5s(km)\n", "//Results\n", "printf('The true anomaly is: %.3f degrees',v)\n", "printf('\nThe magnitude of radius vector 5s after epoch is: %d km',r)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.15: express_r_in_vector_form_in_the_perifocal_coordinate_system.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Variable Declaration\n", "v=204.81 //True anomaly(degrees) from Example 2.14\n", "r=7257 //Magnitude of radius vector(km) from Example 2.14\n", "//Calculation\n", "rP=r*cos(v*%pi/180) //P coordinate of radius vector(km)\n", "rQ=r*sin(v*%pi/180) //Q coordinate of radius vector(km)\n", "//Result\n", "printf('r in the perifocal coordinate system is %.2f Pkm %.2f Qkm',rP,rQ)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.17: Find_the_GST_for_13h_UT_on_18December_2000.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Variable Declaration\n", "pi = %pi\n", "T=1.009638376 //Time in Julian centuries from Example 2.11\n", "UT=13 //Universal time(hours)\n", "//Calculation\n", "GST=(99.6910+36000.7689*T+0.004*T**2)*3.142/180 //GST(radians)\n", "UT=2*pi*UT/24 //Universal time converted to fraction of earth rotation (radians)\n", "GST=GST+UT \n", "GST=(modulo(GST,2*pi))*180/pi\n", "//Result\n", "printf('The GST for given date and time is %.2f degrees',GST)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.18: Find_the_LST_for_Thunder_Bay.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Variable Declararion\n", "pi = %pi\n", "WL=-89.26 //Expressing the longitude in degrees west\n", "GST=282.449 //GST from Example 2.17 (degrees)\n", "//Calculation\n", "EL=2*pi+WL //Longitude in degrees East \n", "LST=(GST+EL)*pi/180 //LST(radians)\n", "LST=(modulo(LST,2*pi))*180/pi //fmod removes multiple revolutions(Degrees)\n", "//Results\n", "printf('LST for Thunder Bay on given day is: %.2f Degrees',LST)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.19: Find_the_components_of_the_radius_vector_to_the_earth_station_at_Thunder_Bay.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Variable Declaration\n", "LST=167.475 //LST(degrees)\n", "LE=48.42 //Latitude at thunder bay(degrees)\n", "H=200 //Height above sea level(metres)\n", "aE=6378.1414 //Semimajor axis(km)\n", "eE=0.08182 //Eccentricity\n", "//Calculation\n", "l=(aE/sqrt(1-eE**2*sin(LE*3.142/180)**2)+H/1000)*cos(LE*3.142/180) \n", "z=((aE*(1-eE**2))/sqrt(1-eE**2*sin(LE*3.142/180)**2)+H/1000)*sin(LE*3.142/180) \n", "RI=l*cos(LST*3.142/180) //I component of radius vector at thunder bay(km)\n", "RJ=l*sin(LST*3.142/180) //J component of radius vector at thunder bay(km)\n", "RK= z //Z component of radius vector at thunder bay(km)\n", "R=sqrt(RI**2+RJ**2+RK**2)\n", "//Results\n", "printf('The Radius vector components are %.2f ikm+ %.2f jkm+ %.2f kkm',RI,RJ,RK)\n", "printf('\nThe Magnitude of radius component is %.2f km',R)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.1: Calculate_the_radius_of_a_circular_orbit_for_which_the_period_is_1_day.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Variable Declaration\n", "u=3.986*(10**14) //Earth's Gravitational constant(m^3/sec^2)\n", "//Calculation\n", "n=(2*3.14)/(24*60*60) //Mean Motion(rad/sec)\n", "a=((u/n**2)**(0.33333))/1000 //Radius of the orbit by kepler's 3rd law(km)\n", "//Result\n", "printf('The Radius of the circular orbit with 1 day period is : %d km',a)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.20: EX2_20.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Variable Declaration\n", "PI=-1280 //I component of range vector for a satellite(km)\n", "PJ=-1278 //J component of range vector for a satellite(km)\n", "PK=66 //K component of range vector for a satellite(km)\n", "GST=240 //GST(degrees)\n", "LE=48.42 //Latitude(Degrees)\n", "PE=-89.26 //Longitude(Degrees)\n", "H=200 //Height above mean sea level(metres)\n", "aE=6378.1414 //Semimajor axis(km)\n", "eE=0.08182 //Eccentricity\n", "//Calculation\n", "l=(aE/sqrt(1-eE**2*sin(LE*3.142/180)**2)+H/1000)*cos(LE*3.142/180) \n", "z=((aE*(1-eE**2))/sqrt(1-eE**2*sin(LE*3.142/180)**2)+H/1000)*sin(LE*3.142/180) \n", "SE=(atan(z/l))*180/3.142 //Geocentric latitude angle (degrees)\n", "LST=240+PE\n", "a=sin(SE*3.142/180)*cos(LST*3.142/180)\n", "b=sin(SE*3.142/180)*sin(LST*3.142/180)\n", "c=-cos(SE*3.142/180)\n", "d=-sin(LST*3.142/180)\n", "e=cos(LST*3.142/180)\n", "f=0\n", "g=cos(SE*3.142/180)*cos(LST*3.142/180)\n", "h=cos(SE*3.142/180)*sin(LST*3.142/180)\n", "i=sin(SE*3.142/180)\n", "D = [a,b,c;d,e,f;g,h,i]\n", "P= [PI;PJ;PK]\n", "R=D*P //Components of range of earth station\n", "Ro=sqrt(R(1,1)**2+R(2,1)**2+R(3,1)**2) //Magnitude of range of earth station(km)\n", "El=asin(R(3,1)/Ro) //Antenna elevation angle for the earth station(radians) \n", "El= El*180/3.142 //Converting El to degrees\n", "alpha=(atan(R(2,1)/R(3,1)))*180/3.142\n", "if ( R(1,1)<0 & R(2,1)>0 ) then\n", " Aza=alpha\n", "else\n", " Aza=0\n", "end \n", "if ( R(1,1)>0 & R(2,1)>0 ) then\n", " Azb=180-alpha\n", "else:\n", " Azb=0\n", "end\n", " \n", "if ( R(1,1)>0 & R(2,1)<0 ) then\n", " Azc=180+alpha\n", "else\n", " Azc=0\n", "end \n", "if ( R(1,1)<0 & R(2,1)<0 ) then\n", " Azd=360-alpha\n", "else\n", " Azd=0\n", "end \n", "Az= Aza+Azb+Azc+Azd //Azimuth angle (degrees)\n", "printf('The magnitude of range of earth station is %.0f km',Ro)\n", "printf('\nThe antenna elevation angle for the earth station are %.f degrees',El)\n", "printf('\nThe Azimuth angle for the earth station is %.2f degrees',Az)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.21: Determine_the_subsatellite_height_latitude_and_LST.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Variable Declaration\n", "rI=-4685.3 //I component of radius vector from Example 2.16(km)\n", "rJ=5047.7 //J component of radius vector from Example 2.16(km)\n", "rK=-3289.1 //K component of radius vector from Example 2.16(km)\n", "aE=6378.1414 //Semimajor axis (km)\n", "eE=0.08182 //Eccentricity\n", "//Calculation\n", "r=sqrt(rI**2+rJ**2+rK**2)\n", "a=%pi //Guess value for LST(radians)\n", "b=atan(rK/rI) //Guess Value for latitude(radians)\n", "c=r-aE //Guess value for height(km)\n", "function [ans] = equations(p)\n", " L = p(1)\n", " h = p(2)\n", " LST = p(3)\n", " a = rI-((aE/sqrt(1-eE**2*sin(L)**2))+h)*cos(L)*cos(LST)\n", " b = rJ-((aE/sqrt(1-eE**2*sin(L)**2))+h)*cos(L)*sin(LST)\n", " c = rK-((aE*(1-eE**2)/sqrt(1-eE**2*sin(L)**2))+h)*sin(L)\n", " ans = [a;b;c]\n", "endfunction\n", "ans = fsolve([b;c;a],equations)\n", "L = ans(1)\n", "h = ans(2)\n", "LST = ans(3)\n", "L= L*180/3.142 //Converting L into degrees\n", "h=round(h)\n", "LST=LST*180/3.142 //Converting LST into degrees\n", "printf('The latitude of subsatellite is %.2f degrees',L)\n", "printf('\nThe height of subsatellite is %.2f km',h)\n", "printf('\nThe LST of subsatellite is %.1f degrees',LST)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.2: Calculate_the_semimajor_axis_for_the_satellite_parameters_give.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Variable Declaration\n", "NN=14.22296917 //Mean Motion (1/day)\n", "u=3.986005*(10**14) //Earth's Gravitational COnstant(m^3/sec^2)\n", "//Calculation\n", "n0=(NN*2*3.142)/(24*60*60) //Mean Motion(rad/sec)\n", "a=((u/n0**2)**(0.33333))/1000 //Radius of the orbit by kepler's 3rd law(km)\n", "//Result\n", "printf('The Semimajor axis for given satellite parameters is : %.2f km',a)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.3: Calculate_the_apogee_and_perigee_for_the_orbital_parameters_given.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Variable Declaration\n", "R=6371 //Mean Earth's radius(km)\n", "e=0.0011501 //Eccentricity\n", "a=7192.3 //Semimajor axis(km)\n", "//Calculation\n", "ra=a*(1+e) //Radius Vector at apogee(km)\n", "rp=a*(1-e) //Radius Vector at perigee(km)\n", "ha=ra-R //Apogee height(km)\n", "hp=rp-R //Perigee height(km)\n", "//Result\n", "printf('The Apogee height for given orbital parameters is: %.2f km',ha)\n", "printf('The Apogee height for given orbital parameters is: %.2f km',hp)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.4: calculate_the_semimajor_axis.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Variable Declaration\n", "aE=6378.141 //Earth's equitorial radius(km)\n", "e=0.002 //Eccentricity\n", "p=12 //period from perigee to perigee (hours)\n", "K1=66063.1704 //Constant (km^2)\n", "u=3.986005*(10**14) //Earth's Gravitational constant(m^3/sec^2)\n", "//Calculation\n", "n=(2*%pi)/(12*60*60) //Mean Motion(rad/sec)\n", "anp=((u/n**2)**(0.3333))/1000 //Radius of the orbit by kepler's 3rd law(km)\n", "k2=(1-e**2)**1.5\n", "function [y]=f(a)\n", " y=(n-((u/a**3)**0.5)*(1+K1/a**2*k2))\n", "endfunction\n", "a=fsolve(2,f)\n", "a=a/1000 //Converting a into km\n", "//Result\n", "printf('The nonperturbed value of semimajor axis is %.2f km',anp)\n", "printf('\nThe perturbed value of semimajor axis is %.2f km',a)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.5: EX2_5.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Variable Declaration\n", "i=98.6328 //Angle(degrees)\n", "e=0.0011501 //eccentricity\n", "n=14.23304826 //Mean Motion(1/day)\n", "a=7192.3 //Semimajor axis(km)\n", "K1=66063.1704 //Known constant(km^2)\n", "//Calculation\n", "n0=(2*180*n) //Mean Motion (deg/sec)\n", "K=(n0*K1)/((a**2)*((1-e**2)**2)) //Constant (deg/day)\n", "w=-K*cos(i*3.142/180) //Rate of regression of nodes(deg/day)\n", "W=K*(2-2.5*(sin(i*3.142/180))**2) //Rate of rotation of line of apsides(deg/day)\n", "//Results\n", "printf('The rate of regression of nodes is: %.3f deg/day',w)\n", "printf('\nThe rate of rotation of line of apsides is : %.3f deg/day',W)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.6: Calculate_the_new_values_for_W_and_w_one_period_after_epoch.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Variable Declaration\n", "w=0.982 //rate of regression of nodes from Example 2.5(deg/day)\n", "W=-2.903 //rate of rotation of line of apsides from Example 2.5)deg/day)\n", "n=14.23304826 //Mean Motion(1/day)\n", "W0=113.5534 //Argument of perigee(deg)\n", "w0=251.5324 //Right ascension of the ascending node(deg)\n", "//Calculation\n", "PA=1/n //Period \n", "w=w0+w*PA //New value of rate of regression of nodes(deg)\n", "W=W0+W*PA //New Value of rate of rotation of line of apsides(deg)\n", "//Result\n", "printf('New value of rate of regression of nodes is: %.3f deg',w)\n", "printf('\nNew value of rate of rotation of line of apsides is : %.3f deg',W)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.7: Calculate_the_average_length_of_the_civil_year_in_the_Gregorian_calendar.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Calculation\n", "ndays=400*365 //Nominal number of days in 400years\n", "nleapyrs=400/4 //Nominal number of leap years\n", "gregoriandays=ndays+nleapyrs-3 //number of days in 400 years of Gregorian calendar\n", "gregavg=gregoriandays/400 //number of days in 400 years of Gregorian calendar\n", "//Result\n", "disp (gregoriandays)\n", "printf('The average length of the civil year in gregorian calender is : %.4f days',gregavg)" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.8: Determine_which_of_the_following_are_leap_years.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Calculation and Results\n", "if ( modulo(1987,4) == 0. ) then\n", " disp('1987 is a leap year');\n", "else\n", " disp('1987 is not a leap year');\n", "end\n", "if ( modulo(1988,4) == 0. ) then\n", " disp('1988 is a leap year');\n", "else\n", " disp('1988 is not a leap year');\n", "end\n", "if ( modulo(2000,400) == 0. ) then\n", " disp('2000 is a leap year');\n", "else\n", " disp('2000 is not a leap year');\n", "end\n", "if ( modulo(2100,400) == 0. ) then\n", " disp('2100 is a leap year');\n", "else\n", " disp('2100 is not a leap year');\n", "end" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2.9: Calculate_the_time.sce" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "//Calculation\n", "days=324 //Number of days\n", "hours=floor(24*0.95616765) // Number of hours\n", "decimalfraction1=24*0.95616765-hours\n", "minutes=floor(60*decimalfraction1) // Number of minutes\n", "decimalfraction2=60*decimalfraction1-minutes\n", "seconds=60*decimalfraction2 // Number of seconds\n", "//Result\n", "disp(decimalfraction1)\n", "disp(decimalfraction2)\n", "printf('An Epoch day has %.2f days %.2f hours %.2f minutes %.2f seconds',days,hours,minutes,seconds)" ] } ], "metadata": { "kernelspec": { "display_name": "Scilab", "language": "scilab", "name": "scilab" }, "language_info": { "file_extension": ".sce", "help_links": [ { "text": "MetaKernel Magics", "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" } ], "mimetype": "text/x-octave", "name": "scilab", "version": "0.7.1" } }, "nbformat": 4, "nbformat_minor": 0 }