OnBoardAntennaPhaseModifier.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.  * The ASF 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.estimation.measurements.EstimatedMeasurement;
  22. import org.orekit.estimation.measurements.EstimationModifier;
  23. import org.orekit.estimation.measurements.gnss.Phase;
  24. import org.orekit.frames.Transform;
  25. import org.orekit.propagation.SpacecraftState;
  26. import org.orekit.time.AbsoluteDate;
  27. import org.orekit.utils.ParameterDriver;
  28. import org.orekit.utils.TimeStampedPVCoordinates;

  29. /** On-board antenna offset effect on phase measurements.
  30.  * @author David Soulard
  31.  * @since 10.2
  32.  */
  33. public class OnBoardAntennaPhaseModifier implements EstimationModifier<Phase> {

  34.     /** Position of the Antenna Phase Center in satellite frame. */
  35.     private final Vector3D antennaPhaseCenter;

  36.     /** Simple constructor.
  37.      * @param antennaPhaseCenter position of the Antenna Phase Center in satellite frame
  38.      */
  39.     public OnBoardAntennaPhaseModifier(final Vector3D antennaPhaseCenter) {
  40.         this.antennaPhaseCenter = antennaPhaseCenter;
  41.     }

  42.     /** {@inheritDoc} */
  43.     @Override
  44.     public List<ParameterDriver> getParametersDrivers() {
  45.         return Collections.emptyList();
  46.     }

  47.     /** {@inheritDoc} */
  48.     @Override
  49.     public void modify(final EstimatedMeasurement<Phase> estimated) {
  50.         // the participants are spacecraft at emission, ground station at reception
  51.         final TimeStampedPVCoordinates[] participants = estimated.getParticipants();
  52.         final AbsoluteDate               emissionDate = participants[0].getDate();
  53.         final Vector3D                   pReception   = participants[1].getPosition();

  54.         // transform from spacecraft to inertial frame at emission date
  55.         final SpacecraftState refState          = estimated.getStates()[0];
  56.         final SpacecraftState emissionState     = refState.shiftedBy(emissionDate.durationFrom(refState.getDate()));
  57.         final Transform       spacecraftToInert = emissionState.toTransform().getInverse();

  58.         // compute the geometrical value of the range directly from participants positions.
  59.         // Note that this may be different from the value returned by estimated.getEstimatedValue(),
  60.         // because other modifiers may already have been taken into account
  61.         final Vector3D pSpacecraft = spacecraftToInert.transformPosition(Vector3D.ZERO);
  62.         final double rangeUsingSpacecraftCenter = Vector3D.distance(pSpacecraft, pReception);

  63.         // compute the geometrical value of the range replacing
  64.         // the spacecraft position with antenna phase center position
  65.         final Vector3D pAPC = spacecraftToInert.transformPosition(antennaPhaseCenter);
  66.         final double rangeUsingAntennaPhaseCenter = Vector3D.distance(pAPC, pReception);

  67.         // get the estimated value before this modifier is applied
  68.         final double[] value = estimated.getEstimatedValue();

  69.         // modify the value
  70.         value[0] += (rangeUsingAntennaPhaseCenter - rangeUsingSpacecraftCenter) / estimated.getObservedMeasurement().getWavelength();
  71.         estimated.setEstimatedValue(value);
  72.     }

  73. }