1 /* Copyright 2002-2024 Luc Maisonobe 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.files.rinex.navigation; 18 19 import org.orekit.gnss.SatelliteSystem; 20 import org.orekit.propagation.analytical.gnss.data.GNSSConstants; 21 import org.orekit.utils.units.Unit; 22 23 /** Container for data contained in a ionosphere Klobuchar message. 24 * @author Luc Maisonobe 25 * @since 12.0 26 */ 27 public class IonosphereKlobucharMessage extends IonosphereBaseMessage { 28 29 /** Converters for Klobuchar parameters. */ 30 static final Unit[] S_PER_SC_N; 31 static { 32 final Unit sc = Unit.RADIAN.scale("sc", GNSSConstants.GNSS_PI); 33 S_PER_SC_N = new Unit[4]; 34 S_PER_SC_N[0] = Unit.SECOND; 35 S_PER_SC_N[1] = S_PER_SC_N[0].divide("s/sc", sc); 36 S_PER_SC_N[2] = S_PER_SC_N[1].divide("s/sc²", sc); 37 S_PER_SC_N[3] = S_PER_SC_N[2].divide("s/sc³", sc); 38 } 39 40 /** α (s/radⁿ). */ 41 private final double[] alpha; 42 43 /** β (s/radⁿ). */ 44 private final double[] beta; 45 46 /** Region code. */ 47 private RegionCode regionCode; 48 49 /** Simple constructor. 50 * @param system satellite system 51 * @param prn satellite number 52 * @param navigationMessageType navigation message type 53 */ 54 public IonosphereKlobucharMessage(final SatelliteSystem system, final int prn, final String navigationMessageType) { 55 super(system, prn, navigationMessageType); 56 alpha = new double[4]; 57 beta = new double[4]; 58 } 59 60 /** Get the α coefficients. 61 * <p> 62 * Beware Orekit uses SI units here. 63 * In order to retrieve the more traditional s/semi-circleⁿ, use 64 * {@code IonosphereKlobucharMessage.S_PER_SC_N[i].fromSI(alpha[i])} 65 * </p> 66 * @return α coefficients (s/radⁿ) 67 * @see #S_PER_SC_N 68 */ 69 public double[] getAlpha() { 70 return alpha.clone(); 71 } 72 73 /** Set one α coefficient. 74 * <p> 75 * Beware Orekit uses SI units here. 76 * In order to use the more traditional s/semi-circleⁿ, use 77 * {@code setAlphaI(i, IonosphereKlobucharMessage.S_PER_SC_N[i].toSi(alpha[i]))} 78 * </p> 79 * @param i index of the coefficient 80 * @param alphaI α coefficient to set (s/radⁿ) 81 * @see #S_PER_SC_N 82 */ 83 public void setAlphaI(final int i, final double alphaI) { 84 alpha[i] = alphaI; 85 } 86 87 /** Get the β coefficients. 88 * <p> 89 * Beware Orekit uses SI units here. 90 * In order to retrieve the more traditional s/semi-circleⁿ, use 91 * {@code IonosphereKlobucharMessage.S_PER_SC_N[i].fromSI(beta[i])} 92 * </p> 93 * @return β coefficients (s/radⁿ) 94 * @see #S_PER_SC_N 95 */ 96 public double[] getBeta() { 97 return beta.clone(); 98 } 99 100 /** Set one β coefficient. 101 * <p> 102 * Beware Orekit uses SI units here. 103 * In order to use the more traditional s/semi-circleⁿ, use 104 * {@code setBetaI(i, IonosphereKlobucharMessage.S_PER_SC_N[i].toSi(beta[i]))} 105 * </p> 106 * @param i index of the coefficient 107 * @param betaI β coefficient to set (s/radⁿ) 108 * @see #S_PER_SC_N 109 */ 110 public void setBetaI(final int i, final double betaI) { 111 beta[i] = betaI; 112 } 113 114 /** Get the region code. 115 * @return region code 116 */ 117 public RegionCode getRegionCode() { 118 return regionCode; 119 } 120 121 /** Set the region code. 122 * @param regionCode region code 123 */ 124 public void setRegionCode(final RegionCode regionCode) { 125 this.regionCode = regionCode; 126 } 127 128 }