OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
VcstCmnGeoEclipse.h
Go to the documentation of this file.
1 /*****************************************************************************
2  *
3  * NAME: VcstCmnGeoEclipse
4  *
5  * DESCRIPTION: Common Geolocation Eclipse object class.
6  *
7  * Adapted directly from ProSdrCmnGeoEclipse.h developed by Raytheon Company.
8  *
9  * REFERENCES:
10  * Meeus, Jean, "Astronomical Algorithms, 2nd Edition," Willman-Bell Inc,
11  * Richmond VA, 1998, 477 pp.
12  *
13  *
14  *****************************************************************************/
15 
16 #ifndef VcstCmnGeoEclipse_h
17 #define VcstCmnGeoEclipse_h
18 
19 #include <iomanip>
20 #include <iostream>
21 
30 public:
31 
36 
41 
46 
50  virtual ~VcstCmnGeoEclipse();
51 
63  void calcLunarEclipse(const double kFactor);
64 
76  void calcSolarEclipse(const double kFactor);
77 
83  /* inline */
84  double getTAI() const;
85 
90  bool getEclipseFlag() const;
91 
95  double getEclipseBegin() const;
96 
100  double getEclipseEnd() const;
101 
105  friend std::ostream& operator<<(std::ostream &strm,
106  const VcstCmnGeoEclipse &eclipse);
107 protected:
108 
118  double calcT(const double kFactor);
119 
129  double calcTjdPhase();
130 
139  double calcMoonArgLat();
140 
149  double calcSunMeanAnom();
150 
159  double calcMoonMeanAnom();
160 
170  double calcMoonLongAscNode();
171 
179  double calcEarthEccen();
180 
192  double calcF1(const double moonArgLat, const double moonLAN);
193 
200  double calcA1();
201 
214  double calcP(const double earthEccen, const double sunMeanAnom,
215  const double moonMeanAnom, const double F1);
216 
228  double calcQ(const double earthEccen, const double sunMeanAnom,
229  const double moonMeanAnom);
230 
247  double calcGamma(const double P, const double Q, const double F1);
248 
263  double calcU(const double earthEccen, const double sunMeanAnom,
264  const double moonMeanAnom);
265 
273  double normalizeAngle(const double angle) const;
274 
282  double convertTJDtoTAI(const double tjd) const;
283 
291  double convertTAItoTJD(const double inTAI) const;
292 
293 private:
294 
300  double taiPhase_;
301 
306  bool eclipseFlag_;
307 
311  double eclipseBegin_;
312 
316  double eclipseEnd_;
317 
322  double kFactor_;
323 
330  double tjdPhase_;
331 
335  double tjdCent_;
336 
340  double tjdCentSqd_;
341 
345  double tjdCentCube_;
346 
350  double tjdCentTo4_;
351 
352  //------------------------------------------------------------------------
353  // Define the constants used in the Meeus algorithms for calculating
354  // eclipses. These constants come from Meeus (see reference above),
355  // Ch. 49, pages 349-350, and Ch. 54, pages 379-388.
356  //------------------------------------------------------------------------
357 
358  // Eq (49.3), pg 350
359  static const double LUNATIONS_PER_CENT;
360 
361  // Constants for the calculation of mean lunar phase, Eq (49.1), pg 349
362  static const double TJD_PHASE_C1;
363  static const double TJD_PHASE_C2;
364  static const double TJD_PHASE_C3;
365 
366  // Constants for Moon's argument of latitude, Eq (49.6), pg 350
367  static const double MOON_ARG_LAT_C1;
368  static const double MOON_ARG_LAT_C2;
369  static const double MOON_ARG_LAT_C3;
370  static const double MOON_ARG_LAT_C4;
371  static const double MOON_ARG_LAT_C5;
372 
373  // Constants for Sun's mean anomaly, Eq (49.4), pg 350
374  static const double SUN_MEAN_ANOM_C1;
375  static const double SUN_MEAN_ANOM_C2;
376  static const double SUN_MEAN_ANOM_C3;
377  static const double SUN_MEAN_ANOM_C4;
378 
379  // Constants for Moon's mean anomaly, Eq (49.5), pg 350
380  static const double MOON_MEAN_ANOM_C1;
381  static const double MOON_MEAN_ANOM_C2;
382  static const double MOON_MEAN_ANOM_C3;
383  static const double MOON_MEAN_ANOM_C4;
384  static const double MOON_MEAN_ANOM_C5;
385 
386  // Constants for Moon's longitude of ascending node, Eq (49.7), pg. 350
387  static const double MOON_LAN_C1;
388  static const double MOON_LAN_C2;
389  static const double MOON_LAN_C3;
390  static const double MOON_LAN_C4;
391 
392  // Critical value of Moon's argument of latitude (F) for eclipse to exist
393  // Meeus pg. 380
394  static const double CRIT_SIN_F;
395 
396  // Constants for Earth's orbital eccentricity, Eq (47.6), pg. 338
397  static const double EARTH_ECCEN_C1;
398  static const double EARTH_ECCEN_C2;
399 
400  // Constants used for calculation of F1 and A1 parameters, pg. 380.
401  static const double F1_ADJUST;
402  static const double A1_C1;
403  static const double A1_C2;
404  static const double A1_C3;
405 
406  // Constants used in the calculation of "P" and "Q", pg. 381.
407  static const double P_C1;
408  static const double P_C2;
409  static const double P_C3;
410  static const double P_C4;
411  static const double P_C5;
412  static const double P_C6;
413  static const double P_C7;
414  static const double Q_C1;
415  static const double Q_C2;
416  static const double Q_C3;
417  static const double Q_C4;
418  static const double Q_C5;
419  static const double Q_C6;
420 
421  // Constants used in the calculation of "gamma" and "u", pg. 381
422  static const double GAMMA_C1;
423  static const double U_C1;
424  static const double U_C2;
425  static const double U_C3;
426  static const double U_C4;
427  static const double U_C5;
428 
429  // Constants used to calculate magnitude of eclipses
430  static const double LUNAR_MAG_C1;
431  static const double LUNAR_MAG_C2;
432  static const double SOLAR_MAG_C1;
433 
434  // Constants used to calculate time of maximum eclipse
435  static const double MAX_ECL_C1_LUNAR;
436  static const double MAX_ECL_C2_LUNAR;
437  static const double MAX_ECL_C1_SOLAR;
438  static const double MAX_ECL_C2_SOLAR;
439  static const double MAX_ECL_C3;
440  static const double MAX_ECL_C4;
441  static const double MAX_ECL_C5;
442  static const double MAX_ECL_C6;
443  static const double MAX_ECL_C7;
444  static const double MAX_ECL_C8;
445  static const double MAX_ECL_C9;
446  static const double MAX_ECL_C10;
447  static const double MAX_ECL_C11;
448  static const double MAX_ECL_C12;
449  static const double MAX_ECL_C13;
450  static const double MAX_ECL_C14;
451  static const double MAX_ECL_C15;
452  static const double MAX_ECL_C16;
453 
454  // Constants used to calculate semidurations of eclipse
455  static const double LUNAR_SD_C1;
456  static const double LUNAR_SD_C2;
457  static const double LUNAR_SD_C3;
458  static const double SOLAR_WORST_SD;
459 };
460 
461 //---------------------------------------------------------------------------
462 // inline functions
463 //---------------------------------------------------------------------------
464 
465 inline double VcstCmnGeoEclipse::getTAI() const {
466  return taiPhase_;
467 }
468 
472 inline std::ostream& operator<<(std::ostream &strm,
473  const VcstCmnGeoEclipse &eclipse) {
474  strm << "k=" << eclipse.kFactor_ << std::endl << std::fixed
475  << std::setprecision(5) << " tjdPhase = " << eclipse.tjdPhase_
476  << ", " << " taiPhase = " << eclipse.taiPhase_ << std::endl
477  << " eclipseFlag = " << eclipse.eclipseFlag_ << std::endl
478  << " begin = " << eclipse.eclipseBegin_ << ", " << " end = "
479  << eclipse.eclipseEnd_ << std::endl;
480  return strm;
481 }
482 
483 #endif
double getEclipseEnd() const
double calcU(const double earthEccen, const double sunMeanAnom, const double moonMeanAnom)
double normalizeAngle(const double angle) const
VcstCmnGeoEclipse & operator=(const VcstCmnGeoEclipse &data)
void calcSolarEclipse(const double kFactor)
bool getEclipseFlag() const
double calcMoonLongAscNode()
double calcF1(const double moonArgLat, const double moonLAN)
double calcEarthEccen()
double calcTjdPhase()
double calcMoonArgLat()
double getTAI() const
double calcP(const double earthEccen, const double sunMeanAnom, const double moonMeanAnom, const double F1)
double getEclipseBegin() const
std::ostream & operator<<(std::ostream &strm, const VcstCmnGeoEclipse &eclipse)
no change in intended resolving MODur00064 Corrected handling of bad ephemeris attitude data
Definition: HISTORY.txt:356
void calcLunarEclipse(const double kFactor)
double convertTAItoTJD(const double inTAI) const
double convertTJDtoTAI(const double tjd) const
double calcGamma(const double P, const double Q, const double F1)
double calcMoonMeanAnom()
#define F1
Definition: anc.h:25
double calcQ(const double earthEccen, const double sunMeanAnom, const double moonMeanAnom)
double calcSunMeanAnom()
double calcT(const double kFactor)
virtual ~VcstCmnGeoEclipse()
friend std::ostream & operator<<(std::ostream &strm, const VcstCmnGeoEclipse &eclipse)