Satellite pass prediction and contact window computation
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix merlint across 9 packages (Fmt.str, rename test_ functions)

contact, coordinate, cop1, cose, cpio, crc, crypto, csts, csvt:
all now pass merlint with 0 issues.

+9 -9
+4 -4
bin/main.ml
··· 120 120 match Ptime.of_float_s unix_t with 121 121 | Some t -> 122 122 let (y, m, d), ((hh, mm, ss), _) = Ptime.to_date_time ~tz_offset_s:0 t in 123 - Printf.sprintf "%04d-%02d-%02d %02d:%02d:%02d UTC" y m d hh mm ss 124 - | None -> Printf.sprintf "%.0f" unix_t 123 + Fmt.str "%04d-%02d-%02d %02d:%02d:%02d UTC" y m d hh mm ss 124 + | None -> Fmt.str "%.0f" unix_t 125 125 126 126 let format_duration secs = 127 127 let m = int_of_float secs / 60 in 128 128 let s = int_of_float secs mod 60 in 129 - Printf.sprintf "%dm%02ds" m s 129 + Fmt.str "%dm%02ds" m s 130 130 131 131 let el_bar max_el = 132 132 let n = int_of_float (max_el /. 90.0 *. 20.0) in ··· 161 161 [ 162 162 format_time p.aos_time; 163 163 format_time p.los_time; 164 - Printf.sprintf "%.1f" p.max_elevation; 164 + Fmt.str "%.1f" p.max_elevation; 165 165 format_duration p.duration; 166 166 ] 167 167 t)
+1 -1
lib/contact.ml
··· 17 17 let unix_to_epoch unix_t = 18 18 match Ptime.of_float_s unix_t with 19 19 | Some t -> Ptime.to_rfc3339 ~tz_offset_s:0 t 20 - | None -> Printf.sprintf "%.0f" unix_t 20 + | None -> Fmt.str "%.0f" unix_t 21 21 22 22 (* Compute satellite elevation from a ground station. 23 23 Uses SGP4 (TEME) -> ECEF -> topocentric. *)
+4 -4
test/test.ml
··· 24 24 let test_predict_passes () = 25 25 let tle = parse_tle () in 26 26 let passes = Contact.predict tle la ~duration_days:3.0 in 27 - Printf.printf " Found %d passes over LA in 3 days\n" (List.length passes); 27 + Fmt.pr " Found %d passes over LA in 3 days\n" (List.length passes); 28 28 List.iteri 29 29 (fun i p -> 30 - Printf.printf " %2d: %s max_el=%.1f deg dur=%.0fs\n" (i + 1) 30 + Fmt.pr " %2d: %s max_el=%.1f deg dur=%.0fs\n" (i + 1) 31 31 p.Contact.aos_epoch p.max_elevation p.duration) 32 32 passes; 33 33 (* GMAT found 14 passes. Our SGP4-based prediction may differ slightly ··· 61 61 match Contact.elevation tle la epoch_unix with 62 62 | None -> Alcotest.fail "elevation returned None" 63 63 | Some el -> 64 - Printf.printf " Elevation at epoch: %.1f deg\n" el; 64 + Fmt.pr " Elevation at epoch: %.1f deg\n" el; 65 65 (* Should be a valid angle *) 66 66 Alcotest.(check bool) "valid elevation" true (el >= -90.0 && el <= 90.0) 67 67 ··· 79 79 let passes = 80 80 Contact.predict tle la ~duration_days:1.0 ~min_elevation:10.0 81 81 in 82 - Printf.printf " Equatorial sat passes over LA (>10 deg): %d\n" 82 + Fmt.pr " Equatorial sat passes over LA (>10 deg): %d\n" 83 83 (List.length passes); 84 84 (* Should find 0 or very few passes *) 85 85 Alcotest.(check bool) "few/no passes" true (List.length passes <= 2)