Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 05:43 02 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : MMX - solar eclipses

Author Message
cdeagle
Senior Member

Joined: 22/06/2014
Location: United States
Posts: 265
Posted: 07:46am 14 Mar 2017
Copy link to clipboard 
Print this post

This post is an MMBASIC computer program for the MicroMite eXtreme which can be used to predict the local circumstances of solar eclipses. The software uses a combination of one-dimensional minimization and root-finding to calculate these conditions.

Here's a typical user interaction with the software. The program will take a minute or so to run to completion. Be patient, it's performing thousands of hardware-based, double precision calculations looking for the answer. The source code listing is 3200+ lines of comments, white space and actual code.


program solar_eclipse
=====================

please input the initial calendar date

(month [1 - 12], day [1 - 31], year [yyyy])
< for example, october 21, 1986 is input as 10,21,1986 >
< b.c. dates are negative, a.d. dates are positive >
< the day of the month may also include a decimal part >

? 12,1,2000

please input the geographic latitude of the observer
(degrees [-90 to +90], minutes [0 - 60], seconds [0 - 60])
(north latitudes are positive, south latitudes are negative)
? 39,40,36

please input the geographic longitude of the observer
(degrees [0 - 360], minutes [0 - 60], seconds [0 - 60])
(east longitude is positive, west longitude is negative)
? -104,57,12

please input the altitude of the observer (meters)
(positive above sea level, negative below sea level)
? 1644

please input the search duration in days
? 30

searching for solar eclipse ...


Here's the program output for this example.

begin penumbral phase of solar eclipse

calendar date December 25 2000

UTC time 15 hours 29 minutes 23.91 seconds

UTC julian day 2451904.14541560

topocentric coordinates

lunar azimuth angle 132 deg 9 min 29.65 sec

lunar elevation angle 10 deg 35 min 42.02 sec

solar azimuth angle 132 deg 8 min 30.41 sec

solar elevation angle 10 deg 4 min 35.03 sec


greatest eclipse conditions

calendar date December 25 2000

UTC time 16 hours 43 minutes 32.47 seconds

UTC julian day 2451904.19690359

topocentric coordinates

lunar azimuth angle 146 deg 40 min 53.36 sec

lunar elevation angle 19 deg 34 min 59.64 sec

solar azimuth angle 146 deg 53 min 27.85 sec

solar elevation angle 19 deg 21 min 2.24 sec


end penumbral phase of solar eclipse

calendar date December 25 2000

UTC time 18 hours 6 minutes 3.54 seconds

UTC julian day 2451904.25420764

topocentric coordinates

lunar azimuth angle 165 deg 38 min 46.45 sec

lunar elevation angle 25 deg 48 min 46.82 sec

solar azimuth angle 166 deg 12 min 32.05 sec

solar elevation angle 25 deg 41 min 51.62 sec

event duration 2.61100903 hours


Here's a PDF document for the MATLAB version of the program.

2017-03-14_173057_solar_eclipse.pdf

Here's a zip archive of the MMBASIC source code for the solar eclipse computer program.

2017-03-14_173117_solar_eclipse.zip
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10180
Posted: 11:39am 14 Mar 2017
Copy link to clipboard 
Print this post

Just run it for my house in France for the next 10,000 days and it is matching exactly this site

August 12th 2026 we get 90% coverage

Fascinating - thanks for posting
 
Frank N. Furter
Guru

Joined: 28/05/2012
Location: Germany
Posts: 946
Posted: 11:46pm 14 Mar 2017
Copy link to clipboard 
Print this post

Hi Cdeagle,

very nice code, thank you very much!

Did you have some code for calculating the position of the planets?

Frank
 
cdeagle
Senior Member

Joined: 22/06/2014
Location: United States
Posts: 265
Posted: 12:08am 15 Mar 2017
Copy link to clipboard 
Print this post

Yes I do have MMBASIC code for computing planetary positions.

I will post it in the near feature.
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 03:44am 15 Mar 2017
Copy link to clipboard 
Print this post

My son recently got very interested in space related stuff. It happened after the CRS-10 launch of SpaceX. The day after the ISS was visible from my location and it was great to see it fly over.
Now he wants to see it more clear. The idea is to buy a small telescope and try to follow it. Here is where it gets interesting for me. :)
Adding a small motor that actually tracks it so that there are no jerky movements that will probably cause it to loose sight of it.
Controlling a motor with a micromite would be the plan.

Did any of you guys ever do something like that? What is the best place to get more info, my googling is not getting much info.

Microblocks. Build with logic.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10180
Posted: 02:43pm 13 Apr 2018
Copy link to clipboard 
Print this post

I've been using this program to test various MMBasic implementations as it is a very good test of both the resilience and the accuracy of any port.

Results so far:

Pi-cromite @ 1200MHz: 7.86 seconds - identical answer
STM32H7 @ 400MHz: 26.66 seconds - identical answer
MMX @ 200MHz 74.98 seconds - identical answer
MM+ @ 100MHz 121.75 seconds - small variations (NB software floating point)

This gives an interesting insight into the comparative strengths of the ARM core vs the MIPS and it is interesting to speculate where the differences arise.

The MMX result vs the MM+ is disappointing. The MMX has a double precision hardware FPU but is not that much quicker. We have always suspected that the limiting factor in MMBasic is the parsing rather than the times for the underlying calculations and that the flash memory access times may be critical in this.

The Pi-cromite and STM32H7 are pretty much in-line with their relative clock speeds but significantly faster than the PICs on a per MHz basis. This suggests to me that the cacheing on the ARM core is better than the PIC and to test this I turned cacheing off on the STM32. This then gave results of:

STM32H7 @ 400MHz (no cacheing): 95.49 seconds - identical answer
STM32H7 @ 400MHz (Instruction cacheing only): 53.29 seconds - identical answer
STM32H7 @ 400MHz (Data cacheing only): 86.48 seconds - identical answer

As can be seen both types of cacheing are important but instruction caching is essential before the availability of data becomes really relevant

So it is clear that the cacheing is absolutely critical to the chips performance.
 
isochronic
Guru

Joined: 21/01/2012
Location: Australia
Posts: 689
Posted: 01:57am 14 Apr 2018
Copy link to clipboard 
Print this post

I think the STM has a FPU - don't know if it is DP or not though.
I agree, at a guess the double-precision of the FPU is probably not going to speed up the parsed eclipse iterative minimisation/root-finding process a lot, at least until the iteration is very close to a solution (?).
 
Boppa
Guru

Joined: 08/11/2016
Location: Australia
Posts: 814
Posted: 04:12am 14 Apr 2018
Copy link to clipboard 
Print this post

  MicroBlocks said   My son recently got very interested in space related stuff. It happened after the CRS-10 launch of SpaceX. The day after the ISS was visible from my location and it was great to see it fly over.
Now he wants to see it more clear. The idea is to buy a small telescope and try to follow it. Here is where it gets interesting for me. :)
Adding a small motor that actually tracks it so that there are no jerky movements that will probably cause it to loose sight of it.
Controlling a motor with a micromite would be the plan.

Did any of you guys ever do something like that? What is the best place to get more info, my googling is not getting much info.


Basically you are making a goto telescope...

GOTO telescope
 
plasma
Guru

Joined: 08/04/2012
Location: Germany
Posts: 437
Posted: 10:28am 15 Apr 2018
Copy link to clipboard 
Print this post

thanks for the code ! i like this kind of stuff.
 
cdeagle
Senior Member

Joined: 22/06/2014
Location: United States
Posts: 265
Posted: 12:03pm 07 Apr 2019
Copy link to clipboard 
Print this post

Here's an updated version of the solar eclipse MMBASIC program. It should run on any MicroMite that supports double precision math. It now displays conditions during the total/annular phases of eclipses. The documentation includes the write-up that appeared in Volume 2, Number 2 of Celestial Computing.

2019-04-07_220307_solar_eclipse.zip
 
isochronic
Guru

Joined: 21/01/2012
Location: Australia
Posts: 689
Posted: 12:10am 21 Apr 2019
Copy link to clipboard 
Print this post

Apart from eclipses, could the earth/moon/sun system positions be used to calculate tide times and strengths ? I guess there would be a calculation assuming the ocean as a large blob of water modified by a local factor for individual locations eg a local phase delay and amplitude scale based on local measurement (?)
 
cdeagle
Senior Member

Joined: 22/06/2014
Location: United States
Posts: 265
Posted: 12:17am 21 Apr 2019
Copy link to clipboard 
Print this post

For tide predictions check out

https://tidesandcurrents.noaa.gov/tide_predictions.htmlC
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6266
Posted: 03:54am 21 Apr 2019
Copy link to clipboard 
Print this post

I use wtides
http://www.wtides.com/

Jim
VK7JH
MMedit
 
isochronic
Guru

Joined: 21/01/2012
Location: Australia
Posts: 689
Posted: 03:01am 22 Apr 2019
Copy link to clipboard 
Print this post


(!) more empirical than I thought
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025