Skip to content

Commit

Permalink
take possible missing PR (filtered out on SNR mask) into account
Browse files Browse the repository at this point in the history
Signed-off-by: Guillaume W. Bres <guillaume.bressaix@gmail.com>
  • Loading branch information
gwbres committed Nov 29, 2023
1 parent 1b93972 commit b94ea55
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/candidate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,11 @@ impl Candidate {
* Infaillible, because we don't allow to build Self without at least
* 1 PR observation
*/
pub(crate) fn prefered_pseudorange(&self) -> &Observation {
pub(crate) fn prefered_pseudorange(&self) -> Option<&Observation> {
self.code
.iter()
// .map(|pr| pr.value)
.reduce(|k, _| k)
.unwrap()
}
/*
* apply min SNR mask
Expand Down Expand Up @@ -178,7 +177,14 @@ impl Candidate {
pub(crate) fn transmission_time(&self, cfg: &Config) -> Result<(Epoch, f64), Error> {
let (t, ts) = (self.t, self.t.time_scale);
let seconds_ts = t.to_duration().to_seconds();
let dt_tx = seconds_ts - self.prefered_pseudorange().value / SPEED_OF_LIGHT;

let dt_tx = seconds_ts
- self
.prefered_pseudorange()
.ok_or(Error::MissingPseudoRange)?
.value
/ SPEED_OF_LIGHT;

let mut e_tx = Epoch::from_duration(dt_tx * Unit::Second, ts);

if cfg.modeling.sv_clock_bias {
Expand Down Expand Up @@ -244,7 +250,10 @@ impl Candidate {
y[row_index] -= delay * SPEED_OF_LIGHT;
}

let pr = self.prefered_pseudorange();
let pr = self
.prefered_pseudorange()
.ok_or(Error::MissingPseudoRange)?;

let (pr, frequency) = (pr.value, pr.frequency);

/*
Expand Down
2 changes: 2 additions & 0 deletions src/solver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ pub enum Error {
TimeIsNan,
#[error("undefined apriori position")]
UndefinedAprioriPosition,
#[error("missing pseudo range observation")]
MissingPseudoRange,
#[error("at least one pseudo range observation is mandatory")]
NeedsAtLeastOnePseudoRange,
#[error("failed to model or measure ionospheric delay")]
Expand Down

0 comments on commit b94ea55

Please sign in to comment.