WDM update : demux changes for memory optimizaion
This commit is contained in:
@@ -113,8 +113,35 @@ classdef Optical_Demultiplex < handle
|
|||||||
pha = mod(-2*pi*(0:blocklen_in-1).'.*df_T/obj.fs_in, 2*pi);
|
pha = mod(-2*pi*(0:blocklen_in-1).'.*df_T/obj.fs_in, 2*pi);
|
||||||
lo = cos(pha)+1i*sin(pha);
|
lo = cos(pha)+1i*sin(pha);
|
||||||
|
|
||||||
x_envelopes = ifft(fft(att.*signal_in(:,1).*lo).*H);
|
% x_envelopes = ifft(fft(att.*signal_in(:,1).*lo).*H);
|
||||||
y_envelopes = ifft(fft(att.*signal_in(:,2).*lo).*H);
|
% y_envelopes = ifft(fft(att.*signal_in(:,2).*lo).*H);
|
||||||
|
|
||||||
|
N = size(lo,1);
|
||||||
|
C = size(lo,2);
|
||||||
|
|
||||||
|
x_envelopes = zeros(N, C, 'like', signal_in);
|
||||||
|
y_envelopes = zeros(N, C, 'like', signal_in);
|
||||||
|
|
||||||
|
s1 = signal_in(:,1);
|
||||||
|
s2 = signal_in(:,2);
|
||||||
|
|
||||||
|
% Reusable work buffers (avoid reallocations)
|
||||||
|
wrk_time = zeros(N,1, 'like', signal_in);
|
||||||
|
wrk_freq = zeros(N,1, 'like', signal_in);
|
||||||
|
|
||||||
|
for c = 1:C
|
||||||
|
% ---- X branch ----
|
||||||
|
wrk_time(:) = att .* s1 .* lo(:,c); % N×1
|
||||||
|
wrk_freq(:) = fft(wrk_time); % N×1
|
||||||
|
wrk_freq(:) = wrk_freq .* H; % N×1
|
||||||
|
x_envelopes(:,c) = ifft(wrk_freq); % N×1
|
||||||
|
|
||||||
|
% ---- Y branch ----
|
||||||
|
wrk_time(:) = att .* s2 .* lo(:,c);
|
||||||
|
wrk_freq(:) = fft(wrk_time);
|
||||||
|
wrk_freq(:) = wrk_freq .* H;
|
||||||
|
y_envelopes(:,c) = ifft(wrk_freq);
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
% --- FIRST LINE: evaluate settings located beside this script ---
|
% --- FIRST LINE: evaluate settings located beside this script ---
|
||||||
run(fullfile(fileparts(mfilename('fullpath')),'WDM_settings.m'));
|
run(fullfile(fileparts(mfilename('fullpath')),'WDM_settings.m'));
|
||||||
|
|
||||||
num_realiz = 1;
|
num_realiz = 50;
|
||||||
% wavelengthplan = calcWavelengthPlan(16,400e9,1310);
|
% wavelengthplan = calcWavelengthPlan(16,400e9,1310);
|
||||||
wavelengthplan = [1295,1305,1315,1325];
|
wavelengthplan = [1295,1305,1315,1325];
|
||||||
link_length = 2;
|
link_length = 2;
|
||||||
@@ -65,7 +65,7 @@ signal_cell = {};
|
|||||||
Symbols = {};
|
Symbols = {};
|
||||||
Tx_bits = {};
|
Tx_bits = {};
|
||||||
|
|
||||||
rop = linspace(-11,0,8);
|
rop = -8.25:0.75:0;
|
||||||
|
|
||||||
output_ffe = cell(length(wavelengthplan),length(rop),num_realiz);
|
output_ffe = cell(length(wavelengthplan),length(rop),num_realiz);
|
||||||
output_vnle = cell(length(wavelengthplan),length(rop),num_realiz);
|
output_vnle = cell(length(wavelengthplan),length(rop),num_realiz);
|
||||||
@@ -75,7 +75,7 @@ output_dbt = cell(length(wavelengthplan),length(rop),num_realiz);
|
|||||||
for realiz = 1:num_realiz
|
for realiz = 1:num_realiz
|
||||||
|
|
||||||
|
|
||||||
for l = 1:N
|
parfor l = 1:N
|
||||||
|
|
||||||
[Digi_sig,Symbols{l},Tx_bits{l}] = PAMsource(...
|
[Digi_sig,Symbols{l},Tx_bits{l}] = PAMsource(...
|
||||||
"fsym",fsym,"M",M,"order",18,"useprbs",0,...
|
"fsym",fsym,"M",M,"order",18,"useprbs",0,...
|
||||||
@@ -103,7 +103,7 @@ for realiz = 1:num_realiz
|
|||||||
signal_cell{l} = Polarization_Controller("mode","rot_power","desired_power",30).process(Eml_out);
|
signal_cell{l} = Polarization_Controller("mode","rot_power","desired_power",30).process(Eml_out);
|
||||||
end
|
end
|
||||||
|
|
||||||
Opt_sig_wdm = Optical_Multiplex("fs_in",signal_cell{l}.fs,"fs_out",upsample_pow*Eml_out.fs,...
|
Opt_sig_wdm = Optical_Multiplex("fs_in",fdac*kover,"fs_out",upsample_pow*fdac*kover,...
|
||||||
"lambda_center",1310,"random_key",0,"filtype",1,"B",200e9).process(signal_cell);
|
"lambda_center",1310,"random_key",0,"filtype",1,"B",200e9).process(signal_cell);
|
||||||
|
|
||||||
Opt_sig_wdm = Amplifier("amp_mode","ideal_no_noise","gain_mode","output_power","amplification_db",3+10*log10(N)).process(Opt_sig_wdm);
|
Opt_sig_wdm = Amplifier("amp_mode","ideal_no_noise","gain_mode","output_power","amplification_db",3+10*log10(N)).process(Opt_sig_wdm);
|
||||||
@@ -250,8 +250,8 @@ cols = linspecer(N);
|
|||||||
for l = 1:N
|
for l = 1:N
|
||||||
% plot(rop,mean(squeeze(ber_vnle(l,:,:)),2,'omitnan'),'Marker','*','DisplayName',sprintf('Ch: %d',wavelengthplan(l)))
|
% plot(rop,mean(squeeze(ber_vnle(l,:,:)),2,'omitnan'),'Marker','*','DisplayName',sprintf('Ch: %d',wavelengthplan(l)))
|
||||||
% plot(rop,cellfun(@(c) c.metrics.BER, output_ffe(l,:), 'UniformOutput', true),'Marker','*','DisplayName',sprintf('Ch: %d',wavelengthplan(l)),'Color',cols(l,:),'HandleVisibility','on','LineStyle',':');
|
% plot(rop,cellfun(@(c) c.metrics.BER, output_ffe(l,:), 'UniformOutput', true),'Marker','*','DisplayName',sprintf('Ch: %d',wavelengthplan(l)),'Color',cols(l,:),'HandleVisibility','on','LineStyle',':');
|
||||||
plot(rop,cellfun(@(c) c.metrics.BER, output_vnle(l,:), 'UniformOutput', true),'Marker','x','DisplayName',sprintf('Ch: %d',wavelengthplan(l)),'Color',cols(l,:),'HandleVisibility','on','LineStyle','--')
|
plot(rop,cellfun(@(c) c.metrics.BER, res.vnle(l,:), 'UniformOutput', true),'Marker','x','DisplayName',sprintf('Ch: %d',wavelengthplan(l)),'Color',cols(l,:),'HandleVisibility','on','LineStyle','--')
|
||||||
plot(rop,cellfun(@(c) c.metrics.BER, output_mlse(l,:), 'UniformOutput', true),'Marker','o','DisplayName',sprintf('Ch: %d',wavelengthplan(l)),'Color',cols(l,:),'HandleVisibility','on','LineStyle','-')
|
plot(rop,cellfun(@(c) c.metrics.BER, res.mlse(l,:), 'UniformOutput', true),'Marker','o','DisplayName',sprintf('Ch: %d',wavelengthplan(l)),'Color',cols(l,:),'HandleVisibility','on','LineStyle','-')
|
||||||
end
|
end
|
||||||
yline([3.8e-3,2.2e-4],'HandleVisibility','off');
|
yline([3.8e-3,2.2e-4],'HandleVisibility','off');
|
||||||
ylabel('BER');
|
ylabel('BER');
|
||||||
|
|||||||
Reference in New Issue
Block a user