[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Generating a chirp pulse, non-even transfers
From: |
tom sutherland |
Subject: |
Generating a chirp pulse, non-even transfers |
Date: |
Mon, 2 Oct 2023 15:26:09 +0000 (UTC) |
I want to generate a chirp signal. My idea was to have a sawtooth signal feed a
VCO. The generated chirp repeats, so I was going to blank off the signal after
the first chirp. I wanted to count the number of samples in the chirp with a
python block and output the VCO chirp only when the blanking pulse was high. It
sort of works but the python code doesn't count the regularly. It seems to
count in random length blocks, so I get some "chirps output" that have 20
chirps and some have 50, not the one chirp I want. I have attached my code.
Thanks...Tom
My Python Block's Code:"""Embedded Python Blocks:
Each time this file is saved, GRC will instantiate the first class it findsto
get ports and parameters of your block. The arguments to __init__ willbe the
parameters. All of them are required to have default values!"""
import numpy as npfrom gnuradio import gr
class blk(gr.sync_block): # other base classes are basic_block, decim_block,
interp_block """Embedded Python Block example - a simple multiply const"""
def __init__(self, ONpulsecount=1000,OFFpulsecount=10000,threshold = 0.5):
# only default arguments here """arguments to this function show up as
parameters in GRC""" gr.sync_block.__init__( self,
name='pulseshaper', # will show up in GRC
in_sig=[np.complex64,np.float32], out_sig=[np.complex64,np.float32]
) # if an attribute with the same name as a parameter is found,
# a callback is registered (properties work, too). self.ONpulsecount
= ONpulsecount self.OFFpulsecount = OFFpulsecount self.threshold
= threshold self.count=0 self.pulseblanker = 1.0
def work(self, input_items, output_items): """example: multiply with
constant""" self.count = self.count + 1
if self.count < self.ONpulsecount: self.pulseblanker = 1.0
elif self.count < self.OFFpulsecount: self.pulseblanker = 0.0
else: self.count = 0
output_items[0][:] = input_items[0][:] * self.pulseblanker
output_items[1][:] = self.pulseblanker return
len(output_items[0])
chirpGeneration.grc
Description: Binary data
chirpGeneration.py
Description: Binary data
chirpGeneration_epy_block_0.py
Description: Binary data

- Generating a chirp pulse, non-even transfers,
tom sutherland <=