Created
September 25, 2015 02:32
-
-
Save dfinke/89046c03bf3183d81304 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Function MoonRiseLCT(DY As Double, MN As Double, YR As Double, DS As Double, ZC As Double, GLong As Double, GLat As Double) As Double | |
| Dim K As Integer | |
| GDY = LctGDay(12, 0, 0, DS, ZC, DY, MN, YR) | |
| GMN = LctGMonth(12, 0, 0, DS, ZC, DY, MN, YR) | |
| GYR = LctGYear(12, 0, 0, DS, ZC, DY, MN, YR) | |
| LCT = 12#: DY1 = DY: MN1 = MN: YR1 = YR | |
| GoSub 6700: LA = LU | |
| For K = 1 To 8 | |
| X = LSTGST(LA, 0, 0, GLong) | |
| UT = GSTUT(X, 0, 0, GDY, GMN, GYR) | |
| If (K = 1) Then | |
| G1 = UT | |
| Else | |
| G1 = GU | |
| End If | |
| GU = UT | |
| UT = GU: GoSub 6680: LA = LU: AA = AU | |
| Next K | |
| AU = AA | |
| X = LSTGST(LA, 0, 0, GLong) | |
| UT = GSTUT(X, 0, 0, GDY, GMN, GYR) | |
| If (eGSTUT(X, 0, 0, GDY, GMN, GYR) <> "OK") Then | |
| If (Abs(G1 - UT) > 0.5) Then | |
| UT = UT + 23.93447 | |
| End If | |
| End If | |
| UT = UTDayAdjust(UT, G1) | |
| LCT = UTLct(UT, 0, 0, DS, ZC, GDY, GMN, GYR) | |
| GoTo 6800 | |
| 6680 If (eGSTUT(X, 0, 0, GDY, GMN, GYR) <> "OK") Then | |
| If (Abs(G1 - UT) > 0.5) Then | |
| UT = UT + 23.93447 | |
| End If | |
| End If | |
| UT = UTDayAdjust(UT, G1) | |
| LCT = UTLct(UT, 0, 0, DS, ZC, GDY, GMN, GYR) | |
| DY1 = UTLcDay(UT, 0, 0, DS, ZC, GDY, GMN, GYR) | |
| MN1 = UTLcMonth(UT, 0, 0, DS, ZC, GDY, GMN, GYR) | |
| YR1 = UTLcYear(UT, 0, 0, DS, ZC, GDY, GMN, GYR) | |
| GDY = LctGDay(LCT, 0, 0, DS, ZC, DY1, MN1, YR1) | |
| GMN = LctGMonth(LCT, 0, 0, DS, ZC, DY1, MN1, YR1) | |
| GYR = LctGYear(LCT, 0, 0, DS, ZC, DY1, MN1, YR1) | |
| UT = UT - 24# * Int(UT / 24#) | |
| 6700 MM = MoonLong(LCT, 0, 0, DS, ZC, DY1, MN1, YR1) | |
| BM = MoonLat(LCT, 0, 0, DS, ZC, DY1, MN1, YR1) | |
| PM = Radians(MoonHP(LCT, 0, 0, DS, ZC, DY1, MN1, YR1)) | |
| DP = NutatLong(GDY, GMN, GYR) | |
| TH = 0.27249 * Sin(PM): DI = TH + 0.0098902 - PM | |
| P = DDDH(ECRA(MM + DP, 0, 0, BM, 0, 0, GDY, GMN, GYR)) | |
| Q = ECDec(MM + DP, 0, 0, BM, 0, 0, GDY, GMN, GYR) | |
| LU = RSLSTR(P, 0, 0, Q, 0, 0, Degrees(DI), GLat) | |
| If (eRS(P, 0, 0, Q, 0, 0, Degrees(DI), GLat) <> "OK") Then | |
| LCT = -99 | |
| GoTo 6800 | |
| End If | |
| Return | |
| 6800 MoonRiseLCT = LCT | |
| End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment