|
@@ -92,7 +92,7 @@ class OpticalChannel(layers.Layer):
|
|
|
dispersion_factor,
|
|
dispersion_factor,
|
|
|
fiber_length,
|
|
fiber_length,
|
|
|
lpf_cutoff=32e9,
|
|
lpf_cutoff=32e9,
|
|
|
- rx_stddev=0.01,
|
|
|
|
|
|
|
+ rx_stddev=0.03,
|
|
|
q_stddev=0.01):
|
|
q_stddev=0.01):
|
|
|
"""
|
|
"""
|
|
|
A channel model that simulates chromatic dispersion, non-linear photodiode detection, finite bandwidth of
|
|
A channel model that simulates chromatic dispersion, non-linear photodiode detection, finite bandwidth of
|
|
@@ -298,13 +298,13 @@ class ModulationModel(tf.keras.Model):
|
|
|
pass
|
|
pass
|
|
|
|
|
|
|
|
def plot(self, inputs, signal):
|
|
def plot(self, inputs, signal):
|
|
|
- t = np.arange(self.messages_per_block * self.samples_per_symbol*3)
|
|
|
|
|
|
|
+ t = np.arange(self.messages_per_block * self.samples_per_symbol*1)
|
|
|
frequency = SAMPLING_FREQUENCY*1e-9
|
|
frequency = SAMPLING_FREQUENCY*1e-9
|
|
|
t = np.divide(t, frequency)
|
|
t = np.divide(t, frequency)
|
|
|
plt.figure()
|
|
plt.figure()
|
|
|
- plt.plot(t, signal.flatten()[:self.messages_per_block * self.samples_per_symbol*3], label='Received Signal')
|
|
|
|
|
|
|
+ plt.plot(t, signal.flatten()[:self.messages_per_block * self.samples_per_symbol*1], label='Received Signal')
|
|
|
inputs = np.square(inputs)
|
|
inputs = np.square(inputs)
|
|
|
- plt.plot(t, inputs.flatten()[:self.messages_per_block * self.samples_per_symbol*3], label='Transmitted Signal')
|
|
|
|
|
|
|
+ plt.plot(t, inputs.flatten()[:self.messages_per_block * self.samples_per_symbol*1], label='Transmitted Signal')
|
|
|
plt.xlabel('Time (ns)')
|
|
plt.xlabel('Time (ns)')
|
|
|
plt.ylabel('Power')
|
|
plt.ylabel('Power')
|
|
|
plt.title('Effect of Chromatic Dispersion and Noise on Generated Signal')
|
|
plt.title('Effect of Chromatic Dispersion and Noise on Generated Signal')
|
|
@@ -314,7 +314,7 @@ class ModulationModel(tf.keras.Model):
|
|
|
def demodulate(self, validation, outputs):
|
|
def demodulate(self, validation, outputs):
|
|
|
symbol_rate = SAMPLING_FREQUENCY/SAMPLES_PER_SYMBOL
|
|
symbol_rate = SAMPLING_FREQUENCY/SAMPLES_PER_SYMBOL
|
|
|
|
|
|
|
|
- b, a = bessel(5, 10*(symbol_rate)/(SAMPLING_FREQUENCY/2), btype='low', analog=False)
|
|
|
|
|
|
|
+ b, a = bessel(5, 8*(symbol_rate)/(SAMPLING_FREQUENCY/2), btype='low', analog=False)
|
|
|
outputsfilt = filtfilt(b, a, outputs)
|
|
outputsfilt = filtfilt(b, a, outputs)
|
|
|
demodulate = np.sqrt(outputsfilt)
|
|
demodulate = np.sqrt(outputsfilt)
|
|
|
#modulation_scheme.plot(inputs, demodulate)
|
|
#modulation_scheme.plot(inputs, demodulate)
|
|
@@ -350,14 +350,17 @@ class ModulationModel(tf.keras.Model):
|
|
|
def plot_output_graphs():
|
|
def plot_output_graphs():
|
|
|
inputs, validation = modulation_scheme.generate_random_inputs(num_of_blocks=size)
|
|
inputs, validation = modulation_scheme.generate_random_inputs(num_of_blocks=size)
|
|
|
outputs = optical_channel(inputs).numpy()
|
|
outputs = optical_channel(inputs).numpy()
|
|
|
- b, a = bessel(5, 10 * (SAMPLING_FREQUENCY/SAMPLES_PER_SYMBOL) / (SAMPLING_FREQUENCY / 2), btype='low', analog=False)
|
|
|
|
|
|
|
+ b, a = bessel(3, 8 * (SAMPLING_FREQUENCY/SAMPLES_PER_SYMBOL) / (SAMPLING_FREQUENCY / 2), btype='low', analog=False)
|
|
|
outputsfilt = filtfilt(b, a, outputs)
|
|
outputsfilt = filtfilt(b, a, outputs)
|
|
|
- modulation_scheme.plot(inputs, outputs)
|
|
|
|
|
- modulation_scheme.plot(inputs, outputsfilt)
|
|
|
|
|
|
|
+ input = np.sqrt(inputs)
|
|
|
|
|
+ noisy = np.sqrt(outputs)
|
|
|
|
|
+ demodulate = np.sqrt(outputsfilt)
|
|
|
|
|
+ modulation_scheme.plot(input, noisy)
|
|
|
|
|
+ modulation_scheme.plot(input, demodulate)
|
|
|
|
|
|
|
|
#ber.append(modulation_scheme.demodulate(validation, outputs))
|
|
#ber.append(modulation_scheme.demodulate(validation, outputs))
|
|
|
def plot_fibre_length_vs_ber():
|
|
def plot_fibre_length_vs_ber():
|
|
|
- lengths = np.linspace(5, 50, 200)
|
|
|
|
|
|
|
+ lengths = np.linspace(5, 70, 1000)
|
|
|
ber =[]
|
|
ber =[]
|
|
|
for length in lengths:
|
|
for length in lengths:
|
|
|
optical_channel = OpticalChannel(fs=SAMPLING_FREQUENCY,
|
|
optical_channel = OpticalChannel(fs=SAMPLING_FREQUENCY,
|
|
@@ -387,10 +390,10 @@ def plot_fibre_length_vs_ber():
|
|
|
if __name__ == '__main__':
|
|
if __name__ == '__main__':
|
|
|
SAMPLING_FREQUENCY = 336e9
|
|
SAMPLING_FREQUENCY = 336e9
|
|
|
CARDINALITY = 4
|
|
CARDINALITY = 4
|
|
|
- SAMPLES_PER_SYMBOL = 64
|
|
|
|
|
|
|
+ SAMPLES_PER_SYMBOL = 128
|
|
|
MESSAGES_PER_BLOCK = 9
|
|
MESSAGES_PER_BLOCK = 9
|
|
|
DISPERSION_FACTOR = -21.7 * 1e-24
|
|
DISPERSION_FACTOR = -21.7 * 1e-24
|
|
|
- FIBER_LENGTH = 30
|
|
|
|
|
|
|
+ FIBER_LENGTH = 50
|
|
|
|
|
|
|
|
optical_channel = OpticalChannel(fs=SAMPLING_FREQUENCY,
|
|
optical_channel = OpticalChannel(fs=SAMPLING_FREQUENCY,
|
|
|
num_of_samples=MESSAGES_PER_BLOCK * SAMPLES_PER_SYMBOL,
|
|
num_of_samples=MESSAGES_PER_BLOCK * SAMPLES_PER_SYMBOL,
|
|
@@ -406,6 +409,7 @@ if __name__ == '__main__':
|
|
|
#inputs, validation = modulation_scheme.generate_random_inputs(num_of_blocks=size)
|
|
#inputs, validation = modulation_scheme.generate_random_inputs(num_of_blocks=size)
|
|
|
#outputs = optical_channel(inputs).numpy()
|
|
#outputs = optical_channel(inputs).numpy()
|
|
|
#decisions = modulation_scheme.demodulate(validation, outputs)
|
|
#decisions = modulation_scheme.demodulate(validation, outputs)
|
|
|
|
|
+ #plot_output_graphs()
|
|
|
plot_fibre_length_vs_ber()
|
|
plot_fibre_length_vs_ber()
|
|
|
#modulation_scheme.plot(inputs, outputs, size)
|
|
#modulation_scheme.plot(inputs, outputs, size)
|
|
|
print("done")
|
|
print("done")
|