PhaseCentersGroundReceiverBaseModifier.java

  1. /* Copyright 2002-2024 Luc Maisonobe
  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 org.orekit.estimation.measurements.EstimatedMeasurementBase;
  19. import org.orekit.estimation.measurements.GroundReceiverMeasurement;
  20. import org.orekit.estimation.measurements.GroundStation;
  21. import org.orekit.frames.Frame;
  22. import org.orekit.frames.Transform;
  23. import org.orekit.gnss.antenna.FrequencyPattern;
  24. import org.orekit.propagation.SpacecraftState;
  25. import org.orekit.time.AbsoluteDate;
  26. import org.orekit.utils.TimeStampedPVCoordinates;

  27. /** Ground and on-board antennas offsets effect on range measurements.
  28.  * @param <T> the type of the measurement
  29.  * @author Luc Maisonobe
  30.  * @since 12.0
  31.  */
  32. public class PhaseCentersGroundReceiverBaseModifier<T extends GroundReceiverMeasurement<T>> {

  33.     /** Uplink offset model. */
  34.     private final PhaseCentersOffsetComputer uplink;

  35.     /** Downlink offset model. */
  36.     private final PhaseCentersOffsetComputer downlink;

  37.     /** Simple constructor.
  38.      * @param stationPattern station pattern
  39.      * @param satellitePattern satellite pattern
  40.      */
  41.     public PhaseCentersGroundReceiverBaseModifier(final FrequencyPattern stationPattern,
  42.                                                   final FrequencyPattern satellitePattern) {
  43.         this.uplink   = new PhaseCentersOffsetComputer(stationPattern, satellitePattern);
  44.         this.downlink = new PhaseCentersOffsetComputer(satellitePattern, stationPattern);
  45.     }

  46.     /** Compute distance modification for one way measurement.
  47.      * @param estimated estimated measurement to modify
  48.      * @return distance modification to add to raw measurement
  49.      */
  50.     public double oneWayDistanceModification(final EstimatedMeasurementBase<T> estimated) {

  51.         // get all participants
  52.         // note that clock offset is compensated in participants,
  53.         // so the dates included there are more accurate than the measurement date
  54.         final TimeStampedPVCoordinates[] participants = estimated.getParticipants();

  55.         // station at reception date
  56.         final Frame         inertial       = estimated.getStates()[0].getFrame();
  57.         final GroundStation station        = estimated.getObservedMeasurement().getStation();
  58.         final AbsoluteDate  receptionDate  = participants[1].getDate();
  59.         final Transform     stationToInert = station.getOffsetToInertial(inertial, receptionDate, false);

  60.         // spacecraft at emission date
  61.         final AbsoluteDate    emissionDate      = participants[0].getDate();
  62.         final SpacecraftState refState          = estimated.getStates()[0];
  63.         final SpacecraftState emissionState     = refState.shiftedBy(emissionDate.durationFrom(refState.getDate()));
  64.         final Transform       spacecraftToInert = emissionState.toTransform().getInverse();

  65.         // compute offset due to phase centers
  66.         return downlink.offset(spacecraftToInert, stationToInert);

  67.     }

  68.     /** Apply a modifier to a two-way range measurement.
  69.      * @param estimated estimated measurement to modify
  70.      * @return distance modification to add to raw measurement
  71.      */
  72.     public double twoWayDistanceModification(final EstimatedMeasurementBase<T> estimated) {

  73.         // get all participants
  74.         // note that clock offset is compensated in participants,
  75.         // so the dates included there are more accurate than the measurement date
  76.         final TimeStampedPVCoordinates[] participants = estimated.getParticipants();

  77.         // station at reception date
  78.         final Frame         inertial                = estimated.getStates()[0].getFrame();
  79.         final GroundStation station                 = estimated.getObservedMeasurement().getStation();
  80.         final AbsoluteDate  receptionDate           = participants[2].getDate();
  81.         final Transform     stationToInertReception = station.getOffsetToInertial(inertial, receptionDate, false);

  82.         // transform from spacecraft to inertial frame at transit date
  83.         final AbsoluteDate    transitDate           = participants[1].getDate();
  84.         final SpacecraftState refState              = estimated.getStates()[0];
  85.         final SpacecraftState transitState          = refState.shiftedBy(transitDate.durationFrom(refState.getDate()));
  86.         final Transform       spacecraftToInert     = transitState.toTransform().getInverse();

  87.         // station at emission date
  88.         final AbsoluteDate emissionDate             = participants[0].getDate();
  89.         final Transform    stationToInertEmission   = station.getOffsetToInertial(inertial, emissionDate, true);

  90.         // compute offsets due to phase centers
  91.         final double uplinkOffset   = uplink.offset(stationToInertEmission, spacecraftToInert);
  92.         final double downlinkOffset = downlink.offset(spacecraftToInert, stationToInertReception);

  93.         return 0.5 * (uplinkOffset + downlinkOffset);

  94.     }

  95. }