diff options
author | SARA <sara.halter@ost.ch> | 2021-11-29 16:35:06 +0100 |
---|---|---|
committer | SARA <sara.halter@ost.ch> | 2021-11-29 16:35:06 +0100 |
commit | 63eb10396d2b5ca3a10c5fdcd6412fb7d3aada94 (patch) | |
tree | 4e12ccde966be9b804c885e5e3825a96e1279be3 /src | |
parent | überprüfung Delay (diff) | |
parent | Merge remote-tracking branch 'origin/master' (diff) | |
download | Fading-63eb10396d2b5ca3a10c5fdcd6412fb7d3aada94.tar.gz Fading-63eb10396d2b5ca3a10c5fdcd6412fb7d3aada94.zip |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to '')
-rw-r--r-- | src/gr-fadingui/grc/fadingui_multipath_fading.block.yml | 13 | ||||
-rw-r--r-- | src/gr-fadingui/python/multipath_fading.py | 67 | ||||
-rwxr-xr-x | src/gui/gui.py (renamed from src/gui.py) | 0 | ||||
-rw-r--r-- | src/gui/net.py (renamed from src/net.py) | 0 |
4 files changed, 58 insertions, 22 deletions
diff --git a/src/gr-fadingui/grc/fadingui_multipath_fading.block.yml b/src/gr-fadingui/grc/fadingui_multipath_fading.block.yml index e116467..1d374ac 100644 --- a/src/gr-fadingui/grc/fadingui_multipath_fading.block.yml +++ b/src/gr-fadingui/grc/fadingui_multipath_fading.block.yml @@ -12,12 +12,19 @@ templates: # * label (label shown in the GUI) # * dtype (e.g. int, float, complex, byte, short, xxx_vector, ...) parameters: -- id: amplitudes - label: Amplitudes - dtype: raw - id: delays label: Delays + dtype: complex_vector +- id: amplitudes + label: Amplitudes dtype: raw +- id: los + label: LOS/NLOS + options: ['True', 'False'] + option_labels: ['LOS', 'NLOS'] + #default: 'False' + dtype: bool + #hide: ${ 'none' if los == 'False' else 'part' } # Make one 'inputs' list entry per input and one 'outputs' list entry per output. # Keys include: diff --git a/src/gr-fadingui/python/multipath_fading.py b/src/gr-fadingui/python/multipath_fading.py index 01f2dbe..02b3bb4 100644 --- a/src/gr-fadingui/python/multipath_fading.py +++ b/src/gr-fadingui/python/multipath_fading.py @@ -44,45 +44,74 @@ class multipath_fading(gr.sync_block): self.amplitudes = amplitudes self.delays = delays self.temp = [0] - # if los: - # self.amplitudes.append(1) - # self.delays.append(0) - self.los= 1 - #self.fir = + log.debug(los) #TO DO: True False unterscheidung + if los == True: + self.los = 1 + log.debug("Los True") + else: + self.los = 0 + log.debug("Los False") + + + + def work(self, input_items, output_items): """example: multiply with constant""" inp = input_items[0] oup = output_items[0] - if len(self.amplitudes) != len(self.delays): + if len(self.amplitudes) != len(self.delays): # Test: Es muss gleich viele Werte für Delays und Amplituden haben. raise Exception("Amplitudes and Delay length dont match") + + #TO DO negativ check + + + # raise Exception("Delay length can't be one") #if np.min(self.delays)<=1: # raise Exception("Delay length can't be one") - max_len = np.max(self.delays) - sum_x = np.zeros(max_len) - for(a,d) in zip(self.amplitudes,self.delays): + + #max_len = np.max(self.delays) #Max Werte herausfinden für länge + #sum_x = np.zeros(max_len) + + max_order = 2 * np.floor(np.max(self.delays)) + 1 + max_samples = np.arange(0, max_order +1) + max_len = len(max_samples) #Für Filter + + sum_x = np.zeros(int(max_len)) + + for (a,d) in zip(self.amplitudes,self.delays): # if d-1 <= 0: # x = np.concatenate([[a], np.zeros(max_len-1)]) - # else: - x = np.concatenate([np.zeros(d-1), [a], np.zeros(max_len-d)]) - sum_x += x + # else: + order = 2 * np.floor(d) + 1 + + skip = np.floor(d) - (order - 1) / 2 #M sollte immer 0 sein + assert skip >= 0 + + samples = np.arange(0, order +1) + + h = a*(np.sinc(samples-d)) #sinc + h_len = np.concatenate([h, np.zeros(max_len-len(h))]) + + sum_x += h_len + + #x = np.concatenate([np.zeros(d-1), [a], np.zeros(max_len-d)]) + #sum_x += x sum_x[0] = self.los - log.debug(sum_x) - - #H_int = fft(sum_x) - - #h = ifft(H_int) + #log.debug(sum_x) - #h[0]=1 y = np.convolve(inp, sum_x) + # signal_shifted = np.convolve(h, inp, mode='full') + # y = signal_shifted + + #y+=np.concatenate([self.temp,np.zeros(len(y)-len(self.temp))]) y+=np.concatenate([self.temp,np.zeros(len(y)-len(self.temp))]) - oup[:] = y[:len(inp)] self.temp = y[len(inp):] diff --git a/src/gui.py b/src/gui/gui.py index b2cbebb..b2cbebb 100755 --- a/src/gui.py +++ b/src/gui/gui.py diff --git a/src/net.py b/src/gui/net.py index 2c91bb8..2c91bb8 100644 --- a/src/net.py +++ b/src/gui/net.py |