forked from daniestevez/gr-satellites
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for EIRSAT-1 deframing.
- Loading branch information
David Murphy
committed
Jun 8, 2020
1 parent
1433772
commit d686ce6
Showing
15 changed files
with
399 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
grc/components/deframers/satellites_eirsat_concatenated_deframer.block.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
37
grc/components/deframers/satellites_eirsat_deframer.block.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
python/components/deframers/eirsat_concatenated_deframer.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.