ocaml-clcw#
CCSDS Command Link Control Word (CLCW) parser and encoder.
The CLCW is a 32-bit word defined in CCSDS 232.1-B-2, carried in the Operational Control Field (OCF) of TM and AOS Transfer Frames. It provides feedback from the receiving spacecraft to the ground about the state of the command link.
Installation#
opam install clcw
Usage#
(* Decode a CLCW word *)
let () =
let word = 0x01280032 in
match Clcw.decode word with
| Error e -> Printf.printf "Error: %a\n" Clcw.pp_error e
| Ok clcw -> Printf.printf "CLCW: %a\n" Clcw.pp clcw
(* Encode a CLCW *)
let () =
let vcid = Clcw.vcid_exn 10 in
let clcw = Clcw.v ~vcid ~report_value:50 ~lockout:true () in
let word = Clcw.encode clcw in
Printf.printf "Encoded: 0x%08X\n" word
CLCW Format#
Bit 0: Control Word Type (0=CLCW)
Bits 1-2: CLCW Version Number
Bits 3-5: Status Field
Bits 6-7: COP in Effect
Bits 8-13: Virtual Channel ID
Bits 14-15: Reserved (spare)
Bit 16: No RF Available
Bit 17: No Bit Lock
Bit 18: Lockout
Bit 19: Wait
Bit 20: Retransmit
Bits 21-22: FARM-B Counter
Bit 23: Reserved (spare)
Bits 24-31: Report Value N(R)
Licence#
MIT