OnBoardAntennaInterSatellitesRangeModifier.java

  1. /* Copyright 2002-2018 CS Systèmes d'Information
  2.  * Licensed to CS Systèmes d'Information (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.estimation.measurements.EstimatedMeasurement;
  22. import org.orekit.estimation.measurements.EstimationModifier;
  23. import org.orekit.estimation.measurements.InterSatellitesRange;
  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 inter-satellites range measurements.
  30.  * @author Luc Maisonobe
  31.  * @since 9.0
  32.  */
  33. public class OnBoardAntennaInterSatellitesRangeModifier implements EstimationModifier<InterSatellitesRange> {

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

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

  38.     /** Simple constructor.
  39.      * @param antennaPhaseCenter1 position of the Antenna Phase Center in satellite 1 frame
  40.      * (i.e. the satellite which receives the signal and performs the measurement)
  41.      * @param antennaPhaseCenter2 position of the Antenna Phase Center in satellite 2 frame
  42.      * (i.e. the satellite which simply emits the signal in the one-way
  43.      * case, or reflects the signal in the two-way case)
  44.      */
  45.     public OnBoardAntennaInterSatellitesRangeModifier(final Vector3D antennaPhaseCenter1,
  46.                                                       final Vector3D antennaPhaseCenter2) {
  47.         this.antennaPhaseCenter1 = antennaPhaseCenter1;
  48.         this.antennaPhaseCenter2 = antennaPhaseCenter2;
  49.     }

  50.     /** {@inheritDoc} */
  51.     @Override
  52.     public List<ParameterDriver> getParametersDrivers() {
  53.         return Collections.emptyList();
  54.     }

  55.     /** {@inheritDoc} */
  56.     @Override
  57.     public void modify(final EstimatedMeasurement<InterSatellitesRange> estimated) {
  58.         if (estimated.getParticipants().length < 3) {
  59.             modifyOneWay(estimated);
  60.         } else {
  61.             modifyTwoWay(estimated);
  62.         }
  63.     }

  64.     /** Apply a modifier to an estimated measurement in the one-way case.
  65.      * @param estimated estimated measurement to modify
  66.      */
  67.     private void modifyOneWay(final EstimatedMeasurement<InterSatellitesRange> estimated) {

  68.         // the participants are satellite 2 at emission, satellite 1 at reception
  69.         final TimeStampedPVCoordinates[] participants  = estimated.getParticipants();
  70.         final AbsoluteDate               emissionDate  = participants[0].getDate();
  71.         final AbsoluteDate               receptionDate = participants[1].getDate();

  72.         // transforms from spacecraft to inertial frame at emission/reception dates
  73.         final SpacecraftState refState1                  = estimated.getStates()[0];
  74.         final SpacecraftState receptionState             = refState1.shiftedBy(receptionDate.durationFrom(refState1.getDate()));
  75.         final Transform       receptionSpacecraftToInert = receptionState.toTransform().getInverse();
  76.         final SpacecraftState refState2                  = estimated.getStates()[1];
  77.         final SpacecraftState emissionState              = refState2.shiftedBy(emissionDate.durationFrom(refState2.getDate()));
  78.         final Transform       emissionSpacecraftToInert  = emissionState.toTransform().getInverse();

  79.         // compute the geometrical value of the inter-satellites range directly from participants positions.
  80.         // Note that this may be different from the value returned by estimated.getEstimatedValue(),
  81.         // because other modifiers may already have been taken into account
  82.         final Vector3D pSpacecraftReception = receptionSpacecraftToInert.transformPosition(Vector3D.ZERO);
  83.         final Vector3D pSpacecraftEmission  = emissionSpacecraftToInert.transformPosition(Vector3D.ZERO);
  84.         final double interSatellitesRangeUsingSpacecraftCenter =
  85.                         Vector3D.distance(pSpacecraftEmission, pSpacecraftReception);

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

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

  94.         // modify the value
  95.         value[0] += interSatellitesRangeUsingAntennaPhaseCenter - interSatellitesRangeUsingSpacecraftCenter;
  96.         estimated.setEstimatedValue(value);

  97.     }

  98.     /** Apply a modifier to an estimated measurement in the two-way case.
  99.      * @param estimated estimated measurement to modify
  100.      */
  101.     private void modifyTwoWay(final EstimatedMeasurement<InterSatellitesRange> estimated) {

  102.         // the participants are satellite 1 at emission, satellite 2 at transit, satellite 1 at reception
  103.         final TimeStampedPVCoordinates[] participants  = estimated.getParticipants();
  104.         final AbsoluteDate               emissionDate  = participants[0].getDate();
  105.         final AbsoluteDate               transitDate   = participants[1].getDate();
  106.         final AbsoluteDate               receptionDate = participants[2].getDate();

  107.         // transforms from spacecraft to inertial frame at emission/reception dates
  108.         final SpacecraftState refState1                  = estimated.getStates()[0];
  109.         final SpacecraftState receptionState             = refState1.shiftedBy(receptionDate.durationFrom(refState1.getDate()));
  110.         final Transform       receptionSpacecraftToInert = receptionState.toTransform().getInverse();
  111.         final SpacecraftState refState2                  = estimated.getStates()[1];
  112.         final SpacecraftState transitState               = refState2.shiftedBy(transitDate.durationFrom(refState2.getDate()));
  113.         final Transform       transitSpacecraftToInert   = transitState.toTransform().getInverse();
  114.         final SpacecraftState emissionState              = refState1.shiftedBy(emissionDate.durationFrom(refState1.getDate()));
  115.         final Transform       emissionSpacecraftToInert  = emissionState.toTransform().getInverse();

  116.         // compute the geometrical value of the inter-satellites range directly from participants positions.
  117.         // Note that this may be different from the value returned by estimated.getEstimatedValue(),
  118.         // because other modifiers may already have been taken into account
  119.         final Vector3D pSpacecraftReception = receptionSpacecraftToInert.transformPosition(Vector3D.ZERO);
  120.         final Vector3D pSpacecraftTransit   = transitSpacecraftToInert.transformPosition(Vector3D.ZERO);
  121.         final Vector3D pSpacecraftEmission  = emissionSpacecraftToInert.transformPosition(Vector3D.ZERO);
  122.         final double interSatellitesRangeUsingSpacecraftCenter =
  123.                         0.5 * (Vector3D.distance(pSpacecraftEmission, pSpacecraftTransit) +
  124.                                Vector3D.distance(pSpacecraftTransit, pSpacecraftReception));

  125.         // compute the geometrical value of the range replacing
  126.         // the spacecraft positions with antenna phase center positions
  127.         final Vector3D pAPCReception = receptionSpacecraftToInert.transformPosition(antennaPhaseCenter1);
  128.         final Vector3D pAPCTransit   = transitSpacecraftToInert.transformPosition(antennaPhaseCenter2);
  129.         final Vector3D pAPCEmission  = emissionSpacecraftToInert.transformPosition(antennaPhaseCenter1);
  130.         final double interSatellitesRangeUsingAntennaPhaseCenter =
  131.                         0.5 * (Vector3D.distance(pAPCEmission, pAPCTransit) +
  132.                                Vector3D.distance(pAPCTransit, pAPCReception));


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

  135.         // modify the value
  136.         value[0] += interSatellitesRangeUsingAntennaPhaseCenter - interSatellitesRangeUsingSpacecraftCenter;
  137.         estimated.setEstimatedValue(value);

  138.     }

  139. }