Compare commits

..

14 Commits

12 changed files with 3578 additions and 0 deletions

72
awgn_harness.py Normal file
View File

@@ -0,0 +1,72 @@
#!/usr/bin/env python
import asyncio
from time import sleep
import framing
from header import Onbeat_Header
PACKET_LEN=255*4 + 32
DATA_LEN=223*4
HEADER_LEN=32
async def tcp_client(file_2_send: str, callsign: str, rs_coding: bool = True):
port = 50001
reader, writer = await asyncio.open_connection(
'127.0.0.1', port)
with open(file_2_send, "rb") as file_to_send:
seq = 0
sent: list[list[int]] = []
while message := file_to_send.read(DATA_LEN if rs_coding == True else (PACKET_LEN - HEADER_LEN)):
sent.append([i for i in message])
frame = bytes(framing.encode_packet([i for i in message], callsign, seq, rs_coding))
writer.write(frame)
seq += 1
sleep(0.1)
else:
frame = bytes(framing.encode_packet([], callsign, seq, rs_coding))
for _ in range(0,16):
writer.write(frame)
sleep(0.1)
sent.append([])
output: list[tuple[Onbeat_Header, list[int]]] = []
packet_loss = 0
while message := await reader.read(PACKET_LEN):
try:
received = framing.decode_packet([i for i in message])
output.append(received)
if received[0].pkt_len == 0:
break
except Exception as e:
packet_loss += 1
print(e)
return sent, output
rs_coding = False
filename = "loremipsum"
sent, output = asyncio.run(tcp_client(filename, "HA5PLS", rs_coding))
output.sort(key=lambda packet: packet[0].pkt_sequence_id)
output.pop()
def hamming_dist(msg:int, got:int):
return bin(msg ^ got).count('1')
total_errors = sum([sum([hamming_dist(msg, got) for msg, got in zip(sent[pkt[0].pkt_sequence_id], pkt[1])]) for pkt in output])
rcv_len = sum([pkt[0].pkt_len for pkt in output]) * 8
ber = total_errors/rcv_len
print(f"Total errors: {total_errors}, BER: {ber}")
# file : bytes = b''
# filesize = 0
# for pkt in output:
# payload = bytes(pkt[1])
# file += payload
# filesize += pkt[0].pkt_len
# print(file.decode(errors="ignore"))
# print(f"Lost {packet_loss} packets during the transfer, filesize: {filesize}")

46
framing.py Normal file
View File

@@ -0,0 +1,46 @@
from header import Onbeat_Header, PROTOCOL_IDENTIFIER
from reedsolo import RSCodec
import numpy as np
PROTOCOL_V1_NOFEC = 1
PROTOCOL_V1_FEC = 2
RSC = RSCodec(255-223,255)
def decode_packet(packet: list[int]) -> tuple[Onbeat_Header, list[int]]:
if len(packet) < 32:
raise OverflowError(f"Packet is too small to be valid, len: {len(packet)}")
header_raw = packet[0:32]
header = Onbeat_Header(0, 0, "", 0, 0)
if header.decode(header_raw) != True:
raise RuntimeError("invalid CRC")
if header.protocol_id != PROTOCOL_IDENTIFIER:
raise ValueError(f"Protocol ID mismatch, got{header.protocol_id}, expected {PROTOCOL_IDENTIFIER}")
if header.pkt_len > len(packet) - 32:
raise OverflowError(f"Header not fully captured, len:{header.pkt_len}, maximal: {len(packet) - 32}")
elif header.pkt_len == 0:
return header, []
payload = packet[32:32+header.pkt_len]
if header.protocol_configuration == PROTOCOL_V1_FEC:
payload_decoded = np.empty((4, min(len(payload)//4-32, 255)), dtype=int)
for i in range(0,4):
payload_decoded[i] = RSC.decode(bytearray(payload[i::4]))[0]
payload = payload_decoded.flatten(order='F').tolist()
elif header.protocol_configuration == PROTOCOL_V1_NOFEC:
pass
else:
raise ValueError(f"Unknown protocol configuration: {header.protocol_configuration}")
return header, payload
def encode_packet(payload: list[int], callsign: str, sequence: int, rs_coding: bool = False) -> list[int]:
protocol_configuration = PROTOCOL_V1_NOFEC
if rs_coding == True:
protocol_configuration = PROTOCOL_V1_FEC
if len(payload) != 0:
for _ in range(0, len(payload)%4):
payload.append(0)
payload_encoded = np.empty((4, min((len(payload))//4+32, 255)), dtype=int)
for i in range(0,4):
payload_encoded[i] = RSC.encode(bytearray(payload[i::4]))
payload = payload_encoded.flatten(order='F').tolist()
header = Onbeat_Header(0, protocol_configuration, callsign, len(payload), sequence)
return header.encode() + payload

96
hamming_7_4_codec.py Normal file
View File

@@ -0,0 +1,96 @@
import numpy as np
import numpy.typing as npt
GEN_MATRIX = np.asarray([(1, 1, 1, 0, 0, 0, 0),
(1, 0, 0, 1, 1, 0, 0),
(0, 1, 0, 1, 0, 1, 0),
(1, 1, 0, 1, 0, 0, 1),
])
PARITY_MATRIX = np.asarray([(0, 0, 0, 1, 1, 1, 1),
(0, 1, 1, 0, 0, 1, 1),
(1, 0, 1, 0, 1, 0, 1),
])
DECODER_MATRIX = np.asarray([(0, 0, 1, 0, 0, 0, 0,),
(0, 0, 0, 0, 1, 0, 0,),
(0, 0, 0, 0, 0, 1, 0,),
(0, 0, 0, 0, 0, 0, 1,),
])
def number_to_list(number: int, N: int) -> npt.NDArray:
"""Return the last N bits of a number as an MSB-first array"""
return np.array([(number >> (N-1-i)) % 2 for i in range(0, N)],dtype=int)
def list_to_number(array: npt.NDArray, N: int) -> int:
"""Reconstruct a number from the first N elements of an MSB-first array"""
output = 0
for i in range(0, N):
output += array[i] << (N-1-i)
return output
def encode_nibble(data: int) -> int:
"""Encode the lower 4 bits of data as hamming(7,4)"""
data_asarr = number_to_list(data, 4)
output_asarr = (data_asarr @ GEN_MATRIX) % 2
return list_to_number(output_asarr, 7)
def hamming_7_4_encode(data: list[int]) -> list[int]:
"""Encode a list of ints using Hamming(7,4)
The returned list is twice as long as the list in the argument"""
data_encoded = []
for element in data:
data_encoded += [encode_nibble(element >> 4),
encode_nibble(element % 16)]
return data_encoded
def decode_nibble(data: int) -> int:
"""decode a single nibble using the parity check matrix of Hamming(7,4).
This should correct 2 errors maximum."""
data_asarr = number_to_list(data, 7)
syndrome = (PARITY_MATRIX @ data_asarr) % 2
error = list_to_number(syndrome, 3)
if error == 0:
data_decoded = (DECODER_MATRIX @ data_asarr) % 2
return list_to_number(data_decoded, 4)
data_asarr[error - 1] ^= 1
data_decoded = (DECODER_MATRIX @ data_asarr) % 2
return list_to_number(data_decoded, 4)
def hamming_7_4_decode(data: list[int]) -> list[int]:
"""Decode a list of ints using Hamming(7,4)
The returned list is half as long as the list in the argument"""
return [(decode_nibble(data[i]) << 4) + (decode_nibble(data[i + 1])) for i in range(0, len(data), 2)]
if __name__ == "__main__":
msg = 'TEST DE HA5PLS'
data_in = [byte for byte in bytearray(msg.encode())]
data_encoded = hamming_7_4_encode(data_in)
print(f"Data sent: {msg}")
data_corrupted_1bit = [data ^ (1 << (idx % 7))
for idx, data in enumerate(data_encoded)]
# print(f"Corrupt data with 1-bit errors: {data_corrupted_1bit}")
data_corrected_1bit = hamming_7_4_decode(data_corrupted_1bit)
data_corrected_1bit_str = [int.to_bytes(int(i), 1, "big").decode(
encoding="utf-8", errors="ignore") for i in data_corrected_1bit]
print(f"Recovered data from 1-bit errors: {data_corrected_1bit_str}")
data_corrupted_2bit = [data ^ (5 << (idx % 7))
for idx, data in enumerate(data_encoded)]
# print(f"Corrupt data with 2-bit errors: {data_corrupted_2bit}")
data_corrected_2bit = hamming_7_4_decode(data_corrupted_2bit)
data_corrected_2bit_str = [int.to_bytes(int(i), 1, "big").decode(
encoding="utf-8", errors="ignore") for i in data_corrected_2bit]
print(f"Recovered data from 2-bit errors: {data_corrected_2bit_str}")
# print(f"Corrupt data with 3-bit errors: {data_corrupted_3bit}")
data_corrected_noerr = hamming_7_4_decode(data_encoded)
data_corrected_noerr_str = [int.to_bytes(int(i), 1, "big").decode(
encoding="utf-8", errors="ignore") for i in data_corrected_noerr]
print(f"Recovered data from no errors: {data_corrected_noerr_str}")

58
header.py Normal file
View File

@@ -0,0 +1,58 @@
from hamming_7_4_codec import hamming_7_4_encode, hamming_7_4_decode
from crc import Calculator, Crc16
PROTOCOL_IDENTIFIER = 0x0
# CRC_POLY = (0xed2f << 1) + 1 # from https://users.ece.cmu.edu/~koopman/crc/index.html as "best 16-bit CRC" on 2025-10-24
ONBEAT_CRC = Calculator(Crc16.IBM_3740)
class Onbeat_Header:
"""This class represents a header for a single packet of ONBEAT."""
def __init__(self, protocol_id, protocol_configuration: int, callsign: str, pkt_len: int, pkt_sequence_id: int):
if protocol_id >= 2 << 4:
raise OverflowError(
f"protocol identifier should be confined to 4 bits, got {protocol_id}")
self.protocol_id = protocol_id
if protocol_configuration >= 2 << 4:
raise OverflowError(
f"protocol configuration should be confined to 4 bits, got {protocol_configuration}")
self.protocol_configuration = protocol_configuration
call_len = len(callsign.encode())
if call_len > 10:
raise OverflowError(
f"Callsign must be confined to 10 bytes, got {callsign} with length {call_len} (using UTF-8)")
for _ in range(call_len, 10):
callsign += "\0"
self.callsign = callsign
if pkt_len >= 2 << 16:
raise OverflowError(
f"Maximum allowed packet size is {2 << 16 - 1} got {pkt_len}")
self.pkt_len = pkt_len
if pkt_sequence_id >= 256:
raise OverflowError(
f"Packet sequence ID must be confined to 8 bits, got {pkt_sequence_id}")
self.pkt_sequence_id = pkt_sequence_id
def encode(self) -> list[int]:
header_asints = []
header_asints += [(PROTOCOL_IDENTIFIER << 4) +
self.protocol_configuration]
header_asints += [ord(c) for c in self.callsign]
header_asints += [(self.pkt_len >> 8), self.pkt_len % 256]
header_asints += [self.pkt_sequence_id]
header_crc = ONBEAT_CRC.checksum(bytes(header_asints))
header_asints += [header_crc >> 8, header_crc % 256]
return hamming_7_4_encode(header_asints)
def decode(self, header_encoded: list[int]) -> bool:
header_corrected = hamming_7_4_decode(header_encoded)
self.protocol_id = int(header_corrected[0] >> 4)
self.protocol_configuration = int(header_corrected[0] % 16)
self.callsign = bytes(header_corrected[1:11]).decode(errors="ignore")
self.pkt_len = int((header_corrected[11] << 8) + header_corrected[12])
self.pkt_sequence_id = int(header_corrected[13])
return ONBEAT_CRC.verify(bytearray(header_corrected[0:14]), (header_corrected[14] << 8) + header_corrected[15])

View File

@@ -0,0 +1,880 @@
options:
parameters:
author: HA5PLS
catch_exceptions: 'True'
category: '[ONBEAT]'
cmake_opt: ''
comment: ''
copyright: GPL 3.0 or later
description: Hier block for demod of ONBEAT
gen_cmake: 'On'
gen_linking: dynamic
generate_options: hb
hier_block_src_path: '.:'
id: ONBEAT_Demod
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: ONBEAT Demod
window_size: (1000,1000)
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [8, 8]
rotation: 0
state: enabled
blocks:
- name: QPSK_MAP
id: variable_constellation_rect
parameters:
comment: ''
const_points: '[-1-1j, -1+1j, 1+1j, 1-1j]'
imag_sect: '2'
precision: '8'
real_sect: '2'
rot_sym: '4'
soft_dec_lut: None
sym_map: symbol_map
w_imag_sect: '1'
w_real_sect: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [192, 12.0]
rotation: 0
state: enabled
- name: FULL_PACKET_LEN
id: parameter
parameters:
alias: ''
comment: ''
hide: none
label: ''
short_id: ''
type: eng_float
value: '4096'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [664, 8.0]
rotation: 0
state: enabled
- name: OVERSAMPLING
id: parameter
parameters:
alias: ''
comment: ''
hide: none
label: ''
short_id: ''
type: intx
value: '10'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [448, 8.0]
rotation: 0
state: enabled
- name: RRC_ALPHA
id: parameter
parameters:
alias: ''
comment: ''
hide: none
label: ''
short_id: ''
type: eng_float
value: '0.35'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [568, 8.0]
rotation: 0
state: enabled
- name: analog_agc_xx_0
id: analog_agc_xx
parameters:
affinity: ''
alias: ''
comment: ''
gain: '1.0'
max_gain: '65536'
maxoutbuf: '0'
minoutbuf: '0'
rate: 1e-4
reference: '1.0'
type: complex
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [152, 232.0]
rotation: 0
state: enabled
- name: blocks_multiply_const_xx_0
id: blocks_multiply_const_xx
parameters:
affinity: ''
alias: ''
comment: ''
const: 1j
maxoutbuf: '0'
minoutbuf: '0'
type: complex
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [48, 592.0]
rotation: 0
state: enabled
- name: blocks_multiply_const_xx_0_0
id: blocks_multiply_const_xx
parameters:
affinity: ''
alias: ''
comment: ''
const: '-1'
maxoutbuf: '0'
minoutbuf: '0'
type: complex
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [48, 680.0]
rotation: 0
state: enabled
- name: blocks_multiply_const_xx_0_1
id: blocks_multiply_const_xx
parameters:
affinity: ''
alias: ''
comment: ''
const: -1j
maxoutbuf: '0'
minoutbuf: '0'
type: complex
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [48, 768.0]
rotation: 0
state: enabled
- name: blocks_repack_bits_bb_0_0_0
id: blocks_repack_bits_bb
parameters:
affinity: ''
alias: ''
align_output: 'False'
comment: ''
endianness: gr.GR_MSB_FIRST
k: '2'
l: '1'
len_tag_key: '""'
maxoutbuf: '0'
minoutbuf: '0'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [616, 584.0]
rotation: 0
state: enabled
- name: blocks_repack_bits_bb_0_1_0
id: blocks_repack_bits_bb
parameters:
affinity: ''
alias: ''
align_output: 'False'
comment: ''
endianness: gr.GR_MSB_FIRST
k: '2'
l: '1'
len_tag_key: '""'
maxoutbuf: '0'
minoutbuf: '0'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [616, 672.0]
rotation: 0
state: enabled
- name: blocks_repack_bits_bb_0_2_0
id: blocks_repack_bits_bb
parameters:
affinity: ''
alias: ''
align_output: 'False'
comment: ''
endianness: gr.GR_MSB_FIRST
k: '2'
l: '1'
len_tag_key: '""'
maxoutbuf: '0'
minoutbuf: '0'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [616, 760.0]
rotation: 0
state: enabled
- name: blocks_repack_bits_bb_0_3
id: blocks_repack_bits_bb
parameters:
affinity: ''
alias: ''
align_output: 'False'
comment: ''
endianness: gr.GR_MSB_FIRST
k: '2'
l: '1'
len_tag_key: '""'
maxoutbuf: '0'
minoutbuf: '0'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [616, 496.0]
rotation: 0
state: enabled
- name: blocks_tag_debug_0
id: blocks_tag_debug
parameters:
affinity: ''
alias: ''
comment: ''
display: 'True'
filter: '""'
name: ''
num_inputs: '4'
type: byte
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1064.0, 896]
rotation: 270
state: disabled
- name: digital_constellation_decoder_cb_0
id: digital_constellation_decoder_cb
parameters:
affinity: ''
alias: ''
comment: ''
constellation: QPSK_MAP
maxoutbuf: '0'
minoutbuf: '0'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [240, 504.0]
rotation: 0
state: enabled
- name: digital_constellation_decoder_cb_0_0
id: digital_constellation_decoder_cb
parameters:
affinity: ''
alias: ''
comment: ''
constellation: QPSK_MAP
maxoutbuf: '0'
minoutbuf: '0'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [240, 592.0]
rotation: 0
state: enabled
- name: digital_constellation_decoder_cb_0_1
id: digital_constellation_decoder_cb
parameters:
affinity: ''
alias: ''
comment: ''
constellation: QPSK_MAP
maxoutbuf: '0'
minoutbuf: '0'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [240, 680.0]
rotation: 0
state: enabled
- name: digital_constellation_decoder_cb_0_2
id: digital_constellation_decoder_cb
parameters:
affinity: ''
alias: ''
comment: ''
constellation: QPSK_MAP
maxoutbuf: '0'
minoutbuf: '0'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [240, 768.0]
rotation: 0
state: enabled
- name: digital_correlate_access_code_tag_xx_0
id: digital_correlate_access_code_tag_xx
parameters:
access_code: syncword
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
tagname: '"syncword_found"'
threshold: int(len(syncword)*(1-roc_tolerance))
type: byte
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [832, 488.0]
rotation: 0
state: enabled
- name: digital_correlate_access_code_tag_xx_0_0
id: digital_correlate_access_code_tag_xx
parameters:
access_code: syncword
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
tagname: '"syncword_found"'
threshold: int(len(syncword)*(1-roc_tolerance))
type: byte
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [832, 576.0]
rotation: 0
state: enabled
- name: digital_correlate_access_code_tag_xx_0_1
id: digital_correlate_access_code_tag_xx
parameters:
access_code: syncword
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
tagname: '"syncword_found"'
threshold: int(len(syncword)*(1-roc_tolerance))
type: byte
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [832, 664.0]
rotation: 0
state: enabled
- name: digital_correlate_access_code_tag_xx_0_2
id: digital_correlate_access_code_tag_xx
parameters:
access_code: syncword
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
tagname: '"syncword_found"'
threshold: int(len(syncword)*(1-roc_tolerance))
type: byte
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [832, 752.0]
rotation: 0
state: enabled
- name: digital_costas_loop_cc_0
id: digital_costas_loop_cc
parameters:
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
order: '4'
use_snr: 'False'
w: '0.045'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1008, 184.0]
rotation: 0
state: enabled
- name: digital_map_bb_0
id: digital_map_bb
parameters:
affinity: ''
alias: ''
comment: ''
map: symbol_map
maxoutbuf: '0'
minoutbuf: '0'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [464, 504.0]
rotation: 0
state: enabled
- name: digital_map_bb_0_0
id: digital_map_bb
parameters:
affinity: ''
alias: ''
comment: ''
map: symbol_map
maxoutbuf: '0'
minoutbuf: '0'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [464, 592.0]
rotation: 0
state: enabled
- name: digital_map_bb_0_1
id: digital_map_bb
parameters:
affinity: ''
alias: ''
comment: ''
map: symbol_map
maxoutbuf: '0'
minoutbuf: '0'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [464, 680.0]
rotation: 0
state: enabled
- name: digital_map_bb_0_2
id: digital_map_bb
parameters:
affinity: ''
alias: ''
comment: ''
map: symbol_map
maxoutbuf: '0'
minoutbuf: '0'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [464, 768.0]
rotation: 0
state: enabled
- name: digital_symbol_sync_xx_0
id: digital_symbol_sync_xx
parameters:
affinity: ''
alias: ''
comment: ''
constellation: digital.constellation_bpsk().base()
damping: '1.0'
loop_bw: '0.045'
max_dev: '1.5'
maxoutbuf: '0'
minoutbuf: '0'
nfilters: '64'
osps: '1'
pfb_mf_taps: '[]'
resamp_type: digital.IR_MMSE_8TAP
sps: '2'
ted_gain: '1.0'
ted_type: digital.TED_GARDNER
type: cc
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [616, 196.0]
rotation: 0
state: enabled
- name: filter_fft_rrc_filter_0
id: filter_fft_rrc_filter
parameters:
affinity: ''
alias: ''
alpha: RRC_ALPHA
comment: ''
decim: OVERSAMPLING//2
gain: '1'
maxoutbuf: '0'
minoutbuf: '0'
ntaps: 11*OVERSAMPLING
nthreads: '1'
samp_rate: samp_rate
sym_rate: samp_rate/OVERSAMPLING
type: ccc
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [352, 204.0]
rotation: 0
state: enabled
- name: pad_sink_0
id: pad_sink
parameters:
affinity: ''
alias: ''
comment: ''
label: freq_sync_out
num_streams: '1'
optional: 'True'
type: complex
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1216.0, 344]
rotation: 270
state: enabled
- name: pad_sink_1
id: pad_sink
parameters:
affinity: ''
alias: ''
comment: ''
label: symbol_sync_out
num_streams: '1'
optional: 'True'
type: complex
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [928.0, 336]
rotation: 270
state: enabled
- name: pad_sink_2
id: pad_sink
parameters:
affinity: ''
alias: ''
comment: ''
label: RRC_out
num_streams: '1'
optional: 'True'
type: complex
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [560.0, 376]
rotation: 270
state: enabled
- name: pad_sink_3
id: pad_sink
parameters:
affinity: ''
alias: ''
comment: ''
label: agc_out
num_streams: '1'
optional: 'True'
type: complex
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [296.0, 376]
rotation: 270
state: disabled
- name: pad_sink_4
id: pad_sink
parameters:
affinity: ''
alias: ''
comment: ''
label: out
num_streams: '1'
optional: 'False'
type: message
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1528, 632.0]
rotation: 0
state: enabled
- name: pad_source_0
id: pad_source
parameters:
affinity: ''
alias: ''
comment: ''
label: in
maxoutbuf: '0'
minoutbuf: '0'
num_streams: '1'
optional: 'False'
type: complex
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [8, 256.0]
rotation: 0
state: enabled
- name: roc_tolerance
id: parameter
parameters:
alias: ''
comment: ''
hide: none
label: ''
short_id: ''
type: eng_float
value: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1000, 8.0]
rotation: 0
state: enabled
- name: samp_rate
id: parameter
parameters:
alias: ''
comment: ''
hide: none
label: ''
short_id: ''
type: eng_float
value: 1e6
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [352, 8.0]
rotation: 0
state: enabled
- name: satellites_fixedlen_to_pdu_0
id: satellites_fixedlen_to_pdu
parameters:
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
pack: 'True'
packet_len: FULL_PACKET_LEN
syncword_tag: '"syncword_found"'
type: byte
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1208, 488.0]
rotation: 0
state: enabled
- name: satellites_fixedlen_to_pdu_0_0
id: satellites_fixedlen_to_pdu
parameters:
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
pack: 'True'
packet_len: FULL_PACKET_LEN
syncword_tag: '"syncword_found"'
type: byte
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1208, 576.0]
rotation: 0
state: enabled
- name: satellites_fixedlen_to_pdu_0_1
id: satellites_fixedlen_to_pdu
parameters:
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
pack: 'True'
packet_len: FULL_PACKET_LEN
syncword_tag: '"syncword_found"'
type: byte
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1208, 664.0]
rotation: 0
state: enabled
- name: satellites_fixedlen_to_pdu_0_2
id: satellites_fixedlen_to_pdu
parameters:
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
pack: 'True'
packet_len: FULL_PACKET_LEN
syncword_tag: '"syncword_found"'
type: byte
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1208, 752.0]
rotation: 0
state: enabled
- name: symbol_map
id: parameter
parameters:
alias: ''
comment: ''
hide: none
label: ''
short_id: ''
type: ''
value: '[0, 1, 3, 2]'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [352, 96.0]
rotation: 0
state: enabled
- name: syncword
id: parameter
parameters:
alias: ''
comment: ''
hide: none
label: ''
short_id: ''
type: ''
value: '"0000011100001001000110110010110101110111100110001010100111111010"'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [824, 8.0]
rotation: 0
state: enabled
- name: virtual_sink_0
id: virtual_sink
parameters:
alias: ''
comment: ''
stream_id: freq_sync_signal
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1304, 176.0]
rotation: 0
state: enabled
- name: virtual_source_0
id: virtual_source
parameters:
alias: ''
comment: ''
stream_id: freq_sync_signal
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [8, 504.0]
rotation: 0
state: enabled
connections:
- [analog_agc_xx_0, '0', filter_fft_rrc_filter_0, '0']
- [analog_agc_xx_0, '0', pad_sink_3, '0']
- [blocks_multiply_const_xx_0, '0', digital_constellation_decoder_cb_0_0, '0']
- [blocks_multiply_const_xx_0_0, '0', digital_constellation_decoder_cb_0_1, '0']
- [blocks_multiply_const_xx_0_1, '0', digital_constellation_decoder_cb_0_2, '0']
- [blocks_repack_bits_bb_0_0_0, '0', digital_correlate_access_code_tag_xx_0_0, '0']
- [blocks_repack_bits_bb_0_1_0, '0', digital_correlate_access_code_tag_xx_0_1, '0']
- [blocks_repack_bits_bb_0_2_0, '0', digital_correlate_access_code_tag_xx_0_2, '0']
- [blocks_repack_bits_bb_0_3, '0', digital_correlate_access_code_tag_xx_0, '0']
- [digital_constellation_decoder_cb_0, '0', digital_map_bb_0, '0']
- [digital_constellation_decoder_cb_0_0, '0', digital_map_bb_0_0, '0']
- [digital_constellation_decoder_cb_0_1, '0', digital_map_bb_0_1, '0']
- [digital_constellation_decoder_cb_0_2, '0', digital_map_bb_0_2, '0']
- [digital_correlate_access_code_tag_xx_0, '0', blocks_tag_debug_0, '3']
- [digital_correlate_access_code_tag_xx_0, '0', satellites_fixedlen_to_pdu_0, '0']
- [digital_correlate_access_code_tag_xx_0_0, '0', blocks_tag_debug_0, '2']
- [digital_correlate_access_code_tag_xx_0_0, '0', satellites_fixedlen_to_pdu_0_0,
'0']
- [digital_correlate_access_code_tag_xx_0_1, '0', blocks_tag_debug_0, '1']
- [digital_correlate_access_code_tag_xx_0_1, '0', satellites_fixedlen_to_pdu_0_1,
'0']
- [digital_correlate_access_code_tag_xx_0_2, '0', blocks_tag_debug_0, '0']
- [digital_correlate_access_code_tag_xx_0_2, '0', satellites_fixedlen_to_pdu_0_2,
'0']
- [digital_costas_loop_cc_0, '0', pad_sink_0, '0']
- [digital_costas_loop_cc_0, '0', virtual_sink_0, '0']
- [digital_map_bb_0, '0', blocks_repack_bits_bb_0_3, '0']
- [digital_map_bb_0_0, '0', blocks_repack_bits_bb_0_0_0, '0']
- [digital_map_bb_0_1, '0', blocks_repack_bits_bb_0_1_0, '0']
- [digital_map_bb_0_2, '0', blocks_repack_bits_bb_0_2_0, '0']
- [digital_symbol_sync_xx_0, '0', digital_costas_loop_cc_0, '0']
- [digital_symbol_sync_xx_0, '0', pad_sink_1, '0']
- [filter_fft_rrc_filter_0, '0', digital_symbol_sync_xx_0, '0']
- [filter_fft_rrc_filter_0, '0', pad_sink_2, '0']
- [pad_source_0, '0', analog_agc_xx_0, '0']
- [satellites_fixedlen_to_pdu_0, pdus, pad_sink_4, in]
- [satellites_fixedlen_to_pdu_0_0, pdus, pad_sink_4, in]
- [satellites_fixedlen_to_pdu_0_1, pdus, pad_sink_4, in]
- [satellites_fixedlen_to_pdu_0_2, pdus, pad_sink_4, in]
- [virtual_source_0, '0', blocks_multiply_const_xx_0, '0']
- [virtual_source_0, '0', blocks_multiply_const_xx_0_0, '0']
- [virtual_source_0, '0', blocks_multiply_const_xx_0_1, '0']
- [virtual_source_0, '0', digital_constellation_decoder_cb_0, '0']
metadata:
file_format: 1
grc_version: 3.10.11.0

361
hier_blocks/ONBEAT_mod.grc Normal file
View File

@@ -0,0 +1,361 @@
options:
parameters:
author: HA5PLS
catch_exceptions: 'True'
category: '[ONBEAT]'
cmake_opt: ''
comment: ''
copyright: GPL 3.0 or later
description: Hier block for modulation of ONBEAT
gen_cmake: 'On'
gen_linking: dynamic
generate_options: hb
hier_block_src_path: '.:'
id: ONBEAT_Mod
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: ONBEAT Mod
window_size: (1000,1000)
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [8, 8]
rotation: 0
state: enabled
blocks:
- name: QPSK_MAP
id: variable_constellation_rect
parameters:
comment: ''
const_points: '[-1-1j, -1+1j, 1+1j, 1-1j]'
imag_sect: '2'
precision: '8'
real_sect: '2'
rot_sym: '4'
soft_dec_lut: None
sym_map: '[0, 1, 3, 2]'
w_imag_sect: '1'
w_real_sect: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1104, 20.0]
rotation: 0
state: enabled
- name: preamble_len
id: variable_tag_object
parameters:
comment: ''
key: pmt.intern("packet_len")
offset: '0'
src: pmt.intern("src")
value: pmt.from_long(len(preamble))
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [64, 184.0]
rotation: 0
state: enabled
- name: syncword_len
id: variable_tag_object
parameters:
comment: ''
key: pmt.intern("packet_len")
offset: '0'
src: pmt.intern("src")
value: pmt.from_long((len(syncword)+7)//8)
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [64, 304.0]
rotation: 0
state: enabled
- name: trailer_len
id: variable_tag_object
parameters:
comment: ''
key: pmt.intern("packet_len")
offset: '0'
src: pmt.intern("src")
value: pmt.from_long(8)
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [168, 504.0]
rotation: 0
state: disabled
- name: OVERSAMPLING
id: parameter
parameters:
alias: ''
comment: ''
hide: none
label: ''
short_id: ''
type: intx
value: '10'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [248, 8.0]
rotation: 0
state: enabled
- name: RRC_ALPHA
id: parameter
parameters:
alias: ''
comment: ''
hide: none
label: ''
short_id: ''
type: eng_float
value: '0.35'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [368, 8.0]
rotation: 0
state: enabled
- 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: '1'
l: '8'
len_tag_key: '""'
maxoutbuf: '0'
minoutbuf: '0'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [352, 312.0]
rotation: 0
state: enabled
- name: blocks_repack_bits_bb_1_0_0
id: blocks_repack_bits_bb
parameters:
affinity: ''
alias: ''
align_output: 'False'
comment: ''
endianness: gr.GR_MSB_FIRST
k: '1'
l: '8'
len_tag_key: '""'
maxoutbuf: '0'
minoutbuf: '0'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [456, 512.0]
rotation: 0
state: disabled
- name: blocks_tagged_stream_mux_0
id: blocks_tagged_stream_mux
parameters:
affinity: ''
alias: ''
comment: ''
lengthtagname: packet_len
maxoutbuf: '0'
minoutbuf: '0'
ninputs: '3'
tag_preserve_head_pos: '0'
type: byte
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [848, 296.0]
rotation: 0
state: enabled
- name: blocks_vector_source_x_0_0
id: blocks_vector_source_x
parameters:
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
repeat: 'True'
tags: '[preamble_len]'
type: byte
vector: preamble
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [168, 216.0]
rotation: 0
state: enabled
- name: blocks_vector_source_x_0_0_0
id: blocks_vector_source_x
parameters:
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
repeat: 'True'
tags: '[syncword_len]'
type: byte
vector: '[int(i) for i in syncword]'
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [168, 304.0]
rotation: 0
state: enabled
- name: blocks_vector_source_x_0_0_0_0
id: blocks_vector_source_x
parameters:
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
repeat: 'True'
tags: '[trailer_len]'
type: byte
vector: preamble
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [272, 504.0]
rotation: 0
state: disabled
- name: digital_constellation_modulator_0
id: digital_constellation_modulator
parameters:
affinity: ''
alias: ''
comment: ''
constellation: QPSK_MAP
differential: 'False'
excess_bw: RRC_ALPHA
log: 'False'
maxoutbuf: '0'
minoutbuf: '0'
samples_per_symbol: OVERSAMPLING
truncate: 'False'
verbose: 'False'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1096, 312.0]
rotation: 0
state: enabled
- name: pad_sink_0
id: pad_sink
parameters:
affinity: ''
alias: ''
comment: ''
label: out
num_streams: '1'
optional: 'False'
type: complex
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1352, 336.0]
rotation: 0
state: enabled
- name: pad_source_0
id: pad_source
parameters:
affinity: ''
alias: ''
comment: ''
label: in
maxoutbuf: '0'
minoutbuf: '0'
num_streams: '1'
optional: 'False'
type: byte
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [288, 416.0]
rotation: 0
state: enabled
- name: preamble
id: parameter
parameters:
alias: ''
comment: ''
hide: none
label: ''
short_id: ''
type: ''
value: '[0x33 for i in range(0, 128*2, 8)]'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [808, 24.0]
rotation: 0
state: enabled
- name: syncword
id: parameter
parameters:
alias: ''
comment: ''
hide: none
label: ''
short_id: ''
type: ''
value: '"0000011100001001000110110010110101110111100110001010100111111010"'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [608, 24.0]
rotation: 0
state: enabled
connections:
- [blocks_repack_bits_bb_1_0, '0', blocks_tagged_stream_mux_0, '1']
- [blocks_tagged_stream_mux_0, '0', digital_constellation_modulator_0, '0']
- [blocks_vector_source_x_0_0, '0', blocks_tagged_stream_mux_0, '0']
- [blocks_vector_source_x_0_0_0, '0', blocks_repack_bits_bb_1_0, '0']
- [blocks_vector_source_x_0_0_0_0, '0', blocks_repack_bits_bb_1_0_0, '0']
- [digital_constellation_modulator_0, '0', pad_sink_0, '0']
- [pad_source_0, '0', blocks_tagged_stream_mux_0, '2']
metadata:
file_format: 1
grc_version: 3.10.11.0

9
loremipsum Normal file
View File

@@ -0,0 +1,9 @@
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque scelerisque nunc ac mi rhoncus, in commodo elit euismod. Suspendisse eu tempor dolor, in convallis tortor. Quisque semper nec augue sed sollicitudin. Sed at justo neque. Suspendisse dolor dolor, interdum ultricies commodo sollicitudin, congue sed massa. Sed ut tellus in felis feugiat ornare. Nunc in fringilla nisi. Ut eget fermentum massa. Nam nec ex a enim vestibulum commodo ut nec urna. Fusce id iaculis lectus. Integer aliquet quis est sit amet posuere.
Nulla vitae facilisis ex. Etiam mi ipsum, tristique nec convallis vitae, molestie vel massa. Aliquam erat volutpat. Vivamus molestie lorem nibh, lacinia efficitur magna elementum ac. Morbi ut lectus a mauris sodales ultricies eu vel nisl. Phasellus eget dui ac ante tristique tristique. Suspendisse nisi orci, vestibulum in leo ac, mollis ultricies mi. Donec bibendum, justo quis consequat ultrices, quam est lobortis orci, ut laoreet nibh ligula non felis. Mauris dignissim, odio ac luctus interdum, dolor massa pretium elit, vitae ullamcorper justo orci nec mi. Nunc pharetra et tortor id fringilla. Sed ac gravida diam, quis rutrum dolor. Curabitur sit amet enim nec libero pulvinar dictum. Cras sodales orci et tellus volutpat, eget malesuada odio commodo.
Curabitur varius ultricies metus nec laoreet. Fusce commodo felis et eros volutpat iaculis. Suspendisse potenti. Etiam augue nibh, consequat at malesuada ac, interdum vel dolor. Morbi nec urna tincidunt, varius eros sed, sagittis odio. Quisque auctor nibh diam, ut feugiat urna fermentum a. Aenean sit amet lectus vehicula, iaculis purus in, suscipit ante. Vestibulum vitae euismod urna. Nam id aliquam lorem. Nullam aliquet leo sit amet mi imperdiet congue. Sed luctus urna erat, sed finibus nisl tincidunt sed. Integer at tortor quam. Praesent id imperdiet lorem.
Aenean feugiat tempus lorem ac gravida. Praesent quis dolor at risus sodales porttitor a ut tellus. Aenean varius ex in lorem pulvinar, pulvinar mattis elit rhoncus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Sed varius elit sed justo mattis varius. Curabitur a enim mi. Mauris nec est congue tortor sollicitudin convallis. Donec vestibulum diam risus, quis imperdiet massa consectetur non. Curabitur vel nunc est. Vestibulum convallis ipsum vel diam eleifend, nec gravida arcu auctor. Nam id libero tellus. Etiam at vehicula elit, imperdiet sollicitudin ligula. In hac habitasse platea dictumst. Phasellus lorem ex, efficitur in sem sit amet, fringilla dictum purus. Duis porta pharetra faucibus. Duis turpis tellus, condimentum id fringilla sed, fringilla sed mi.
Etiam et metus id elit varius faucibus non id justo. Aliquam interdum elit id massa egestas cursus quis sed magna. Sed gravida pellentesque ornare. Integer at pharetra tortor. Nam sit amet velit eu ligula fringilla mattis eu vel tortor. Nunc in ipsum tellus. Vivamus efficitur neque non purus faucibus, nec congue libero consequat.

962
onbeat_rx.grc Normal file
View File

@@ -0,0 +1,962 @@
options:
parameters:
author: HA5PLS
catch_exceptions: 'True'
category: '[GRC Hier Blocks]'
cmake_opt: ''
comment: ''
copyright: GPL 3.0 or later
description: Receiver flowgraph for onbeat
gen_cmake: 'On'
gen_linking: dynamic
generate_options: qt_gui
hier_block_src_path: '.:'
id: onbeat_rx
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: ONBEAT receiver
window_size: (1000,1000)
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [8, 8]
rotation: 0
state: enabled
blocks:
- name: OVERSAMPLING
id: variable
parameters:
comment: ''
value: '100'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [288, 12.0]
rotation: 0
state: enabled
- name: RRC_ALPHA
id: variable
parameters:
comment: ''
value: '0.35'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [816, 12.0]
rotation: 0
state: enabled
- name: lo_freq
id: variable_qtgui_range
parameters:
comment: ''
gui_hint: ''
label: RX frequency
min_len: '200'
orient: QtCore.Qt.Horizontal
rangeType: int
start: '50'
step: '1'
stop: '3000'
value: '433'
widget: counter_slider
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [192, 96.0]
rotation: 0
state: true
- name: rx_gain
id: variable_qtgui_range
parameters:
comment: ''
gui_hint: ''
label: RX gain
min_len: '200'
orient: QtCore.Qt.Horizontal
rangeType: float
start: '0'
step: '0.1'
stop: '49.6'
value: '20'
widget: counter_slider
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [160, 256.0]
rotation: 0
state: true
- name: samp_rate
id: variable
parameters:
comment: ''
value: 1e6
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [192, 12.0]
rotation: 0
state: enabled
- name: symbol_map
id: variable
parameters:
comment: ''
value: '[0, 1, 3, 2]'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [712, 12.0]
rotation: 0
state: enabled
- name: ONBEAT_Demod_1
id: ONBEAT_Demod
parameters:
FULL_PACKET_LEN: 8*(4*255+2*16)
OVERSAMPLING: OVERSAMPLING
RRC_ALPHA: RRC_ALPHA
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
roc_tolerance: '0.8'
samp_rate: samp_rate
symbol_map: symbol_map
syncword: syncword
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [728, 412.0]
rotation: 0
state: enabled
- name: network_socket_pdu_1
id: network_socket_pdu
parameters:
affinity: ''
alias: ''
comment: ''
host: 0.0.0.0
maxoutbuf: '0'
minoutbuf: '0'
mtu: '10000'
port: rx_port
tcp_no_delay: 'False'
type: TCP_SERVER
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1104, 572.0]
rotation: 0
state: enabled
- name: qtgui_const_sink_x_0
id: qtgui_const_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: '"red"'
color2: '"red"'
color3: '"green"'
color4: '"black"'
color5: '"cyan"'
color6: '"magenta"'
color7: '"yellow"'
color8: '"dark red"'
color9: '"dark green"'
comment: ''
grid: 'False'
gui_hint: ''
label1: ''
label10: ''
label2: ''
label3: ''
label4: ''
label5: ''
label6: ''
label7: ''
label8: ''
label9: ''
legend: 'True'
marker1: '0'
marker10: '0'
marker2: '0'
marker3: '0'
marker4: '0'
marker5: '0'
marker6: '0'
marker7: '0'
marker8: '0'
marker9: '0'
name: '""'
nconnections: '1'
size: '128'
style1: '0'
style10: '0'
style2: '0'
style3: '0'
style4: '0'
style5: '0'
style6: '0'
style7: '0'
style8: '0'
style9: '0'
tr_chan: '0'
tr_level: '0.0'
tr_mode: qtgui.TRIG_MODE_FREE
tr_slope: qtgui.TRIG_SLOPE_POS
tr_tag: '""'
type: complex
update_time: '0.10'
width1: '1'
width10: '1'
width2: '1'
width3: '1'
width4: '1'
width5: '1'
width6: '1'
width7: '1'
width8: '1'
width9: '1'
xmax: '2'
xmin: '-2'
ymax: '2'
ymin: '-2'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1104, 316.0]
rotation: 0
state: enabled
- name: qtgui_eye_sink_x_0
id: qtgui_eye_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: blue
color2: blue
color3: blue
color4: blue
color5: blue
color6: blue
color7: blue
color8: blue
color9: blue
comment: ''
ctrlpanel: 'False'
entags: 'True'
grid: 'False'
gui_hint: ''
label1: Signal 1
label10: Signal 10
label2: Signal 2
label3: Signal 3
label4: Signal 4
label5: Signal 5
label6: Signal 6
label7: Signal 7
label8: Signal 8
label9: Signal 9
legend: 'True'
marker1: '-1'
marker10: '-1'
marker2: '-1'
marker3: '-1'
marker4: '-1'
marker5: '-1'
marker6: '-1'
marker7: '-1'
marker8: '-1'
marker9: '-1'
nconnections: '1'
samp_per_symbol: '1'
size: '128'
srate: samp_rate
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'
tr_level: '0.0'
tr_mode: qtgui.TRIG_MODE_FREE
tr_slope: qtgui.TRIG_SLOPE_POS
tr_tag: '""'
type: complex
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'
ymin: '-1'
yunit: '""'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1104, 380.0]
rotation: 0
state: enabled
- name: qtgui_freq_sink_x_0
id: qtgui_freq_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'
average: '1.0'
axislabels: 'True'
bw: samp_rate
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: 'False'
fc: lo_freq*10e6
fftsize: '1024'
freqhalf: 'True'
grid: 'False'
gui_hint: ''
label: Relative Gain
label1: ''
label10: ''''''
label2: ''''''
label3: ''''''
label4: ''''''
label5: ''''''
label6: ''''''
label7: ''''''
label8: ''''''
label9: ''''''
legend: 'True'
maxoutbuf: '0'
minoutbuf: '0'
name: '""'
nconnections: '1'
norm_window: 'False'
showports: 'False'
tr_chan: '0'
tr_level: '0.0'
tr_mode: qtgui.TRIG_MODE_FREE
tr_tag: '""'
type: complex
units: dB
update_time: '0.10'
width1: '1'
width10: '1'
width2: '1'
width3: '1'
width4: '1'
width5: '1'
width6: '1'
width7: '1'
width8: '1'
width9: '1'
wintype: window.WIN_BLACKMAN_hARRIS
ymax: '10'
ymin: '-140'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [776, 224.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: 'False'
entags: 'True'
grid: 'False'
gui_hint: ''
label1: Signal 1
label10: Signal 10
label2: Signal 2
label3: Signal 3
label4: Signal 4
label5: Signal 5
label6: Signal 6
label7: Signal 7
label8: Signal 8
label9: Signal 9
legend: 'True'
marker1: '-1'
marker10: '-1'
marker2: '-1'
marker3: '-1'
marker4: '-1'
marker5: '-1'
marker6: '-1'
marker7: '-1'
marker8: '-1'
marker9: '-1'
name: '""'
nconnections: '1'
size: '1024'
srate: samp_rate/5
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'
tr_level: '0.0'
tr_mode: qtgui.TRIG_MODE_FREE
tr_slope: qtgui.TRIG_SLOPE_POS
tr_tag: '""'
type: complex
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'
ymin: '-1'
yunit: '""'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1104, 484.0]
rotation: 0
state: enabled
- name: rtlsdr_source_0
id: rtlsdr_source
parameters:
affinity: ''
alias: ''
ant0: ''
ant1: ''
ant10: ''
ant11: ''
ant12: ''
ant13: ''
ant14: ''
ant15: ''
ant16: ''
ant17: ''
ant18: ''
ant19: ''
ant2: ''
ant20: ''
ant21: ''
ant22: ''
ant23: ''
ant24: ''
ant25: ''
ant26: ''
ant27: ''
ant28: ''
ant29: ''
ant3: ''
ant30: ''
ant31: ''
ant4: ''
ant5: ''
ant6: ''
ant7: ''
ant8: ''
ant9: ''
args: '""'
bb_gain0: '20'
bb_gain1: '20'
bb_gain10: '20'
bb_gain11: '20'
bb_gain12: '20'
bb_gain13: '20'
bb_gain14: '20'
bb_gain15: '20'
bb_gain16: '20'
bb_gain17: '20'
bb_gain18: '20'
bb_gain19: '20'
bb_gain2: '20'
bb_gain20: '20'
bb_gain21: '20'
bb_gain22: '20'
bb_gain23: '20'
bb_gain24: '20'
bb_gain25: '20'
bb_gain26: '20'
bb_gain27: '20'
bb_gain28: '20'
bb_gain29: '20'
bb_gain3: '20'
bb_gain30: '20'
bb_gain31: '20'
bb_gain4: '20'
bb_gain5: '20'
bb_gain6: '20'
bb_gain7: '20'
bb_gain8: '20'
bb_gain9: '20'
bw0: '0'
bw1: '0'
bw10: '0'
bw11: '0'
bw12: '0'
bw13: '0'
bw14: '0'
bw15: '0'
bw16: '0'
bw17: '0'
bw18: '0'
bw19: '0'
bw2: '0'
bw20: '0'
bw21: '0'
bw22: '0'
bw23: '0'
bw24: '0'
bw25: '0'
bw26: '0'
bw27: '0'
bw28: '0'
bw29: '0'
bw3: '0'
bw30: '0'
bw31: '0'
bw4: '0'
bw5: '0'
bw6: '0'
bw7: '0'
bw8: '0'
bw9: '0'
clock_source0: ''
clock_source1: ''
clock_source2: ''
clock_source3: ''
clock_source4: ''
clock_source5: ''
clock_source6: ''
clock_source7: ''
comment: ''
corr0: '0'
corr1: '0'
corr10: '0'
corr11: '0'
corr12: '0'
corr13: '0'
corr14: '0'
corr15: '0'
corr16: '0'
corr17: '0'
corr18: '0'
corr19: '0'
corr2: '0'
corr20: '0'
corr21: '0'
corr22: '0'
corr23: '0'
corr24: '0'
corr25: '0'
corr26: '0'
corr27: '0'
corr28: '0'
corr29: '0'
corr3: '0'
corr30: '0'
corr31: '0'
corr4: '0'
corr5: '0'
corr6: '0'
corr7: '0'
corr8: '0'
corr9: '0'
dc_offset_mode0: '0'
dc_offset_mode1: '0'
dc_offset_mode10: '0'
dc_offset_mode11: '0'
dc_offset_mode12: '0'
dc_offset_mode13: '0'
dc_offset_mode14: '0'
dc_offset_mode15: '0'
dc_offset_mode16: '0'
dc_offset_mode17: '0'
dc_offset_mode18: '0'
dc_offset_mode19: '0'
dc_offset_mode2: '0'
dc_offset_mode20: '0'
dc_offset_mode21: '0'
dc_offset_mode22: '0'
dc_offset_mode23: '0'
dc_offset_mode24: '0'
dc_offset_mode25: '0'
dc_offset_mode26: '0'
dc_offset_mode27: '0'
dc_offset_mode28: '0'
dc_offset_mode29: '0'
dc_offset_mode3: '0'
dc_offset_mode30: '0'
dc_offset_mode31: '0'
dc_offset_mode4: '0'
dc_offset_mode5: '0'
dc_offset_mode6: '0'
dc_offset_mode7: '0'
dc_offset_mode8: '0'
dc_offset_mode9: '0'
freq0: lo_freq * 1e6
freq1: 100e6
freq10: 100e6
freq11: 100e6
freq12: 100e6
freq13: 100e6
freq14: 100e6
freq15: 100e6
freq16: 100e6
freq17: 100e6
freq18: 100e6
freq19: 100e6
freq2: 100e6
freq20: 100e6
freq21: 100e6
freq22: 100e6
freq23: 100e6
freq24: 100e6
freq25: 100e6
freq26: 100e6
freq27: 100e6
freq28: 100e6
freq29: 100e6
freq3: 100e6
freq30: 100e6
freq31: 100e6
freq4: 100e6
freq5: 100e6
freq6: 100e6
freq7: 100e6
freq8: 100e6
freq9: 100e6
gain0: rx_gain
gain1: '10'
gain10: '10'
gain11: '10'
gain12: '10'
gain13: '10'
gain14: '10'
gain15: '10'
gain16: '10'
gain17: '10'
gain18: '10'
gain19: '10'
gain2: '10'
gain20: '10'
gain21: '10'
gain22: '10'
gain23: '10'
gain24: '10'
gain25: '10'
gain26: '10'
gain27: '10'
gain28: '10'
gain29: '10'
gain3: '10'
gain30: '10'
gain31: '10'
gain4: '10'
gain5: '10'
gain6: '10'
gain7: '10'
gain8: '10'
gain9: '10'
gain_mode0: 'False'
gain_mode1: 'False'
gain_mode10: 'False'
gain_mode11: 'False'
gain_mode12: 'False'
gain_mode13: 'False'
gain_mode14: 'False'
gain_mode15: 'False'
gain_mode16: 'False'
gain_mode17: 'False'
gain_mode18: 'False'
gain_mode19: 'False'
gain_mode2: 'False'
gain_mode20: 'False'
gain_mode21: 'False'
gain_mode22: 'False'
gain_mode23: 'False'
gain_mode24: 'False'
gain_mode25: 'False'
gain_mode26: 'False'
gain_mode27: 'False'
gain_mode28: 'False'
gain_mode29: 'False'
gain_mode3: 'False'
gain_mode30: 'False'
gain_mode31: 'False'
gain_mode4: 'False'
gain_mode5: 'False'
gain_mode6: 'False'
gain_mode7: 'False'
gain_mode8: 'False'
gain_mode9: 'False'
if_gain0: '20'
if_gain1: '20'
if_gain10: '20'
if_gain11: '20'
if_gain12: '20'
if_gain13: '20'
if_gain14: '20'
if_gain15: '20'
if_gain16: '20'
if_gain17: '20'
if_gain18: '20'
if_gain19: '20'
if_gain2: '20'
if_gain20: '20'
if_gain21: '20'
if_gain22: '20'
if_gain23: '20'
if_gain24: '20'
if_gain25: '20'
if_gain26: '20'
if_gain27: '20'
if_gain28: '20'
if_gain29: '20'
if_gain3: '20'
if_gain30: '20'
if_gain31: '20'
if_gain4: '20'
if_gain5: '20'
if_gain6: '20'
if_gain7: '20'
if_gain8: '20'
if_gain9: '20'
iq_balance_mode0: '0'
iq_balance_mode1: '0'
iq_balance_mode10: '0'
iq_balance_mode11: '0'
iq_balance_mode12: '0'
iq_balance_mode13: '0'
iq_balance_mode14: '0'
iq_balance_mode15: '0'
iq_balance_mode16: '0'
iq_balance_mode17: '0'
iq_balance_mode18: '0'
iq_balance_mode19: '0'
iq_balance_mode2: '0'
iq_balance_mode20: '0'
iq_balance_mode21: '0'
iq_balance_mode22: '0'
iq_balance_mode23: '0'
iq_balance_mode24: '0'
iq_balance_mode25: '0'
iq_balance_mode26: '0'
iq_balance_mode27: '0'
iq_balance_mode28: '0'
iq_balance_mode29: '0'
iq_balance_mode3: '0'
iq_balance_mode30: '0'
iq_balance_mode31: '0'
iq_balance_mode4: '0'
iq_balance_mode5: '0'
iq_balance_mode6: '0'
iq_balance_mode7: '0'
iq_balance_mode8: '0'
iq_balance_mode9: '0'
maxoutbuf: '0'
minoutbuf: '0'
nchan: '1'
num_mboards: '1'
sample_rate: samp_rate * OVERSAMPLING
sync: sync
time_source0: ''
time_source1: ''
time_source2: ''
time_source3: ''
time_source4: ''
time_source5: ''
time_source6: ''
time_source7: ''
type: fc32
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [256, 332.0]
rotation: 0
state: disabled
- name: rx_port
id: parameter
parameters:
alias: ''
comment: ''
hide: none
label: ''
short_id: ''
type: str
value: '50002'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [408, 92.0]
rotation: 0
state: enabled
- name: soapy_rtlsdr_source_0
id: soapy_rtlsdr_source
parameters:
affinity: ''
agc: 'False'
alias: ''
bias: 'False'
bufflen: '16384'
center_freq: lo_freq*1e6
comment: ''
dev_args: ''
freq_correction: '0'
gain: rx_gain
maxoutbuf: '0'
minoutbuf: '0'
samp_rate: samp_rate
type: fc32
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [320, 232.0]
rotation: 0
state: enabled
- name: syncword
id: parameter
parameters:
alias: ''
comment: ''
hide: none
label: ''
short_id: ''
type: ''
value: '"0000011100001001000110110010110101110111100110001010100111111010"'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [448, 12.0]
rotation: 0
state: enabled
connections:
- [ONBEAT_Demod_1, '0', qtgui_const_sink_x_0, '0']
- [ONBEAT_Demod_1, '1', qtgui_eye_sink_x_0, '0']
- [ONBEAT_Demod_1, '2', qtgui_time_sink_x_0, '0']
- [ONBEAT_Demod_1, out, network_socket_pdu_1, pdus]
- [rtlsdr_source_0, '0', ONBEAT_Demod_1, '0']
- [rtlsdr_source_0, '0', qtgui_freq_sink_x_0, '0']
- [soapy_rtlsdr_source_0, '0', ONBEAT_Demod_1, '0']
- [soapy_rtlsdr_source_0, '0', qtgui_freq_sink_x_0, '0']
metadata:
file_format: 1
grc_version: 3.10.11.0

43
onbeat_rx_wrapper.py Normal file
View File

@@ -0,0 +1,43 @@
#!/usr/bin/env python
import asyncio
import framing
from header import Onbeat_Header
import json
PACKET_LEN=255*4 + 32
DATA_LEN=223*4
HEADER_LEN=32
async def tcp_client():
port = 50002
reader, _ = await asyncio.open_connection(
'127.0.0.1', port)
# output: list[tuple[Onbeat_Header, list[int]]] = []
output: list[list[int]] = []
packet_loss = 0
while message := await reader.read(PACKET_LEN):
try:
received = framing.decode_packet([i for i in message])
output.append([i for i in message])
print("pkt received")
if received[0].pkt_len == 0:
break
except KeyboardInterrupt:
break
except Exception as e:
packet_loss += 1
print(e)
return output
rs_coding = False
filename = "loremipsum"
received = asyncio.run(tcp_client())
with open("rx_packets.json", mode="w") as packetfile:
json.dump(received, packetfile)

311
onbeat_tx.grc Normal file
View File

@@ -0,0 +1,311 @@
options:
parameters:
author: HA5PLS
catch_exceptions: 'True'
category: '[GRC Hier Blocks]'
cmake_opt: ''
comment: ''
copyright: GPL 3.0 or later
description: Transmitter flowgraph for onbeat
gen_cmake: 'On'
gen_linking: dynamic
generate_options: qt_gui
hier_block_src_path: '.:'
id: onbeat_tx
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: ONBEAT transmitter
window_size: (1000,1000)
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [8, 8]
rotation: 0
state: enabled
blocks:
- name: OVERSAMPLING
id: variable
parameters:
comment: ''
value: '100'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [288, 12.0]
rotation: 0
state: enabled
- name: RRC_ALPHA
id: variable
parameters:
comment: ''
value: '0.35'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [816, 12.0]
rotation: 0
state: enabled
- name: lo_freq
id: variable_qtgui_range
parameters:
comment: ''
gui_hint: ''
label: TX frequency
min_len: '200'
orient: QtCore.Qt.Horizontal
rangeType: int
start: '50'
step: '1'
stop: '3000'
value: '433'
widget: counter_slider
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [192, 92.0]
rotation: 0
state: true
- name: samp_rate
id: variable
parameters:
comment: ''
value: 1e6
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [192, 12.0]
rotation: 0
state: enabled
- name: symbol_map
id: variable
parameters:
comment: ''
value: '[0, 1, 3, 2]'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [712, 12.0]
rotation: 0
state: enabled
- name: ONBEAT_Mod_0
id: ONBEAT_Mod
parameters:
OVERSAMPLING: OVERSAMPLING
RRC_ALPHA: RRC_ALPHA
affinity: ''
alias: ''
comment: ''
data_len: '1'
maxoutbuf: '0'
minoutbuf: '0'
preamble: '[0x33 for i in range(0, 128*2, 8)]'
syncword: syncword
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [832, 176.0]
rotation: 0
state: enabled
- name: iio_pluto_sink_0
id: iio_pluto_sink
parameters:
affinity: ''
alias: ''
attenuation1: '5.0'
bandwidth: '20000000'
buffer_size: '32768'
comment: ''
cyclic: 'False'
filter: ''
filter_source: '''Auto'''
fpass: '0'
frequency: lo_freq * 1000000
fstop: '0'
len_tag_key: ''
samplerate: int(samp_rate)
type: fc32
uri: ''
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1168, 148.0]
rotation: 0
state: true
- name: network_socket_pdu_1
id: network_socket_pdu
parameters:
affinity: ''
alias: ''
comment: ''
host: 0.0.0.0
maxoutbuf: '0'
minoutbuf: '0'
mtu: '10000'
port: tx_port
tcp_no_delay: 'False'
type: TCP_SERVER
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [408, 184.0]
rotation: 0
state: enabled
- name: pdu_pdu_to_tagged_stream_0
id: pdu_pdu_to_tagged_stream
parameters:
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
tag: packet_len
type: byte
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [608, 208.0]
rotation: 0
state: enabled
- name: qtgui_freq_sink_x_0
id: qtgui_freq_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'
average: '1.0'
axislabels: 'True'
bw: samp_rate
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: 'False'
fc: lo_freq * 1e6
fftsize: '1024'
freqhalf: 'True'
grid: 'False'
gui_hint: ''
label: Relative Gain
label1: ''
label10: ''''''
label2: ''''''
label3: ''''''
label4: ''''''
label5: ''''''
label6: ''''''
label7: ''''''
label8: ''''''
label9: ''''''
legend: 'True'
maxoutbuf: '0'
minoutbuf: '0'
name: '""'
nconnections: '1'
norm_window: 'False'
showports: 'False'
tr_chan: '0'
tr_level: '0.0'
tr_mode: qtgui.TRIG_MODE_FREE
tr_tag: '""'
type: complex
units: dB
update_time: '0.10'
width1: '1'
width10: '1'
width2: '1'
width3: '1'
width4: '1'
width5: '1'
width6: '1'
width7: '1'
width8: '1'
width9: '1'
wintype: window.WIN_BLACKMAN_hARRIS
ymax: '10'
ymin: '-140'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1176, 340.0]
rotation: 0
state: true
- name: syncword
id: parameter
parameters:
alias: ''
comment: ''
hide: none
label: ''
short_id: ''
type: ''
value: '"0000011100001001000110110010110101110111100110001010100111111010"'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [448, 12.0]
rotation: 0
state: enabled
- name: tx_port
id: parameter
parameters:
alias: ''
comment: ''
hide: none
label: ''
short_id: ''
type: str
value: '50001'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [408, 92.0]
rotation: 0
state: enabled
connections:
- [ONBEAT_Mod_0, '0', iio_pluto_sink_0, '0']
- [ONBEAT_Mod_0, '0', qtgui_freq_sink_x_0, '0']
- [network_socket_pdu_1, pdus, pdu_pdu_to_tagged_stream_0, pdus]
- [pdu_pdu_to_tagged_stream_0, '0', ONBEAT_Mod_0, '0']
metadata:
file_format: 1

46
onbeat_tx_wrapper.py Normal file
View File

@@ -0,0 +1,46 @@
#!/usr/bin/env python
import asyncio
from time import sleep
import framing
# from header import Onbeat_Header
import json
PACKET_LEN=255*4 + 32
DATA_LEN=223*4
HEADER_LEN=32
async def tcp_client(file_2_send: str, callsign: str, rs_coding: bool = True):
port = 50001
_, writer = await asyncio.open_connection(
'127.0.0.1', port)
with open(file_2_send, "rb") as file_to_send:
seq = 0
sent: list[list[int]] = []
try:
while message := file_to_send.read(DATA_LEN if rs_coding == True else (PACKET_LEN - HEADER_LEN)):
sent.append([i for i in message])
frame = bytes(framing.encode_packet([i for i in message], callsign, seq%256, rs_coding))
writer.write(frame)
seq += 1
print(seq)
sleep(0.01)
else:
frame = bytes(framing.encode_packet([], callsign, seq%256, rs_coding))
for _ in range(0,4):
writer.write(frame)
sleep(0.01)
sent.append([])
except KeyboardInterrupt:
return sent
rs_coding = True
filename = "/home/lacko/live_output/2025-11-01_12-39_elektro_lrit_1.691 GHz/IMAGES/ELEKTRO-L3/2025-11-01_12-30-00/msu_gs_Color IR Merge.png"
sent = asyncio.run(tcp_client(filename, "HA5PLS", rs_coding))
with open("packets.json", mode="w") as packetfile:
json.dump(sent, packetfile)

694
simulation/awgn.grc Normal file
View File

@@ -0,0 +1,694 @@
options:
parameters:
author: HA5PLS
catch_exceptions: 'True'
category: '[GRC Hier Blocks]'
cmake_opt: ''
comment: ''
copyright: GPL 3.0 or later
description: wrapper around ONBEAT modulator/demodulator for BER simulation
gen_cmake: 'On'
gen_linking: dynamic
generate_options: qt_gui
hier_block_src_path: '.:'
id: ONBEAT_AWGN_sim
max_nouts: '0'
output_language: python
placement: (0,0)
qt_qss_theme: ''
realtime_scheduling: ''
run: 'True'
run_command: '{python} -u {filename}'
run_options: run
sizing_mode: fixed
thread_safe_setters: ''
title: ONBEAT AWGN simulator
window_size: (1000,1000)
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [16, 16.0]
rotation: 0
state: enabled
blocks:
- name: OVERSAMPLING
id: variable
parameters:
comment: ''
value: '2'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [288, 16.0]
rotation: 0
state: enabled
- name: RRC_ALPHA
id: variable
parameters:
comment: ''
value: '0.35'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [816, 16.0]
rotation: 0
state: enabled
- name: full_packet_len
id: variable
parameters:
comment: ''
value: data_len*8
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [456, 88.0]
rotation: 0
state: enabled
- name: samp_rate
id: variable
parameters:
comment: ''
value: 1e6
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [200, 16.0]
rotation: 0
state: enabled
- name: symbol_map
id: variable
parameters:
comment: ''
value: '[0, 1, 3, 2]'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [720, 16.0]
rotation: 0
state: enabled
- name: EbN0
id: parameter
parameters:
alias: ''
comment: ''
hide: none
label: ''
short_id: ''
type: eng_float
value: '3'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [864, 136.0]
rotation: 0
state: enabled
- name: ONBEAT_Demod_0
id: ONBEAT_Demod
parameters:
FULL_PACKET_LEN: full_packet_len
OVERSAMPLING: OVERSAMPLING
RRC_ALPHA: RRC_ALPHA
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
roc_tolerance: '0.8'
samp_rate: samp_rate
symbol_map: symbol_map
syncword: syncword
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [248, 484.0]
rotation: 0
state: enabled
- name: ONBEAT_Mod_0
id: ONBEAT_Mod
parameters:
OVERSAMPLING: OVERSAMPLING
RRC_ALPHA: RRC_ALPHA
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
preamble: '[0x33 for i in range(0, 128*2, 8)]'
syncword: syncword
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [480, 264.0]
rotation: 0
state: enabled
- name: blocks_tag_gate_0
id: blocks_tag_gate
parameters:
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
propagate_tags: 'False'
single_key: '""'
type: complex
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [744, 280.0]
rotation: 0
state: enabled
- 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*1000
type: complex
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1144, 280.0]
rotation: 0
state: enabled
- name: channels_channel_model_0
id: channels_channel_model
parameters:
affinity: ''
alias: ''
block_tags: 'False'
comment: ''
epsilon: time_offset
freq_offset: freq_offset
maxoutbuf: '0'
minoutbuf: '0'
noise_voltage: 1.0/sqrt(2* 10**(float(EbN0) / 10)) * sqrt(OVERSAMPLING/2)
seed: '0'
taps: '1.0'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [928, 248.0]
rotation: 0
state: enabled
- name: data_len
id: parameter
parameters:
alias: ''
comment: ''
hide: none
label: ''
short_id: ''
type: intx
value: 255*4 + 32
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [576, 88.0]
rotation: 0
state: enabled
- name: freq_offset
id: parameter
parameters:
alias: ''
comment: ''
hide: none
label: ''
short_id: ''
type: eng_float
value: '0'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [960, 136.0]
rotation: 0
state: enabled
- name: import_0
id: import
parameters:
alias: ''
comment: ''
imports: from math import log10, log2, sqrt
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [968, 24.0]
rotation: 0
state: enabled
- name: network_socket_pdu_1
id: network_socket_pdu
parameters:
affinity: ''
alias: ''
comment: ''
host: 0.0.0.0
maxoutbuf: '0'
minoutbuf: '0'
mtu: '10000'
port: tx_port
tcp_no_delay: 'False'
type: TCP_SERVER
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [40, 264.0]
rotation: 0
state: enabled
- name: pdu_pdu_to_tagged_stream_0
id: pdu_pdu_to_tagged_stream
parameters:
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
tag: packet_len
type: byte
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [240, 288.0]
rotation: 0
state: enabled
- name: qtgui_const_sink_x_0
id: qtgui_const_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: ''
grid: 'False'
gui_hint: ''
label1: ''
label10: ''
label2: ''
label3: ''
label4: ''
label5: ''
label6: ''
label7: ''
label8: ''
label9: ''
legend: 'True'
marker1: '0'
marker10: '0'
marker2: '0'
marker3: '0'
marker4: '0'
marker5: '0'
marker6: '0'
marker7: '0'
marker8: '0'
marker9: '0'
name: '""'
nconnections: '1'
size: '128'
style1: '0'
style10: '0'
style2: '0'
style3: '0'
style4: '0'
style5: '0'
style6: '0'
style7: '0'
style8: '0'
style9: '0'
tr_chan: '0'
tr_level: '0.0'
tr_mode: qtgui.TRIG_MODE_FREE
tr_slope: qtgui.TRIG_SLOPE_POS
tr_tag: '""'
type: complex
update_time: '0.10'
width1: '1'
width10: '1'
width2: '1'
width3: '1'
width4: '1'
width5: '1'
width6: '1'
width7: '1'
width8: '1'
width9: '1'
xmax: '2'
xmin: '-2'
ymax: '2'
ymin: '-2'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [616, 400.0]
rotation: 0
state: enabled
- name: qtgui_eye_sink_x_0
id: qtgui_eye_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: blue
color2: blue
color3: blue
color4: blue
color5: blue
color6: blue
color7: blue
color8: blue
color9: blue
comment: ''
ctrlpanel: 'False'
entags: 'True'
grid: 'False'
gui_hint: ''
label1: Signal 1
label10: Signal 10
label2: Signal 2
label3: Signal 3
label4: Signal 4
label5: Signal 5
label6: Signal 6
label7: Signal 7
label8: Signal 8
label9: Signal 9
legend: 'True'
marker1: '-1'
marker10: '-1'
marker2: '-1'
marker3: '-1'
marker4: '-1'
marker5: '-1'
marker6: '-1'
marker7: '-1'
marker8: '-1'
marker9: '-1'
nconnections: '1'
samp_per_symbol: '1'
size: '128'
srate: samp_rate
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'
tr_level: '0.0'
tr_mode: qtgui.TRIG_MODE_FREE
tr_slope: qtgui.TRIG_SLOPE_POS
tr_tag: '""'
type: complex
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'
ymin: '-1'
yunit: '""'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [616, 472.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: 'False'
entags: 'True'
grid: 'False'
gui_hint: ''
label1: Signal 1
label10: Signal 10
label2: Signal 2
label3: Signal 3
label4: Signal 4
label5: Signal 5
label6: Signal 6
label7: Signal 7
label8: Signal 8
label9: Signal 9
legend: 'True'
marker1: '-1'
marker10: '-1'
marker2: '-1'
marker3: '-1'
marker4: '-1'
marker5: '-1'
marker6: '-1'
marker7: '-1'
marker8: '-1'
marker9: '-1'
name: '""'
nconnections: '1'
size: '1024'
srate: samp_rate/5
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'
tr_level: '0.0'
tr_mode: qtgui.TRIG_MODE_FREE
tr_slope: qtgui.TRIG_SLOPE_POS
tr_tag: '""'
type: complex
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'
ymin: '-1'
yunit: '""'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [616, 576.0]
rotation: 0
state: enabled
- name: rx_port
id: parameter
parameters:
alias: ''
comment: ''
hide: none
label: ''
short_id: ''
type: str
value: '50002'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [104, 152.0]
rotation: 0
state: enabled
- name: syncword
id: parameter
parameters:
alias: ''
comment: ''
hide: none
label: ''
short_id: ''
type: ''
value: '"0000011100001001000110110010110101110111100110001010100111111010"'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [456, 16.0]
rotation: 0
state: enabled
- name: time_offset
id: parameter
parameters:
alias: ''
comment: ''
hide: none
label: ''
short_id: ''
type: eng_float
value: '1.0'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1064, 136.0]
rotation: 0
state: enabled
- name: tx_port
id: parameter
parameters:
alias: ''
comment: ''
hide: none
label: ''
short_id: ''
type: str
value: '50001'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [16, 152.0]
rotation: 0
state: enabled
- name: virtual_sink_0
id: virtual_sink
parameters:
alias: ''
comment: ''
stream_id: receiver_in
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1320, 288.0]
rotation: 0
state: enabled
- name: virtual_source_0
id: virtual_source
parameters:
alias: ''
comment: ''
stream_id: receiver_in
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [40, 536.0]
rotation: 0
state: enabled
connections:
- [ONBEAT_Demod_0, '0', qtgui_const_sink_x_0, '0']
- [ONBEAT_Demod_0, '1', qtgui_eye_sink_x_0, '0']
- [ONBEAT_Demod_0, '2', qtgui_time_sink_x_0, '0']
- [ONBEAT_Demod_0, out, network_socket_pdu_1, pdus]
- [ONBEAT_Mod_0, '0', blocks_tag_gate_0, '0']
- [blocks_tag_gate_0, '0', channels_channel_model_0, '0']
- [blocks_throttle2_0, '0', virtual_sink_0, '0']
- [channels_channel_model_0, '0', blocks_throttle2_0, '0']
- [network_socket_pdu_1, pdus, pdu_pdu_to_tagged_stream_0, pdus]
- [pdu_pdu_to_tagged_stream_0, '0', ONBEAT_Mod_0, '0']
- [virtual_source_0, '0', ONBEAT_Demod_0, '0']
metadata:
file_format: 1
grc_version: 3.10.11.0