PhaseCentersGroundReceiverBaseModifier.java

  1. /* Copyright 2022-2025 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.     /** Get the name of the effect modifying the measurement.
  47.      * @return name of the effect modifying the measurement
  48.      * @since 13.0
  49.      */
  50.     public String getEffectName() {
  51.         return "mean phase center";
  52.     }

  53.     /** Compute distance modification for one way measurement.
  54.      * @param estimated estimated measurement to modify
  55.      * @return distance modification to add to raw measurement
  56.      */
  57.     public double oneWayDistanceModification(final EstimatedMeasurementBase<T> estimated) {

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

  62.         // station at reception date
  63.         final Frame         inertial       = estimated.getStates()[0].getFrame();
  64.         final GroundStation station        = estimated.getObservedMeasurement().getStation();
  65.         final AbsoluteDate  receptionDate  = participants[1].getDate();
  66.         final Transform     stationToInert = station.getOffsetToInertial(inertial, receptionDate, false);

  67.         // spacecraft at emission date
  68.         final AbsoluteDate    emissionDate      = participants[0].getDate();
  69.         final SpacecraftState refState          = estimated.getStates()[0];
  70.         final SpacecraftState emissionState     = refState.shiftedBy(emissionDate.durationFrom(refState.getDate()));
  71.         final Transform       spacecraftToInert = emissionState.toTransform().getInverse();

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

  74.     }

  75.     /** Apply a modifier to a two-way range measurement.
  76.      * @param estimated estimated measurement to modify
  77.      * @return distance modification to add to raw measurement
  78.      */
  79.     public double twoWayDistanceModification(final EstimatedMeasurementBase<T> estimated) {

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

  84.         // station at reception date
  85.         final Frame         inertial                = estimated.getStates()[0].getFrame();
  86.         final GroundStation station                 = estimated.getObservedMeasurement().getStation();
  87.         final AbsoluteDate  receptionDate           = participants[2].getDate();
  88.         final Transform     stationToInertReception = station.getOffsetToInertial(inertial, receptionDate, false);

  89.         // transform from spacecraft to inertial frame at transit date
  90.         final AbsoluteDate    transitDate           = participants[1].getDate();
  91.         final SpacecraftState refState              = estimated.getStates()[0];
  92.         final SpacecraftState transitState          = refState.shiftedBy(transitDate.durationFrom(refState.getDate()));
  93.         final Transform       spacecraftToInert     = transitState.toTransform().getInverse();

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

  97.         // compute offsets due to phase centers
  98.         final double uplinkOffset   = uplink.offset(stationToInertEmission, spacecraftToInert);
  99.         final double downlinkOffset = downlink.offset(spacecraftToInert, stationToInertReception);

  100.         return 0.5 * (uplinkOffset + downlinkOffset);

  101.     }

  102. }