70 LOCAL double sunLongitude(
double t_ka);
71 LOCAL double sunLatitude(
double t_ka);
72 LOCAL double sunDistance(
double t_ka);
73 LOCAL double solarNoonApprox(
double noonGuess_d,
77 LOCAL double riseSetApprox(
double risesetGuess_d,
133 L_deg =
normalize(280.461 + (0.9856474 * n), 360.0);
134 g_deg =
normalize(357.529 + (0.9856003 * n), 360.0);
135 lambda_deg = L_deg + 1.915 * sin(
degToRad(g_deg))
136 + 0.02 * sin(
degToRad(g_deg + g_deg));
137 epsilon_deg = 23.439 - (0.0000004 * n);
138 appV->a[0] = cos(
degToRad(lambda_deg));
142 *dist_au = 1.00014 - 0.01671 * cos(
degToRad(g_deg))
143 - 0.00014 * cos(
degToRad(g_deg + g_deg));
190 *dist_au = sunDistance(t_ka);
191 beta_rad = sunLatitude(t_ka);
192 lambda_rad = sunLongitude(t_ka);
352 estimate_d = solarNoonApprox(estimate_d, deltas, site, &topo1);
353 estimate_d = solarNoonApprox(estimate_d, deltas, site, &topo1);
433 estimate_d = riseSetApprox(estimate_d, getSunrise, deltas, &st, &topo1);
434 if (estimate_d == 0.0) {
439 estimate_d = riseSetApprox(estimate_d, getSunrise, deltas, &st, &topo1);
455 LOCAL double sunLongitude(
double t_ka)
473 static const SunSeries l0[] = {
475 { 3341656.0, 4.6692568, 6283.07585},
476 { 34894.0, 4.6261, 12566.1517 },
477 {3497.0, 2.7441, 5753.3849},
478 {3418.0, 2.8289, 3.5231},
479 {3136.0, 3.6277, 77713.7715},
480 {2676.0, 4.4181, 7860.4194},
481 {2343.0, 6.1352, 3930.2097},
482 {1324.0, 0.7425, 11506.7698},
483 {1273.0, 2.0371, 529.691 },
484 {1199.0, 1.1096, 1577.3435},
485 {990, 5.233, 5884.927},
486 {902, 2.045, 26.298},
487 {857, 3.508, 398.149},
488 {780, 1.179, 5223.694},
489 {753, 2.533, 5507.553},
490 {505, 4.583, 18849.228},
491 {492, 4.205, 775.523},
493 {317, 5.849, 11790.629},
494 {284, 1.899, 796.298},
495 {271, 0.315, 10977.079},
496 {243, 0.345, 5486.778},
497 {206, 4.806, 2544.314},
498 {205, 1.869, 5573.143},
499 {202, 2.458, 6069.777},
500 {156, 0.833, 213.299},
501 {132, 3.411, 2942.463},
502 {126, 1.083, 20.775},
504 {103, 0.636, 4694.003},
505 {102, 0.976, 15720.839},
507 { 99, 6.21, 2146.17},
509 { 86, 5.98, 161000.69},
511 { 85, 3.67, 71430.7 },
512 { 80, 1.81, 17260.15},
513 { 79, 3.04, 12036.46},
514 { 75, 1.76, 5088.63},
517 { 70, 0.83, 9437.76},
518 { 62, 3.98, 8827.39},
519 { 61, 1.82, 7084.9 },
520 { 57, 2.78, 6286.6 },
521 { 56, 4.39, 14143.5 },
522 { 56, 3.47, 6279.55},
523 { 52, 0.19, 12139.55},
524 { 52, 1.33, 1748.02},
525 { 51, 0.28, 5856.48},
526 { 49, 0.49, 1194.45},
527 { 41, 5.37, 8429.24},
528 { 41, 2.4, 19651.05},
529 { 39, 6.17, 10447.39},
530 { 37, 6.04, 10213.29},
531 { 37, 2.57, 1059.38},
532 { 36, 1.71, 2352.87},
533 { 36, 1.78, 6812.77},
534 { 33, 0.59, 17789.85},
535 { 30, 0.44, 83996.85},
536 { 30, 2.74, 1349.87},
539 static const SunSeries l1[] = {
540 {628331966747.0, 0, 0},
541 {206059.0, 2.678235, 6283.07585},
542 {4303.0, 2.6351, 12566.1517},
543 {425.0, 1.59, 3.523},
544 {119.0, 5.796, 26.298},
545 {109.0, 2.966, 1577.344},
546 {93, 2.59, 18849.23},
561 {15, 1.21, 10977.08},
575 static const SunSeries l2[] = {
577 { 8720.0, 1.0721, 6283.0758},
578 { 309.0, 0.867, 12566.152},
582 {10, 0.76, 18849.23},
583 { 9, 2.06, 77713.77},
597 static const SunSeries l3[] = {
598 {289.0, 5.844, 6283.076},
600 {17, 5.49, 12566.15},
606 static const SunSeries l4[] = {
611 static const SunSeries l5[] = {
615 static const SunSeries *lt[L_COUNT] = { l0, l1, l2, l3, l4, l5 };
616 static const int lSubcount[L_COUNT] = {
ARRAY_SIZE(l0),
629 for (i = 0; i < L_COUNT; i++) {
631 for (j = 0; j < lSubcount[i]; j++) {
632 sum[i] += lt[i][j].a * cos(lt[i][j].cb + lt[i][j].cct * t_ka);
638 for (i = 0; i < L_COUNT; i++) {
640 earthSum += sum[i] * tPower;
654 LOCAL double sunLatitude(
double t_ka)
672 static const SunSeries b0[] = {
673 {280.0, 3.199, 84334.662},
674 {102.0, 5.422, 5507.553},
675 { 80.0, 3.88, 5223.69},
676 { 44.0, 3.7, 2352.87},
677 { 32.0, 4.0, 1577.34}
679 static const SunSeries b1[] = {
684 static const SunSeries *bt[B_COUNT] = { b0, b1 };
685 static const int bSubcount[B_COUNT] = {
ARRAY_SIZE(b0),
693 for (i = 0; i < B_COUNT; i++) {
695 for (j = 0; j < bSubcount[i]; j++) {
696 sum[i] += bt[i][j].a * cos(bt[i][j].cb + bt[i][j].cct * t_ka);
700 earthSum = sum[0] + sum[1] * t_ka;
704 earthSum = -earthSum;
711 LOCAL double sunDistance(
double t_ka)
729 static const SunSeries r0[] = {
730 {100013989.0, 0.0, 0.0},
731 {1670700.0, 3.0984635, 6283.07585},
732 {13956.0, 3.05525, 12566.1517},
733 {3084.0, 5.1985, 77713.7715},
734 {1628.0, 1.1739, 5753.3849},
735 {1576.0, 2.8469, 7860.4194},
736 { 925.0, 5.453, 11506.77},
737 { 542.0, 4.564, 3930.21},
738 { 472.0, 3.661, 5884.927},
739 { 346.0, 0.964, 5507.553},
740 { 329.0, 5.9, 5223.694},
741 { 307.0, 0.299, 5573.143},
742 { 243.0, 4.273, 11790.629},
743 { 212.0, 5.847, 1577.344},
744 { 186.0, 5.022, 10977.079},
745 { 175.0, 3.012, 18849.228},
746 { 110.0, 5.055, 5486.778},
747 { 98.0, 0.89, 6069.78},
748 { 86.0, 5.69, 15720.84},
749 { 86.0, 1.27, 161000.69},
750 { 65.0, 0.27, 17260.15},
751 { 63.0, 0.92, 529.69},
752 { 57.0, 2.01, 83996.85},
753 { 56.0, 5.24, 71430.7},
754 { 49.0, 3.25, 2544.31},
755 { 47.0, 2.58, 775.52},
756 { 45.0, 5.54, 9437.76},
757 { 43.0, 6.01, 6275.96},
758 { 39.0, 5.36, 4694.0},
759 { 38.0, 2.39, 8827.39},
760 { 37.0, 0.83, 19651.05},
761 { 37.0, 4.9, 12139.55},
762 { 36.0, 1.67, 12036.46},
763 { 35.0, 1.84, 2942.46},
764 { 33.0, 0.24, 7084.9},
765 { 32.0, 0.18, 5088.63},
766 { 32.0, 1.78, 398.15},
767 { 28.0, 1.21, 6286.6},
768 { 28.0, 1.9, 6279.55},
769 { 26.0, 4.59, 10447.39}
771 static const SunSeries r1[] = {
772 {103019.0, 1.10749, 6283.07585},
773 { 1721.0, 1.0644, 12566.1517},
774 {702.0, 3.142, 0.0 },
775 { 32.0, 1.02, 18849.23},
776 { 31.0, 2.84, 5507.55},
777 { 25.0, 1.32, 5223.69},
778 { 18.0, 1.42, 1577.34},
779 { 10.0, 5.91, 10977.08},
780 { 9.0, 1.42, 6275.96},
781 { 9.0, 0.27, 5486.78}
783 static const SunSeries r2[] = {
784 {4359.0, 5.7846, 6283.0758},
785 { 124.0, 5.579, 12566.152},
787 { 9.0, 3.63, 77713.77},
788 { 6.0, 1.87, 5573.14},
789 { 3.0, 5.47, 18849.23}
791 static const SunSeries r3[] = {
792 {145.0, 4.273, 6283.076},
793 { 7.0, 3.92, 12566.15 }
795 static const SunSeries r4[] = {
799 static const SunSeries *rt[R_COUNT] = { r0, r1, r2, r3, r4 };
800 static const int rSubcount[R_COUNT] = {
ARRAY_SIZE(r0),
811 for (i = 0; i < R_COUNT; i++) {
813 for (j = 0; j < rSubcount[i]; j++) {
814 sum[i] += rt[i][j].a * cos(rt[i][j].cb + rt[i][j].cct * t_ka);
820 for (i = 0; i < R_COUNT; i++) {
822 earthSum += sum[i] * tPower;
832 LOCAL double solarNoonApprox(
double noonGuess_d,
866 return noonGuess_d - ha_rad /
TWOPI;
871 LOCAL double riseSetApprox(
double risesetGuess_d,
915 double riseSetApprox_d;
928 riseSetApprox_d = 0.0;
929 }
else if (cosHa2 < -1.0) {
931 riseSetApprox_d = 0.0;
934 ha2_rad = -acos(cosHa2);
936 ha2_rad = acos(cosHa2);
941 riseSetApprox_d = risesetGuess_d - (ha1_rad - ha2_rad) /
TWOPI;
943 return riseSetApprox_d;