[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orekit Users] Calculating Azimuth and Elevation



Hi,

Le 25/03/2013 22:48, gvillemos@gmail.com a écrit :
> We are using OREKIT to calculate the AOS and LOS of a satellite for a given
> position. Works very well.

Thank you very much, this is really appreciated.

> 
> We would like to also calculate the pointing information (azimuth and
> elevation) of the satellite while parsing in 500ms increments. Is there any
> classes / APIs that supports this? Is there any working examples?

Yes, there are some supporting classes for this computation.
The simplest way to do it is to set up a step handler that will be
called every 500ms increments by the propagator and have this step
handler delegate the computation to a topocentric frame located at the
station.

For the first part, step handler, look at the MasterMode.java file in
the src/tutorials/java/fr/cs/examples/propagation directory. You will
see how the propagator is set up and what the small TutorialStepHandler
class does. The handleStep method of this small class is called at each
step. In the tutorial, the fixed step size at which the handler is
called is set to 60 seconds using the call:

  propagator.setMasterMode(60., new TutorialStepHandler());

You simply have to change the 60.0 into 0.5 to have 500 ms steps.

For the second part, computing azimuth and elevation, you will need to
change the body of the handleStep method. I would advise you to add a
TopocentricFrame to the step handler, initialized at construction. Then,
when the handleStep method is called, you will simply have to convert
the spacecraft state position in the ground station frame, and from this
you will get the azimuth and elevation. In fact, if you convert both
position and velocity, you will also have Doppler has velocity
composition between the moving spacecraft and moving ground station will
be taken into account in the transform.

Here is a quick example. Beware I just wrote this in the mail, I did not
compile it so it probably has some errors in it. Just consider it as a
rough example to be adjusted to your needs.

  public class AzimuthElevationDoppler
    implements OrekitFixedStepHandler {

        private final TopocentricFrame stationFrame;

        private AzimuthElevationDoppler(String name,
                                        double latitude,
                                        double longiture,
                                        double altitude) {
           final BodyShape earth =
          new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
                               Constants.WGS84_EARTH_FLATTENING,
                               FramesFactory.getITRF2008(true));
           final GeodeticPoint gp =
              new GeodeticPoint(latitude, longitude, altitude);
           stationFrame = new TopocentricFrame(earth, gp, name);

        }

        public void init(final SpacecraftState s0,
                         final AbsoluteDate t) {
          // nothing to do here
        }

        public void handleStep(SpacecraftState state, boolean isLast) {

          // get transform between state reference frame
          // and ground station at current time
          Transform transform =
             state.getFrame().getTransformTo(stationFrame,
                                             state.getDate());

          // get position-velocity in ground station frame
          PVCoordinates pv =
            transform.transformPVCoordinates(state.getPVCoordinates());
          vector3D p = pv.getPosition();
          vector3D v = pv.getVelocity();

          // extract pointing data
          double azimuth   = p.getAlpha();
          double elevation = p.getDelta();
          double doppler   = p.normalize().dotProduct(v);

          // print everything
          System.out.println(state.getDate() + " " +
                             FastMath.toDegrees(azimuth) + " " +
                             FastMath.toDegrees(elevation) + " " +
                             doppler);
        }

    }


Hope this helps,
Luc