Skip to content

Commit

Permalink
Used soft decoding for RA codes for SMOG-P and ATL-1
Browse files Browse the repository at this point in the history
  • Loading branch information
daniestevez committed Dec 18, 2019
1 parent fe350f1 commit 59c8c2b
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 66 deletions.
30 changes: 15 additions & 15 deletions apps/atl_1.grc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ options:
gen_linking: dynamic
generate_options: no_gui
hier_block_src_path: '.:'
id: smog_p
id: atl_1
max_nouts: '0'
output_language: python
placement: (0,0)
Expand Down Expand Up @@ -565,42 +565,42 @@ blocks:
coordinate: [479, 599]
rotation: 0
state: true
- name: sync_to_pdu_packed_0_0
id: sync_to_pdu_packed
- name: sync_to_pdu_soft_0_0
id: sync_to_pdu_soft
parameters:
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
packlen: '260'
packlen: 260 * 8
sync: '''0010110111010100'''
threshold: '0'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [272, 859]
coordinate: [271, 863]
rotation: 0
state: true
- name: sync_to_pdu_packed_0_0_0
id: sync_to_pdu_packed
state: enabled
- name: sync_to_pdu_soft_0_0_0
id: sync_to_pdu_soft
parameters:
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
packlen: '514'
packlen: 514 * 8
sync: '''0010110111010100'''
threshold: '0'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [271, 961]
coordinate: [275, 961]
rotation: 0
state: true
state: enabled

connections:
- [blocks_add_const_vxx_0, '0', blocks_divide_xx_0, '1']
Expand All @@ -613,12 +613,12 @@ connections:
- [dc_blocker_xx_0, '0', blocks_divide_xx_0, '0']
- [dc_blocker_xx_0, '0', blocks_rms_xx_0, '0']
- [digital_binary_slicer_fb_0, '0', sync_to_pdu_packed_0, '0']
- [digital_binary_slicer_fb_0, '0', sync_to_pdu_packed_0_0, '0']
- [digital_binary_slicer_fb_0, '0', sync_to_pdu_packed_0_0_0, '0']
- [digital_clock_recovery_mm_xx_0, '0', digital_binary_slicer_fb_0, '0']
- [digital_clock_recovery_mm_xx_0, '0', satellites_ao40_fec_decoder_soft_0, '0']
- [digital_clock_recovery_mm_xx_0, '0', satellites_smogp_short_fec_decoder_soft_0,
'0']
- [digital_clock_recovery_mm_xx_0, '0', sync_to_pdu_soft_0_0, '0']
- [digital_clock_recovery_mm_xx_0, '0', sync_to_pdu_soft_0_0_0, '0']
- [low_pass_filter_0, '0', dc_blocker_xx_0, '0']
- [satellites_ao40_fec_decoder_soft_0, out, satellites_print_timestamp_0, in]
- [satellites_decode_ra_code_0, out, satellites_smogp_packet_filter_0, in]
Expand All @@ -630,8 +630,8 @@ connections:
- [satellites_smogp_packet_filter_0, out, satellites_print_timestamp_0, in]
- [satellites_smogp_short_fec_decoder_soft_0, out, satellites_print_timestamp_0, in]
- [sync_to_pdu_packed_0, out, satellites_smogp_signalling_0, in]
- [sync_to_pdu_packed_0_0, out, satellites_decode_ra_code_0, in]
- [sync_to_pdu_packed_0_0_0, out, satellites_decode_ra_code_0_0, in]
- [sync_to_pdu_soft_0_0, out, satellites_decode_ra_code_0, in]
- [sync_to_pdu_soft_0_0_0, out, satellites_decode_ra_code_0_0, in]

metadata:
file_format: 1
80 changes: 32 additions & 48 deletions apps/smog_p.grc
Original file line number Diff line number Diff line change
Expand Up @@ -322,22 +322,7 @@ blocks:
bus_structure: null
coordinate: [239, 622]
rotation: 0
state: true
- name: digital_binary_slicer_fb_0_0
id: digital_binary_slicer_fb
parameters:
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [798, 1163]
rotation: 0
state: true
state: enabled
- name: digital_clock_recovery_mm_xx_0
id: digital_clock_recovery_mm_xx
parameters:
Expand Down Expand Up @@ -601,7 +586,7 @@ blocks:
bus_structure: null
coordinate: [463, 864]
rotation: 0
state: true
state: enabled
- name: satellites_decode_ra_code_0_0
id: satellites_decode_ra_code
parameters:
Expand All @@ -617,7 +602,7 @@ blocks:
bus_structure: null
coordinate: [469, 966]
rotation: 0
state: true
state: enabled
- name: satellites_print_timestamp_0
id: satellites_print_timestamp
parameters:
Expand Down Expand Up @@ -649,7 +634,7 @@ blocks:
bus_structure: null
coordinate: [605, 829]
rotation: 0
state: true
state: enabled
- name: satellites_smogp_short_fec_decoder_soft_0
id: satellites_smogp_short_fec_decoder_soft
parameters:
Expand Down Expand Up @@ -757,78 +742,78 @@ blocks:
coordinate: [466, 602]
rotation: 0
state: true
- name: sync_to_pdu_packed_0_0
id: sync_to_pdu_packed
- name: sync_to_pdu_soft_0_0
id: sync_to_pdu_soft
parameters:
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
packlen: '260'
packlen: 260 * 8
sync: '''0010110111010100'''
threshold: '0'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [149, 846]
coordinate: [125, 846]
rotation: 0
state: true
- name: sync_to_pdu_packed_0_0_0
id: sync_to_pdu_packed
state: enabled
- name: sync_to_pdu_soft_0_0_0
id: sync_to_pdu_soft
parameters:
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
packlen: '514'
packlen: 514 * 8
sync: '''0010110111010100'''
threshold: '0'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [148, 948]
coordinate: [129, 944]
rotation: 0
state: true
- name: sync_to_pdu_packed_0_0_0_0
id: sync_to_pdu_packed
state: enabled
- name: sync_to_pdu_soft_0_0_0_0
id: sync_to_pdu_soft
parameters:
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
packlen: '514'
packlen: 514 * 8
sync: '''0010110111010100'''
threshold: '0'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [959, 1172]
coordinate: [941, 1169]
rotation: 0
state: true
- name: sync_to_pdu_packed_0_0_1
id: sync_to_pdu_packed
state: enabled
- name: sync_to_pdu_soft_0_0_1
id: sync_to_pdu_soft
parameters:
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
packlen: '260'
packlen: 260 * 8
sync: '''0010110111010100'''
threshold: '0'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [960, 1070]
coordinate: [937, 1071]
rotation: 0
state: true
state: enabled

connections:
- [blocks_add_const_vxx_0, '0', blocks_divide_xx_0, '1']
Expand All @@ -847,18 +832,17 @@ connections:
- [dc_blocker_xx_0, '0', blocks_rms_xx_0, '0']
- [dc_blocker_xx_0_0, '0', blocks_divide_xx_0_0, '0']
- [digital_binary_slicer_fb_0, '0', sync_to_pdu_packed_0, '0']
- [digital_binary_slicer_fb_0, '0', sync_to_pdu_packed_0_0, '0']
- [digital_binary_slicer_fb_0, '0', sync_to_pdu_packed_0_0_0, '0']
- [digital_binary_slicer_fb_0_0, '0', sync_to_pdu_packed_0_0_0_0, '0']
- [digital_binary_slicer_fb_0_0, '0', sync_to_pdu_packed_0_0_1, '0']
- [digital_clock_recovery_mm_xx_0, '0', digital_binary_slicer_fb_0, '0']
- [digital_clock_recovery_mm_xx_0, '0', satellites_ao40_fec_decoder_soft_0, '0']
- [digital_clock_recovery_mm_xx_0, '0', satellites_smogp_short_fec_decoder_soft_0,
'0']
- [digital_clock_recovery_mm_xx_0_0, '0', digital_binary_slicer_fb_0_0, '0']
- [digital_clock_recovery_mm_xx_0, '0', sync_to_pdu_soft_0_0, '0']
- [digital_clock_recovery_mm_xx_0, '0', sync_to_pdu_soft_0_0_0, '0']
- [digital_clock_recovery_mm_xx_0_0, '0', satellites_ao40_fec_decoder_soft_0_0, '0']
- [digital_clock_recovery_mm_xx_0_0, '0', satellites_smogp_short_fec_decoder_soft_0_0,
'0']
- [digital_clock_recovery_mm_xx_0_0, '0', sync_to_pdu_soft_0_0_0_0, '0']
- [digital_clock_recovery_mm_xx_0_0, '0', sync_to_pdu_soft_0_0_1, '0']
- [low_pass_filter_0, '0', dc_blocker_xx_0, '0']
- [low_pass_filter_0_0, '0', blocks_rms_xx_0_0, '0']
- [low_pass_filter_0_0, '0', dc_blocker_xx_0_0, '0']
Expand All @@ -875,10 +859,10 @@ connections:
- [satellites_smogp_short_fec_decoder_soft_0_0, out, satellites_print_timestamp_0,
in]
- [sync_to_pdu_packed_0, out, satellites_smogp_signalling_0, in]
- [sync_to_pdu_packed_0_0, out, satellites_decode_ra_code_0, in]
- [sync_to_pdu_packed_0_0_0, out, satellites_decode_ra_code_0_0, in]
- [sync_to_pdu_packed_0_0_0_0, out, satellites_decode_ra_code_0_0, in]
- [sync_to_pdu_packed_0_0_1, out, satellites_decode_ra_code_0, in]
- [sync_to_pdu_soft_0_0, out, satellites_decode_ra_code_0, in]
- [sync_to_pdu_soft_0_0_0, out, satellites_decode_ra_code_0_0, in]
- [sync_to_pdu_soft_0_0_0_0, out, satellites_decode_ra_code_0_0, in]
- [sync_to_pdu_soft_0_0_1, out, satellites_decode_ra_code_0, in]

metadata:
file_format: 1
27 changes: 24 additions & 3 deletions lib/decode_ra_code_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@
#include "config.h"
#endif

#include <cstdio>

#include <gnuradio/io_signature.h>
#include <gnuradio/logger.h>
#include "decode_ra_code_impl.h"

extern "C" {
#include "radecoder/ra_decoder.h"
#include "radecoder/ra_decoder_gen.h"
}

namespace gr {
Expand Down Expand Up @@ -81,9 +84,27 @@ namespace gr {
pmt::pmt_t msg = pmt::cdr(pmt_msg);
uint8_t *ra_out = new uint8_t [d_size];
size_t offset(0);
const float * const soft_bits = (const float *) pmt::uniform_vector_elements(msg, offset);

ra_length_init(d_size/2);

if (pmt::length(msg) != ra_code_length * RA_BITCOUNT) {
fprintf(stderr, "message length: %d, expected: %d\n", pmt::length(msg), ra_code_length * RA_BITCOUNT);
GR_LOG_ERROR(d_logger, "Invalid message length");
return;
}

float *ra_in = new float [ra_code_length * RA_BITCOUNT];
// Weird bit organization: see radecoder/ra_decoder.c
for (int i = 0; i < ra_code_length * RA_BITCOUNT / 8; i++) {
for (int j = 0; j < 8; j++) {
ra_in[8 * i + j] = -soft_bits[8 * i + 7 - j];
}
}

ra_decoder_gen(ra_in, (ra_word_t *) ra_out, 20);

memset(ra_out, 0, d_size);
ra_decode((const uint8_t*) pmt::uniform_vector_elements(msg, offset), ra_out, d_size);
delete[] ra_in;

message_port_pub(pmt::mp("out"),
pmt::cons(pmt::PMT_NIL,
Expand Down

0 comments on commit 59c8c2b

Please sign in to comment.