DavidArmstrong / SiderealPlanets

General Astronomy library for advanced Arduino platforms
MIT License
11 stars 2 forks source link

moonrise and moonset #12

Open australopitheque opened 8 months ago

australopitheque commented 8 months ago

Hello, I tried one of your examples (example5_moon) to see if this library corresponds to what I'm looking for, so I just modified at the end the location and date as follows:

  myAstro.setDST() ;
  myAstro.setTimeZone(0) ;
  myAstro.setLatLong(myAstro.decimalDegrees(35,30,0), myAstro.decimalDegrees(-0,30,0)) ;
  monAstro.setGMTdate(2024,2,1) ;
  myAstro.doMoonRiseSetTimes() ;
  Serial.println("Our results should be:") ;
  Serial.print("Local Moonrise===> ") ;
  myAstro.printDegMinSecs(myAstro.getMoonriseTime()) ;
  Serial.println("") ;
  Serial.print("Local MoonSet===> ") ;
  myAstro.printDegMinSecs(myAstro.getMoonsetTime()) ;
  Serial.println("") ;
}

I get :

We can also calculate the moon's rising and setting times.
We set : DST off, Time Zone = 0, Date : 1 feb 2024
Longitude = -0:30:0; Latitude = 35:30:0

Our results should be :
Local moonrise===> 23:46:24.94 
Local moonset===> 11:14:28.92 

except that the 23:46:24.94 match to the time of moonrise the day before and not on the day itself. In the calculation, I should have an XX or a nomoonrise since it's the calculation that's required for D-day. link to verify : https://www.mooncalc.org/#/35.5,-0.5,15/2024.02.01/23:48/1/3

ps: I'm French and use a translator

australopitheque commented 8 months ago

if I use your example5 , I don't get the famous xx:xx:xx but this:

Moon Rise/Set: no DST, Time Zone = 0, Date: Jan 11,1984
Geo Long: 0:0:0.0, Lat: 30:0:0.0
local Rise=11:54:54.02 local Set=xx:xx:xx.xx
11:54:54.02 23:46:32.66 

I've checked, but I think the 23:46:32.66 is for yesterday and not today as your text predicts. I also have a 30-minute difference with the control site, but that's another matter.

https://www.mooncalc.org/#/30,0,15/1984.01.11/23:48/1/3

DavidArmstrong commented 7 months ago

First, I apologize for getting back to you after such a long time.

When I tried to compile the code snippet you provided in your first message, I noticed that this line was flagged as an error: monAstro.setGMTdate(2024,2,1) ;

I corrected it, and then tried running it on my MicroMod test setup: Longitude = 0:0:0; Latitude = 30:0:0 Our results should be: Local Moonrise===> 23:46:23.76 Local MoonSet===> 11:14:30.79

The moonset time looks a lot closer to what your reference page reports. While the moonrise is as you stated. There is some subtlety here, and I'll have to look closer at the code to see how it is determining the day of the report.

australopitheque commented 7 months ago

I compared it to other software or websites and the 23:46 corresponds to d-1, i.e. 31/01 and not 1/02. I think this is due to the iteration, which looks for the time of day closest to sunrise or sunset, but doesn't really indicate the time of day itself. one approach i'd thought of would be to check at each hour found to verify the end its altitude at either sunrise or sunset which has been calculated to know if the time calculated is indeed that of the day.