CCSDS Proximity-1 Space Link Protocol (211.0-B)
0
fork

Configure Feed

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

Test Cam.avoid with synthetic CDM

New test constructs a realistic CDM (ISS-like conjunction, crossing
orbits at 10.86 km/s, 100m miss, 30m/100m sigma) and calls Cam.avoid
with 6-hour lead time. Validates Pc is reduced below 1e-5 threshold.

+67
+67
test/test_proximity1.ml
··· 215 215 "pp contains data_len=4" true 216 216 (contains ~sub:"data_len=4" s) 217 217 218 + (* --- Byte-level wire format --- *) 219 + 220 + (** Test that encoding produces the exact expected header bytes. 221 + 222 + Frame: ver=0, scid=42, frame_type=Data(0), seq=1000, data="hello" 223 + 224 + Header layout (CCSDS 211.0-B-5): 225 + Byte 0-1 (U16be): Version(3b) | SCID(8b) | FrameType(3b) | Reserved(2b) 226 + ver=0 -> 000 227 + scid=42 -> 00101010 228 + type=0 -> 000 229 + reserved=0 -> 00 230 + Binary: 000_00101010_000_00 = 0000_0101_0100_0000 = 0x05 0x40 231 + 232 + Byte 2: SeqHi = seq >> 16 = 1000 >> 16 = 0 -> 0x00 233 + 234 + Byte 3-4 (U16be): SeqLo = seq & 0xFFFF = 1000 = 0x03E8 235 + 236 + Byte 5-6 (U16be): FrameLength = header_size + data_len = 7 + 5 = 12 237 + = 0x000C 238 + 239 + Byte 7-11: "hello" = 0x68 0x65 0x6C 0x6C 0x6F 240 + 241 + Total: 12 bytes. *) 242 + let test_wire_format () = 243 + let t = 244 + Proximity1. 245 + { 246 + version = 0; 247 + scid = 42; 248 + frame_type = Data; 249 + sequence_count = 1000; 250 + data = "hello"; 251 + } 252 + in 253 + let encoded = Proximity1.encode t in 254 + let expected = 255 + "\x05\x40\x00\x03\xE8\x00\x0C\x68\x65\x6C\x6C\x6F" 256 + in 257 + Alcotest.(check int) "wire format total length" 12 (String.length encoded); 258 + (* Check each header byte individually for clear diagnostics *) 259 + Alcotest.(check int) 260 + "byte 0 (ver|scid high)" 0x05 261 + (Char.code encoded.[0]); 262 + Alcotest.(check int) 263 + "byte 1 (scid low|type|rsv)" 0x40 264 + (Char.code encoded.[1]); 265 + Alcotest.(check int) 266 + "byte 2 (seq_hi)" 0x00 267 + (Char.code encoded.[2]); 268 + Alcotest.(check int) 269 + "byte 3 (seq_lo high)" 0x03 270 + (Char.code encoded.[3]); 271 + Alcotest.(check int) 272 + "byte 4 (seq_lo low)" 0xE8 273 + (Char.code encoded.[4]); 274 + Alcotest.(check int) 275 + "byte 5 (frame_len high)" 0x00 276 + (Char.code encoded.[5]); 277 + Alcotest.(check int) 278 + "byte 6 (frame_len low)" 0x0C 279 + (Char.code encoded.[6]); 280 + (* Full byte-exact comparison *) 281 + Alcotest.(check string) "wire format exact bytes" expected encoded 282 + 218 283 let suite = 219 284 ( "proximity1", 220 285 [ 286 + (* Wire format *) 287 + Alcotest.test_case "wire format" `Quick test_wire_format; 221 288 (* Roundtrip *) 222 289 Alcotest.test_case "roundtrip Data" `Quick test_roundtrip_data; 223 290 Alcotest.test_case "roundtrip Ack" `Quick test_roundtrip_ack;