EstimatedMeasurementBase.java

  1. /* Copyright 2002-2024 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;

  18. import org.orekit.propagation.SpacecraftState;
  19. import org.orekit.time.AbsoluteDate;
  20. import org.orekit.utils.TimeStampedPVCoordinates;

  21. /** Class holding an estimated theoretical value associated to an {@link ObservedMeasurement observed measurement}.
  22.  * @param <T> the type of the measurement
  23.  * @author Luc Maisonobe
  24.  * @since 8.0
  25.  */
  26. public class EstimatedMeasurementBase<T extends ObservedMeasurement<T>> implements ComparableMeasurement {

  27.     /** Associated observed measurement. */
  28.     private final T observedMeasurement;

  29.     /** Iteration number. */
  30.     private final int iteration;

  31.     /** Evaluations counter. */
  32.     private final int count;

  33.     /** States of the spacecrafts. */
  34.     private final SpacecraftState[] states;

  35.     /** Coordinates of the participants in signal travel order. */
  36.     private final TimeStampedPVCoordinates[] participants;

  37.     /** Estimated value. */
  38.     private double[] estimatedValue;

  39.     /** Measurement status. */
  40.     private Status status;

  41.     /** Simple constructor.
  42.      * @param observedMeasurement associated observed measurement
  43.      * @param iteration iteration number
  44.      * @param count evaluations counter
  45.      * @param states states of the spacecrafts
  46.      * @param participants coordinates of the participants in signal travel order
  47.      * in inertial frame
  48.      */
  49.     public EstimatedMeasurementBase(final T observedMeasurement,
  50.                                 final int iteration, final int count,
  51.                                 final SpacecraftState[] states,
  52.                                 final TimeStampedPVCoordinates[] participants) {
  53.         this.observedMeasurement = observedMeasurement;
  54.         this.iteration           = iteration;
  55.         this.count               = count;
  56.         this.states              = states.clone();
  57.         this.participants        = participants.clone();
  58.         this.status              = Status.PROCESSED;
  59.     }

  60.     /** Get the associated observed measurement.
  61.      * @return associated observed measurement
  62.      */
  63.     public T getObservedMeasurement() {
  64.         return observedMeasurement;
  65.     }

  66.     /** {@inheritDoc} */
  67.     @Override
  68.     public AbsoluteDate getDate() {
  69.         return observedMeasurement.getDate();
  70.     }

  71.     /** Get the iteration number.
  72.      * @return iteration number
  73.      */
  74.     public int getIteration() {
  75.         return iteration;
  76.     }

  77.     /** Get the evaluations counter.
  78.      * @return evaluations counter
  79.      */
  80.     public int getCount() {
  81.         return count;
  82.     }

  83.     /** Get the states of the spacecrafts.
  84.      * @return states of the spacecrafts
  85.      */
  86.     public SpacecraftState[] getStates() {
  87.         return states.clone();
  88.     }

  89.     /** Get the coordinates of the measurements participants in signal travel order.
  90.      * <p>
  91.      * First participant (at index 0) emits the signal (it is for example a ground
  92.      * station for two-way range measurement). Last participant receives the signal
  93.      * (it is also the ground station for two-way range measurement, but a few
  94.      * milliseconds later). Intermediate participants relfect the signal (it is the
  95.      * spacecraft for two-way range measurement).
  96.      * </p>
  97.      * @return coordinates of the measurements participants in signal travel order
  98.      * in inertial frame
  99.      */
  100.     public TimeStampedPVCoordinates[] getParticipants() {
  101.         return participants.clone();
  102.     }

  103.     /** Get the time offset from first state date to measurement date.
  104.      * @return time offset from first state date to measurement date
  105.      */
  106.     public double getTimeOffset() {
  107.         return observedMeasurement.getDate().durationFrom(states[0].getDate());
  108.     }

  109.     /** {@inheritDoc} */
  110.     @Override
  111.     public double[] getObservedValue() {
  112.         return observedMeasurement.getObservedValue();
  113.     }

  114.     /** Get the estimated value.
  115.      * @return estimated value
  116.      */
  117.     public double[] getEstimatedValue() {
  118.         return estimatedValue.clone();
  119.     }

  120.     /** Set the estimated value.
  121.      * @param estimatedValue estimated value
  122.      */
  123.     public void setEstimatedValue(final double... estimatedValue) {
  124.         this.estimatedValue = estimatedValue.clone();
  125.     }

  126.     /** Get the status.
  127.      * <p>
  128.      * The status is set to {@link Status#PROCESSED PROCESSED} at construction, and
  129.      * can be reset to {@link Status#REJECTED REJECTED} later on, typically by
  130.      * {@link org.orekit.estimation.measurements.modifiers.OutlierFilter OutlierFilter}
  131.      * or {@link org.orekit.estimation.measurements.modifiers.DynamicOutlierFilter DynamicOutlierFilter}
  132.      * </p>
  133.      * @return status
  134.      */
  135.     public Status getStatus() {
  136.         return status;
  137.     }

  138.     /** Set the status.
  139.      * @param status status to set
  140.      */
  141.     public void setStatus(final Status status) {
  142.         this.status = status;
  143.     }

  144.     /** Enumerate for the status of the measurement. */
  145.     public enum Status {

  146.         /** Status for processed measurements. */
  147.         PROCESSED,

  148.         /** Status for rejected measurements. */
  149.         REJECTED;

  150.     }

  151. }