Skip to content

Commit 3df4a33

Browse files
authored
NAV RINEX: improve documentation (#362)
* NAV RINEX: improve documentation * add more comments * add RINEX v3 and v4 examples * Status flags are private while they should be public * Add L2P flag support * Fix documentation, improve kepler solver * add kepler2position example * remove non needed struct from kepler solver * kepler solver requires some improvements * Removed unused struct from keplerian solver * Fixed wrong feature gate * V0.19 --------- Signed-off-by: Guillaume W. Bres <[email protected]>
1 parent 6ae6684 commit 3df4a33

File tree

15 files changed

+577
-164
lines changed

15 files changed

+577
-164
lines changed

Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rinex"
3-
version = "0.18.1"
3+
version = "0.19.0"
44
license = "MPL-2.0"
55
authors = ["Guillaume W. Bres <[email protected]>"]
66
description = "RINEX file parsing, analysis and production"
@@ -156,10 +156,11 @@ num-traits = "0.2.15"
156156
num-integer = "0.1.44"
157157

158158
[dev-dependencies]
159+
flate2 = "1"
160+
rand = "0.8.4"
159161
serde_json = "1"
160162
criterion = "0.5"
161-
rand = "0.8.4"
162-
flate2 = "1"
163+
env_logger = "0.11"
163164

164165
[[bench]]
165166
name = "parsing"

db/NAV/orbits.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"idot": "f64",
2525
"l2Codes": "f64",
2626
"week": "u32",
27-
"l2pDataFlag": "f64",
27+
"l2p": "flag",
2828
"accuracy": "f64",
2929
"health": "flag",
3030
"tgd": "f64",
@@ -58,7 +58,7 @@
5858
"idot": "f64",
5959
"l2Codes": "f64",
6060
"week": "u32",
61-
"l2pDataFlag": "f64",
61+
"l2p": "flag",
6262
"accuracy": "f64",
6363
"health": "flag",
6464
"tgd": "f64",
@@ -92,7 +92,7 @@
9292
"idot": "f64",
9393
"l2Codes": "f64",
9494
"week": "u32",
95-
"l2pDataFlag": "f64",
95+
"l2p": "flag",
9696
"accuracy": "f64",
9797
"health": "flag",
9898
"tgd": "f64",
@@ -127,7 +127,7 @@
127127
"idot": "f64",
128128
"l2Codes": "f64",
129129
"week": "u32",
130-
"l2pDataFlag": "f64",
130+
"l2p": "flag",
131131
"accuracy": "f64",
132132
"health": "flag",
133133
"tgd": "f64",
@@ -432,7 +432,7 @@
432432
"idot": "f64",
433433
"l2Codes": "f64",
434434
"week": "u32",
435-
"l2pDataFlag": "f64",
435+
"l2p": "flag",
436436
"accuracy": "f64",
437437
"health": "flag",
438438
"tgd": "f64",
@@ -466,7 +466,7 @@
466466
"idot": "f64",
467467
"l2Codes": "f64",
468468
"week": "u32",
469-
"l2pDataFlag": "f64",
469+
"l2p": "flag",
470470
"accuracy": "f64",
471471
"health": "flag",
472472
"tgd": "f64",

src/bibliography.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,49 @@ pub enum Bibliography {
55
/// RINEX V2.11 specifications by IGS.
66
/// [DOI](https://files.igs.org/pub/data/format/rinex211.pdf).
77
RINEX211,
8+
89
/// RINEX V3 specifications by IGS.
910
/// [DOI](https://files.igs.org/pub/data/format/rinex300.pdf).
1011
RINEX3,
12+
1113
/// RINEX V4 specifications by IGS.
1214
/// [DOI](https://files.igs.org/pub/data/format/rinex_4.00.pdf).
1315
RINEX4,
16+
1417
/// J. Lesouple, 2019: *Estimation Parcimonieuse de Biais Multitrajets pour Systemes GNSS*.
1518
/// Pseudo range calculation method on page 50.
1619
/// Kepler Solver on page 159.
1720
/// Elevation and Azimuth angles determination, page 160.
1821
/// [DOI](http://perso.recherche.enac.fr/~julien.lesouple/fr/publication/thesis/THESIS.pdf?fbclid=IwAR3WlHm0eP7ygRzywbL07Ig-JawvsdCEdvz1umJJaRRXVO265J9cp931YyI)
1922
JLe19,
23+
2024
/// ESA NAVIPedia: *Combining Pairs of signals and clock definitions*.
2125
/// [DOI](https://gssc.esa.int/navipedia/index.php/Combining_pairs_of_signals_and_clock_definition)
2226
ESAGnssCombination,
27+
2328
/// ASCE Appendix 3: *Calculation of Satellite Position from Ephemeris Data*.
2429
/// [DOI](https://ascelibrary.org/doi/pdf/10.1061/9780784411506.ap03).
2530
AsceAppendix3,
31+
2632
/// ESA GNSS Data Processing Book Vol. I.
2733
/// [DOI](https://gssc.esa.int/navipedia/GNSS_Book/ESA_GNSS-Book_TM-23_Vol_I.pdf).
2834
ESABookVol1,
35+
2936
/// ESA GNSS Data Processing Book Vol. II.
3037
/// [DOI](https://gssc.esa.int/navipedia/GNSS_Book/ESA_GNSS-Book_TM-23_Vol_II.pdf).
3138
ESABookVol2,
39+
3240
/// E. Schönemann, M. Becker, T. Springer, 2011:
3341
/// *A new Approach for GNSS Analysis in a Multi-GNSS and Multi-Signal Environment*.
3442
/// [DOI](https://www.degruyter.com/document/doi/10.2478/v10156-010-0023-2/pdf).
3543
GeoScienceJournal1,
44+
3645
/// V. Pinazo Garcia, N. Woodhouse:
3746
/// *Multipath Analysis Using Code-Minus-Carrier technique in
3847
/// GNSS antennas*.
3948
/// [DOI](https://cdn.taoglas.com/wp-content/uploads/pdf/Multipath-Analysis-Using-Code-Minus-Carrier-Technique-in-GNSS-Antennas-_WhitePaper_VP__Final-1.pdf).
4049
MpTaoglas,
50+
4151
/// BeiDou Navigation Satellite System Signal In Space Interface Control Document(BDS-3)
4252
/// [B1I](http://www.beidou.gov.cn/xt/gfxz/201902/P020190227593621142475.pdf)
4353
/// [B1c](http://www.beidou.gov.cn/xt/gfxz/201712/P020171226741342013031.pdf)

src/navigation/ephemeris/kepler/helper.rs

Lines changed: 20 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -4,46 +4,54 @@ use log::{error, warn};
44
use crate::{
55
constants::{Constants, Omega},
66
navigation::Ephemeris,
7-
prelude::{nav::Orbit, Constellation, Epoch, TimeScale, SV},
7+
prelude::{Constellation, Epoch, SV},
88
};
99

1010
use nalgebra::{Matrix3, Rotation, Rotation3, SMatrix, Vector4};
1111

12-
use anise::{constants::frames::EARTH_J2000, math::Vector3};
12+
use anise::math::Vector3;
1313

1414
/// [Helper] helps calcualte satellite orbital state from Keplerian elements.
1515
#[derive(Debug, Clone, Copy)]
1616
pub struct Helper {
17-
/// Satellite
17+
/// [SV] satellite identity
1818
pub sv: SV,
19+
1920
/// The difference between the calculated time and the ephemeris reference time
2021
pub t_k: f64,
21-
/// Ascending angle(corrected)
22+
23+
/// Ascending angle (corrected) in radians
2224
pub u_k: f64,
23-
/// Radius(corrected)
25+
26+
/// Radius(corrected) in radians
2427
pub r_k: f64,
25-
/// Orbital inclination(corrected)
28+
29+
/// Orbital inclination (corrected) in radians
2630
pub i_k: f64,
27-
/// Ascending node right ascension
31+
32+
/// Ascending node right ascension (in radians)
2833
pub omega_k: f64,
34+
2935
/// First Derivative of Ascending angle(corrected)
3036
pub fd_u_k: f64,
37+
3138
/// First Derivative of Radius(corrected)
3239
pub fd_r_k: f64,
40+
3341
/// First Derivative of Orbital inclination(corrected)
3442
pub fd_i_k: f64,
43+
3544
/// First Derivative of Ascending node right ascension
3645
pub fd_omega_k: f64,
46+
3747
/// Relativistic Effect Correction
3848
pub dtr: f64,
49+
3950
/// First Derivative of Relativistic Effect Correction
4051
pub fd_dtr: f64,
52+
4153
/// r_sv in meters ECEF
4254
pub r_sv: (f64, f64, f64),
43-
/// ECEF to Celestial rotation matrix
44-
pub cie_rot: Rotation3<f64>,
45-
/// Orbit
46-
pub orbit: Orbit,
4755
}
4856

4957
impl Helper {
@@ -228,19 +236,13 @@ impl Helper {
228236
impl Ephemeris {
229237
/// Try to form obtain a [Helper] for Keplerian equations solving.
230238
/// This will fail on Glonass and SBAS constellations.
231-
pub fn helper(&self, sv: SV, t_sv: Epoch, t: Epoch) -> Option<Helper> {
239+
pub fn helper(&self, sv: SV, t: Epoch) -> Option<Helper> {
232240
// const
233241
let gm_m3_s2 = Constants::gm(sv);
234242
let omega = Constants::omega(sv);
235243
let dtr_f = Constants::dtr_f(sv);
236244

237245
let t_k = self.t_k(sv, t)?;
238-
if t_k < 0.0 {
239-
#[cfg(feature = "log")]
240-
error!("t_k < 0.0: bad op");
241-
242-
return None;
243-
}
244246

245247
let mut kepler = self.kepler()?;
246248
let perturbations = self.perturbations()?;
@@ -332,52 +334,11 @@ impl Ephemeris {
332334
// position in orbital plane
333335
let (x, y) = (r_k * u_k.cos(), r_k * u_k.sin());
334336

335-
// rotated position
336-
// let (sin_omega_k, cos_omega_k) = omega_k.sin_cos();
337-
// let (sin_i_k, cos_i_k) = i_k.sin_cos();
338-
339-
// earth rotation
340-
let t_sv_gpst = t_sv.to_time_scale(TimeScale::GPST);
341-
let t_gpst = t.to_time_scale(TimeScale::GPST);
342-
let earth_rot = omega * (t_sv_gpst - t_gpst).to_seconds();
343-
let (sin_earth_rot, cos_earth_rot) = earth_rot.sin_cos();
344-
345-
//let r_sv = (
346-
// x * cos_omega_k - y * sin_omega_k * sin_i_k,
347-
// x * sin_omega_k + y * cos_omega_k * cos_i_k,
348-
// y * sin_i_k,
349-
//);
350337
let r_sv = (x, y, 0.0);
351338

352-
let cie_rot = Rotation3::from_matrix(&Matrix3::new(
353-
cos_earth_rot,
354-
-sin_earth_rot,
355-
0.0,
356-
sin_earth_rot,
357-
cos_earth_rot,
358-
0.0,
359-
0.0,
360-
0.0,
361-
1.0,
362-
));
363-
364-
// Finally, determine Orbital state
365-
let orbit = Orbit::try_keplerian(
366-
kepler.a * 1e-3,
367-
kepler.e,
368-
i_k.to_degrees(),
369-
omega_k.to_degrees(),
370-
omega.to_degrees(),
371-
v_k.to_degrees(),
372-
t_gpst,
373-
EARTH_J2000.with_mu_km3_s2(gm_m3_s2 * 1e-9),
374-
)
375-
.ok()?;
376-
377339
Some(Helper {
378340
sv,
379341
t_k,
380-
orbit,
381342
omega_k,
382343
dtr,
383344
fd_dtr,
@@ -389,7 +350,6 @@ impl Ephemeris {
389350
fd_i_k,
390351
fd_omega_k,
391352
r_sv,
392-
cie_rot,
393353
})
394354
}
395355
}

0 commit comments

Comments
 (0)