Skip to content

Commit

Permalink
Added support for EIRSAT-1 deframing.
Browse files Browse the repository at this point in the history
  • Loading branch information
David Murphy committed Jun 8, 2020
1 parent 1433772 commit d686ce6
Show file tree
Hide file tree
Showing 15 changed files with 399 additions and 1 deletion.
2 changes: 2 additions & 0 deletions grc/components/deframers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ install(FILES
satellites_ax25_deframer.block.yml
satellites_ccsds_concatenated_deframer.block.yml
satellites_ccsds_rs_deframer.block.yml
satellites_eirsat_deframer.block.yml
satellites_eirsat_concatenated_deframer.block.yml
satellites_eseo_deframer.block.yml
satellites_k2sat_deframer_component.block.yml
satellites_lucky7_deframer.block.yml
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
id: satellites_eirsat_concatenated_deframer
label: EIRSAT-1 Concatenated Deframer
category: '[Satellites]/Deframers'

parameters:
- id: threshold
label: Syncword threshold
dtype: int
default: 0

inputs:
- domain: stream
dtype: float

outputs:
- domain: message
id: out

templates:
imports: import satellites.components.deframers
make: satellites.components.deframers.eirsat_concatenated_deframer(syncword_threshold = ${threshold})

documentation: |-
Deframes a signal using the EIRSAT-1 concatenated TM protocol
Input:
A stream of soft symbols containing packets using the EIRSAT-1 concatenated TM protocol
Output:
PDUs with the deframed EIRSAT-1 packets
Parameters:
Syncword threshold: number of bit errors to allow in syncword detection
file_format: 1
37 changes: 37 additions & 0 deletions grc/components/deframers/satellites_eirsat_deframer.block.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
id: satellites_eirsat_deframer
label: EIRSAT-1 Deframer
category: '[Satellites]/Deframers'

parameters:
- id: threshold
label: Syncword threshold
dtype: int
default: 0

inputs:
- domain: stream
dtype: float

outputs:
- domain: message
id: out

templates:
imports: import satellites.components.deframers
make: satellites.components.deframers.eirsat_deframer(syncword_threshold = ${threshold})

documentation: |-
Deframes EIRSAT-1 packets
The frames use Reed-Solomon and the CCSDS synchronous scrambler
Input:
A stream of soft symbols containing EIRSAT-1 packets
Output:
PDUs with the deframed EIRSAT-1 packets
Parameters:
Syncword threshold: number of bit errors to allow in syncword detection
file_format: 1
1 change: 1 addition & 0 deletions grc/hier/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
install(FILES
satellites_ccsds_descrambler.py.block.yml
satellites_ccsds_viterbi.py.block.yml
satellites_cmc_viterbi.py.block.yml
satellites_pn9_scrambler.py.block.yml
satellites_rms_agc.py.block.yml
satellites_si4463_scrambler.py.block.yml
Expand Down
20 changes: 20 additions & 0 deletions grc/hier/satellites_cmc_viterbi.py.block.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
id: satellites_cmc_viterbi
label: CPUT CMC Viterbi decoder
category: '[Satellites]/FEC'

inputs:
- label: in
dtype: float
vlen: 1

outputs:
- label: out
dtype: byte
vlen: 1

templates:
imports: import satellites.hier
make: satellites.hier.cmc_viterbi()
callbacks: []

file_format: 1
2 changes: 2 additions & 0 deletions python/components/deframers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ GR_PYTHON_INSTALL(
ax25_deframer.py
ccsds_concatenated_deframer.py
ccsds_rs_deframer.py
eirsat_deframer.py
eirsat_concatenated_deframer.py
eseo_deframer.py
k2sat_deframer.py
lilacsat_1_deframer.py
Expand Down
2 changes: 2 additions & 0 deletions python/components/deframers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
from .ax25_deframer import ax25_deframer
from .ccsds_concatenated_deframer import ccsds_concatenated_deframer
from .ccsds_rs_deframer import ccsds_rs_deframer
from .eirsat_deframer import eirsat_deframer
from .eirsat_concatenated_deframer import eirsat_concatenated_deframer
from .eseo_deframer import eseo_deframer
from .k2sat_deframer import k2sat_deframer
from .lilacsat_1_deframer import lilacsat_1_deframer
Expand Down
59 changes: 59 additions & 0 deletions python/components/deframers/eirsat_concatenated_deframer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Copyright 2019 Daniel Estevez <daniel@destevez.net>
#
# This file is part of gr-satellites
#
# SPDX-License-Identifier: GPL-3.0-or-later
#

from gnuradio import gr, blocks
from .eirsat_deframer import eirsat_deframer
from ...hier.cmc_viterbi import cmc_viterbi
from ...utils.options_block import options_block

class eirsat_concatenated_deframer(gr.hier_block2, options_block):
"""
Hierarchical block to deframe EIRSAT-1 concatenated
(convolutional + Reed-Solomon) TM frames
The input is a float stream of soft symbols. The output are PDUs
with frames.
Args:
frame_size: frame size (not including parity check bytes) (int)
differential: whether to use differential coding (bool)
dual_basis: use dual basis instead of conventional (bool)
syncword_threshold: number of bit errors allowed in syncword (int)
options: Options from argparse
"""
def __init__(self, syncword_threshold = None, options = None):
gr.hier_block2.__init__(self, "eirsat_concatenated_deframer",
gr.io_signature(1, 1, gr.sizeof_float),
gr.io_signature(0, 0, 0))
options_block.__init__(self, options)

self.message_port_register_hier_out('out')

self.delay1 = blocks.delay(gr.sizeof_float, 1)
self.viterbi0 = cmc_viterbi()
self.viterbi1 = cmc_viterbi()
self.char2float0 = blocks.char_to_float(1, 1)
self.char2float1 = blocks.char_to_float(1, 1)
self.addconst0 = blocks.add_const_ff(-0.5)
self.addconst1 = blocks.add_const_ff(-0.5)
self.rs0 = eirsat_deframer(syncword_threshold, options)
self.rs1 = eirsat_deframer(syncword_threshold, options)

self.connect(self, self.viterbi0, self.char2float0, self.addconst0, self.rs0)
self.connect(self, self.delay1, self.viterbi1, self.char2float1, self.addconst1, self.rs1)
self.msg_connect((self.rs0, 'out'), (self, 'out'))
self.msg_connect((self.rs1, 'out'), (self, 'out'))

@classmethod
def add_options(cls, parser):
"""
Adds EIRSAT-1 concatenated deframer specific options to the argparse parser
"""
eirsat_deframer.add_options(parser)
61 changes: 61 additions & 0 deletions python/components/deframers/eirsat_deframer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Copyright 2019 Daniel Estevez <daniel@destevez.net>
#
# This file is part of gr-satellites
#
# SPDX-License-Identifier: GPL-3.0-or-later
#

from gnuradio import gr, digital
from ... import decode_rs_interleaved
from ...hier.sync_to_pdu import sync_to_pdu
from ...hier.ccsds_descrambler import ccsds_descrambler
from ...utils.options_block import options_block

_syncword = '00011010110011111111110000011101'

class eirsat_deframer(gr.hier_block2, options_block):
"""
Hierarchical block to deframe the EIRSAT-1 framing
The input is a float stream of soft symbols. The output are PDUs
with frames.
Args:
syncword_threshold: number of bit errors allowed in syncword (int)
options: Options from argparse
"""
def __init__(self, syncword_threshold = None, options = None):
gr.hier_block2.__init__(self, "eirsat_deframer",
gr.io_signature(1, 1, gr.sizeof_float),
gr.io_signature(0, 0, 0))
options_block.__init__(self, options)

self.message_port_register_hier_out('out')

if syncword_threshold is None:
syncword_threshold = self.options.syncword_threshold

self.slicer = digital.binary_slicer_fb()
self.deframer = sync_to_pdu(packlen = 8 * 255 * 4,\
sync = _syncword,\
threshold = syncword_threshold)
self.scrambler = ccsds_descrambler()
self.rs = decode_rs_interleaved(self.options.verbose_rs, 2, 4)

self.connect(self, self.slicer, self.deframer)
self.msg_connect((self.deframer, 'out'), (self.scrambler, 'in'))
self.msg_connect((self.scrambler, 'out'), (self.rs, 'in'))
self.msg_connect((self.rs, 'out'), (self, 'out'))

_default_sync_threshold = 4

@classmethod
def add_options(cls, parser):
"""
Adds EIRSAT-1 deframer specific options to the argparse parser
"""
parser.add_argument('--syncword_threshold', type = int, default = cls._default_sync_threshold, help = 'Syncword bit errors [default=%(default)r]')
parser.add_argument('--verbose_rs', action = 'store_true', help = 'Verbose RS decoder')
2 changes: 2 additions & 0 deletions python/core/gr_satellites_flowgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ def add_options(cls, parser, file = None, name = None, norad = None):
'OPS-SAT' : deframers.ops_sat_deframer,
'U482C' : deframers.u482c_deframer,
'UA01' : deframers.ua01_deframer,
'EIRSAT-1' : deframers.eirsat_deframer,
'EIRSAT-1 Concatenated' : deframers.eirsat_concatenated_deframer,
}
_transport_hooks = {
'KISS' : transports.kiss_transport,
Expand Down
1 change: 1 addition & 0 deletions python/hier/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ GR_PYTHON_INSTALL(
__init__.py
ccsds_descrambler.py
ccsds_viterbi.py
cmc_viterbi.py
si4463_scrambler.py
sync_to_pdu.py
sync_to_pdu_packed.py
Expand Down
1 change: 1 addition & 0 deletions python/hier/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

from .ccsds_descrambler import ccsds_descrambler
from .ccsds_viterbi import ccsds_viterbi
from .cmc_viterbi import cmc_viterbi
from .pn9_scrambler import pn9_scrambler
from .rms_agc import rms_agc
from .rms_agc_f import rms_agc_f
Expand Down
Loading

0 comments on commit d686ce6

Please sign in to comment.