OnBoardAntennaOneWayGNSSRangeModifier.java

  1. /* Copyright 2002-2022 CS GROUP
  2.  * Licensed to CS GROUP (CS) under one or more
  3.  * contributor license agreements.  See the NOTICE file distributed with
  4.  * this work for additional information regarding copyright ownership.
  5.  * CS licenses this file to You under the Apache License, Version 2.0
  6.  * (the "License"); you may not use this file except in compliance with
  7.  * the License.  You may obtain a copy of the License at
  8.  *
  9.  *   http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */
  17. package org.orekit.estimation.measurements.modifiers;

  18. import java.util.Collections;
  19. import java.util.List;

  20. import org.hipparchus.geometry.euclidean.threed.Vector3D;
  21. import org.orekit.attitudes.AttitudeProvider;
  22. import org.orekit.estimation.measurements.EstimatedMeasurement;
  23. import org.orekit.estimation.measurements.EstimationModifier;
  24. import org.orekit.estimation.measurements.gnss.OneWayGNSSRange;
  25. import org.orekit.frames.Transform;
  26. import org.orekit.orbits.CartesianOrbit;
  27. import org.orekit.orbits.Orbit;
  28. import org.orekit.propagation.SpacecraftState;
  29. import org.orekit.time.AbsoluteDate;
  30. import org.orekit.utils.ParameterDriver;
  31. import org.orekit.utils.TimeStampedPVCoordinates;

  32. /** On-board antenna offset effect on one-way GNSS range measurements.
  33.  * @author Bryan Cazabonne
  34.  * @since 10.3
  35.  */
  36. public class OnBoardAntennaOneWayGNSSRangeModifier implements EstimationModifier<OneWayGNSSRange> {

  37.     /** Position of the Antenna Phase Center in satellite 1 frame. */
  38.     private final Vector3D antennaPhaseCenter1;

  39.     /** Position of the Antenna Phase Center in satellite 2 frame. */
  40.     private final Vector3D antennaPhaseCenter2;

  41.     /** Attitude provider of the emitting satellite. */
  42.     private final AttitudeProvider attitude;

  43.     /** Simple constructor.
  44.      * @param antennaPhaseCenter1 position of the Antenna Phase Center in satellite 1 frame
  45.      * (i.e. the satellite which receives the signal and performs the measurement)
  46.      * @param antennaPhaseCenter2 position of the Antenna Phase Center in satellite 2 frame
  47.      * (i.e. the satellite which simply emits the signal)
  48.      * @param attitude attitude provider of the emitting satellite
  49.      */
  50.     public OnBoardAntennaOneWayGNSSRangeModifier(final Vector3D antennaPhaseCenter1,
  51.                                                  final Vector3D antennaPhaseCenter2,
  52.                                                  final AttitudeProvider attitude) {
  53.         this.antennaPhaseCenter1 = antennaPhaseCenter1;
  54.         this.antennaPhaseCenter2 = antennaPhaseCenter2;
  55.         this.attitude            = attitude;
  56.     }

  57.     /** {@inheritDoc} */
  58.     @Override
  59.     public List<ParameterDriver> getParametersDrivers() {
  60.         return Collections.emptyList();
  61.     }

  62.     /** {@inheritDoc} */
  63.     @Override
  64.     public void modify(final EstimatedMeasurement<OneWayGNSSRange> estimated) {

  65.         // The participants are remote satellite at emission, local satellite at reception
  66.         final TimeStampedPVCoordinates[] participants  = estimated.getParticipants();
  67.         final AbsoluteDate               emissionDate  = participants[0].getDate();
  68.         final AbsoluteDate               receptionDate = participants[1].getDate();

  69.         // Transforms from spacecraft to inertial frame at reception date
  70.         final SpacecraftState refStateLocal              = estimated.getStates()[0];
  71.         final SpacecraftState receptionState             = refStateLocal.shiftedBy(receptionDate.durationFrom(refStateLocal.getDate()));
  72.         final Transform       receptionSpacecraftToInert = receptionState.toTransform().getInverse();

  73.         // Orbit of the remote satellite
  74.         final Orbit orbitRemote = new CartesianOrbit(participants[0], refStateLocal.getFrame(), receptionState.getMu());

  75.         // Transforms from spacecraft to inertial frame at emission date
  76.         final SpacecraftState refStateRemote             = new SpacecraftState(orbitRemote,
  77.                                                                                attitude.getAttitude(orbitRemote,
  78.                                                                                                     orbitRemote.getDate(),
  79.                                                                                                     orbitRemote.getFrame()));
  80.         final SpacecraftState emissionState              = refStateRemote.shiftedBy(emissionDate.durationFrom(refStateRemote.getDate()));
  81.         final Transform       emissionSpacecraftToInert  = emissionState.toTransform().getInverse();

  82.         // Compute the geometrical value of the one-way GNSS range directly from participants positions.
  83.         // Note that this may be different from the value returned by estimated.getEstimatedValue(),
  84.         // because other modifiers may already have been taken into account
  85.         final Vector3D pSpacecraftReception = receptionSpacecraftToInert.transformPosition(Vector3D.ZERO);
  86.         final Vector3D pSpacecraftEmission  = emissionSpacecraftToInert.transformPosition(Vector3D.ZERO);
  87.         final double oneWayGNSSRangeUsingSpacecraftCenter = Vector3D.distance(pSpacecraftEmission, pSpacecraftReception);

  88.         // Compute the geometrical value of the range replacing
  89.         // the spacecraft positions with antenna phase center positions
  90.         final Vector3D pAPCReception = receptionSpacecraftToInert.transformPosition(antennaPhaseCenter1);
  91.         final Vector3D pAPCEmission  = emissionSpacecraftToInert.transformPosition(antennaPhaseCenter2);
  92.         final double oneWayGNSSRangeUsingAntennaPhaseCenter = Vector3D.distance(pAPCEmission, pAPCReception);

  93.         // Get the estimated value before this modifier is applied
  94.         final double[] value = estimated.getEstimatedValue();

  95.         // Modify the value
  96.         value[0] += oneWayGNSSRangeUsingAntennaPhaseCenter - oneWayGNSSRangeUsingSpacecraftCenter;
  97.         estimated.setEstimatedValue(value);

  98.     }

  99. }