Tuesday, January 8, 2019

Re: [Discuss-gnuradio] Regarding correlate access code-tag block

0001101011001111111111000001110110101010#!/usr/bin/env python2
# -*- coding: utf-8 -*-
##################################################
# GNU Radio Python Flow Graph
# Title: Ccsds Tm
# Generated: Tue Jan 8 13:52:35 2019
##################################################

from distutils.version import StrictVersion

if __name__ == '__main__':
import ctypes
import sys
if sys.platform.startswith('linux'):
try:
x11 = ctypes.cdll.LoadLibrary('libX11.so')
x11.XInitThreads()
except:
print "Warning: failed to XInitThreads()"

from PyQt5 import Qt, QtCore
from gnuradio import blocks
from gnuradio import digital
from gnuradio import eng_notation
from gnuradio import fec
from gnuradio import gr
from gnuradio.eng_option import eng_option
from gnuradio.filter import firdes
from grc_gnuradio import blks2 as grc_blks2
from optparse import OptionParser
import numpy
import satellites
import sys
from gnuradio import qtgui


class ccsds_TM(gr.top_block, Qt.QWidget):

def __init__(self):
gr.top_block.__init__(self, "Ccsds Tm")
Qt.QWidget.__init__(self)
self.setWindowTitle("Ccsds Tm")
qtgui.util.check_set_qss()
try:
self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
except:
pass
self.top_scroll_layout = Qt.QVBoxLayout()
self.setLayout(self.top_scroll_layout)
self.top_scroll = Qt.QScrollArea()
self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
self.top_scroll_layout.addWidget(self.top_scroll)
self.top_scroll.setWidgetResizable(True)
self.top_widget = Qt.QWidget()
self.top_scroll.setWidget(self.top_widget)
self.top_layout = Qt.QVBoxLayout(self.top_widget)
self.top_grid_layout = Qt.QGridLayout()
self.top_layout.addLayout(self.top_grid_layout)

self.settings = Qt.QSettings("GNU Radio", "ccsds_TM")

if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
self.restoreGeometry(self.settings.value("geometry").toByteArray())
else:
self.restoreGeometry(self.settings.value("geometry", type=QtCore.QByteArray))

##################################################
# Variables
##################################################
self.samp_rate = samp_rate = 32000


self.CCSDS_encoder = CCSDS_encoder = fec.ccsds_encoder_make(1024, 0, fec.CC_STREAMING)

self.CCSDS_decoder = CCSDS_decoder = fec.cc_decoder.make(1024, 7, 2, ([109,79]), 0, -1, fec.CC_STREAMING, False)

self.Access_code = Access_code = 0,0,0,1,1,0,1,0,1,1,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,0,1
self.ASM_len = ASM_len = 32

##################################################
# Blocks
##################################################
self.satellites_fixedlen_tagger_0 = satellites.fixedlen_tagger('syncword', 'packet_len', 500, numpy.byte)
self.fec_extended_encoder_0 = fec.extended_encoder(encoder_obj_list=CCSDS_encoder, threading= None, puncpat='11')
self.fec_extended_decoder_0 = fec.extended_decoder(decoder_obj_list=CCSDS_decoder, threading= None, ann=None, puncpat='11', integration_period=10000)
self.digital_psk_mod_0 = digital.psk.psk_mod(
constellation_points=2,
mod_code="gray",
differential=True,
samples_per_symbol=2,
excess_bw=0.35,
verbose=False,
log=False,
)
self.digital_psk_demod_0 = digital.psk.psk_demod(
constellation_points=2,
differential=True,
samples_per_symbol=2,
excess_bw=0.35,
phase_bw=6.28/100.0,
timing_bw=6.28/100.0,
mod_code="gray",
verbose=False,
log=False,
)
self.digital_map_bb_0 = digital.map_bb((-1,1))
self.digital_correlate_access_code_tag_bb_0 = digital.correlate_access_code_tag_bb('00011010110011111111110000011101', 0, 'burst')
self.blocks_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(8)
self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char*1, samp_rate,True)
self.blocks_tag_debug_0 = blocks.tag_debug(gr.sizeof_char*1, '', ""); self.blocks_tag_debug_0.set_display(True)
self.blocks_stream_mux_0 = blocks.stream_mux(gr.sizeof_char*1, (ASM_len,500))
self.blocks_file_source_1 = blocks.file_source(gr.sizeof_char*1, '/home/kaushal/Desktop/asm bit pattern.txt', True)
self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, '/home/kaushal/Desktop/1010 pattern.1.txt', True)
self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, '/home/kaushal/Desktop/output.txt', False)
self.blocks_file_sink_0.set_unbuffered(False)
self.blocks_char_to_float_0 = blocks.char_to_float(1, 1)
self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
samples_per_symbol=2,
bits_per_symbol=1,
preamble='',
access_code='',
pad_for_usrp=False,
),
payload_length=0,
)
self.blks2_packet_decoder_0 = grc_blks2.packet_demod_b(grc_blks2.packet_decoder(
access_code='',
threshold=-1,
callback=lambda ok, payload: self.blks2_packet_decoder_0.recv_pkt(ok, payload),
),
)

##################################################
# Connections
##################################################
self.connect((self.blks2_packet_decoder_0, 0), (self.blocks_char_to_float_0, 0))
self.connect((self.blks2_packet_encoder_0, 0), (self.digital_psk_mod_0, 0))
self.connect((self.blocks_char_to_float_0, 0), (self.fec_extended_decoder_0, 0))
self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0))
self.connect((self.blocks_file_source_1, 0), (self.blocks_stream_mux_0, 0))
self.connect((self.blocks_stream_mux_0, 0), (self.blocks_unpack_k_bits_bb_0, 0))
self.connect((self.blocks_throttle_0, 0), (self.blocks_stream_mux_0, 1))
self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.fec_extended_encoder_0, 0))
self.connect((self.digital_correlate_access_code_tag_bb_0, 0), (self.blocks_tag_debug_0, 0))
self.connect((self.digital_correlate_access_code_tag_bb_0, 0), (self.satellites_fixedlen_tagger_0, 0))
self.connect((self.digital_map_bb_0, 0), (self.blks2_packet_encoder_0, 0))
self.connect((self.digital_psk_demod_0, 0), (self.blks2_packet_decoder_0, 0))
self.connect((self.digital_psk_mod_0, 0), (self.digital_psk_demod_0, 0))
self.connect((self.fec_extended_decoder_0, 0), (self.digital_correlate_access_code_tag_bb_0, 0))
self.connect((self.fec_extended_encoder_0, 0), (self.digital_map_bb_0, 0))
self.connect((self.satellites_fixedlen_tagger_0, 0), (self.blocks_file_sink_0, 0))

def closeEvent(self, event):
self.settings = Qt.QSettings("GNU Radio", "ccsds_TM")
self.settings.setValue("geometry", self.saveGeometry())
event.accept()

def get_samp_rate(self):
return self.samp_rate

def set_samp_rate(self, samp_rate):
self.samp_rate = samp_rate
self.blocks_throttle_0.set_sample_rate(self.samp_rate)

def get_CCSDS_encoder(self):
return self.CCSDS_encoder

def set_CCSDS_encoder(self, CCSDS_encoder):
self.CCSDS_encoder = CCSDS_encoder

def get_CCSDS_decoder(self):
return self.CCSDS_decoder

def set_CCSDS_decoder(self, CCSDS_decoder):
self.CCSDS_decoder = CCSDS_decoder

def get_Access_code(self):
return self.Access_code

def set_Access_code(self, Access_code):
self.Access_code = Access_code

def get_ASM_len(self):
return self.ASM_len

def set_ASM_len(self, ASM_len):
self.ASM_len = ASM_len


def main(top_block_cls=ccsds_TM, options=None):

if StrictVersion("4.5.0") <= StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
style = gr.prefs().get_string('qtgui', 'style', 'raster')
Qt.QApplication.setGraphicsSystem(style)
qapp = Qt.QApplication(sys.argv)

tb = top_block_cls()
tb.start()
tb.show()

def quitting():
tb.stop()
tb.wait()
qapp.aboutToQuit.connect(quitting)
qapp.exec_()


if __name__ == '__main__':
main()
Hello,
thanks for your guidance.
I have also attached the grc file, input/output files and python file for your reference. after adding tag debug, still didn't get any output. I have also tried this same in ubuntu 18.04 with GNU radio 3.7.11 version.
actually because these psk blocks are deprecated, I have tried it with dpsk mod, demod block. But as I wanted to do continuous transmission, I didn't find replaced block for correlate access code-tag block, and the cusom block from gr-satellites are for extracting syncbits.
I have also tried with simple flow graph by just sream muxing 2 files one with sync bits and other one is payload file and give that output to correlate access code-tag block, but that also didn't work.

It would be grateful, If you guide me on this. I just want to make that sync bits searching and extracting from payload and receive only payload at the output.


With Best Regards,
Maitry Raval,


----- Original Message -----
From: "Cinaed Simson" <cinaed.simson@gmail.com>
To: "discuss-gnuradio" <discuss-gnuradio@gnu.org>
Sent: Tuesday, January 8, 2019 1:47:56 PM
Subject: Re: [Discuss-gnuradio] Regarding correlate access code-tag block

I broke down and looked at the image.

Note, PSK Demod, Correlate Access Code - Tag, Packet Encoder, and Packet
Decoder have been depreciated.

And they're usually depreciated because they have problems - and they
are usually replaced with different blocks which work better and are
typically more general.

The tutorials are good place to start looking for the replacements.

-- Cinaed


On 1/7/19 11:22 PM, Thomas Lavarenne wrote:
> Oh, it is "File Sink" not "Tagged file sink", didn't see sorry.
>
> Le mar. 8 janv. 2019 à 08:20, Thomas Lavarenne
> <thomas.lavarenne@gmail.com <mailto:thomas.lavarenne@gmail.com>> a écrit :
>
>
>
> Hi,
>
> But, the issue is that correlate access code-tag block is not
> working and producing tags, so that my output file will come
> blank. as  I am certain that at the output of FEC extended
> decoder, both the sync bits and payload is available which I
> have seen by attaching file sink at the output of FEC extended
> decoder.
>
>
> There is a block "Tag Debug" to see if the tag is generated behind
> "correlate access code - tag block".
>
> On the other hand, the documentation of "Tagged File sink" indicate
> that the block need the keyword "burst" (with value: True) to
> trigger the saving of the data.
>
> Best regards,
>
> Thomas
>
> _______________________________________________
>
> Discuss-gnuradio mailing list
> Discuss-gnuradio@gnu.org <mailto:Discuss-gnuradio@gnu.org>
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>
>
> _______________________________________________
> Discuss-gnuradio mailing list
> Discuss-gnuradio@gnu.org
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>


_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

No comments:

Post a Comment