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.time;
18  
19  
20  /** TAI UTC offset model.
21   * @see UTCTAIOffsetsLoader
22   * @author Luc Maisonobe
23   * @since 7.1
24   */
25  public class OffsetModel {
26  
27      /** Date of the offset start. */
28      private final DateComponents start;
29  
30      /** Reference date of the linear model as a modified julian day. */
31      private final int mjdRef;
32  
33      /** Offset at reference date in seconds (TAI minus UTC). */
34      private final double offset;
35  
36      /** Offset slope in seconds per UTC day (TAI minus UTC / dUTC). */
37      private final double slope;
38  
39      /** Constructor for a linear offset model.
40       * <p>
41       * These models were used prior to 1972.
42       * </p>
43       * @param start date of the offset start
44       * @param mjdRef reference date of the linear model as a modified julian day
45       * @param offset offset at reference date in seconds (TAI minus UTC)
46       * @param slope offset slope in seconds per UTC day (TAI minus UTC / dUTC)
47       */
48      public OffsetModel(final DateComponents start,
49                         final int mjdRef, final double offset, final double slope) {
50          this.start  = start;
51          this.mjdRef = mjdRef;
52          this.offset = offset;
53          this.slope  = slope;
54      }
55  
56      /** Constructor for a constant offset model.
57       * <p>
58       * These models are used since 1972.
59       * </p>
60       * @param start date of the offset start
61       * @param offset offset at reference date in seconds (TAI minus UTC)
62       */
63      public OffsetModel(final DateComponents start, final int offset) {
64          this(start, 41317, offset, 0.0);
65      }
66  
67      /** Get the date of the offset start.
68       * @return date of the offset start
69       */
70      public DateComponents getStart() {
71          return start;
72      }
73  
74      /** Get the reference date of the linear model as a modified julian day.
75       * @return reference date of the linear model as a modified julian day
76       */
77      public int getMJDRef() {
78          return mjdRef;
79      }
80  
81      /** Offset at reference date in seconds (TAI minus UTC).
82       * @return offset at reference date in seconds (TAI minus UTC)
83       */
84      public double getOffset() {
85          return offset;
86      }
87  
88      /** Offset slope in seconds per UTC day (TAI minus UTC / dUTC).
89       * @return offset slope in seconds per UTC day (TAI minus UTC / dUTC)
90       */
91      public double getSlope() {
92          return slope;
93      }
94  
95  }