When is a Satellite Ascending or Descending

Information

 
Notes/Code
EarthCentralBody earth = CentralBodiesFacet.GetFromContext().Earth;

// satellite Platform
Platform iss = new Platform("iss");
TwoLineElementSet tle = new TwoLineElementSet("1 25544U 98067A   20177.42287463  .00000643  00000-0  19557-4 0  9997\n2 25544  51.6448 307.7021 0002519  82.2946  19.5375 15.49459404233292");
Sgp4Propagator propagator = new Sgp4Propagator(tle);
iss.LocationPoint = propagator.CreatePoint();
iss.OrientationAxes = Axes.Root;

// some dummy facility that i can compute access to
Platform dummy = new Platform();
dummy.LocationPoint = new PointCartographic(earth, new Cartographic(0.0, 0.0, 0.0));
dummy.OrientationAxes = Axes.Root;

// create velocity Vector
Vector vVector = new VectorVelocity(iss.LocationPoint, earth.FixedFrame);

// create [0, 0, -1] Vector in earth fixed
Vector negz = new VectorFixed(earth.FixedFrame.Axes, new Cartesian(0.0, 0.0, -1.0));

// compute angle between velocity Vector and negative z
ScalarAngleBetweenVectors angle = new ScalarAngleBetweenVectors(vVector, negz);

// if the angle is 0 - 90 degree then the satellite is heading south, otherwide heading north
ScalarConstraint ascending = new ScalarConstraint(angle, Trig.DegreesToRadians(90.0));

// access
AccessComputation access = new AccessComputation();
access.Transmitter = iss;
access.TransmitterConstraints.Add(ascending);
access.Receiver = dummy;

JulianDate jdnow = new JulianDate(DateTime.Now);
JulianDate jdend = jdnow.AddDays(1);

AccessEvaluationResult accessresult = access.ComputeIntervals(jdnow, jdend);
TimeIntervalCollection intervals = accessresult.OverallSatisfactionIntervals;

foreach (TimeInterval thisinterval in intervals)
{
    DateTime thisstart = thisinterval.Start.ToDateTime();
    DateTime thisstop = thisinterval.Stop.ToDateTime();
}

// use a similar logic to get the descending times

 
Download File