Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Join Date
    Jul 2012
    Location
    Northern Sweden
    Posts
    30

    Default Adding twilight durations to dawndusk.asp

    Hi!

    While fiddling with the code in the fantastic dawndusk.asp to add the observatory-location in the newly added day/night-map, I gained some confidence in my scavenger-style coding and programming and decided to add some more features.
    I've added a new column in the table: "Duration", between the dusk & dawn columns... Simply showing how long each of the different twilight's will last, in the hh:mm:ss format. So now you can see how many hours of astronomical darkness you'll have, without having to do the maths yourself (lazy I know.) Maybe it's overkill showing seconds, opinions? View image below to see the result:
    dawnduskduration.jpg

    I've modified quite a lot, so I guess it's easier to download my new dawndusk.asp instead of making all the changes yourself.
    (Remember to make a backup-copy of the original dawndusk.asp in case my modifications screw things up(Beta-testers wanted))


    Here's the code if you want to modify it yourselves... I marked the whole table as green as it's better to replace it as a whole, instead of breaking up every row with inserted additions, big chance of messing things up.
    Code:
    <%@LANGUAGE="JSCRIPT"%><%
    //
    //   Display sunset and sunrise times for the current evening current place
    //
    // 22-Aug-11  rab Adapted from .vbs script
    //              Created to run in a tiddler instead of in the console
    //              Tweaked the SysJulianDate slightly (see below)
    // 23-Sep-11  rbd Part of standard ACP UI. Credit Berg!
    // 21-Sep-12  rbd GEM:871 Incorporate Robert Wahlström's high latitude changes
    // 02-Feb-13  esy updated to calculate the dusk and dawn for the
    //                current Astronomical day. If past dawn it will
    //                calculate the next instead (same as if it was past
    //                local noon). Also, changed the calculator to be a
    //                function, rather than a "printer".
    // 02-Feb-13  rab limited  arccos test to be [-1 to +1] .
    //                regression tested for mid-Winter high latitudes --> OK
    //
    // 05-Feb-14  Mod By Jonas Grinde to add durations of each twilight to the table
    //                 and adding day/night map with observatory location marked
    
    
    var RADIANS_MULTIPLE = 0.0174532925              // multiply by degrees to get radians
    
    
    var        SUNSET = -0.833333 * RADIANS_MULTIPLE; // upper limb at horizon, includes refraction correction
    var         CIVIL =      -6.0 * RADIANS_MULTIPLE; // need artificial illumination to read outside
    var      NAUTICAL =     -12.0 * RADIANS_MULTIPLE; // navigation using sea horizon no longer possible
    var       AMATEUR =     -15.0 * RADIANS_MULTIPLE; // dark enough for most astronomical observations
    var  ASTRONOMICAL =     -18.0 * RADIANS_MULTIPLE; // sky is completely dark
    
    
    var   JULIAN_HOUR = 0.0417              // 1 hour as a fraction of a Julian Day
    var JULIAN_SECOND = 0.0000115741          // 1 second as a fraction of a Julian Day
    
    
    var DAWN = true ; var DUSK = false;          // set some vars to make code cleaner for dawn or dusk
    var TODAY = false ; var TOMORROW = true;
    
    
    function cdiff(JulianStart, JulianEnd) {
        // Calculates the difference between two Julian Dates
        // and returns the result as hh:mm:ss
    
    
        var diff = JulianEnd - JulianStart;
        var msec = diff;
        var hh = Math.floor(msec / 1000 / 60 / 60);
        msec -= hh * 1000 * 60 * 60;
        var mm = Math.floor(msec / 1000 / 60);
        msec -= mm * 1000 * 60;
        var ss = Math.floor(msec / 1000);
        msec -= ss * 1000;
        TimeDiff = hh + "h" + mm + "m" + ss + "s";
        return TimeDiff;
    }
    
    
    
    
    function this_twilight(theta_S, dawn_or_dusk, next_day) {
        // takes the solar elevation angle in radians and returns the
        // twilight ends (dusk) or starts (dawn) during this "astronomical day".
    
    
        var KT = new ActiveXObject("Kepler.Ephemeris"); // Re-usable Earth ephem (reverse = Sun!)
        KT.BodyType = 0; KT.Number = 3;                // This is a Planet. Earth.
    
    
        var tvec = new ActiveXObject("NOVAS.PositionVector");        
        var latitude = Telescope.SiteLatitude * RADIANS_MULTIPLE; 
    
    
        var JD = Util.SysJulianDate;                    // Current UT; Start with tomorrow's date/Time
        var LOCAL_JD = JD - (Util.SysUTCOffset * JULIAN_HOUR) ;
        var LOCAL_JDN = Math.floor(LOCAL_JD);
        
        // Are we looking for a dawn or dsuk calculation?
        if (dawn_or_dusk)
        JD = LOCAL_JDN + 1;
        else
        JD = LOCAL_JDN;
    
    
        // similarly, this is here to do the next astronomical day if we
        // are already past dawn.
        if (next_day)
        JD = JD + 1;
        else
        JD = JD;
    
    
        var JDPrev = LOCAL_JDN;
    
    
        do {                          // Iterate through until we converge on a solution.
              var KA = KT.GetPositionAndVelocity(JD).toArray(); // Get Earth from Sun
            // Reverse cartesian vector for Sun from Earth
            tvec.x = -KA[0]; tvec.y = -KA[1]; tvec.z = -KA[2];
    
    
        // J2000 coordinates of Sun from Earth
            var right_ascension_sun = tvec.RightAscension;
            var declination_sun = tvec.Declination * RADIANS_MULTIPLE;
    
    
            var HA = (Math.sin(theta_S) - (Math.sin(latitude) * Math.sin(declination_sun))) /
                 (Math.cos(latitude) * Math.cos(declination_sun));
    
    
            if (HA >-1.0 && HA <1.0) { 
                HA = Math.acos(HA) / RADIANS_MULTIPLE; // HA in degrees
            } else { 
                    return "//N/A at this latitude//";        // a bust! no solution for this latitude for today or tomorrow.
            }
    
    
            if (dawn_or_dusk) HA = -HA;          // if for dawn, invert the position of the sun.
        
        var LMST = Util.Julian_GMST(JD) + (Telescope.SiteLongitude / 15.0);
    
    
            JD = JD + (((HA / 15.0) - Util.HourAngle12(right_ascension_sun, LMST)) / 24.0);
        
        if (Math.abs(JD - JDPrev) < JULIAN_SECOND) {
            break;                                // Convergence to ~1 second accuracy breaks out of while loop
        }
    
    
            JDPrev = JD;
        }  while(true);
        
        KT = null; tvec = null ;                  // Explicitly release these
    
    
        return new Date(Util.Julian_Date(JD));
    }
    
    
    if (Util.Julian_Date(Util.SysJulianDate) > this_twilight(SUNSET, DAWN, TODAY)) {
        Response.write("It's After Dawn!\n");
        Response.write("Here are the //coming// day's sunset and sunrise times for //" +  Prefs.SiteName + "//\n" );
        Response.write("|>|!Dusk" + "|!Duration|" + ">|!Dawn|");
        Response.write("\n| Sunset is| " + this_twilight(SUNSET, DUSK, TOMORROW) + " | " + cdiff(this_twilight(SUNSET, DUSK, TOMORROW), this_twilight(SUNSET, DAWN, TOMORROW)) + " |" + this_twilight(SUNSET, DAWN, TOMORROW) + " |is Sunrise |");
        Response.write("\n| Civil twilight ends| " + this_twilight(CIVIL, DUSK, TOMORROW) + " | " + cdiff(this_twilight(CIVIL, DUSK, TOMORROW), this_twilight(CIVIL, DAWN, TOMORROW)) + " |" + this_twilight(CIVIL, DAWN, TOMORROW) + " |begins Civil twilight |");
        Response.write("\n| Nautical twilight ends| " + this_twilight(NAUTICAL, DUSK, TOMORROW) + " | " + cdiff(this_twilight(NAUTICAL, DUSK, TOMORROW), this_twilight(NAUTICAL, DAWN, TOMORROW)) + " |" + this_twilight(NAUTICAL, DAWN, TOMORROW) + " |begins Nautical twilight |");
        Response.write("\n| Amateur twilight ends| " + this_twilight(AMATEUR, DUSK, TOMORROW) + " | " + cdiff(this_twilight(AMATEUR, DUSK, TOMORROW), this_twilight(AMATEUR, DAWN, TOMORROW)) + " |" + this_twilight(AMATEUR, DAWN, TOMORROW) + " |begins Amateur twilight |");
        Response.write("\n| Astronomical twilight ends| " + this_twilight(ASTRONOMICAL, DUSK, TOMORROW) + " | " + cdiff(this_twilight(ASTRONOMICAL, DUSK, TOMORROW), this_twilight(ASTRONOMICAL, DAWN, TOMORROW)) + " |" + this_twilight(ASTRONOMICAL, DAWN, TOMORROW) + " |begins Astronomical twilight |");
    } else {
        Response.write("Here are //today's//  sunset and //tomorrow's// sunrise times for //" +  Prefs.SiteName + "//\n" );
        Response.write("|>|!Dusk" + "|!Duration|" + ">|!Dawn|");
        Response.write("\n| Sunset is| " + this_twilight(SUNSET, DUSK, TODAY) + " | " + cdiff(this_twilight(SUNSET, DUSK, TODAY), this_twilight(SUNSET, DAWN, TODAY)) + " |" + this_twilight(SUNSET, DAWN, TODAY) + " |is Sunrise |");
        Response.write("\n| Civil twilight ends| " + this_twilight(CIVIL, DUSK, TODAY) + " | " + cdiff(this_twilight(CIVIL, DUSK, TODAY), this_twilight(CIVIL, DAWN, TODAY)) + " |" + this_twilight(CIVIL, DAWN, TODAY) + " |begins Civil twilight |");
        Response.write("\n| Nautical twilight ends| " + this_twilight(NAUTICAL, DUSK, TODAY) + " | " + cdiff(this_twilight(NAUTICAL, DUSK, TODAY), this_twilight(NAUTICAL, DAWN, TODAY)) + " |" + this_twilight(NAUTICAL, DAWN, TODAY) + " |begins Nautical twilight |");
        Response.write("\n| Amateur twilight ends| " + this_twilight(AMATEUR, DUSK, TODAY) + " | " + cdiff(this_twilight(AMATEUR, DUSK, TODAY), this_twilight(AMATEUR, DAWN, TODAY)) + " |" + this_twilight(AMATEUR, DAWN, TODAY) + " |begins Amateur twilight |");
        Response.write("\n| Astronomical twilight ends| " + this_twilight(ASTRONOMICAL, DUSK, TODAY) + " | " + cdiff(this_twilight(ASTRONOMICAL, DUSK, TODAY), this_twilight(ASTRONOMICAL, DAWN, TODAY)) + " |" + this_twilight(ASTRONOMICAL, DAWN, TODAY) + " |begins Astronomical twilight |");
     }
    
    
    Response.write("\n----\n");
        var MapX = (Math.round(-2+((Telescope.SiteLongitude+180)*(720/360))));
        var MapY = (Math.round(20+(((Telescope.SiteLatitude*-1)+90)*(360/180))));
        Response.Write("<html><style>");
        Response.Write(".marker{position:relative;left:" + MapX + "px;top:" + MapY + "px;z-index:10;border:0px;opacity:1.00;}");
        Response.Write(".map{position:relative;left:0px;top:0px;z-index:1;border:0px;}</style>");
        Response.Write("<div class='marker'><font color=red><b>*</b></font> " + Prefs.SiteName + "</div>");
        Response.Write("<div class='map'><IMG SRC=http://www.timeanddate.com/scripts/sunmap.php border=0></div></html>");    
    Response.Write("//~~Contributed by Dick Berg, author of the [[ACP Reference Guide|http://solo.dc3.com/ar/ACPRefGuide.html]]~~//\n");
    Response.Write("//^^Computational improvements by Robert Wahlstrom, Erik Young, Jeffrey Jongmans and Jonas Grinde^^//");
    
    %>


    Thanks for having a look!

    Best Regards
    Jonas Grinde
    http://www.grinderphoto.se
    Attached Files Attached Files

  2. #2
    Join Date
    Oct 2005
    Location
    Mesa, AZ
    Posts
    30,768

    Default

    Leave it to someone from Scandanavia to add this, ha ha ha. Such a big difference in the length of night between winter and summer!!

    Thanks!!
    -- Bob

  3. #3
    Join Date
    Nov 2005
    Location
    Alingsås, Sweden
    Posts
    114

    Default

    Thanks.

    I had plans to implement something like this too

  4. #4
    Join Date
    Nov 2005
    Location
    Alingsås, Sweden
    Posts
    114

    Default

    Cloudy here as usual this year..... So i added sun altitude too. I often wants to know the sun altitude and it was easy to add.

    dawndusk.PNG

    Code:
    <%@LANGUAGE="JSCRIPT"%><%
    //
    //   Display sunset and sunrise times for the current evening current place
    //
    // 22-Aug-11  rab Adapted from .vbs script
    //              Created to run in a tiddler instead of in the console
    //              Tweaked the SysJulianDate slightly (see below)
    // 23-Sep-11  rbd Part of standard ACP UI. Credit Berg!
    // 21-Sep-12  rbd GEM:871 Incorporate Robert Wahlström's high latitude changes
    // 02-Feb-13  esy updated to calculate the dusk and dawn for the
    //                current Astronomical day. If past dawn it will
    //                calculate the next instead (same as if it was past
    //                local noon). Also, changed the calculator to be a
    //                function, rather than a "printer".
    // 02-Feb-13  rab limited  arccos test to be [-1 to +1] .
    //                regression tested for mid-Winter high latitudes --> OK
    //
    // 05-Feb-14      Mod By Jonas Grinde to add durations of each twilight to the table
    //          and adding day/night map with observatory location marked
    
    
    var RADIANS_MULTIPLE = 0.0174532925              // multiply by degrees to get radians
    
    
    var        SUNSET = -0.833333 * RADIANS_MULTIPLE; // upper limb at horizon, includes refraction correction
    var         CIVIL =      -6.0 * RADIANS_MULTIPLE; // need artificial illumination to read outside
    var      NAUTICAL =     -12.0 * RADIANS_MULTIPLE; // navigation using sea horizon no longer possible
    var       AMATEUR =     -15.0 * RADIANS_MULTIPLE; // dark enough for most astronomical observations
    var  ASTRONOMICAL =     -18.0 * RADIANS_MULTIPLE; // sky is completely dark
    
    
    var   JULIAN_HOUR = 0.0417              // 1 hour as a fraction of a Julian Day
    var JULIAN_SECOND = 0.0000115741          // 1 second as a fraction of a Julian Day
    
    
    var DAWN = true ; var DUSK = false;          // set some vars to make code cleaner for dawn or dusk
    var TODAY = false ; var TOMORROW = true;
    
    
    function cdiff(JulianStart, JulianEnd) {
        // Calculates the difference between two Julian Dates
        // and returns the result as hh:mm:ss
    
    
        var diff = JulianEnd - JulianStart;
        var msec = diff;
        var hh = Math.floor(msec / 1000 / 60 / 60);
        msec -= hh * 1000 * 60 * 60;
        var mm = Math.floor(msec / 1000 / 60);
        msec -= mm * 1000 * 60;
        var ss = Math.floor(msec / 1000);
        msec -= ss * 1000;
        TimeDiff = hh + "h" + mm + "m" + ss + "s";
        return TimeDiff;
    }
    
    
    
    
    
    
    //'
    //' Get current Sun elevation. Used to adjust the high And
    //' low angles if script waits in 1 minute loop.
    //'
    function SunElevation()
    {
        var SunRA, SunDec, CT;
        var tvec, KA;
        var KT;
        var JD = Util.SysJulianDate;
        var RA;
    
    
        var Dec;
        
        KT = new ActiveXObject("Kepler.Ephemeris");                   // Re-usable Earth ephem (reverse = Sun!)
        KT.BodyType = 0;                                             // Planet
        KT.Number = 3;                                               // EARTH    
        
        
        KA = KT.GetPositionAndVelocity(JD).toArray();                          // Get earth from sun
        tvec = new ActiveXObject("NOVAS.PositionVector");
        tvec.x = -KA[0];                                            // Reveerse cartesian vector for sun from earth
        tvec.y = -KA[1];
        tvec.z = -KA[2];
        RA = tvec.RightAscension;                                    // J2000 coordinates of sun from earth
        Dec = tvec.Declination;
        
        
        CT = Util.NewCT(Telescope.SiteLatitude, Util.NowLST(Telescope.SiteLongitude));
        CT.RightAscension = RA;
        CT.Declination = Dec;
        return CT.Elevation;
        
    }
    
    
    
    
    function this_twilight(theta_S, dawn_or_dusk, next_day) {
        // takes the solar elevation angle in radians and returns the
        // twilight ends (dusk) or starts (dawn) during this "astronomical day".
    
    
        var KT = new ActiveXObject("Kepler.Ephemeris"); // Re-usable Earth ephem (reverse = Sun!)
        KT.BodyType = 0; KT.Number = 3;                // This is a Planet. Earth.
    
    
        var tvec = new ActiveXObject("NOVAS.PositionVector");        
        var latitude = Telescope.SiteLatitude * RADIANS_MULTIPLE; 
    
    
        var JD = Util.SysJulianDate;                    // Current UT; Start with tomorrow's date/Time
        var LOCAL_JD = JD - (Util.SysUTCOffset * JULIAN_HOUR) ;
        var LOCAL_JDN = Math.floor(LOCAL_JD);
        
        // Are we looking for a dawn or dusk calculation?
        if (dawn_or_dusk)
        JD = LOCAL_JDN + 1;
        else
        JD = LOCAL_JDN;
    
    
        // similarly, this is here to do the next astronomical day if we
        // are already past dawn.
        if (next_day)
        JD = JD + 1;
        else
        JD = JD;
    
    
        var JDPrev = LOCAL_JDN;
    
    
        do {                          // Iterate through until we converge on a solution.
              var KA = KT.GetPositionAndVelocity(JD).toArray(); // Get Earth from Sun
            // Reverse cartesian vector for Sun from Earth
            tvec.x = -KA[0]; tvec.y = -KA[1]; tvec.z = -KA[2];
    
    
        // J2000 coordinates of Sun from Earth
            var right_ascension_sun = tvec.RightAscension;
            var declination_sun = tvec.Declination * RADIANS_MULTIPLE;
    
    
            var HA = (Math.sin(theta_S) - (Math.sin(latitude) * Math.sin(declination_sun))) /
                 (Math.cos(latitude) * Math.cos(declination_sun));
    
    
            if (HA >-1.0 && HA <1.0) { 
                HA = Math.acos(HA) / RADIANS_MULTIPLE; // HA in degrees
            } else { 
                    return "//N/A at this latitude//";        // a bust! no solution for this latitude for today or tomorrow.
            }
    
    
            if (dawn_or_dusk) HA = -HA;          // if for dawn, invert the position of the sun.
        
        var LMST = Util.Julian_GMST(JD) + (Telescope.SiteLongitude / 15.0);
    
    
            JD = JD + (((HA / 15.0) - Util.HourAngle12(right_ascension_sun, LMST)) / 24.0);
        
        if (Math.abs(JD - JDPrev) < JULIAN_SECOND) {
            break;                                // Convergence to ~1 second accuracy breaks out of while loop
        }
    
    
            JDPrev = JD;
        }  while(true);
        
        KT = null; tvec = null ;                  // Explicitly release these
    
    
        return new Date(Util.Julian_Date(JD));
    }
    
    
    
    
    Response.Write("Sun altitude: " + SunElevation().toFixed(1)+ "\n");
    
    
    if (Util.Julian_Date(Util.SysJulianDate) > this_twilight(SUNSET, DAWN, TODAY)) {
        Response.write("It's After Dawn!\n");
        Response.write("Here are the //coming// day's sunset and sunrise times for //" +  Prefs.SiteName + "//\n" );
        Response.write("|>|!Dusk" + "|!Duration|" + ">|!Dawn|");
        Response.write("\n| Sunset is| " + this_twilight(SUNSET, DUSK, TOMORROW) + " | " + cdiff(this_twilight(SUNSET, DUSK, TOMORROW), this_twilight(SUNSET, DAWN, TOMORROW)) + " |" + this_twilight(SUNSET, DAWN, TOMORROW) + " |is Sunrise |");
        Response.write("\n| Civil twilight ends| " + this_twilight(CIVIL, DUSK, TOMORROW) + " | " + cdiff(this_twilight(CIVIL, DUSK, TOMORROW), this_twilight(CIVIL, DAWN, TOMORROW)) + " |" + this_twilight(CIVIL, DAWN, TOMORROW) + " |begins Civil twilight |");
        Response.write("\n| Nautical twilight ends| " + this_twilight(NAUTICAL, DUSK, TOMORROW) + " | " + cdiff(this_twilight(NAUTICAL, DUSK, TOMORROW), this_twilight(NAUTICAL, DAWN, TOMORROW)) + " |" + this_twilight(NAUTICAL, DAWN, TOMORROW) + " |begins Nautical twilight |");
        Response.write("\n| Amateur twilight ends| " + this_twilight(AMATEUR, DUSK, TOMORROW) + " | " + cdiff(this_twilight(AMATEUR, DUSK, TOMORROW), this_twilight(AMATEUR, DAWN, TOMORROW)) + " |" + this_twilight(AMATEUR, DAWN, TOMORROW) + " |begins Amateur twilight |");
        Response.write("\n| Astronomical twilight ends| " + this_twilight(ASTRONOMICAL, DUSK, TOMORROW) + " | " + cdiff(this_twilight(ASTRONOMICAL, DUSK, TOMORROW), this_twilight(ASTRONOMICAL, DAWN, TOMORROW)) + " |" + this_twilight(ASTRONOMICAL, DAWN, TOMORROW) + " |begins Astronomical twilight |");
    } else {
        Response.write("Here are //today's//  sunset and //tomorrow's// sunrise times for //" +  Prefs.SiteName + "//\n" );
        Response.write("|>|!Dusk" + "|!Duration|" + ">|!Dawn|");
        Response.write("\n| Sunset is| " + this_twilight(SUNSET, DUSK, TODAY) + " | " + cdiff(this_twilight(SUNSET, DUSK, TODAY), this_twilight(SUNSET, DAWN, TODAY)) + " |" + this_twilight(SUNSET, DAWN, TODAY) + " |is Sunrise |");
        Response.write("\n| Civil twilight ends| " + this_twilight(CIVIL, DUSK, TODAY) + " | " + cdiff(this_twilight(CIVIL, DUSK, TODAY), this_twilight(CIVIL, DAWN, TODAY)) + " |" + this_twilight(CIVIL, DAWN, TODAY) + " |begins Civil twilight |");
        Response.write("\n| Nautical twilight ends| " + this_twilight(NAUTICAL, DUSK, TODAY) + " | " + cdiff(this_twilight(NAUTICAL, DUSK, TODAY), this_twilight(NAUTICAL, DAWN, TODAY)) + " |" + this_twilight(NAUTICAL, DAWN, TODAY) + " |begins Nautical twilight |");
        Response.write("\n| Amateur twilight ends| " + this_twilight(AMATEUR, DUSK, TODAY) + " | " + cdiff(this_twilight(AMATEUR, DUSK, TODAY), this_twilight(AMATEUR, DAWN, TODAY)) + " |" + this_twilight(AMATEUR, DAWN, TODAY) + " |begins Amateur twilight |");
        Response.write("\n| Astronomical twilight ends| " + this_twilight(ASTRONOMICAL, DUSK, TODAY) + " | " + cdiff(this_twilight(ASTRONOMICAL, DUSK, TODAY), this_twilight(ASTRONOMICAL, DAWN, TODAY)) + " |" + this_twilight(ASTRONOMICAL, DAWN, TODAY) + " |begins Astronomical twilight |");
     }
    
    
    Response.write("\n----\n");
        var MapX = (Math.round(-2+((Telescope.SiteLongitude+180)*(720/360))));
        var MapY = (Math.round(20+(((Telescope.SiteLatitude*-1)+90)*(360/180))));
        Response.Write("<html><style>");
        Response.Write(".marker{position:relative;left:" + MapX + "px;top:" + MapY + "px;z-index:10;border:0px;opacity:1.00;}");
        Response.Write(".map{position:relative;left:0px;top:0px;z-index:1;border:0px;}</style>");
        Response.Write("<div class='marker'><font color=red><b>*</b></font> " + Prefs.SiteName + "</div>");
        Response.Write("<div class='map'><IMG SRC=http://www.timeanddate.com/scripts/sunmap.php border=0></div></html>");    
    Response.Write("//~~Contributed by Dick Berg, author of the [[ACP Reference Guide|http://solo.dc3.com/ar/ACPRefGuide.html]]~~//\n");
    Response.Write("//^^Computational improvements by Robert Wahlstrom, Erik Young, Jeffrey Jongmans and Jonas Grinde^^//");
    
    
    %>

  5. #5

    Default

    Does this code still work? ASCOM indicates the Kepler.Ephemeris class is obsolete and I get an error on this line that the object cannot be created.
    Last edited by Dave Wormuth; Dec 10, 2015 at 05:05. Reason: Speling

  6. #6
    Join Date
    Oct 2005
    Location
    Mesa, AZ
    Posts
    30,768

    Default

    The Kepler they are using is the one that comes with ACP. It's one I wrote years ago in C++ and it is rock solid. I still maintain it. The reason ASCOM reports is deprecated is that I contributed Kepler and NOVAS-COM to the ASCOM Initiative eons ago, and the Platform developers have written similar components in C# which they include in the Platform. New programmers should use the C# ones (which have a different API). As I responded to in your other thread, it Kepler not properly installed in your system. I gave you some instructions on how to get it installed. I don't know why ACP's original installation didn't do it, it is supposed to. Once Kepler is installed and registered this should work. The reinstall should also catch NOVAS-COM if it isn't installed as well.
    -- Bob

  7. #7

    Default

    Yes in fact the reinstall has fixed the issue.

    Sorry for the confusion.

    Dave

  8. #8
    Join Date
    Oct 2005
    Location
    Mesa, AZ
    Posts
    30,768

    Default

    I just saw that in the other thread. Thanks for letting us know!
    -- Bob

  9. #9

    Default

    I made three modifications to the 8.0 version of the above code:

    To get a more precise label for the observatory, I added 135 to MapX and 52 to MapY

    var MapX = (Math.round(-2+((Telescope.SiteLongitude+180)*(720/360)))) + 135;
    var MapY = (Math.round(20+(((Telescope.SiteLatitude*-1)+90)*(360/180)))) + 52;

    Updated the timeanddate.com URL to:

    http://www.timeanddate.com/scripts/sunmap.php?earth=1

    This gives the above pictured "satellite view" instead of simple line graph.

    Dave

  10. #10
    Join Date
    Oct 2005
    Location
    Mesa, AZ
    Posts
    30,768

    Default

    Nice work! I have added a ticket to incorporate this into the production ACP web UI:

    ACP-1418 - Enhancement to DawnDusk Item on Web UI
    -- Bob

 

 

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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