Loading ...
Sorry, an error occurred while loading the content.

Re: Novas Transform

Expand Messages
  • Peter Simpson
    Hi Peter, Your JScript code doesn t work because you don t have the correct namespaces in front of the Star and Site objects. These lines should be: var site =
    Message 1 of 11 , Apr 25 12:12 PM
    View Source
    • 0 Attachment
      Hi Peter,

      Your JScript code doesn't work because you don't have the correct namespaces in front of the Star and Site objects. These lines should be:

      var site = new ActiveXObject("ASCOM.Astrometry.NOVASCOM.Site");
      var objv = new ActiveXObject("ASCOM.Astrometry.NOVASCOM.Star");

      With these changes I get the expected messagebox at the end of the script. The namespaces are documented  in the additional  help file installed by the Developer Components install. I'm not sure if you intended to use the Transform component, but you are actually already following Bob's advice and are using NOVASCOM.

      I hope this helps, 

      Regards, Peter

      --- In ASCOM-Talk@yahoogroups.com, "peschman2001" <eschman@...> wrote:
      >
      > I'm trying to ease my way in to working with Novas Transform
      > for converting to and from Epoch J2000 when the source coordinates
      > from the planetarium software are Epoch Local. I have done some
      > archive searching leading back to ASCOM-Talk messages 26726 and
      > 12536.
      >
      > In the earlier message, Bob Denny offered this code:
      >
      > ----------
      > Paste this demo script into a file test.js and double-click it.
      >
      > // Site info
      > var lat = 33; // Latitude
      > var lon = -111; // Longitude (+ east)
      > var elev = 200; // Elevation, meters
      > var temp = 25; // Temperature, deg C
      > // Input J2000 coordinates
      > var raJ = 10.0; // J2000 RA
      > var deJ = 30.0; // J2000 Dec
      > // Time for which local topo coordinates should be calculated
      > var epoch = 2454300.12345; // Julian epoch of conversion
      > //
      > var dt = 65.15; // Delta-T, seconds (for 2007)
      > // Refraction option
      > var doRef = true; // True for refraction corr
      > // Set up the NOVAS.Site
      > var site = new ActiveXObject("NOVAS.Site");
      > site.Latitude = lat;
      > site.Longitude = lon;
      > site.Height = elev;
      > site.Temperature = temp;
      > // Set up the NOVAS.Star (fixed point in space)
      > // This could have proper motion, radial velocity
      > // parallax as well.
      > var objv = new ActiveXObject("NOVAS.Star");
      > objv.RightAscension = raJ;
      > objv.Declination = deJ;
      > objv.DeltaT = dt;
      > var tvec = objv.GetTopocentricPosition(epoch, site, doRef);
      > WScript.Echo("Local topo RA=" + tvec.RightAscension +
      > " DE=" + tvec.Declination);
      > ----------
      >
      > when I attempt to execute the resulting js file, I get this error
      > message:
      >
      > Line 18:
      > Automation server can't create this object
      >
      > where Line 18:
      > var site = new ActiveXObject("NOVAS.Site");
      >
      > I probably missed some important details in
      > ASCOM Platform Developer Help.chm
      > So any specific references are welcome.
      >
      > Ultimately I'll be implementing this in VB6, but for now it would be
      > nice to get some simple testing done by way of scripting. Once I get
      > to adding the appropriate code to the VB6 scope driver, I'll probably
      > have more questions.
      >
      > Thanks,
      > Peter Eschman
      >
    • peschman2001
      Thanks Peter, that was the fix for the script. In the mean time, I fired up VB6 and added a reference to ASCOM_Astrometry. Once I did that, I could see the
      Message 2 of 11 , Apr 25 4:04 PM
      View Source
      • 0 Attachment
        Thanks Peter, that was the fix for the script.

        In the mean time, I fired up VB6 and added a reference to ASCOM_Astrometry.
        Once I did that, I could see the newer Transform section. That's the one
        I would prefer to use, so can you offer some suggestions as to how to
        script that one prior to flailing around in VB6 with an actual driver?

        A guess would be
        var trns = new ActiveXObject("ASCOM.Astrometry.NOVASCOM.Transform");

        Does the newer Transform code automatically access the Telescope
        class attributes for SiteLatitude, SiteLongitude, and SiteElevation?
        If so, great, I have them already. I'd need to add SiteTemperature,
        Refraction (if part of the Apparent Coords), and Accuracy = 1 for
        reduced accuracy. This might actually work!

        Peter E.

        --- In ASCOM-Talk@yahoogroups.com, "Peter Simpson" <peter@...> wrote:
        >
        > Hi Peter,
        > Your JScript code doesn't work because you don't have the correct
        > namespaces in front of the Star and Site objects. These lines should be:
        > var site = new ActiveXObject("ASCOM.Astrometry.NOVASCOM.Site");var objv
        > = new ActiveXObject("ASCOM.Astrometry.NOVASCOM.Star");
        > With these changes I get the expected messagebox at the end of the
        > script. The namespaces are documented in the additional help file
        > installed by the Developer Components install. I'm not sure if you
        > intended to use the Transform component, but you are actually already
        > following Bob's advice and are using NOVASCOM.
        > I hope this helps,
        > Regards, Peter
        > --- In ASCOM-Talk@yahoogroups.com, "peschman2001" <eschman@> wrote:
        > >
        > > I'm trying to ease my way in to working with Novas Transform
        > > for converting to and from Epoch J2000 when the source coordinates
        > > from the planetarium software are Epoch Local. I have done some
        > > archive searching leading back to ASCOM-Talk messages 26726 and
        > > 12536.
        > >
        > > In the earlier message, Bob Denny offered this code:
        > >
        > > ----------
        > > Paste this demo script into a file test.js and double-click it.
        > >
        > > // Site info
        > > var lat = 33; // Latitude
        > > var lon = -111; // Longitude (+ east)
        > > var elev = 200; // Elevation, meters
        > > var temp = 25; // Temperature, deg C
        > > // Input J2000 coordinates
        > > var raJ = 10.0; // J2000 RA
        > > var deJ = 30.0; // J2000 Dec
        > > // Time for which local topo coordinates should be calculated
        > > var epoch = 2454300.12345; // Julian epoch of conversion
        > > //
        > > var dt = 65.15; // Delta-T, seconds (for 2007)
        > > // Refraction option
        > > var doRef = true; // True for refraction corr
        > > // Set up the NOVAS.Site
        > > var site = new ActiveXObject("NOVAS.Site");
        > > site.Latitude = lat;
        > > site.Longitude = lon;
        > > site.Height = elev;
        > > site.Temperature = temp;
        > > // Set up the NOVAS.Star (fixed point in space)
        > > // This could have proper motion, radial velocity
        > > // parallax as well.
        > > var objv = new ActiveXObject("NOVAS.Star");
        > > objv.RightAscension = raJ;
        > > objv.Declination = deJ;
        > > objv.DeltaT = dt;
        > > var tvec = objv.GetTopocentricPosition(epoch, site, doRef);
        > > WScript.Echo("Local topo RA=" + tvec.RightAscension +
        > > " DE=" + tvec.Declination);
        > > ----------
        > >
        > > when I attempt to execute the resulting js file, I get this error
        > > message:
        > >
        > > Line 18:
        > > Automation server can't create this object
        > >
        > > where Line 18:
        > > var site = new ActiveXObject("NOVAS.Site");
        > >
        > > I probably missed some important details in
        > > ASCOM Platform Developer Help.chm
        > > So any specific references are welcome.
        > >
        > > Ultimately I'll be implementing this in VB6, but for now it would be
        > > nice to get some simple testing done by way of scripting. Once I get
        > > to adding the appropriate code to the VB6 scope driver, I'll probably
        > > have more questions.
        > >
        > > Thanks,
        > > Peter Eschman
        > >
        >
      • Tim Long
        I think Bob is correct, Peter put a lot of work into making sure everything worked from COM, so it _should_ work from VB6. It s going to come down to finding
        Message 3 of 11 , Apr 26 3:24 AM
        View Source
        • 0 Attachment
          I think Bob is correct, Peter put a lot of work into making sure
          everything worked from COM, so it _should_ work from VB6. It's going to
          come down to finding the right ProgID, which as far as I can tell, is
          "ASCOM.Astrometry.Transform.Transform" for the Transform class. If you
          look in RegEdit under HKEY_CLASSES_ROOT/ASCOM.* you can see all the
          ASCOM ProgID registrations. You'll probably need to look in the Help
          under "Which NOVAS?" to work out which ones to use.

          --Tim

          -----Original Message-----
          From: ASCOM-Talk@yahoogroups.com [mailto:ASCOM-Talk@yahoogroups.com] On
          Behalf Of peschman2001
          Sent: 25 April 2012 17:23
          To: ASCOM-Talk@yahoogroups.com
          Subject: Re: [ASCOM] Novas Transform

          Hi Bob,

          If I use Visual Studio C# Express on my test case based on Tim's code,
          and try to add references:

          After selecting the COM tab
          I see
          ASCOM Astrometry
          TypeLib Version 5.5
          and
          TypeLib Version 6.0

          Both are located (on x64 system)
          c:\Windows\assembly\GAC_MSI\ASCOM.Astrometry
          in different sub dirs

          I just need a bit of help on how to correctly reference the COM objects
          from .js or from VB6. I have an XP Pro system I can also use for
          testing .js files

          Thanks,
          Peter E

          --- In ASCOM-Talk@yahoogroups.com, Bob Denny <rdenny@...> wrote:
          > I thought the new transform classes were exposed to the OS via COM, so
          would be accessible to any language including VB6. If not, the interim
          solution is to use the NOVAS-COM objects which are similar and have been
          available for a long time. The new classes are better in all respects,
          but the functions provided by NOVAS-COM are correct and stable.
          >
          > -- Bob
          >
          >
          > On Apr 24, 2012, at 22:15, "peschman2001" <eschman@...> wrote:
          >
          > > I'm not sure how I can access this given the driver is in VB6.
          > > I will do a complete driver re-write some time, but that time is not

          > > now. I'm hoping someone can help with an interim solution.
          >




          ------------------------------------

          For more information see http://ASCOM-Standards.org/.

          To unsubscribe from this group, send an email FROM THE ACCOUNT YOU USED
          TO SUBSCRIBE(!) to:
          ASCOM-Talk-unsubscribe@yahoogroups.com

          Yahoo! Groups Links




          --
          ExchangeDefender Message Security: Click below to verify authenticity
          http://www.exchangedefender.com/verify.asp?id=q3QAOTGT026642&from=tim@...
          Complete email hygiene and business continuity solution available from http://www.tigranetworks.co.uk
        • peschman2001
          Thanks to Bob, Peter S. and Tim, I have a script that mostly works. I hope I am not burdening folks with this continuing thread. I am getting an error when I
          Message 4 of 11 , Apr 26 8:05 AM
          View Source
          • 0 Attachment
            Thanks to Bob, Peter S. and Tim, I have a script that mostly works.
            I hope I am not burdening folks with this continuing thread.

            I am getting an error when I attempt to translate to Topocentric
            RA and Dec: "RA topocentric can not be derived from the information
            provided. Are site parameters set?"

            As far as I can tell, the site parameters are set, and the conversion
            to Apparent does work if the Topocentric sections are commented out.
            When the Topocentric sections are commented out, WScript.Echo window
            reads:
            J2000 Coords RA=10 DE=30
            Apparent Coords RA= 10.01224138573996 DE=29.93956008746439
            Topocentric Coords RA=5 DE=5

            (If you try running this script, you can expect to get slightly
            different Apparent Coords, since they change as clock time is elapsed
            -- I saw change in the RA 8th decimal place in a relatively short period
            of time)

            I also tried changing = true to = True in the Refraction assignment,
            but "True" is undefined, where "true" does not trigger an error message.

            I can't seem to spot the error in the script file, having tried to
            carefully inspect every variable assignment and spelling. I would have
            expected that if the Site specific parameters are good enough for the
            conversion to Apparent, they would be good enough for the conversion
            to Topocentric.

            I also tried inserting SetApparent(raA, deA) along with Refresh()
            prior to accessing the Topocentric RA and DEC, but this did not help.

            // Novas transform test 03
            //
            // Site info
            var SiteLatitude = 33; // Latitude
            var SiteLongitude = -111; // Longitude (+ east)
            var SiteElevation = 200; // Elevation, meters
            var SiteTemperature = 25; // Temperature, deg C
            // Refraction option
            var Refraction = true; // True for refraction corr
            // Set up the NOVAS.Transform
            // Input J2000 coordinates
            var raJ = 10.0; // J2000 RA
            var deJ = 30.0; // J2000 Dec
            var trns = new ActiveXObject("ASCOM.Astrometry.Transform.Transform");
            trns.SetJ2000(raJ, deJ)
            trns.Refresh()
            //
            var raA = trns.RAApparent;
            var deA = trns.DECApparent;
            //
            //trns.SetApparent(raA, deA) // adding this does not help
            //trns.Refresh() // adding this does not help
            // values below are dummied out so script does not fail on
            // desired assignments
            var raT = 5.0; // desired assignment is trns.RATopocentric;
            var deT = 5.0; // desired assignment is trns.DECTopocentric;
            //
            WScript.Echo("J2000 Coords RA=" + raJ + " DE=" + deJ +
            "\nApparent Coords RA=" + raA + " DE=" + deA +
            "\nTopocentric Coords RA=" + raT + " DE=" + deT);

            --- In ASCOM-Talk@yahoogroups.com, "Tim Long" <Tim@...> wrote:
            > I think Bob is correct, Peter put a lot of work into making sure
            > everything worked from COM, so it _should_ work from VB6. It's going to
            > come down to finding the right ProgID, which as far as I can tell, is
            > "ASCOM.Astrometry.Transform.Transform" for the Transform class. If you
            > look in RegEdit under HKEY_CLASSES_ROOT/ASCOM.* you can see all the
            > ASCOM ProgID registrations. You'll probably need to look in the Help
            > under "Which NOVAS?" to work out which ones to use.
            >
            > --Tim
          • Peter Simpson
            Hi Peter, Its certainly true that you are creating variables with the names of the required site properties, but these are JScript variables rather than
            Message 5 of 11 , Apr 26 12:34 PM
            View Source
            • 0 Attachment
              Hi Peter,

              Its certainly true that you are creating variables with the names of the required site properties, but these are JScript variables rather than properties of the Transform object. I have added a few lines of code, in bold, to your sample which set the Transform properties; this version  runs as expected and provides Topocentric coordinates in a messagebox.

              // Novas transform test 03
              //
              // Site info
              var SiteLatitude = 33; // Latitude
              var SiteLongitude = -111; // Longitude (+ east)
              var SiteElevation = 200; // Elevation, meters
              var SiteTemperature = 25; // Temperature, deg C
              // Refraction option
              var Refraction = true; // True for refraction corr
              // Set up the NOVAS.Transform
              // Input J2000 coordinates
              var raJ = 10.0; // J2000 RA
              var deJ = 30.0; // J2000 Dec
              var trns = new ActiveXObject("ASCOM.Astrometry.Transform.Transform");
              trns.SetJ2000(raJ, deJ)
              trns.Refresh()
              //
              var raA = trns.RAApparent;
              var deA = trns.DECApparent;
              //
              //trns.SetApparent(raA, deA) // adding this does not help
              //trns.Refresh() // adding this does not help
              // values below are dummied out so script does not fail on
              // desired assignments

              trns.SiteElevation = SiteElevation;
              trns.SiteLatitude  = SiteLatitude;
              trns.SiteLongitude = SiteLongitude;
              trns.SiteTemperature = SiteTemperature;
              trns.Refraction = Refraction;

              var raT = trns.RATopocentric;
              var deT = trns.DECTopocentric;
              //
              WScript.Echo("J2000 Coords RA=" + raJ + " DE=" + deJ + 
              "\nApparent Coords RA=" + raA + " DE=" + deA + 
              "\nTopocentric Coords RA=" + raT + " DE=" + deT);

              Regards, Peter

              --- In ASCOM-Talk@yahoogroups.com, "peschman2001" <eschman@...> wrote:
              >
              > Thanks to Bob, Peter S. and Tim, I have a script that mostly works.
              > I hope I am not burdening folks with this continuing thread.
              >
              > I am getting an error when I attempt to translate to Topocentric
              > RA and Dec: "RA topocentric can not be derived from the information
              > provided. Are site parameters set?"
              >
              > As far as I can tell, the site parameters are set, and the conversion
              > to Apparent does work if the Topocentric sections are commented out.
              > When the Topocentric sections are commented out, WScript.Echo window
              > reads:
              > J2000 Coords RA=10 DE=30
              > Apparent Coords RA= 10.01224138573996 DE=29.93956008746439
              > Topocentric Coords RA=5 DE=5
              >
              > (If you try running this script, you can expect to get slightly
              > different Apparent Coords, since they change as clock time is elapsed
              > -- I saw change in the RA 8th decimal place in a relatively short period
              > of time)
              >
              > I also tried changing = true to = True in the Refraction assignment,
              > but "True" is undefined, where "true" does not trigger an error message.
              >
              > I can't seem to spot the error in the script file, having tried to
              > carefully inspect every variable assignment and spelling. I would have
              > expected that if the Site specific parameters are good enough for the
              > conversion to Apparent, they would be good enough for the conversion
              > to Topocentric.
              >
              > I also tried inserting SetApparent(raA, deA) along with Refresh()
              > prior to accessing the Topocentric RA and DEC, but this did not help.
              >
              > // Novas transform test 03
              > //
              > // Site info
              > var SiteLatitude = 33; // Latitude
              > var SiteLongitude = -111; // Longitude (+ east)
              > var SiteElevation = 200; // Elevation, meters
              > var SiteTemperature = 25; // Temperature, deg C
              > // Refraction option
              > var Refraction = true; // True for refraction corr
              > // Set up the NOVAS.Transform
              > // Input J2000 coordinates
              > var raJ = 10.0; // J2000 RA
              > var deJ = 30.0; // J2000 Dec
              > var trns = new ActiveXObject("ASCOM.Astrometry.Transform.Transform");
              > trns.SetJ2000(raJ, deJ)
              > trns.Refresh()
              > //
              > var raA = trns.RAApparent;
              > var deA = trns.DECApparent;
              > //
              > //trns.SetApparent(raA, deA) // adding this does not help
              > //trns.Refresh() // adding this does not help
              > // values below are dummied out so script does not fail on
              > // desired assignments
              > var raT = 5.0; // desired assignment is trns.RATopocentric;
              > var deT = 5.0; // desired assignment is trns.DECTopocentric;
              > //
              > WScript.Echo("J2000 Coords RA=" + raJ + " DE=" + deJ +
              > "\nApparent Coords RA=" + raA + " DE=" + deA +
              > "\nTopocentric Coords RA=" + raT + " DE=" + deT);
              >
              > --- In ASCOM-Talk@yahoogroups.com, "Tim Long" Tim@ wrote:
              > > I think Bob is correct, Peter put a lot of work into making sure
              > > everything worked from COM, so it _should_ work from VB6. It's going to
              > > come down to finding the right ProgID, which as far as I can tell, is
              > > "ASCOM.Astrometry.Transform.Transform" for the Transform class. If you
              > > look in RegEdit under HKEY_CLASSES_ROOT/ASCOM.* you can see all the
              > > ASCOM ProgID registrations. You'll probably need to look in the Help
              > > under "Which NOVAS?" to work out which ones to use.
              > >
              > > --Tim
              >
            • peschman2001
              Peter, Thanks very much for clarifying the assignment process. I had asked this very question in an earlier post. I assume this means that even though these
              Message 6 of 11 , Apr 26 1:03 PM
              View Source
              • 0 Attachment
                Peter,

                Thanks very much for clarifying the assignment process. I had asked this
                very question in an earlier post. I assume this means that even though
                these vars are part of a telescope driver, they must specifically be
                assigned the trns object the way you have shown here.

                Thanks for everyone's help on this,
                Peter E.

                A cleaned up script example:
                // Novas transform test 04
                //
                // Set up the NOVAS.Transform
                var trns = new ActiveXObject("ASCOM.Astrometry.Transform.Transform");
                // Site info
                trns.SiteLatitude = 33; // Latitude
                trns.SiteLongitude = -111; // Longitude (+ east)
                trns.SiteElevation = 200; // Elevation, meters
                trns.SiteTemperature = 25; // Temperature, deg C
                trns.Refraction = true; // True for refraction correction
                //
                var raJ = 10.0; // J2000 RA
                var deJ = 30.0; // J2000 Dec
                // Input J2000 coordinates
                trns.SetJ2000(raJ, deJ)
                trns.Refresh()
                //
                var raA = trns.RAApparent;
                var deA = trns.DECApparent;
                //
                var raT = trns.RATopocentric;
                var deT = trns.DECTopocentric;
                //
                WScript.Echo("J2000 Coords RA=" + raJ + " DE=" + deJ +
                "\nApparent Coords RA=" + raA + " DE=" + deA +
                "\nTopocentric Coords RA=" + raT + " DE=" + deT);
                // end of script

                --- In ASCOM-Talk@yahoogroups.com, "Peter Simpson" <peter@...> wrote:
                >
                > Hi Peter,
                > Its certainly true that you are creating variables with the names of the
                > required site properties, but these are JScript variables rather than
                > properties of the Transform object. I have added a few lines of code, in
                > bold, to your sample which set the Transform properties; this version
                > runs as expected and provides Topocentric coordinates in a messagebox.
              Your message has been successfully submitted and would be delivered to recipients shortly.