Hello, I worked on it, and I correct things in my python block and my grc file. It works when I put QT GUI Time Sink blocks, than Histogramms block. You can fin the update here : https://github.com/Krounet/gnuradio-WSPR/tree/development/WSPR-Tx
Best Regards Mathieu Le ven. 23 févr. 2024 à 17:25, Croizer Mathieu <croizer.math...@gmail.com> a écrit : > Hello, > > I would like to simulate the simulation of a WSPR transmission with > GNURADIO. First I created a python block for WSPR coding process. The > output of my python block is connected to a Pack K Bits block to create > packs of bytes of 8 bits. It is also connected to a QT GUI Histogramm, to > verify if there is something at the output. The Pack K Bits block is also > connected to a QT GUI Histogramm. When I launch my gnuradio file, The two > histogramms show a pike at 0. So think I think there is nothing at the > output of my python block. But, in my code I put some prints to show what > happens at the output, and they indicates that there are zeroes and ones. > So I don't understand what happens, and I need some Help. > > This is my python block work function : > > def work(self,input_items,output_items): > > """ > What do we do here ? : > > _ The Callsigns and the Location + Power are compressed in two > integer N and M > _ N is calculated with these equations : > * N1 = [Ch1] -> [Chn] is the n character in decimal of the > Callsigns modified by the function transform_Callsigns() > * N2 = N1 * 36 + [Ch2] > * N3 = N2 * 10 + [Ch3] > * N4 = 27 * N3 + [Ch4] - 10 > * N5 = 27 * N4 + [Ch5] - 10 > * N = N6 = 27 * N5 + [Ch6] - 10 > > _ M is calculated with these equations : > * M1= (179 - 10 * [Loc1] - [Loc3]) * 180 + 10 * [Loc2] + > [Loc4] -> [Locn] is the n character in decimal of the Location modified by > the function transform_Location() > * M = M1 * 128 + [Pwr] + 64 -> [Pwr] is the power in dBm > """ > #time.sleep(5) > codingN=self.transform_Callsigns() > codingM=self.transform_Location() > #creating the 88 elements array to encode. The array will be > packed then in 11 8-bits bytes array c[0] to c[6] will contain the > informations to transmit.c[6] will contain the 2 two las bit of M and is > completed by zeroes. c[7] to c[10] is filled with zeroes > #serializing N > n_Serial=np.byte([bit for bit in codingN]) > #serializing M > m_Serial=np.hstack((np.byte([bit for bit in > codingM]),np.byte([0,0,0,0,0,0]))) > #creating c[7] to c[10] > c7toc10bin=np.binary_repr(0,32) > c7toc10=np.byte([bit for bit in c7toc10bin]) > > #stacking the arrays > bitstreams=np.hstack((n_Serial,m_Serial,c7toc10)) > #output_items[0]=bitstreams > for x in range(len(bitstreams)): > output_items[0]=bitstreams[x] > print(output_items[0]) > #print("length of the Block Output: "+str(len(output_items[0]))) > return len(bitstreams) > > You can find all the code here : > https://github.com/Krounet/gnuradio-WSPR/tree/development/WSPR-Tx > > Best Regards. > > Mathieu >