Skip to content

Encoding/Decoding CCSDS (255,223) messages with reedsolomon #76

@Jazzinghen

Description

@Jazzinghen

I have been trying to use the library to encode/decode messages using the CCSDS standard for the last couple days and I cannot seem to be able to get results in line with a reference implementation. I am already handling conventional to double-base conversion, but it seems impossible to set the proper parameters for the encoder.

The parameters for the CCSDS encoder are the following:

  • Symbol size: 8
  • Message length: 255
  • Nsym: 32
  • Generator polynomial: 0x187 (x^8 + x^7 + x^2 + x + 1)
  • First consecutive root: 112
  • Primitive element: 11

I tried using the library with this configuration but it doesn't seem to generate the correct output:

encoder = crs.RSCodec(32,255,112,0x187,11)

Which has the following members:

encoder.gen -> 0x01,0x92,0x7a,0xf7,0x77,0x13,0x05,0xfe,0x90,0xec,0xdc,0xfd,0x2a,0xa4,0x24,0xd8,0x93,0xd8,0x24,0xa4,0x2a,0xfd,0xdc,0xec,0x90,0xfe,0x05,0x13,0x77,0xf7,0x7a,0x92,0x01
encoder.generator -> 11
encoder.prim -> 391

I have been also trying to debug the issue by checking all the steps, but due to my lack of knowledge on Reed-Solomon and the differences in implementation between the two libraries it is almost impossible for me.

I also tried to use detect_reedsolomon_parameters from pyFileFixty, and it cannot find the proper parameters:

print(detect_reedsolomon_parameters(test_data,test_message,gen_list=[2,3,5,11]))
Found closest set of parameters, with Hamming distance 30:
gen_nb=2 prim=285(0x11d) fcr=38
gen_nb=2 prim=285(0x11d) fcr=43
gen_nb=2 prim=285(0x11d) fcr=167
gen_nb=2 prim=299(0x12b) fcr=59
gen_nb=2 prim=299(0x12b) fcr=168
gen_nb=2 prim=299(0x12b) fcr=182
gen_nb=2 prim=333(0x14d) fcr=98
gen_nb=2 prim=333(0x14d) fcr=180
gen_nb=2 prim=333(0x14d) fcr=200
gen_nb=2 prim=351(0x15f) fcr=227
gen_nb=2 prim=357(0x165) fcr=84
gen_nb=2 prim=357(0x165) fcr=94
gen_nb=2 prim=357(0x165) fcr=213
gen_nb=2 prim=391(0x187) fcr=72
gen_nb=2 prim=391(0x187) fcr=208
gen_nb=2 prim=391(0x187) fcr=233
gen_nb=2 prim=397(0x18d) fcr=250
gen_nb=2 prim=425(0x1a9) fcr=4
gen_nb=2 prim=425(0x1a9) fcr=71
gen_nb=2 prim=451(0x1c3) fcr=3
gen_nb=2 prim=451(0x1c3) fcr=51
gen_nb=2 prim=451(0x1c3) fcr=113
gen_nb=2 prim=451(0x1c3) fcr=155
gen_nb=2 prim=463(0x1cf) fcr=91
gen_nb=2 prim=487(0x1e7) fcr=20
gen_nb=2 prim=501(0x1f5) fcr=9
gen_nb=3 prim=333(0x14d) fcr=98
gen_nb=3 prim=333(0x14d) fcr=180
gen_nb=3 prim=333(0x14d) fcr=200
gen_nb=3 prim=351(0x15f) fcr=227
gen_nb=3 prim=357(0x165) fcr=84
gen_nb=3 prim=357(0x165) fcr=94
gen_nb=3 prim=357(0x165) fcr=213
gen_nb=3 prim=397(0x18d) fcr=250
gen_nb=3 prim=419(0x1a3) fcr=60
gen_nb=3 prim=419(0x1a3) fcr=145
gen_nb=3 prim=419(0x1a3) fcr=230
gen_nb=3 prim=425(0x1a9) fcr=4
gen_nb=3 prim=425(0x1a9) fcr=71
gen_nb=3 prim=451(0x1c3) fcr=3
gen_nb=3 prim=451(0x1c3) fcr=51
gen_nb=3 prim=451(0x1c3) fcr=113
gen_nb=3 prim=451(0x1c3) fcr=155
gen_nb=3 prim=501(0x1f5) fcr=9
gen_nb=5 prim=333(0x14d) fcr=98
gen_nb=5 prim=333(0x14d) fcr=180
gen_nb=5 prim=333(0x14d) fcr=200
gen_nb=5 prim=351(0x15f) fcr=227
gen_nb=5 prim=357(0x165) fcr=84
gen_nb=5 prim=357(0x165) fcr=94
gen_nb=5 prim=357(0x165) fcr=213
gen_nb=5 prim=397(0x18d) fcr=250
gen_nb=5 prim=419(0x1a3) fcr=60
gen_nb=5 prim=419(0x1a3) fcr=145
gen_nb=5 prim=419(0x1a3) fcr=230
gen_nb=5 prim=425(0x1a9) fcr=4
gen_nb=5 prim=425(0x1a9) fcr=71
gen_nb=5 prim=451(0x1c3) fcr=3
gen_nb=5 prim=451(0x1c3) fcr=51
gen_nb=5 prim=451(0x1c3) fcr=113
gen_nb=5 prim=451(0x1c3) fcr=155
gen_nb=5 prim=501(0x1f5) fcr=9
gen_nb=11 prim=351(0x15f) fcr=227
gen_nb=11 prim=357(0x165) fcr=84
gen_nb=11 prim=357(0x165) fcr=94
gen_nb=11 prim=357(0x165) fcr=213
gen_nb=11 prim=391(0x187) fcr=72
gen_nb=11 prim=391(0x187) fcr=208
gen_nb=11 prim=391(0x187) fcr=233
gen_nb=11 prim=463(0x1cf) fcr=91
gen_nb=11 prim=477(0x1dd) fcr=39
gen_nb=11 prim=477(0x1dd) fcr=124
gen_nb=11 prim=477(0x1dd) fcr=209

As an example, this is the output of an application using libfec to compute the CCSDS parity:

Conventional Message:
	0x00,0xcc,0xac,0x60,0x79,0xb5,0xd5,0x19,0xf0,0x3c,0x5c,0x90,0x89,0x45,0x25,0xe9,
	0xfd,0x31,0x51,0x9d,0x84,0x48,0x28,0xe4,0x0d,0xc1,0xa1,0x6d,0x74,0xb8,0xd8,0x14,
	0x2e,0xe2,0x82,0x4e,0x57,0x9b,0xfb,0x37,0xde,0x12,0x72,0xbe,0xa7,0x6b,0x0b,0xc7,
	0xd3,0x1f,0x7f,0xb3,0xaa,0x66,0x06,0xca,0x23,0xef,0x8f,0x43,0x5a,0x96,0xf6,0x3a,
	0x42,0x8e,0xee,0x22,0x3b,0xf7,0x97,0x5b,0xb2,0x7e,0x1e,0xd2,0xcb,0x07,0x67,0xab,
	0xbf,0x73,0x13,0xdf,0xc6,0x0a,0x6a,0xa6,0x4f,0x83,0xe3,0x2f,0x36,0xfa,0x9a,0x56,
	0x6c,0xa0,0xc0,0x0c,0x15,0xd9,0xb9,0x75,0x9c,0x50,0x30,0xfc,0xe5,0x29,0x49,0x85,
	0x91,0x5d,0x3d,0xf1,0xe8,0x24,0x44,0x88,0x61,0xad,0xcd,0x01,0x18,0xd4,0xb4,0x78,
	0xc5,0x09,0x69,0xa5,0xbc,0x70,0x10,0xdc,0x35,0xf9,0x99,0x55,0x4c,0x80,0xe0,0x2c,
	0x38,0xf4,0x94,0x58,0x41,0x8d,0xed,0x21,0xc8,0x04,0x64,0xa8,0xb1,0x7d,0x1d,0xd1,
	0xeb,0x27,0x47,0x8b,0x92,0x5e,0x3e,0xf2,0x1b,0xd7,0xb7,0x7b,0x62,0xae,0xce,0x02,
	0x16,0xda,0xba,0x76,0x6f,0xa3,0xc3,0x0f,0xe6,0x2a,0x4a,0x86,0x9f,0x53,0x33,0xff,
	0x87,0x4b,0x2b,0xe7,0xfe,0x32,0x52,0x9e,0x77,0xbb,0xdb,0x17,0x0e,0xc2,0xa2,0x6e,
	0x7a,0xb6,0xd6,0x1a,0x03,0xcf,0xaf,0x63,0x8a,0x46,0x26,0xea,0xf3,0x3f,0x5f

Conventional Parity:
	0xab,0xc4,0x94,0x3f,0x0a,0xb4,0x52,0x78,0x37,0xc4,0xf9,0x69,0x6e,0x4f,0xa4,0x11,
	0xac,0x99,0xb6,0xe4,0xdd,0x40,0xfc,0x37,0x58,0x7a,0x8e,0x35,0xfb,0xa6,0x10,0x73

This is the output of reedsolo:

Conventional Message:
	0x00,0xcc,0xac,0x60,0x79,0xb5,0xd5,0x19,0xf0,0x3c,0x5c,0x90,0x89,0x45,0x25,0xe9,
	0xfd,0x31,0x51,0x9d,0x84,0x48,0x28,0xe4,0x0d,0xc1,0xa1,0x6d,0x74,0xb8,0xd8,0x14,
	0x2e,0xe2,0x82,0x4e,0x57,0x9b,0xfb,0x37,0xde,0x12,0x72,0xbe,0xa7,0x6b,0x0b,0xc7,
	0xd3,0x1f,0x7f,0xb3,0xaa,0x66,0x06,0xca,0x23,0xef,0x8f,0x43,0x5a,0x96,0xf6,0x3a,
	0x42,0x8e,0xee,0x22,0x3b,0xf7,0x97,0x5b,0xb2,0x7e,0x1e,0xd2,0xcb,0x07,0x67,0xab,
	0xbf,0x73,0x13,0xdf,0xc6,0x0a,0x6a,0xa6,0x4f,0x83,0xe3,0x2f,0x36,0xfa,0x9a,0x56,
	0x6c,0xa0,0xc0,0x0c,0x15,0xd9,0xb9,0x75,0x9c,0x50,0x30,0xfc,0xe5,0x29,0x49,0x85,
	0x91,0x5d,0x3d,0xf1,0xe8,0x24,0x44,0x88,0x61,0xad,0xcd,0x01,0x18,0xd4,0xb4,0x78,
	0xc5,0x09,0x69,0xa5,0xbc,0x70,0x10,0xdc,0x35,0xf9,0x99,0x55,0x4c,0x80,0xe0,0x2c,
	0x38,0xf4,0x94,0x58,0x41,0x8d,0xed,0x21,0xc8,0x04,0x64,0xa8,0xb1,0x7d,0x1d,0xd1,
	0xeb,0x27,0x47,0x8b,0x92,0x5e,0x3e,0xf2,0x1b,0xd7,0xb7,0x7b,0x62,0xae,0xce,0x02,
	0x16,0xda,0xba,0x76,0x6f,0xa3,0xc3,0x0f,0xe6,0x2a,0x4a,0x86,0x9f,0x53,0x33,0xff,
	0x87,0x4b,0x2b,0xe7,0xfe,0x32,0x52,0x9e,0x77,0xbb,0xdb,0x17,0x0e,0xc2,0xa2,0x6e,
	0x7a,0xb6,0xd6,0x1a,0x03,0xcf,0xaf,0x63,0x8a,0x46,0x26,0xea,0xf3,0x3f,0x5f

Conventional Parity:
	0x04,0x01,0x32,0x09,0xc2,0xe5,0x3e,0xd5,0xfc,0x4c,0xac,0x30,0xe7,0x8e,0x8c,0xe0
        0xef,0x9a,0xff,0x4a,0x3c,0xff,0xed,0x3a,0x58,0xbc,0xd4,0x63,0x4f,0xbb,0x6f,0xf9

Did I miss something? It is entirely possible given that I am not an expert in this field.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions