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 BeidouLegacyNavigationMessage}.
25   * @author Luc Maisonobe
26   * @since 14.0
27   */
28  public class BeidouLegacyNavigationMessageFactory
29      extends AbstractNavigationMessageFactory<BeidouLegacyNavigationMessage> {
30  
31      /** Indicator for D2 messages. */
32      private final boolean d2;
33  
34      /** Age of Data, Ephemeris. */
35      private int aode;
36  
37      /** Age of Data, Clock. */
38      private int aodc;
39  
40      /** Health identifier. */
41      private int satH1;
42  
43      /** B1/B3 Group Delay Differential (s). */
44      private double tgd1;
45  
46      /** B2/B3 Group Delay Differential (s). */
47      private double tgd2;
48  
49      /** The user SV accuracy (m). */
50      private double svAccuracy;
51  
52      /** Simple constructor.
53       * @param timeScales known time scales
54       * @param system     satellite system to use for interpreting week number
55       * @param type       message type (null if not a navigation message)
56       * @param inertial   reference inertial frame
57       * @param bodyFixed  body fixed frame (will be frozen at {@code date} to build the orbital elements
58       * @param d2         indicator for D2 messages
59       */
60      public BeidouLegacyNavigationMessageFactory(final TimeScales timeScales, final SatelliteSystem system,
61                                                  final String type, final Frame inertial, final Frame bodyFixed,
62                                                  final boolean d2) {
63          super(GNSSConstants.BEIDOU_AV, timeScales, system,
64                type, inertial, bodyFixed, GNSSConstants.BEIDOU_MU);
65          this.d2 = d2;
66      }
67  
68      /** Check if message is a D2 message.
69       * @return true if message is a D2 message
70       */
71      public boolean isD2() {
72          return d2;
73      }
74  
75      /** Get the Age Of Data Clock (AODC).
76       * @return the Age Of Data Clock (AODC)
77       */
78      public int getAodc() {
79          return aodc;
80      }
81  
82      /** Set the Age Of Data Clock (AODC).
83       * @param aodc the Age Of Data Clock (AODC)
84       */
85      public void setAodc(final int aodc) {
86          this.aodc = aodc;
87      }
88  
89      /** Get the Age Of Data Ephemeris (AODE).
90       * @return the Age Of Data Ephemeris (AODE)
91       */
92      public int getAode() {
93          return aode;
94      }
95  
96      /** Set the Age Of Data Ephemeris (AODE).
97       * @param aode the Age Of Data Ephemeris (AODE)
98       */
99      public void setAode(final int aode) {
100         this.aode = aode;
101     }
102 
103     /** Get the estimated group delay differential TGD1 for B1I signal.
104      * @return the estimated group delay differential TGD1 for B1I signal (s)
105      */
106     public double getTgd1() {
107         return tgd1;
108     }
109 
110     /** Set the estimated group delay differential TGD1 for B1I signal.
111      * @param tgd1 the estimated group delay differential TGD1 for B1I signal (s)
112      */
113     public void setTgd1(final double tgd1) {
114         this.tgd1 = tgd1;
115     }
116 
117     /** Get the estimated group delay differential TGD for B2I signal.
118      * @return the estimated group delay differential TGD2 for B2I signal (s)
119      */
120     public double getTgd2() {
121         return tgd2;
122     }
123 
124     /** Set the estimated group delay differential TGD for B2I signal.
125      * @param tgd2 the estimated group delay differential TGD2 for B2I signal (s)
126      */
127     public void setTgd2(final double tgd2) {
128         this.tgd2 = tgd2;
129     }
130 
131     /** Get the user SV accuray (meters).
132      * @return the user SV accuracy
133      */
134     public double getSvAccuracy() {
135         return svAccuracy;
136     }
137 
138     /** Set the user SV accuray (meters).
139      * @param svAccuracy the user SV accuracy
140      */
141     public void setSvAccuracy(final double svAccuracy) {
142         this.svAccuracy = svAccuracy;
143     }
144 
145     /** Get the health identifier.
146      * @return health identifier
147      */
148     public int getSatH1() {
149         return satH1;
150     }
151 
152     /** Set the health identifier.
153      * @param satH1 health identifier
154      */
155     public void setSatH1(final int satH1) {
156         this.satH1 = satH1;
157     }
158 
159     /** {@inheritDoc} */
160     @Override
161     public BeidouLegacyNavigationMessage createFromDrivers() {
162         return new BeidouLegacyNavigationMessage(isD2(),
163                                                  getTimeScales(), getType(), getPrn(), getTimeOfEphemeris(),
164                                                  createOrbitFromDrivers(),
165                                                  getADotDriver().getValue(),
166                                                  getDeltaN0Driver().getValue(), getDeltaN0DotDriver().getValue(),
167                                                  getIDotDriver().getValue(), getOmegaDotDriver().getValue(),
168                                                  getCucDriver().getValue(), getCusDriver().getValue(),
169                                                  getCrcDriver().getValue(), getCrsDriver().getValue(),
170                                                  getCicDriver().getValue(), getCisDriver().getValue(),
171                                                  getAf0Driver().getValue(), getAf1Driver().getValue(),
172                                                  getAf2Driver().getValue(),
173                                                  getTgd(), getTimeOfClock(), getTransmissionTime(),
174                                                  getAode(), getAodc(), getSatH1(),
175                                                  getTgd1(), getTgd2(), getSvAccuracy());
176     }
177 
178 }