1   /* Copyright 2022-2025 Thales Alenia Space
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.propagation.analytical.gnss.data;
18  
19  import org.orekit.frames.Frame;
20  import org.orekit.gnss.SatelliteSystem;
21  import org.orekit.time.TimeScales;
22  
23  /**
24   * Factory for {@link GPSAlmanac}.
25   * @author Luc Maisonobe
26   * @since 14.0
27   */
28  public class GPSAlmanacFactory extends GNSSOrbitalElementsFactory<GPSAlmanac> {
29  
30      /** Source of the almanac. */
31      private String source;
32  
33      /** SVN number. */
34      private int svn;
35  
36      /** Health status. */
37      private int health;
38  
39      /** Average URA. */
40      private int ura;
41  
42      /** Satellite configuration. */
43      private int satConfiguration;
44  
45      /** Simple constructor.
46       * @param timeScales      known time scales
47       * @param system          satellite system to use for interpreting week number
48       * @param inertial        reference inertial frame
49       * @param bodyFixed       body fixed frame (will be frozen at {@code date} to build the orbital elements
50       */
51      public GPSAlmanacFactory(final TimeScales timeScales, final SatelliteSystem system,
52                               final Frame inertial, final Frame bodyFixed) {
53          super(GNSSConstants.GPS_AV, timeScales, system, null,
54                inertial, bodyFixed, GNSSConstants.GPS_MU);
55      }
56  
57      /** Get the source of this GPS almanac.
58       * <p>Sources can be SEM or YUMA, when the almanac is read from a file.</p>
59       * @return the source of this GPS almanac
60       */
61      public String getSource() {
62          return source;
63      }
64  
65      /** Set the source of this GPS almanac.
66       * <p>Sources can be SEM or YUMA, when the almanac is read from a file.</p>
67       * @param source source of this GPS almanac
68       */
69      public void setSource(final String source) {
70          this.source = source;
71      }
72  
73      /** Get the satellite "SVN" reference number.
74       * @return the satellite "SVN" reference number
75       */
76      public int getSvn() {
77          return svn;
78      }
79  
80      /** Set the satellite "SVN" reference number.
81       * @param svn the satellite "SVN" reference number
82       */
83      public void setSvn(final int svn) {
84          this.svn = svn;
85      }
86  
87      /** Get the Health status.
88       * @return the Health status
89       */
90      public int getHealth() {
91          return health;
92      }
93  
94      /** Set the Health status.
95       * @param health the Health status
96       */
97      public void setHealth(final int health) {
98          this.health = health;
99      }
100 
101     /** Get the average URA number.
102      * @return the average URA number
103      */
104     public int getUra() {
105         return ura;
106     }
107 
108     /** Set the average URA number.
109      * @param ura the average URA number
110      */
111     public void setUra(final int ura) {
112         this.ura = ura;
113     }
114 
115     /** Get the satellite configuration.
116      * @return the satellite configuration
117      */
118     public int getSatConfiguration() {
119         return satConfiguration;
120     }
121 
122     /** Set the satellite configuration.
123      * @param satConfiguration the satellite configuration
124      */
125     public void setSatConfiguration(final int satConfiguration) {
126         this.satConfiguration = satConfiguration;
127     }
128 
129     /** {@inheritDoc} */
130     @Override
131     public GPSAlmanac createFromDrivers() {
132         return new GPSAlmanac(getTimeScales(), getPrn(), getTimeOfEphemeris(),
133                               createOrbitFromDrivers(),
134                               getADotDriver().getValue(),
135                               getDeltaN0Driver().getValue(), getDeltaN0DotDriver().getValue(),
136                               getIDotDriver().getValue(), getOmegaDotDriver().getValue(),
137                               getCucDriver().getValue(), getCusDriver().getValue(),
138                               getCrcDriver().getValue(), getCrsDriver().getValue(),
139                               getCicDriver().getValue(), getCisDriver().getValue(),
140                               getAf0Driver().getValue(), getAf1Driver().getValue(),
141                               getAf2Driver().getValue(),
142                               getTgd(), getTimeOfClock(), getSource(), getSvn(), getHealth(),
143                               getUra(), getSatConfiguration());
144     }
145 
146 }