Post Reply 
(34S) - Sunrise/Sunset
02-21-2015, 07:05 AM
Post: #20
RE: WP 34S - Sunrise/Sunset
(02-21-2015 02:17 AM)Kiwi Geoff Wrote:  Those of us living below the equator are coming up to our Autumn (or Spring in Northern Hemisphere) - our seasons are the opposite. To make Dieter's DST code work correctly for both North & South Hemispheres, I ADDED 3 lines of code ( marked with **NEW** ) as per the following - to make the code work properly for us "Down Under".

This requires R.01 to hold the latitude – but this happens not until further down the code. So another modification is required: move the latitude entry (lines 043...051) upwards, for instance like this:

Code:
Step   Instruction    Comments
001    LBL  'RS'      
002    LocR 016       allocate 16 local registers
003    DEG            Set degrees mode (used throughout)
004    STO .00        store input date
005    YEAR           get year of input date
006    FILL           fill stack
007    #011           enter 11, for November
008    XEQ 01         calculate j-day for last Sunday in October
009    #007           enter 7
010    +              add 7 for US DST end 1st Sunday in November
011    x<>Y           get year of input date back
012    #003           enter 3, for March
013    XEQ 01         calculate j-day for last Sunday in February
014    #014           enter 14
015    +              add 14 for US DST start 2nd Sunday in March
016    RCL .00        recall input date
017    D→J            get j-day of input date
018    SF A           set DST flag
019    x≥? Y          IF date < first DST day 
020    x≥? Z          OR date ≥ first standard time day
021    CF A           THEN clear DST flag
022    RCL .00        Recall input date
023    ENTER          Copy input date into Y, could use RCL X, etc.
024    YEAR           year of input date
025    DEC X          previous year
026    #12            enter 12
027    #31            enter 31
028    →DATE          create last day of previous year in current date mode.
029    X<>Y           
030    ΔDAYS          days from beginning of year
031    STO .04        
032    3              Latitude
033    5              Latitude
034    .              Latitude
035    1              Latitude
036    2              Latitude
037    3              Latitude
038    4              Latitude
039    5              Latitude
040    STO .01        35.12345 for example (decimal)
041    x≤0?           Southern hemisphere?
042    FF A           then reverse DST setting
043    9              Longitude
044    0              Longitude
045    .              Longitude
046    5              Longitude
047    4              Longitude
048    3              Longitude
049    2              Longitude
050    1              Longitude
051    +/-            Longitude
052    STO .02        -90.54321 for example (decimal)
053    #015           15 Degrees per hour
054    STO .09        Store for later use
055    /              
056    STO .06        Longitude hour value (lngHour)
057    5              Offset from UTC (-5 represents EST)
058    +/-            Offset from UTC (-5 represents EST)
059    FS?  A         If flag A set, DST in effect for input date
060    INC X          If flag A set, increment offset from UTC
061    STO .03        Local time offset from UTC
062    9              
063    0              
064    .              
065    5              
066    ->HR           90.83333333333333 entered for degrees from zenith at
                      Sunrise/sunset (fewer steps than direct entry)
067    STO .05        degrees from zenith for Sunrise.  May be changed if
                      twilight times or other solar elevation times are desired (e.g.
                      enter 50 to find times when sun is at 40 degrees altitude.)

Continue with line 066 of the original code (#018 XEQ 05 ...)

I also changed FS?C A (line 59) to FS? A because I think having the "=" annunciator signal a DST result is a useful feature.

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(34S) - Sunrise/Sunset - Jeff O. - 01-28-2015, 08:08 PM
RE: WP 34S - Sunrise/Sunset - Kiwi Geoff - 02-09-2015, 10:06 AM
RE: WP 34S - Sunrise/Sunset - Jeff O. - 02-11-2015, 03:22 AM
RE: WP 34S - Sunrise/Sunset - Paul Dale - 02-09-2015, 09:13 PM
RE: WP 34S - Sunrise/Sunset - Dieter - 02-10-2015, 10:31 PM
RE: WP 34S - Sunrise/Sunset - Thomas_Sch - 02-11-2015, 07:48 AM
RE: WP 34S - Sunrise/Sunset - Dieter - 02-11-2015, 03:06 PM
RE: WP 34S - Sunrise/Sunset - Jeff O. - 02-11-2015, 05:49 PM
RE: WP 34S - Sunrise/Sunset - Dieter - 02-11-2015, 09:46 PM
RE: WP 34S - Sunrise/Sunset - Jeff O. - 02-11-2015, 08:03 PM
RE: WP 34S - Sunrise/Sunset - Paul Dale - 02-11-2015, 09:06 PM
RE: WP 34S - Sunrise/Sunset - Jeff O. - 02-13-2015, 12:19 AM
RE: WP 34S - Sunrise/Sunset - Dieter - 02-13-2015, 06:52 AM
RE: WP 34S - Sunrise/Sunset - Jeff O. - 02-13-2015, 02:19 PM
RE: WP 34S - Sunrise/Sunset - Dieter - 02-13-2015, 08:01 PM
RE: WP 34S - Sunrise/Sunset - Dieter - 02-15-2015, 07:57 PM
RE: WP 34S - Sunrise/Sunset - Jeff O. - 02-15-2015, 08:31 PM
RE: WP 34S - Sunrise/Sunset - Kiwi Geoff - 02-22-2015, 11:48 AM
RE: WP 34S - Sunrise/Sunset - Thomas_Sch - 02-11-2015, 06:09 PM
RE: WP 34S - Sunrise/Sunset - Kiwi Geoff - 02-21-2015, 02:17 AM
RE: WP 34S - Sunrise/Sunset - Dieter - 02-21-2015 07:05 AM



User(s) browsing this thread: 2 Guest(s)