Orbit Data Messages (CCSDS 502.0-B-3)
0
fork

Configure Feed

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

odm: rename test_ functions in interop test (merlint E330)

+50 -50
+50 -50
test/interop/gmat/test.ml
··· 27 27 ISS-like orbit: SMA=6778.137 km, ECC=0.0008, INC=51.6 deg. 28 28 High-fidelity propagation (20x20 gravity, MSISE90, SRP, lunisolar). *) 29 29 30 - let test_leo_parse () = 30 + let leo_parse () = 31 31 let oem = parse_oem "leo_7day.oem" in 32 32 let segs = Odm.segments oem in 33 33 Alcotest.(check bool) "has segments" true (List.length segs > 0); ··· 36 36 (* 7 days at 60s step = 10080 + 1 vectors *) 37 37 Alcotest.(check bool) "~10K vectors" true (Array.length sv > 10000) 38 38 39 - let test_leo_metadata () = 39 + let leo_metadata () = 40 40 let oem = parse_oem "leo_7day.oem" in 41 41 let seg = List.hd (Odm.segments oem) in 42 42 Alcotest.(check string) "ref frame" "EME2000" seg.metadata.ref_frame; ··· 47 47 48 48 (* GMAT outputs "ORIGINATOR = GMAT USER" — space inside the value. 49 49 Parser must not split on internal whitespace. *) 50 - let test_leo_originator_with_space () = 50 + let leo_originator_with_space () = 51 51 let oem = parse_oem "leo_7day.oem" in 52 52 Alcotest.(check string) "originator" "GMAT USER" oem.header.originator 53 53 54 54 (* GMAT outputs "INTERPOLATION_DEGREE = 7 " with trailing space. 55 55 Parser must trim before int_of_string. *) 56 - let test_leo_interpolation_degree () = 56 + let leo_interpolation_degree () = 57 57 let oem = parse_oem "leo_7day.oem" in 58 58 let seg = List.hd (Odm.segments oem) in 59 59 Alcotest.(check (option int)) 60 60 "interpolation degree" (Some 7) seg.metadata.interpolation_degree 61 61 62 - let test_leo_radius_bounds () = 62 + let leo_radius_bounds () = 63 63 let oem = parse_oem "leo_7day.oem" in 64 64 let svs = Odm.state_vectors (List.hd (Odm.segments oem)) in 65 65 Array.iter ··· 69 69 Alcotest.failf "radius out of bounds: %.1f km at %s" r sv.epoch) 70 70 svs 71 71 72 - let test_leo_velocity_bounds () = 72 + let leo_velocity_bounds () = 73 73 let oem = parse_oem "leo_7day.oem" in 74 74 let svs = Odm.state_vectors (List.hd (Odm.segments oem)) in 75 75 Array.iter ··· 79 79 Alcotest.failf "velocity out of bounds: %.3f km/s at %s" v sv.epoch) 80 80 svs 81 81 82 - let test_leo_epoch_range () = 82 + let leo_epoch_range () = 83 83 let oem = parse_oem "leo_7day.oem" in 84 84 let start, stop = Odm.epoch_range (List.hd (Odm.segments oem)) in 85 85 Alcotest.(check string) "start epoch" "2026-01-01T00:00:00.000" start; ··· 88 88 (* First data line has Vz = 3.68e-16 km/s (machine epsilon). 89 89 Verify no NaN or underflow to exactly 0.0 — the parsed value should be 90 90 non-zero and finite. *) 91 - let test_leo_near_zero_velocity_component () = 91 + let leo_near_zero_velocity_component () = 92 92 let oem = parse_oem "leo_7day.oem" in 93 93 let svs = Odm.state_vectors (List.hd (Odm.segments oem)) in 94 94 let vz = svs.(0).Odm.vel.z in ··· 98 98 99 99 (* All state vectors must have finite (non-NaN, non-inf) components. 100 100 GMAT uses 16-digit scientific notation — parser must handle full precision. *) 101 - let test_leo_no_nan_or_inf () = 101 + let leo_no_nan_or_inf () = 102 102 let oem = parse_oem "leo_7day.oem" in 103 103 let svs = Odm.state_vectors (List.hd (Odm.segments oem)) in 104 104 Array.iteri ··· 117 117 svs 118 118 119 119 (* Epochs must be monotonically increasing. *) 120 - let test_leo_epoch_monotonic () = 120 + let leo_epoch_monotonic () = 121 121 let oem = parse_oem "leo_7day.oem" in 122 122 let svs = Odm.state_vectors (List.hd (Odm.segments oem)) in 123 123 for i = 1 to Array.length svs - 1 do ··· 128 128 129 129 (* Energy conservation: specific orbital energy should be roughly constant 130 130 across the 7-day propagation (within drag/perturbation effects). *) 131 - let test_leo_energy_conservation () = 131 + let leo_energy_conservation () = 132 132 let oem = parse_oem "leo_7day.oem" in 133 133 let svs = Odm.state_vectors (List.hd (Odm.segments oem)) in 134 134 let mu = 398600.4418 in ··· 152 152 GMAT data points are the truth. Interpolation at an exact data point epoch 153 153 must return the exact GMAT value (Lagrange is exact at nodes). 154 154 Test at 10 evenly-spaced points across the segment. *) 155 - let test_leo_interpolation_at_nodes () = 155 + let leo_interpolation_at_nodes () = 156 156 let oem = parse_oem "leo_7day.oem" in 157 157 let seg = List.hd (Odm.segments oem) in 158 158 let svs = Odm.state_vectors seg in ··· 183 183 (* Interpolation at Molniya perigee. 184 184 Perigee is the hardest case — maximum velocity, maximum curvature. 185 185 Interpolation at a known GMAT perigee point must be exact. *) 186 - let test_molniya_interpolation_perigee () = 186 + let molniya_interpolation_perigee () = 187 187 let oem = parse_oem "molniya_2day.oem" in 188 188 let seg = List.hd (Odm.segments oem) in 189 189 let svs = Odm.state_vectors seg in ··· 224 224 Source: GMAT R2026a, geo_3day.script. 225 225 GEO orbit: SMA=42164 km, ECC=0.0001, INC=0.05 deg. *) 226 226 227 - let test_geo_parse () = 227 + let geo_parse () = 228 228 let oem = parse_oem "geo_3day.oem" in 229 229 let sv = Odm.state_vectors (List.hd (Odm.segments oem)) in 230 230 Alcotest.(check bool) "~864 vectors" true (Array.length sv > 800) 231 231 232 - let test_geo_radius () = 232 + let geo_radius () = 233 233 let oem = parse_oem "geo_3day.oem" in 234 234 let svs = Odm.state_vectors (List.hd (Odm.segments oem)) in 235 235 Array.iter ··· 239 239 Alcotest.failf "GEO radius out of bounds: %.1f km at %s" r sv.epoch) 240 240 svs 241 241 242 - let test_geo_velocity () = 242 + let geo_velocity () = 243 243 let oem = parse_oem "geo_3day.oem" in 244 244 let svs = Odm.state_vectors (List.hd (Odm.segments oem)) in 245 245 Array.iter ··· 251 251 252 252 (* GEO: near-circular orbit. Eccentricity < 0.001 means radius variation 253 253 should be tiny (< 50 km peak-to-peak). *) 254 - let test_geo_near_circular () = 254 + let geo_near_circular () = 255 255 let oem = parse_oem "geo_3day.oem" in 256 256 let svs = Odm.state_vectors (List.hd (Odm.segments oem)) in 257 257 let min_r = ref Float.infinity in ··· 266 266 Alcotest.(check bool) "radius variation < 50 km" true (variation < 50.0); 267 267 Fmt.pr " GEO radius variation: %.3f km\n" variation 268 268 269 - let test_geo_no_nan_or_inf () = 269 + let geo_no_nan_or_inf () = 270 270 let oem = parse_oem "geo_3day.oem" in 271 271 let svs = Odm.state_vectors (List.hd (Odm.segments oem)) in 272 272 Array.iteri ··· 290 290 in position values, near-zero Y components (1e-12 km), velocities 291 291 from 1.5 to 10 km/s. *) 292 292 293 - let test_molniya_parse () = 293 + let molniya_parse () = 294 294 let oem = parse_oem "molniya_2day.oem" in 295 295 let sv = Odm.state_vectors (List.hd (Odm.segments oem)) in 296 296 Alcotest.(check bool) "~5760 vectors" true (Array.length sv > 5700) 297 297 298 - let test_molniya_radius_range () = 298 + let molniya_radius_range () = 299 299 let oem = parse_oem "molniya_2day.oem" in 300 300 let svs = Odm.state_vectors (List.hd (Odm.segments oem)) in 301 301 let min_r = ref Float.infinity in ··· 314 314 (!max_r > 44000.0 && !max_r < 48000.0); 315 315 Fmt.pr " Molniya: perigee %.1f km, apogee %.1f km\n" !min_r !max_r 316 316 317 - let test_molniya_velocity_range () = 317 + let molniya_velocity_range () = 318 318 let oem = parse_oem "molniya_2day.oem" in 319 319 let svs = Odm.state_vectors (List.hd (Odm.segments oem)) in 320 320 let min_v = ref Float.infinity in ··· 334 334 335 335 (* Molniya Y-position at epoch is ~1e-12 km (numerical noise from integrator). 336 336 Parser must handle exponents down to e-15 without underflow to zero. *) 337 - let test_molniya_near_zero_components () = 337 + let molniya_near_zero_components () = 338 338 let oem = parse_oem "molniya_2day.oem" in 339 339 let svs = Odm.state_vectors (List.hd (Odm.segments oem)) in 340 340 let y0 = svs.(0).Odm.pos.y in ··· 343 343 Alcotest.(check bool) "Y0 ~1e-12" true (Float.abs y0 < 1e-10) 344 344 345 345 (* All 5760+ vectors must be finite — no NaN from parsing 1e-15 exponents. *) 346 - let test_molniya_no_nan_or_inf () = 346 + let molniya_no_nan_or_inf () = 347 347 let oem = parse_oem "molniya_2day.oem" in 348 348 let svs = Odm.state_vectors (List.hd (Odm.segments oem)) in 349 349 Array.iteri ··· 363 363 364 364 (* Vis-viva: v^2 = mu * (2/r - 1/a). For Molniya, SMA=26600 km. 365 365 At each point, check vis-viva holds within perturbation error. *) 366 - let test_molniya_vis_viva () = 366 + let molniya_vis_viva () = 367 367 let oem = parse_oem "molniya_2day.oem" in 368 368 let svs = Odm.state_vectors (List.hd (Odm.segments oem)) in 369 369 let mu = 398600.4418 in ··· 389 389 svs 390 390 391 391 (* Epoch monotonicity for Molniya (30s step — more data points to check). *) 392 - let test_molniya_epoch_monotonic () = 392 + let molniya_epoch_monotonic () = 393 393 let oem = parse_oem "molniya_2day.oem" in 394 394 let svs = Odm.state_vectors (List.hd (Odm.segments oem)) in 395 395 for i = 1 to Array.length svs - 1 do ··· 403 403 [ 404 404 ( "leo", 405 405 [ 406 - Alcotest.test_case "parse" `Quick test_leo_parse; 407 - Alcotest.test_case "metadata" `Quick test_leo_metadata; 406 + Alcotest.test_case "parse" `Quick leo_parse; 407 + Alcotest.test_case "metadata" `Quick leo_metadata; 408 408 Alcotest.test_case "originator with space" `Quick 409 - test_leo_originator_with_space; 409 + leo_originator_with_space; 410 410 Alcotest.test_case "interpolation degree" `Quick 411 - test_leo_interpolation_degree; 412 - Alcotest.test_case "radius bounds" `Quick test_leo_radius_bounds; 413 - Alcotest.test_case "velocity bounds" `Quick test_leo_velocity_bounds; 414 - Alcotest.test_case "epoch range" `Quick test_leo_epoch_range; 411 + leo_interpolation_degree; 412 + Alcotest.test_case "radius bounds" `Quick leo_radius_bounds; 413 + Alcotest.test_case "velocity bounds" `Quick leo_velocity_bounds; 414 + Alcotest.test_case "epoch range" `Quick leo_epoch_range; 415 415 Alcotest.test_case "near-zero Vz (3.68e-16)" `Quick 416 - test_leo_near_zero_velocity_component; 417 - Alcotest.test_case "no NaN or inf" `Quick test_leo_no_nan_or_inf; 418 - Alcotest.test_case "epoch monotonic" `Quick test_leo_epoch_monotonic; 416 + leo_near_zero_velocity_component; 417 + Alcotest.test_case "no NaN or inf" `Quick leo_no_nan_or_inf; 418 + Alcotest.test_case "epoch monotonic" `Quick leo_epoch_monotonic; 419 419 Alcotest.test_case "energy conservation" `Quick 420 - test_leo_energy_conservation; 420 + leo_energy_conservation; 421 421 Alcotest.test_case "interpolation at nodes" `Quick 422 - test_leo_interpolation_at_nodes; 422 + leo_interpolation_at_nodes; 423 423 ] ); 424 424 ( "geo", 425 425 [ 426 - Alcotest.test_case "parse" `Quick test_geo_parse; 427 - Alcotest.test_case "radius" `Quick test_geo_radius; 428 - Alcotest.test_case "velocity" `Quick test_geo_velocity; 429 - Alcotest.test_case "near-circular" `Quick test_geo_near_circular; 430 - Alcotest.test_case "no NaN or inf" `Quick test_geo_no_nan_or_inf; 426 + Alcotest.test_case "parse" `Quick geo_parse; 427 + Alcotest.test_case "radius" `Quick geo_radius; 428 + Alcotest.test_case "velocity" `Quick geo_velocity; 429 + Alcotest.test_case "near-circular" `Quick geo_near_circular; 430 + Alcotest.test_case "no NaN or inf" `Quick geo_no_nan_or_inf; 431 431 ] ); 432 432 ( "molniya", 433 433 [ 434 - Alcotest.test_case "parse" `Quick test_molniya_parse; 435 - Alcotest.test_case "radius range" `Quick test_molniya_radius_range; 436 - Alcotest.test_case "velocity range" `Quick test_molniya_velocity_range; 434 + Alcotest.test_case "parse" `Quick molniya_parse; 435 + Alcotest.test_case "radius range" `Quick molniya_radius_range; 436 + Alcotest.test_case "velocity range" `Quick molniya_velocity_range; 437 437 Alcotest.test_case "near-zero Y (1e-12)" `Quick 438 - test_molniya_near_zero_components; 439 - Alcotest.test_case "no NaN or inf" `Quick test_molniya_no_nan_or_inf; 440 - Alcotest.test_case "vis-viva consistency" `Quick test_molniya_vis_viva; 438 + molniya_near_zero_components; 439 + Alcotest.test_case "no NaN or inf" `Quick molniya_no_nan_or_inf; 440 + Alcotest.test_case "vis-viva consistency" `Quick molniya_vis_viva; 441 441 Alcotest.test_case "epoch monotonic" `Quick 442 - test_molniya_epoch_monotonic; 442 + molniya_epoch_monotonic; 443 443 Alcotest.test_case "interpolation at perigee" `Quick 444 - test_molniya_interpolation_perigee; 444 + molniya_interpolation_perigee; 445 445 ] ); 446 446 ]