MeasurementDecorator.java

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

  18. import org.hipparchus.filtering.kalman.Measurement;
  19. import org.hipparchus.linear.MatrixUtils;
  20. import org.hipparchus.linear.RealMatrix;
  21. import org.hipparchus.linear.RealVector;
  22. import org.orekit.estimation.measurements.ObservedMeasurement;
  23. import org.orekit.time.AbsoluteDate;


  24. /** Decorator adding {@link Measurement} API to an {@link ObservedMeasurement}.
  25.  * @author Luc Maisonobe
  26.  * @since 9.2
  27.  */
  28. public class MeasurementDecorator implements Measurement {

  29.     /** Wrapped observed measurement. */
  30.     private final ObservedMeasurement<?> observedMeasurement;

  31.     /** Covariance. */
  32.     private final RealMatrix covariance;

  33.     /** Reference date. */
  34.     private final AbsoluteDate reference;

  35.     /** Simple constructor.
  36.      * @param observedMeasurement observed measurement
  37.      * @param covariance measurement covariance
  38.      * @param reference reference date
  39.      */
  40.     public MeasurementDecorator(final ObservedMeasurement<?> observedMeasurement,
  41.                                 final RealMatrix covariance, final AbsoluteDate reference) {
  42.         this.observedMeasurement = observedMeasurement;
  43.         this.covariance          = covariance;
  44.         this.reference           = reference;
  45.     }

  46.     /** Get the observed measurement.
  47.      * @return observed measurement
  48.      */
  49.     public ObservedMeasurement<?> getObservedMeasurement() {
  50.         return observedMeasurement;
  51.     }

  52.     /** {@inheritDoc} */
  53.     @Override
  54.     public double getTime() {
  55.         return observedMeasurement.getDate().durationFrom(reference);
  56.     }

  57.     /** {@inheritDoc} */
  58.     @Override
  59.     public RealVector getValue() {
  60.         return MatrixUtils.createRealVector(observedMeasurement.getObservedValue());
  61.     }

  62.     /** {@inheritDoc} */
  63.     @Override
  64.     public RealMatrix getCovariance() {
  65.         return covariance;
  66.     }

  67. }