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

Added visibility status to struct predict_observation. #36

Merged
merged 3 commits into from
Oct 5, 2015
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/predict/predict.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ struct predict_observation {
double range_x, range_y, range_z;
///Range velocity (km/s)
double range_rate;
///Visibility status, whether satellite can be seen through optical means
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding: The satellite is "visible" if all of these apply:

  • The satellite is in sunlight
  • The satellite is above the horizon
  • The sun is low enough to make the sky so dark that the satellite is visible (this obviously depends on a definition of darkness)

The short description of the variable is OK, but I'd like to see a longer description containing all the details.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've written a longer comment (commit a41ccb8).

bool visible;
};

/**
Expand Down
10 changes: 10 additions & 0 deletions src/observer.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ void predict_destroy_observer(predict_observer_t *obs)
}
}


#define VISIBILITY_SUN_ELE_UPPER_THRESH -12.0
#define VISIBILITY_ORBIT_ELE_LOWER_THRESH 0.0
/**
* \brief Calculates range, azimuth, elevation and relative velocity.
*
Expand All @@ -43,6 +46,13 @@ void predict_observe_orbit(const predict_observer_t *observer, const predict_orb

observer_calculate(observer, julTime, orbit->position, orbit->velocity, obs);

// Calculate visibility status of the orbit: Orbit is visible if sun elevation is low enough and the orbit is above the horizon, but still in sunlight.
obs->visible = false;
struct predict_observation sun_obs;
predict_observe_sun(observer, orbit->time, &sun_obs);
if (!(orbit->eclipsed) && (sun_obs.elevation*180.0/M_PI < VISIBILITY_SUN_ELE_UPPER_THRESH) && (obs->elevation*180.0/M_PI > VISIBILITY_ORBIT_ELE_LOWER_THRESH)) {
obs->visible = true;
}
}

void observer_calculate(const predict_observer_t *observer, double time, const double pos[3], const double vel[3], struct predict_observation *result)
Expand Down