Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- options:
- parameters:
- author: Barry Duggan
- catch_exceptions: 'True'
- category: '[GRC Hier Blocks]'
- cmake_opt: ''
- comment: ''
- copyright: ''
- description: packet FSK xmt
- gen_cmake: 'On'
- gen_linking: dynamic
- generate_options: qt_gui
- hier_block_src_path: '.:'
- id: pkt_fsk_xmt_a
- max_nouts: '0'
- output_language: python
- placement: (0,0)
- qt_qss_theme: ''
- realtime_scheduling: ''
- run: 'True'
- run_command: '{python} -u {filename}'
- run_options: prompt
- sizing_mode: fixed
- thread_safe_setters: ''
- title: pkt_fsk_xmt_a
- window_size: (1000,1000)
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [16, 12.0]
- rotation: 0
- state: enabled
- blocks:
- - name: access_key
- id: variable
- parameters:
- comment: ''
- value: '''11100001010110101110100010010011'''
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [856, 12.0]
- rotation: 0
- state: enabled
- - name: baud
- id: variable
- parameters:
- comment: ''
- value: '1200'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [280, 12.0]
- rotation: 0
- state: true
- - name: center
- id: variable
- parameters:
- comment: ''
- value: (mark+space)/2
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [240, 124.0]
- rotation: 0
- state: enabled
- - name: excess_bw
- id: variable
- parameters:
- comment: ''
- value: '0.35'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [608, 12.0]
- rotation: 0
- state: enabled
- - name: fsk_deviation
- id: variable
- parameters:
- comment: ''
- value: (abs)(mark-space)
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [400, 124.0]
- rotation: 0
- state: enabled
- - name: hdr_format
- id: variable
- parameters:
- comment: header_format_default
- value: digital.header_format_default(access_key, 0)
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [856, 76.0]
- rotation: 0
- state: enabled
- - name: inp_amp
- id: variable
- parameters:
- comment: ''
- value: (mark/vco_max)-vco_offset
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [704, 124.0]
- rotation: 0
- state: true
- - name: mark
- id: variable
- parameters:
- comment: ''
- value: '40500'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [360, 12.0]
- rotation: 0
- state: true
- - name: repeat
- id: variable
- parameters:
- comment: ''
- value: (int)(samp_rate/baud)
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [320, 124.0]
- rotation: 0
- state: true
- - name: rrc_taps
- id: variable
- parameters:
- comment: ''
- value: firdes.root_raised_cosine(1.0,samp_rate,samp_rate/sps,excess_bw,11*sps)
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [1144, 12.0]
- rotation: 0
- state: enabled
- - name: samp_rate
- id: variable
- parameters:
- comment: '|----------------------------------------------------------------------------------------->
- User set values'
- value: '384000'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [184, 12.0]
- rotation: 0
- state: enabled
- - name: space
- id: variable
- parameters:
- comment: ''
- value: '39500'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [448, 12.0]
- rotation: 0
- state: true
- - name: sps
- id: variable
- parameters:
- comment: ''
- value: (int)(samp_rate/baud)
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [704, 12.0]
- rotation: 0
- state: enabled
- - name: thresh
- id: variable
- parameters:
- comment: ''
- value: '1'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [536, 12.0]
- rotation: 0
- state: enabled
- - name: vco_max
- id: variable
- parameters:
- comment: ''
- value: center+fsk_deviation
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [504, 124.0]
- rotation: 0
- state: true
- - name: vco_offset
- id: variable
- parameters:
- comment: ''
- value: space/vco_max
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [592, 124.0]
- rotation: 0
- state: true
- - name: InFile
- id: parameter
- parameters:
- alias: ''
- comment: 'Filename is specified on the command line, e.g.:
- python3 pkt_fsk_xmt_a.py --InFile="../gr-logo.png"'
- hide: none
- label: File Name
- short_id: ''
- type: str
- value: default
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [1040, 12.0]
- rotation: 0
- state: true
- - name: blocks_add_const_vxx_0
- id: blocks_add_const_vxx
- parameters:
- affinity: ''
- alias: ''
- comment: vco_offset
- const: vco_offset
- maxoutbuf: '0'
- minoutbuf: '0'
- type: float
- vlen: '1'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [408, 628.0]
- rotation: 0
- state: true
- - name: blocks_multiply_const_vxx_0
- id: blocks_multiply_const_vxx
- parameters:
- affinity: ''
- alias: ''
- comment: inp_amp
- const: inp_amp
- maxoutbuf: '0'
- minoutbuf: '0'
- type: float
- vlen: '1'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [224, 628.0]
- rotation: 0
- state: true
- - name: blocks_repack_bits_bb_1_0
- id: blocks_repack_bits_bb
- parameters:
- affinity: ''
- alias: ''
- align_output: 'False'
- comment: ''
- endianness: gr.GR_MSB_FIRST
- k: '8'
- l: '1'
- len_tag_key: ''
- maxoutbuf: '0'
- minoutbuf: '0'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [200, 452.0]
- rotation: 0
- state: true
- - name: blocks_repeat_0
- id: blocks_repeat
- parameters:
- affinity: ''
- alias: ''
- comment: ''
- interp: repeat
- maxoutbuf: '0'
- minoutbuf: '0'
- type: byte
- vlen: '1'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [424, 460.0]
- rotation: 0
- state: enabled
- - name: blocks_tagged_stream_mux_0
- id: blocks_tagged_stream_mux
- parameters:
- affinity: ''
- alias: ''
- comment: ''
- lengthtagname: packet_len
- maxoutbuf: '0'
- minoutbuf: '0'
- ninputs: '2'
- tag_preserve_head_pos: '0'
- type: byte
- vlen: '1'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [1056, 312.0]
- rotation: 0
- state: true
- - name: blocks_throttle2_0
- id: blocks_throttle2
- parameters:
- affinity: ''
- alias: ''
- comment: ''
- ignoretag: 'True'
- limit: auto
- maximum: '0.1'
- maxoutbuf: '0'
- minoutbuf: '0'
- samples_per_second: samp_rate
- type: float
- vlen: '1'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [1024, 620.0]
- rotation: 0
- state: true
- - name: blocks_uchar_to_float_0
- id: blocks_uchar_to_float
- parameters:
- affinity: ''
- alias: ''
- comment: ''
- maxoutbuf: '0'
- minoutbuf: '0'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [616, 464.0]
- rotation: 0
- state: enabled
- - name: blocks_vco_f_0
- id: blocks_vco_f
- parameters:
- affinity: ''
- alias: ''
- amplitude: '0.9'
- comment: ''
- maxoutbuf: '0'
- minoutbuf: '0'
- samp_rate: samp_rate
- sensitivity: 2*math.pi*vco_max
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [832, 612.0]
- rotation: 0
- state: enabled
- - name: digital_crc32_bb_0
- id: digital_crc32_bb
- parameters:
- affinity: ''
- alias: ''
- check: 'False'
- comment: ''
- lengthtagname: '"packet_len"'
- maxoutbuf: '0'
- minoutbuf: '0'
- packed: 'True'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [528, 324.0]
- rotation: 0
- state: true
- - name: digital_protocol_formatter_bb_0
- id: digital_protocol_formatter_bb
- parameters:
- affinity: ''
- alias: ''
- comment: ''
- format: hdr_format
- len_tag_key: '"packet_len"'
- maxoutbuf: '0'
- minoutbuf: '0'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [792, 260.0]
- rotation: 0
- state: true
- - name: epy_block_0
- id: epy_block
- parameters:
- FileName: InFile
- Pkt_len: '75'
- _source_code: "\"\"\"\nEmbedded Python Block: File Source to Tagged Stream\n\"\
- \"\"\n\nimport numpy as np\nfrom gnuradio import gr\nimport time\nimport pmt\n\
- import os.path\nimport sys\nimport base64\n\nclass blk(gr.sync_block):\n \
- \ def __init__(self, FileName='None', Pkt_len=52):\n gr.sync_block.__init__(\n\
- \ self,\n name='EPB: File Source to Tagged Stream',\n\
- \ in_sig=None,\n out_sig=[np.uint8])\n self.FileName\
- \ = FileName\n self.Pkt_len = Pkt_len\n self.state = 0\n \
- \ self.pre_count = 0\n self.indx = 0\n self._debug = 0\n \
- \ if (os.path.exists(self.FileName)):\n # open input file\n \
- \ self.f_in = open (self.FileName, 'rb')\n self._eof =\
- \ False\n if (self._debug):\n print (\"File name:\"\
- , self.FileName)\n else:\n print(self.FileName, 'does not\
- \ exist')\n self._eof = True\n self.state = 3\n\n \
- \ self.char_list = [37,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85, 85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,\
- \ 85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85, 85,85,85,93]\n self.c_len\
- \ = len (self.char_list)\n # print (self.c_len)\n\n def work(self,\
- \ input_items, output_items):\n if (self.state == 0):\n #\
- \ send phasing filler\n # delay 40 ms\n time.sleep (0.040)\n\
- \ key1 = pmt.intern(\"packet_len\")\n val1 = pmt.from_long(self.c_len)\n\
- \ self.add_item_tag(0, # Write to output port 0\n \
- \ self.indx, # Index of the tag\n key1, # Key of the tag\n\
- \ val1 # Value of the tag\n )\n \
- \ self.indx += self.c_len\n i = 0\n while (i < self.c_len):\n\
- \ output_items[0][i] = self.char_list[i]\n i +=\
- \ 1\n self.pre_count += 1\n if (self.pre_count > 3):\n\
- \ self.state = 1\n return (self.c_len)\n elif\
- \ (self.state == 1):\n while (not (self._eof)):\n \
- \ buff = self.f_in.read (self.Pkt_len)\n b_len = len(buff)\n\
- \ if b_len == 0:\n print ('End of file')\n\
- \ self._eof = True\n self.f_in.close()\n\
- \ self.state = 2\n self.pre_count = 0\n\
- \ break\n # convert to Base64\n \
- \ encoded = base64.b64encode (buff)\n e_len = len(encoded)\n\
- \ if (self._debug):\n print ('b64 length =',\
- \ e_len)\n # delay 500 ms\n time.sleep (0.5)\n\
- \ key0 = pmt.intern(\"packet_len\")\n val0 = pmt.from_long(e_len)\n\
- \ self.add_item_tag(0, # Write to output port 0\n \
- \ self.indx, # Index of the tag\n key0, # Key\
- \ of the tag\n val0 # Value of the tag\n \
- \ )\n self.indx += e_len\n i = 0\n \
- \ while (i < e_len):\n output_items[0][i] = encoded[i]\n\
- \ i += 1\n return (e_len)\n elif (self.state\
- \ == 2):\n # send file name\n fn_len = len (self.FileName)\n\
- \ key1 = pmt.intern(\"packet_len\")\n val1 = pmt.from_long(fn_len+8)\n\
- \ self.add_item_tag(0, # Write to output port 0\n \
- \ self.indx, # Index of the tag\n key1, # Key of the tag\n\
- \ val1 # Value of the tag\n )\n \
- \ self.indx += (fn_len+8)\n i = 0\n while (i < 8):\n \
- \ output_items[0][i] = self.char_list[i]\n i +=\
- \ 1\n j = 0\n while (i < (fn_len+8)):\n \
- \ output_items[0][i] = ord(self.FileName[j])\n i += 1\n \
- \ j += 1\n self.state = 3\n return (fn_len+8)\n\
- \ elif (self.state == 3):\n # send post filler\n \
- \ # delay 10 ms\n time.sleep (0.010)\n key1 = pmt.intern(\"\
- packet_len\")\n val1 = pmt.from_long(self.c_len)\n self.add_item_tag(0,\
- \ # Write to output port 0\n self.indx, # Index of the tag\n\
- \ key1, # Key of the tag\n val1 # Value of\
- \ the tag\n )\n self.indx += self.c_len\n \
- \ i = 0\n while (i < self.c_len):\n output_items[0][i]\
- \ = self.char_list[i]\n i += 1\n self.pre_count +=\
- \ 1\n if (self.pre_count > 9):\n self.state = 4\n\
- \ return (self.c_len)\n elif (self.state == 4):\n \
- \ # delay 10 sec\n time.sleep (10.0)\n print (\"End\
- \ of transmission\")\n self.state = 5\n return (0)\n \
- \ return (0)\n\n"
- affinity: ''
- alias: ''
- comment: 'Filename is specified on the command line, e.g.:
- python3 pkt_fsk_xmt_a.py --InFile="../gr-logo.png"'
- maxoutbuf: '0'
- minoutbuf: '0'
- states:
- _io_cache: '(''EPB: File Source to Tagged Stream'', ''blk'', [(''FileName'', "''None''"),
- (''Pkt_len'', ''52'')], [], [(''0'', ''byte'', 1)], '''', [''FileName'', ''Pkt_len''])'
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [144, 332.0]
- rotation: 0
- state: true
- - name: import_0
- id: import
- parameters:
- alias: ''
- comment: ''
- imports: import math
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [16, 124.0]
- rotation: 0
- state: enabled
- - name: interp_fir_filter_xxx_0
- id: interp_fir_filter_xxx
- parameters:
- affinity: ''
- alias: ''
- comment: ''
- interp: '1'
- maxoutbuf: '0'
- minoutbuf: '0'
- samp_delay: '0'
- taps: rrc_taps
- type: fff
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [592, 620.0]
- rotation: 0
- state: enabled
- - name: note_0
- id: note
- parameters:
- alias: ''
- comment: '|----------------------------------------------------------------------------------------------------------------------------------------------------------|
- Calculated values:
- - center freq = (mark+space)/2
- - repeat = (int)(samp_rate/baud)
- - fsk_deviation = (abs)(mark-space)
- - vco_max = center+fsk_deviation
- - vco_offset = space/vco_max
- - inp_amp = (mark/vco_max)-vco_offset
- - vco sensitivity = 2*math.pi*vco_max'
- note: ''
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [184, 148.0]
- rotation: 0
- state: enabled
- - name: qtgui_time_sink_x_0
- id: qtgui_time_sink_x
- parameters:
- affinity: ''
- alias: ''
- alpha1: '1.0'
- alpha10: '1.0'
- alpha2: '1.0'
- alpha3: '1.0'
- alpha4: '1.0'
- alpha5: '1.0'
- alpha6: '1.0'
- alpha7: '1.0'
- alpha8: '1.0'
- alpha9: '1.0'
- autoscale: 'False'
- axislabels: 'True'
- color1: blue
- color10: dark blue
- color2: red
- color3: green
- color4: black
- color5: cyan
- color6: magenta
- color7: yellow
- color8: dark red
- color9: dark green
- comment: ''
- ctrlpanel: 'True'
- entags: 'True'
- grid: 'False'
- gui_hint: ''
- label1: ''
- label10: ''
- label2: ''
- label3: ''
- label4: ''
- label5: ''
- label6: ''
- label7: ''
- label8: ''
- label9: ''
- legend: 'True'
- marker1: '-1'
- marker10: '-1'
- marker2: '-1'
- marker3: '-1'
- marker4: '-1'
- marker5: '-1'
- marker6: '-1'
- marker7: '-1'
- marker8: '-1'
- marker9: '-1'
- name: Transmit data
- nconnections: '2'
- size: '8192'
- srate: samp_rate
- stemplot: 'False'
- style1: '1'
- style10: '1'
- style2: '1'
- style3: '1'
- style4: '1'
- style5: '1'
- style6: '1'
- style7: '1'
- style8: '1'
- style9: '1'
- tr_chan: '0'
- tr_delay: '0.0'
- tr_level: '0.1'
- tr_mode: qtgui.TRIG_MODE_NORM
- tr_slope: qtgui.TRIG_SLOPE_POS
- tr_tag: '"packet_len"'
- type: float
- update_time: '0.10'
- width1: '1'
- width10: '1'
- width2: '1'
- width3: '1'
- width4: '1'
- width5: '1'
- width6: '1'
- width7: '1'
- width8: '1'
- width9: '1'
- ylabel: Amplitude
- ymax: '1.1'
- ymin: '-0.1'
- yunit: '""'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [832, 492.0]
- rotation: 0
- state: enabled
- - name: virtual_sink_0
- id: virtual_sink
- parameters:
- alias: ''
- comment: ''
- stream_id: t2
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [832, 428.0]
- rotation: 0
- state: true
- - name: virtual_sink_0_0
- id: virtual_sink
- parameters:
- alias: ''
- comment: ''
- stream_id: t1
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [1296, 324.0]
- rotation: 0
- state: true
- - name: virtual_source_0
- id: virtual_source
- parameters:
- alias: ''
- comment: ''
- stream_id: t2
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [64, 628.0]
- rotation: 0
- state: true
- - name: virtual_source_0_0
- id: virtual_source
- parameters:
- alias: ''
- comment: ''
- stream_id: t1
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [32, 460.0]
- rotation: 0
- state: true
- - name: zeromq_pub_sink_0
- id: zeromq_pub_sink
- parameters:
- address: tcp://127.0.0.1:49303
- affinity: ''
- alias: ''
- bind: 'True'
- comment: ''
- drop_on_hwm: 'True'
- hwm: '-1'
- key: ''
- pass_tags: 'False'
- timeout: '100'
- type: float
- vlen: '1'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [1200, 596.0]
- rotation: 0
- state: true
- connections:
- - [blocks_add_const_vxx_0, '0', interp_fir_filter_xxx_0, '0']
- - [blocks_multiply_const_vxx_0, '0', blocks_add_const_vxx_0, '0']
- - [blocks_repack_bits_bb_1_0, '0', blocks_repeat_0, '0']
- - [blocks_repeat_0, '0', blocks_uchar_to_float_0, '0']
- - [blocks_tagged_stream_mux_0, '0', virtual_sink_0_0, '0']
- - [blocks_throttle2_0, '0', zeromq_pub_sink_0, '0']
- - [blocks_uchar_to_float_0, '0', qtgui_time_sink_x_0, '0']
- - [blocks_uchar_to_float_0, '0', virtual_sink_0, '0']
- - [blocks_vco_f_0, '0', blocks_throttle2_0, '0']
- - [digital_crc32_bb_0, '0', blocks_tagged_stream_mux_0, '1']
- - [digital_crc32_bb_0, '0', digital_protocol_formatter_bb_0, '0']
- - [digital_protocol_formatter_bb_0, '0', blocks_tagged_stream_mux_0, '0']
- - [epy_block_0, '0', digital_crc32_bb_0, '0']
- - [interp_fir_filter_xxx_0, '0', blocks_vco_f_0, '0']
- - [interp_fir_filter_xxx_0, '0', qtgui_time_sink_x_0, '1']
- - [virtual_source_0, '0', blocks_multiply_const_vxx_0, '0']
- - [virtual_source_0_0, '0', blocks_repack_bits_bb_1_0, '0']
- metadata:
- file_format: 1
- grc_version: 3.10.9.1
Add Comment
Please, Sign In to add comment