Skip to content

Commit 2532881

Browse files
Add light time to the AzElRange structure
1 parent e1f0fd6 commit 2532881

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

anise/src/almanac/aer.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
use crate::{
1212
astro::{Aberration, AzElRange},
13+
constants::SPEED_OF_LIGHT_KM_S,
1314
ephemerides::{EphemerisError, EphemerisPhysicsSnafu},
1415
errors::{AlmanacError, EphemerisSnafu, PhysicsError},
1516
frames::Frame,
@@ -21,6 +22,7 @@ use crate::{
2122
use super::Almanac;
2223
use crate::errors::AlmanacResult;
2324

25+
use hifitime::TimeUnits;
2426
use log::warn;
2527

2628
use snafu::ResultExt;
@@ -120,6 +122,7 @@ impl Almanac {
120122
range_km: rho_sez.norm(),
121123
range_rate_km_s,
122124
obstructed_by,
125+
light_time: (rho_sez.norm() / SPEED_OF_LIGHT_KM_S).seconds(),
123126
})
124127
}
125128
}

anise/src/astro/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ use std::fmt::Display;
1313
use crate::errors::PhysicsError;
1414
use crate::frames::Frame;
1515

16-
use hifitime::Epoch;
16+
use hifitime::{Duration, Epoch, TimeUnits};
17+
18+
use crate::constants::SPEED_OF_LIGHT_KM_S;
1719

1820
#[cfg(feature = "python")]
1921
use pyo3::exceptions::PyTypeError;
@@ -47,6 +49,7 @@ pub struct AzElRange {
4749
pub range_km: f64,
4850
pub range_rate_km_s: f64,
4951
pub obstructed_by: Option<Frame>,
52+
pub light_time: Duration,
5053
}
5154

5255
#[cfg_attr(feature = "python", pymethods)]
@@ -79,6 +82,7 @@ impl AzElRange {
7982
range_km,
8083
range_rate_km_s,
8184
obstructed_by,
85+
light_time: (range_km / SPEED_OF_LIGHT_KM_S).seconds(),
8286
}
8387
}
8488

0 commit comments

Comments
 (0)