Code Monkey home page Code Monkey logo

angst's Introduction

  • ๐Ÿ‘‹ Hi, Iโ€™m @brainwagon, aka Mark VandeWettering.
  • ๐Ÿ‘€ Iโ€™m interested in all sorts of things, from programming, to homelabs, to woodworking, to building telescopes.
  • ๐ŸŒฑ Iโ€™m currently learning ...
  • ๐Ÿ’ž๏ธ Iโ€™m looking to collaborate on ...
  • ๐Ÿ“ซ I've been @brainwagon on Twitter, but am currently disengaging from that platform. You can reach me now as @[email protected] or @[email protected].

angst's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

angst's Issues

Derivative motion variable (M2) has wrong formula?

I was looking at the output of your code vs some other code, and noticed that compared to the original G3RUH sources, you apply a different formula to the M2 variable than he does. I'm curious if you corrected an error in his code, or perhaps overlooked what he had done, or perhaps something obvious is eluding me.

In line 241, you have the following code: M2 = RADIANS(getdouble(l1, 33, 43)) ;

However, in G3RUH's code, at line 1370, he uses M2 = M2*2*PI

G3RUH's original code is at http://www.amsat.org/articles/g3ruh/111.html

Another issue that I found while in there is where a float is used instead of a double. Changing it to a double improves the accuracy.

Sidereal and solar data update

For all those, who want to use the implementation after year 2015, the sidereal and solar data should be updated (see http://www.amsat.org/articles/g3ruh/111.html end of code).
Change the lines 41..49 in P13.h to

static const double YG = 2014.f;
static const double G0 = 99.5828f;
static const double MAS0 = 356.4105f;
static const double MASD = 0.98560028f;
static const double EQC1 = 0.03340;
static const double EQC2 = 0.00035;
static const double INS = radians(23.4375f);

Solar data is valid until ~2030

[Suggestion] Class renaming to P13...

I would suggest to rename the classes to something like P13...
Especially the class DateTime could cause potential conflicts with other libraries like e.g. RTC libs which often also use DateTime in their context.

Double precision const with single precision literal?

I wondered what the intention is at the constants in P13.h to declare a constant as "double" and then use the "f" literal for singleprecision at the value?
Is it to save storage space and not have the need to cast them to double when calculating/working with them?

Possibly wrong calculations in Sun::predict?

The calculations for the sun prediction seems to differ from the original code.

Original BASIC code:

:
C = COS(-GHAA): S = SIN(-GHAA)
:

Code in P13.cpp Sun::predict lines 420/421:

:
C = cos(-GHAE) ; 
S = sin(-GHAE) ; 
:

Maybe this could be the reason, that the altaz()-method is broken.
GHAA seems to be calculated in Satellite::predict, but not used in Sun::predict (I am not really sure, if it is the same value, but it seems that is is some kind of time which should be the same for Satellite as well as for Sun prediction at the same time).
So in my opinion, the method should look like this:

void
Sun::predict(const DateTime &dt)
{
    long DN = dt.DN ;
    double TN = dt.TN ;

    double T = (double) (DN - fnday(YG, 1, 0)) + TN ;
    double GHAE = RADIANS(G0) + T * WE ;
    double GHAA = GHAE + T * WE;
    double MRSE = RADIANS(G0) + T * WW + M_PI ;
    double MASE = RADIANS(MAS0 + T * MASD) ;
    double TAS = MRSE + EQC1*sin(MASE) + EQC2*sin(2.*MASE) ;
    double C, S ;

    C = cos(TAS) ;
    S = sin(TAS) ;
    SUN[0]=C ;
    SUN[1]=S*CNS ;
    SUN[2]=S*SNS ;
    C = cos(-GHAA) ;
    S = sin(-GHAA) ;
    H[0]=SUN[0]*C - SUN[1]*S ;
    H[1]=SUN[0]*S + SUN[1]*C ;
    H[2]=SUN[2] ;
}

Regards, Thorsten dl9sec

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.