discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

The operation law of GRC flow graph


From: ????????
Subject: The operation law of GRC flow graph
Date: Tue, 13 Jul 2021 21:49:17 +0800

Hi,guys
I am writing a simple embedded python block program, the content of the program work function is as follows:
def __init__(self):  # only default arguments here
        """arguments to this function show up as parameters in GRC"""
        gr.sync_block.__init__(
            self,
            name='random limit source',   # will show up in GRC
            in_sig = None,
            out_sig = [np.complex64]
 def work(self, input_items, output_items):
        for i in range(10) :
            if i == 0:
                output_items[0][i] = 0.5+0.5j
                print("linge1")
            elif i == 1:
                output_items[0][i] = 0.24+0.5j
                print("linge2")
            elif i == 2:
                output_items[0][i] = 0.35+0.62j
                print("linge3")
            elif i == 3:
                output_items[0][i] = 0.47+0.33j
                print("linge4")
            elif i == 4:
                output_items[0][i] = 0.72+0.21j
                print("linge5")
            elif i == 5:
                output_items[0][i] = 0.12+0.65j
                print("linge6")
            elif i == 6:
                output_items[0][i] = 0.23+0.57j
                print("linge7")
            elif i == 7:
                output_items[0][i] = 0.85+0.23j
                print("linge8")
            elif i == 8:
                output_items[0][i] = 0.86+0.56j
                print("linge9")
            else:
                output_items[0][i] = 0.14+0.57j
                print("linge10")
        return len(output_items[0])

According to the content of the program, my first ten outputs will be the number I specified, so will the number I didn't specify be 0? I observe its output, it will continuously loop the work function according to the sampling rate, and print the "linge." character every once in a while. Is this the working rule of GRC? How can I make it only output ten prescribed numbers without continuing the subsequent loop?

Sincerely

reply via email to

[Prev in Thread] Current Thread [Next in Thread]