Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing properties in moon/sun calculation #49

Closed
bjorgan opened this issue Dec 28, 2015 · 1 comment
Closed

Missing properties in moon/sun calculation #49

bjorgan opened this issue Dec 28, 2015 · 1 comment

Comments

@bjorgan
Copy link
Member

bjorgan commented Dec 28, 2015

Moon calculation does not write anything to range_rate or range in struct predict_observation.

Predict/flyby also displays right ascension, declination and greenwhich hour angle, which are not output from libpredict. These are also observation-independent properties, which might cause some headache in which structs to use in the output. :-)

@bjorgan
Copy link
Member Author

bjorgan commented Dec 30, 2015

Headache outline:

The nice thing so far has been that predict_sun() and predict_moon() uses no special sun or moon structs, but the same struct predict_observation as the rest of the library. This makes some things more smooth for e.g. flyby. However, we apparently need new fields which don't exist within struct predict_observation.

We've also had only one function (predict_observe_moon(), predict_observe_sun()), but the needed properties are not dependent on an observer. Consistency requires a new function, e.g. predict_sun().

Some solution proposals:

Solution 1:

Add new structs, split into observation-independent and observation-dependent, in the same style as struct predict_orbit and struct predict_observation. For sun, it will be struct predict_sun and struct predict_observation, for moon it will be struct predict_moon and struct predict_observation.

struct predict_sun {
/* observation-independent properties we are missing for the sun, longitude, latitude, declination, ... */
};
predict_sun(predict_sun *sun, predict_julian_date_t time);
predict_observe_sun(const predict_observer_t *observer, const struct predict_sun *sun, struct predict_observation *obs);

struct predict_moon {
/* observation-independent properties we are missing for the moon, longitude, latitude, declination, ... */
};
void predict_moon(predict_moon *moon, predict_julian_date_t time);
void predict_observe_moon(const predict_observer_t *observer, const struct predict_moon *moon, struct predict_observation *obs);

Solution 2:

Unify moon and sun structs, since the fields are probably going to be the same anyway. Possible namings: celestial_body, celestial_object, astronomical_body, astronomical_object...

struct predict_celestial{
/* observation-independent properties we are missing */
};
void predict_sun(predict_celestial *orbit, predict_julian_date_t time);
void predict_observe_sun(const predict_observer *observer, struct predict_observation *obs, predict_julian_date_t time);
void predict_moon(predict_celestial *orbit, predict_julian_date_t time);
void predict_observe_moon(const predict_observer *observer, struct predict_observation *obs, predict_julian_date_t time);

Solution 3:

Instead of predict_sun and predict_moon, unify to a common function.

enum predict_celestial_body {
    PREDICT_MOON,
    PREDICT_SUN
};

predict_celestial_body(enum predict_celestial_body body, predict_celestial *orbit, predict_julian_date_t time);
predict_observe_celestial_body(const predict_observer_t *observer, const predict_celestial *orbit, struct predict_observation obs);

Could also be extended to other planets. :-)

Solution 4:

Reuse struct predict_orbit. It makes sense in some ways, since a lot of these fields are going to be the same and predict_observe_orbit can be reused also for the moon and sun, but it will also have some additional weirdness in that functions defined for satellites are suddenly going to work also on moon and sun and result in very undefined behavior. What is the doppler shift from the sun? :^) Some properties like "eclipsed" also do not make much sense.

Solution 5:

Don't provide the missing properties at all and say that they are not available in the API. :-P

Is there any cleaner solution (except for solution 5)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants