Orbital Elements - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: HP Prime Software Library (/forum-15.html) +--- Thread: Orbital Elements (/thread-3879.html) Orbital Elements - Eddie W. Shore - 05-17-2015 06:20 PM Link: http://edspi31415.blogspot.com/2015/05/hp-prime-and-casio-prizm-orbital.html Input: Three types of unit systems that can be used: MI-LB-S: Miles-Pounds-Seconds KM-KG-S: Kilograms-Kilometers-Seconds MU=1: Sets the gravitational parameter (μ) to 1. Used for problems involving canonical units. Radius vector: position where the satellite is located relative to the celestial object the satellite is orbiting around. Celestial objects include planets and stars. Velocity vector: velocity of the satellite. Canonical Units: The distance unit is set between the average distance between the satellite and its reference celestial object. The time unit is selected such that the velocity of the satellite is 1 distance unit per time unit. This ensures that μ = 1. Output: Angular Momentum Vector Node Vector Inclination Angle of the satellite: angle between the z-axis (J vector [0,0,1]) and the angular momentum vector. Longitude Angle: the angle between the I vector ([1,0,0]) and when the satellite crosses the fundamental plane. For orbits around Earth, the measure statements from the vector pointing towards the Vernal Equinox (known as the First Point of Aries*) and going eastward. (Even though today, in 2015, the Vernal Equinox is in the constellation Pisces, slowly moving towards Aquarius.) Eccentricity: The eccentricity of the orbit. The vector and the norm is given. The eccentricity determines the path of the orbit: If e = 0, the orbit is a circle. If e < 1, the orbit is an ellipse. If e = 1, the orbit is a parabola. If e > 1, the orbit is a hyperbola. ** The HP Prime version sets the calculator to Fixed 5 decimal mode. All results shown are rounded to five digits. Code: ```EXPORT ORBELEM(M,vr,vv) BEGIN // 2015-05-01 EWS, Orbital Elements // mass, radius vector, velocity vector LOCAL mu,vh,vn,ve; LOCAL R,H,N,E,I,L,C; LOCAL str,s; // Degrees Mode HAngle:=1; // Set to Fixed 5 Mode HFormat:=1; HDigits:=5; // Main CHOOSE(C,"Unit System","MI-LB-S", "KM-KG-S","mu=1"); IF C==1 THEN mu:=95629.523435*M; END; IF C==2 THEN mu:=398600.4418*M; END; IF C==3 THEN mu:=1; END; vh:=CROSS(vr,vv); MSGBOX("Angular Momentum Vector: "+vh); vn:=CROSS([0,0,1],vh); MSGBOX("Node Vector: "+vn); H:=ABS(vh); IF H≠0 THEN I:=ACOS(vh(3)/H); MSGBOX("Inclination:" +I+"°"); ELSE MSGBOX("No Inclination Angle"); END; N:=ABS(vn); IF N≠0 THEN L:=ACOS(vn(1)/N); MSGBOX("Longitude: "+L+"°"); ELSE MSGBOX("No Longitude Angle"); END; V:=ABS(vv); R:=ABS(vr); ve:=1/mu*((V^2-mu/R)*vr-DOT(vr,vv)*vv); E:=ABS(ve); str:={"Circle","Ellipse","Parabola", "Hyperbola"}; IF E=0 THEN s:=1; END; IF E<1 THEN s:=2; END; IF E=1 THEN s:=3; END; IF E>1 THEN s:=4; END; MSGBOX("Eccentricity: "+E+"; "+str(s)); END;``` Example: A satellite orbiting Earth (mass of 1.3170 * 10^25 pounds) has a radius vector of [[ 14700, 18268, 11500 ]] (miles) with the velocity of [[ 3.5, 4.5, 3.2 ]] (miles/sec). Recall that an hour is 3600 seconds. Then: Angular Momentum Vector: [[ 6707.6, -6790, 2212]] Node Vector: [[6790, 6707.6, 0]] Incidence Angle: 76.95158555° Longitude Angle: 44.6502257° Eccentricity: 1, Parabola Source: Roger R. Bate, Donald D. Mueller, Jerry E. White. “Fundamental of Astrodynamics” Dover Publications, Inc. New York: 1971