Viewing contents of file '../idllib/uit/pro/ascending_node.pro'
FUNCTION ascending_node, met, lnch_inf, orbt_inf, REG_RATE=reg_rate
;+
; NAME:
;	ASCENDING_NODE
; PURPOSE:
;	To compute the right ascension of the ascending node of an orbit
;	at a given time during a shuttle mission.
; CALLING SEQUENCE:
;	node_ra = ascending_node(met, lnch_inf, orbt_inf)
; INPUTS:
;	met      - The mission elapsed time to compute the RA for, in hours.
;	lnch_inf - A structure containing information pertaining to launch:
;		    {LNCHINF_ST, day:0.d, mon:0.d, year:0.d, time:0.d, 
;		    daysav:0, site_lat:28.5d, site_lon:80.6d}
;		day      - The day of the launch.
;		mon      - The month of the launch.
;		year     - The year of the launch.
;		time     - The time of day of the launch, in decimal hours.
;		daysav   - The daylight savings time flag.  Set to 1 if the
;		           time is daylight savings time; set to 0 if standard
;		           time.
;		site_lat - The north latitude of the launch site, in degrees.
;		site_lon - The west longitude of the launch site, in degrees.
;	orbt_inf - A structure containing information pertaining to the orbit:
;		    {ORBITINF_ST, met_ins:0.d, met_an2:0.d, alt:0.d, incl:0.d, 
;		     eccen:0.d, del_u:155.d}
;		met_ins  - The mission elapsed time of the insertion into the 
;		           orbit.
;		met_an2  - The mission elapsed time of the second ascending
;		           node passage.
;		alt      - The altitude (measured from ground level) of the 
;		           orbit, in meters.
;		incl     - The orbital inclination, in degrees.
;		eccen    - The orbital eccentricity.
;		del_u    - This is a parameter which aids in determining the
;	                   longitude of the insertion into orbit.  It depends 
;		           upon orbital altitude, inclination, and launch
;		           profile.  Note that errors of 10 degrees in this
;		           parameter result in an error in the RA of 0.6
;		           degrees; therefore, an approximation of this
;		           parameter is "good enough."  This parameter should
;		           be provided in degrees.
; RETURNED:
;	node_ra - The right ascension of the ascending node, in degrees.
; KEYWORDS:
;	REG_RATE - The rate of change, in degrees per hour, of the ascending
;	           node right ascension.
; PROCEDURE:
;	The computation procedure is described in Appendix B of 
;	"Celestial Target Observability for Astro Spacelab Missions"
;	by Larry D. Mullins.  This is NASA Technical Memorandum
;	NASA TM-86591, and was written at Marshall Space Flight Center.
; MODIFICATION HISTORY:
;	Written by Michael R. Greason, Hughes STX, 23 November 1992.
;-
;			Check parameters.
;
IF (n_params(0) LT 3) THEN message, 'Syntax:  node_ra = ' + $
	'ascending_node(met, lnch_inf, orbt_inf)'
;
;			Set constants.
;
r_e = 6.378140d6			; Earth's radius, in meters.
j2 = 1.0827d-3				; Some sort of constant.
mu = 3.986012d14			; Grav. constant, in m^3/s^2.
conv = !radeg * 3600.d			; (rad/sec) -> (deg/hr) conversion.
omega_e = 15.d				; Earth's rotation rate, deg./hr.
du = 240.d				; Insertion "rate"? in deg/hour.
;
;			Compute the regression rate, in degrees/hour.
;
axis = orbt_inf.alt + r_e
incl_rad = orbt_inf.incl / !radeg
reg_rate = (-1.5) * j2 * (r_e / (axis * (1.d - (orbt_inf.eccen ^ 2)))) * $
	cos(incl_rad) * sqrt(mu / (axis ^ 3)) * conv
;
;			Compute the right ascension at insertion, in degrees.
;
;				First compute the longitude at insertion.
;
lat = lnch_inf.site_lat / !radeg
tan_rat = (tan(lat) / tan(incl_rad) < 1.d) > (-1.d)
lon_ins = -(lnch_inf.site_lon + (!radeg * asin(tan_rat)) + $
	(orbt_inf.del_u * omega_e / du))
;
;				Compute the Greenwich sidereal time
;				of the insertion.  NOTE:  ct2lst returns
;				local sidereal time; this needs to be
;				converted to Greenwich sidereal time.
;
tzone = fix(lnch_inf.site_lon / 15.)
IF (lnch_inf.daysav NE 0) THEN tzone = tzone - 1
ct2lst, gst, lnch_inf.site_lon, tzone, (lnch_inf.time + orbt_inf.met_ins), $
	lnch_inf.day, lnch_inf.mon, lnch_inf.year 
gst = (gst * 15.) + lnch_inf.site_lon			; GST, in degrees.
;
;				Now compute the RA at insertion, in degrees.
;
ra = lon_ins + gst
;
;			Compute and return the node RA.
;
ra = ra + (reg_rate * (met - orbt_inf.met_ins))
WHILE (ra LT 0.) DO ra = ra + 360.d
RETURN, ra
;
END