File tree 4 files changed +62
-10
lines changed
tests/orbit_determination
4 files changed +62
-10
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ use rand::Rng;
23
23
use rand_distr:: Normal ;
24
24
use serde_derive:: { Deserialize , Serialize } ;
25
25
use std:: fmt;
26
- use std:: ops:: Mul ;
26
+ use std:: ops:: { Mul , MulAssign } ;
27
27
28
28
use super :: Stochastics ;
29
29
@@ -153,14 +153,18 @@ impl Mul<f64> for GaussMarkov {
153
153
type Output = Self ;
154
154
155
155
/// Scale the Gauss Markov process by a constant, maintaining the same time constant.
156
- fn mul ( self , rhs : f64 ) -> Self :: Output {
157
- Self {
158
- tau : self . tau ,
159
- process_noise : self . process_noise * rhs,
160
- constant : None ,
161
- init_sample : None ,
162
- prev_epoch : None ,
163
- }
156
+ fn mul ( mut self , rhs : f64 ) -> Self :: Output {
157
+ self . process_noise *= rhs;
158
+ self . constant = None ;
159
+ self . init_sample = None ;
160
+ self . prev_epoch = None ;
161
+ self
162
+ }
163
+ }
164
+
165
+ impl MulAssign < f64 > for GaussMarkov {
166
+ fn mul_assign ( & mut self , rhs : f64 ) {
167
+ * self = * self * rhs;
164
168
}
165
169
}
166
170
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ use rand_pcg::Pcg64Mcg;
27
27
use serde_derive:: { Deserialize , Serialize } ;
28
28
use std:: error:: Error ;
29
29
use std:: fs:: File ;
30
+ use std:: ops:: { Mul , MulAssign } ;
30
31
use std:: path:: Path ;
31
32
use std:: sync:: Arc ;
32
33
@@ -212,6 +213,27 @@ impl StochasticNoise {
212
213
}
213
214
}
214
215
216
+ impl Mul < f64 > for StochasticNoise {
217
+ type Output = Self ;
218
+
219
+ fn mul ( mut self , rhs : f64 ) -> Self :: Output {
220
+ if let Some ( mut wn) = & mut self . white_noise {
221
+ wn *= rhs;
222
+ }
223
+ if let Some ( mut gm) = & mut self . bias {
224
+ gm *= rhs;
225
+ }
226
+
227
+ self
228
+ }
229
+ }
230
+
231
+ impl MulAssign < f64 > for StochasticNoise {
232
+ fn mul_assign ( & mut self , rhs : f64 ) {
233
+ * self = * self * rhs;
234
+ }
235
+ }
236
+
215
237
pub struct StochasticState {
216
238
pub run : u32 ,
217
239
pub dt_s : f64 ,
Original file line number Diff line number Diff line change 16
16
along with this program. If not, see <https://www.gnu.org/licenses/>.
17
17
*/
18
18
19
+ use std:: ops:: { Mul , MulAssign } ;
20
+
19
21
use anise:: constants:: SPEED_OF_LIGHT_KM_S ;
20
22
use hifitime:: { Duration , Epoch } ;
21
23
use rand:: Rng ;
@@ -77,6 +79,22 @@ impl Stochastics for WhiteNoise {
77
79
}
78
80
}
79
81
82
+ impl Mul < f64 > for WhiteNoise {
83
+ type Output = Self ;
84
+
85
+ /// Scale the white noise sigmas by a constant.
86
+ fn mul ( mut self , rhs : f64 ) -> Self :: Output {
87
+ self . sigma *= rhs;
88
+ self
89
+ }
90
+ }
91
+
92
+ impl MulAssign < f64 > for WhiteNoise {
93
+ fn mul_assign ( & mut self , rhs : f64 ) {
94
+ * self = * self * rhs;
95
+ }
96
+ }
97
+
80
98
#[ cfg( test) ]
81
99
mod ut_wn {
82
100
use hifitime:: { Epoch , TimeUnits } ;
Original file line number Diff line number Diff line change @@ -216,7 +216,7 @@ fn continuous_tracking_cov_test(tracking_data: TrackingDataArc) {
216
216
fn od_with_modulus_cov_test (
217
217
spacecraft : Spacecraft ,
218
218
tracking_data : TrackingDataArc ,
219
- devices : BTreeMap < String , GroundStation > ,
219
+ mut devices : BTreeMap < String , GroundStation > ,
220
220
trajectory : Trajectory ,
221
221
almanac : Arc < Almanac > ,
222
222
) {
@@ -227,6 +227,14 @@ fn od_with_modulus_cov_test(
227
227
arc. set_moduli ( MeasurementType :: Range , jpl_dsn_code_length_km) ;
228
228
arc. apply_moduli ( ) ;
229
229
230
+ // Increase the noise on the OD process
231
+ // Set a bias instead of assuming a modulus.
232
+ for ( _, device) in & mut devices {
233
+ for ( _, stochastics) in device. stochastic_noises . as_mut ( ) . unwrap ( ) . iter_mut ( ) {
234
+ * stochastics *= 2.0 ;
235
+ }
236
+ }
237
+
230
238
let uncertainty = SpacecraftUncertainty :: builder ( )
231
239
. nominal ( spacecraft)
232
240
. frame ( LocalFrame :: RIC )
You can’t perform that action at this time.
0 commit comments