Пример #1
0
        def __init__(self, sps=8, bt=0.5, mod_idx=0.68):
            gr.hier_block2.__init__(
                self,
                "simple_modulator",
                gr.io_signature(0, 0, 0),  # Input signature
                gr.io_signature(0, 0, 0))  # Output signature

            # message ports
            self.message_port_register_hier_in("in")
            self.message_port_register_hier_out("out")

            # blocks
            self.pack = pdu_utils.pack_unpack(pdu_utils.MODE_UNPACK_BYTE,
                                              pdu_utils.BIT_ORDER_LSB_FIRST)
            self.preamble = pdu_utils.pdu_preamble([], [], sps, 0)
            modulation_index = mod_idx
            sensitivity = (pi * modulation_index) / sps
            gain = 1.0
            taps = firdes.gaussian(gain, sps, bt, 5)
            self.gmsk = pdu_utils.pdu_gmsk_fc(sensitivity, taps)

            # connections
            self.msg_connect(self, "in", self.pack, "pdu_in")
            self.msg_connect(self.pack, "pdu_out", self.preamble, "pdu_in")
            self.msg_connect(self.preamble, "pdu_out", self.gmsk, "pdu_in")
            self.msg_connect(self.gmsk, "pdu_out", self, "out")
Пример #2
0
 def setUp (self):
     self.tb = gr.top_block ()
     self.emitter = pdu_utils.message_emitter()
     self.pack = pdu_utils.pack_unpack(pdu_utils.MODE_PACK_BYTE, pdu_utils.BIT_ORDER_MSB_FIRST)
     self.debug = blocks.message_debug()
     self.tb.msg_connect((self.emitter, 'msg'), (self.pack, 'pdu_in'))
     self.tb.msg_connect((self.pack, 'pdu_out'), (self.debug, 'store'))
    def __init__(self,
                 callsign='WJ2XMS',
                 client_port='8000',
                 gs_id='WFF',
                 post_bytes=64,
                 pre_bytes=64,
                 sc_id='VCC-A',
                 server_ip='0.0.0.0',
                 ssid=0,
                 verbose=0,
                 wallops_dn_port='56101',
                 wallops_up_port='56100'):
        gr.top_block.__init__(self, "Wff Nogui V3 Verbose")

        ##################################################
        # Parameters
        ##################################################
        self.callsign = callsign
        self.client_port = client_port
        self.gs_id = gs_id
        self.post_bytes = post_bytes
        self.pre_bytes = pre_bytes
        self.sc_id = sc_id
        self.server_ip = server_ip
        self.ssid = ssid
        self.verbose = verbose
        self.wallops_dn_port = wallops_dn_port
        self.wallops_up_port = wallops_up_port

        ##################################################
        # Variables
        ##################################################
        self.ts_str = ts_str = dt.strftime(dt.utcnow(), "%Y%m%d_%H%M%S")
        self.fn_up = fn_up = "{:s}_{:s}_{:s}".format(gs_id, sc_id, ts_str)
        self.fn_dn = fn_dn = "{:s}_{:s}_{:s}".format(sc_id, gs_id, ts_str)
        self.fp_up = fp_up = "/gnuradio/captures/{:s}".format(fn_up)
        self.fp_dn = fp_dn = "/gnuradio/captures/{:s}".format(fn_dn)

        ##################################################
        # Blocks
        ##################################################
        self.vcc_insert_time_tag_bb_0_0 = vcc.insert_time_tag_bb(
            'core:datetime', 'packet_len')
        self.vcc_insert_time_tag_bb_0 = vcc.insert_time_tag_bb(
            'core:datetime', 'packet_len')
        self.vcc_insert_src_callsign_pdu_0 = vcc.insert_src_callsign_pdu(
            callsign=callsign, ssid=ssid, verbose=bool(verbose))
        self.vcc_burst_scramble_bb_0 = vcc.burst_scramble_bb(0x21, 0x0, 16)
        self.sigmf_sink_1 = gr_sigmf.sink("ri8", fp_dn,
                                          gr_sigmf.sigmf_time_mode_absolute,
                                          False)
        self.sigmf_sink_1.set_global_meta("core:sample_rate", 0)
        self.sigmf_sink_1.set_global_meta(
            "core:description", 'Wallops Flight Facility Interface, Downlink')
        self.sigmf_sink_1.set_global_meta("core:author",
                                          'Zach Leffke, [email protected]')
        self.sigmf_sink_1.set_global_meta("core:license", 'MIT')
        self.sigmf_sink_1.set_global_meta("core:hw", 'WFF UHF Ground Station')
        self.sigmf_sink_1.set_global_meta('vcc:spacecraft', 'VCC-A')
        self.sigmf_sink_1.set_global_meta('vcc:ground_station', 'WFF')
        self.sigmf_sink_1.set_global_meta('vcc:callsign', 'WJ2XMS-0')
        self.sigmf_sink_1.set_global_meta(
            'vcc:tap_point',
            'Packed Bytes, NRZ-I decoded, before descrambling')

        self.sigmf_sink_0 = gr_sigmf.sink("ri8", fp_up,
                                          gr_sigmf.sigmf_time_mode_absolute,
                                          False)
        self.sigmf_sink_0.set_global_meta("core:sample_rate", 0)
        self.sigmf_sink_0.set_global_meta(
            "core:description", 'Wallops Flight Facility Interface, Uplink')
        self.sigmf_sink_0.set_global_meta("core:author",
                                          'Zach Leffke, [email protected]')
        self.sigmf_sink_0.set_global_meta("core:license", 'MIT')
        self.sigmf_sink_0.set_global_meta("core:hw", 'WFF UHF Ground Station')
        self.sigmf_sink_0.set_global_meta('vcc:spacecraft', 'VCC-A')
        self.sigmf_sink_0.set_global_meta('vcc:ground_station', 'WFF')
        self.sigmf_sink_0.set_global_meta('vcc:uplink_callsign', 'WJ2XMS-0')
        self.sigmf_sink_0.set_global_meta('vcc:tap_point', 'KISS input')

        self.pdu_utils_pack_unpack_0 = pdu_utils.pack_unpack(
            pdu_utils.MODE_PACK_BYTE, pdu_utils.BIT_ORDER_MSB_FIRST)
        self.kiss_pdu_to_kiss_0 = kiss.pdu_to_kiss()
        self.kiss_kiss_to_pdu_0 = kiss.kiss_to_pdu(True)
        self.kiss_hdlc_framer_0 = kiss.hdlc_framer(preamble_bytes=pre_bytes,
                                                   postamble_bytes=post_bytes)
        self.kiss_hdlc_deframer_0 = kiss.hdlc_deframer(check_fcs=True,
                                                       max_length=300)
        self.digital_descrambler_bb_0 = digital.descrambler_bb(0x21, 0, 16)
        self.blocks_socket_pdu_2 = blocks.socket_pdu("TCP_SERVER", server_ip,
                                                     wallops_dn_port, 1500,
                                                     False)
        self.blocks_socket_pdu_1 = blocks.socket_pdu("TCP_SERVER", server_ip,
                                                     wallops_up_port, 1500,
                                                     False)
        self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", server_ip,
                                                     client_port, 1024, False)
        self.blocks_pdu_to_tagged_stream_1 = blocks.pdu_to_tagged_stream(
            blocks.byte_t, 'packet_len')
        self.blocks_pdu_to_tagged_stream_0_0 = blocks.pdu_to_tagged_stream(
            blocks.byte_t, 'packet_len')
        self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb(
            1, gr.GR_MSB_FIRST)
        self.blocks_message_debug_0 = blocks.message_debug()

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.blocks_socket_pdu_0, 'pdus'),
                         (self.blocks_pdu_to_tagged_stream_1, 'pdus'))
        self.msg_connect((self.blocks_socket_pdu_2, 'pdus'),
                         (self.blocks_pdu_to_tagged_stream_0_0, 'pdus'))
        self.msg_connect((self.kiss_hdlc_deframer_0, 'out'),
                         (self.kiss_pdu_to_kiss_0, 'in'))
        self.msg_connect((self.kiss_hdlc_framer_0, 'out'),
                         (self.vcc_burst_scramble_bb_0, 'in'))
        self.msg_connect((self.kiss_kiss_to_pdu_0, 'out'),
                         (self.vcc_insert_src_callsign_pdu_0, 'in'))
        self.msg_connect((self.kiss_pdu_to_kiss_0, 'out'),
                         (self.blocks_message_debug_0, 'print'))
        self.msg_connect((self.kiss_pdu_to_kiss_0, 'out'),
                         (self.blocks_message_debug_0, 'print_pdu'))
        self.msg_connect((self.kiss_pdu_to_kiss_0, 'out'),
                         (self.blocks_socket_pdu_0, 'pdus'))
        self.msg_connect((self.pdu_utils_pack_unpack_0, 'pdu_out'),
                         (self.blocks_socket_pdu_1, 'pdus'))
        self.msg_connect((self.vcc_burst_scramble_bb_0, 'out'),
                         (self.pdu_utils_pack_unpack_0, 'pdu_in'))
        self.msg_connect((self.vcc_insert_src_callsign_pdu_0, 'out'),
                         (self.kiss_hdlc_framer_0, 'in'))
        self.connect((self.blocks_packed_to_unpacked_xx_0, 0),
                     (self.digital_descrambler_bb_0, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_0_0, 0),
                     (self.vcc_insert_time_tag_bb_0_0, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_1, 0),
                     (self.vcc_insert_time_tag_bb_0, 0))
        self.connect((self.digital_descrambler_bb_0, 0),
                     (self.kiss_hdlc_deframer_0, 0))
        self.connect((self.vcc_insert_time_tag_bb_0, 0),
                     (self.kiss_kiss_to_pdu_0, 0))
        self.connect((self.vcc_insert_time_tag_bb_0, 0),
                     (self.sigmf_sink_0, 0))
        self.connect((self.vcc_insert_time_tag_bb_0_0, 0),
                     (self.blocks_packed_to_unpacked_xx_0, 0))
        self.connect((self.vcc_insert_time_tag_bb_0_0, 0),
                     (self.sigmf_sink_1, 0))