Calculating Sunrise and Sunset 2


Closed Thread
Results 1 to 18 of 18

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Re: Calculating Sunrise and Sunset 2

    but also....... with a few known data points like Hennrik states, a simple calculation is possible. The change in rise and set times per day is a known from charts for a given latitude. So at some given latitude, the overall change in rise and set in hours and minutes can be estimated. And that happens for 180 days at a time, longer for 180 days and then going shorter for 180 days. So with Hennric's example, sunrise changes for 254 minutes ....or 254/180.... on average adds 1.4 minutes a day. Similarly, sunset (with it's minutes calculation) goes X minutes lower each day. Could keep a byte counter to track days of 1 to 182 and when 182 is reached, the additions and subtractions are switched. Those days are Summer Solstice, about June 21 ..... and Winter Solstice ABOUT December 21. Those are the dates to switch the additions and subtractions for rise and set... So only check for dates of change (182 days apart), keep track of mode (season... getting longer/shorter) and add or subtract minutes daily from some basic set point.
    Last edited by amgen; - 25th October 2024 at 20:03.

  2. #2
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    964


    Did you find this post helpful? Yes | No

    Default Re: Calculating Sunrise and Sunset 2

    Just a thought: from what I understand from Amgen's and Henrik's suggestions, is that the sunrise and sunset would be roughtly linearly calculable.

    Is it so?
    Roger

  3. #3
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    974


    Did you find this post helpful? Yes | No

    Default Re: Calculating Sunrise and Sunset 2

    Depending on your application, the approach you take to solve your problem could differ.

    For a changeable lattitude, longitude, Height above sea level, DST the calculation is not trivial. The astronomical calculations used require double precision (15digits floating point) math to get accurate results.

    If your location is fixed, then perhaps a table driven approach with corrections applied to the table for different dates of the year may work - I am not sure of this.

    You may find C code for the calculations if you search for such calculations.

    IMO : this is most certainly not easy to undetake in PicBasic.

Similar Threads

  1. Calculating MKT
    By pedja089 in forum General
    Replies: 1
    Last Post: - 10th November 2013, 14:46
  2. Calculating a checksum
    By simongie in forum General
    Replies: 4
    Last Post: - 21st August 2009, 13:08
  3. Calculating Sunrise and Sunset
    By CocaColaKid in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 21st November 2007, 16:56
  4. calculating speed of a loop
    By EDWARD in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 5th June 2005, 20:34
  5. Sinus calculating !
    By Don Mario in forum mel PIC BASIC Pro
    Replies: 29
    Last Post: - 28th November 2004, 23:56

Members who have read this thread : 2

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts