WIP
This commit is contained in:
59
comm_tb.m
59
comm_tb.m
@@ -1,5 +1,5 @@
|
||||
O = 10; %order of prbs
|
||||
N = 64; %length of prbs
|
||||
O = 14; %order of prbs
|
||||
N = 2^(O-1); %length of prbs
|
||||
[~,seed] = prbs(O,1); %initialize first seed of prbs
|
||||
|
||||
% Modulation
|
||||
@@ -12,6 +12,8 @@ fsym = 56e9;
|
||||
fdac = 120e9;
|
||||
% Simulation oversampling rate "k";
|
||||
kover = 16;
|
||||
% ADC Rate
|
||||
fadc = 256e9;
|
||||
% Simulation frequency in "analog domain"
|
||||
fsimu = kover * fdac ;
|
||||
|
||||
@@ -22,44 +24,73 @@ for i = 1:log2(M)
|
||||
[bitpattern(:,i),seed] = prbs(O,N,seed);
|
||||
end
|
||||
|
||||
S = Signal(bitpattern,fsym);
|
||||
|
||||
pamData = pam_mapping(bitpattern,M,0);
|
||||
|
||||
shapedData = applyPulseShaping(pamData,fsym,fdac);
|
||||
|
||||
|
||||
awg = AWG('preset','M8196A','fdac',fdac,'kover',kover,'lpf_active',1);
|
||||
awgSignal = awg.process_channel(shapedData);
|
||||
|
||||
fil = Filter('filtdegree',4,"f_cutoff",50e9,"fdac",fdac,"filterType",filtertypes.bessel_bilin);
|
||||
fil = Filter('filtdegree',4,"f_cutoff",50e9,"fsamp",fdac,"filterType",filtertypes.bessel_bilin);
|
||||
filtered = fil.process(awgSignal);
|
||||
|
||||
u_pi = 3.5;
|
||||
vbias = (0.5*u_pi)-u_pi;
|
||||
eml = EML("mode",emlmodes.im_cosinus,"power",10,"fsimu",fsimu,"lambda",1550,"bias",vbias,"u_pi",u_pi,"linewidth",1000000);
|
||||
laserfield = eml.process(filtered);
|
||||
extmodlaser = EML("mode",emlmodes.im_cosinus,"power",10,"fsimu",fsimu,"lambda",1550,"bias",vbias,"u_pi",u_pi,"linewidth",1000000);
|
||||
laserfield = extmodlaser.process(filtered);
|
||||
|
||||
att = Amplifier("amplification_db",10,"amp_mode","gain","type","ideal","saturation_mode",0,'saturation_power',10);
|
||||
att_out = att.process(laserfield);
|
||||
|
||||
fib = Fiber("fsimu",fdac*kover,"fiber_length",20,"alpha",0.2,"D",17,"lambda0",1550);
|
||||
fib = Fiber("fsimu",fdac*kover,"fiber_length",0,"alpha",0.2,"D",17,"lambda0",1550);
|
||||
fib_out = fib.process(att_out);
|
||||
|
||||
phdiode = Photodiode("fsimu",fdac*kover,"dark_current",2e-08,"responsivity",1,"temperature",20);
|
||||
phdiod_out = phdiode.process(fib_out);
|
||||
|
||||
fil = Filter('filtdegree',4,"f_cutoff",70e9,"fsamp",fdac,"filterType",filtertypes.bessel_bilin);
|
||||
phdiod_out2 = fil.process(phdiod_out);
|
||||
|
||||
|
||||
scp = Scope("fsimu",fdac*kover,"fadc",fadc,...
|
||||
"delay",0,"fixed_delay",0,"lpf_bw",120e9,"filtertype",filtertypes.bessel_inp,...
|
||||
"samplingdelay",0,"rand_samplingdelay",0,"freq_offset",0,"samp_jitter",0,...
|
||||
"adcresolution",6,"quantbuffer",0.1);
|
||||
|
||||
scope_out = scp.process(phdiod_out2);
|
||||
|
||||
figure;
|
||||
plot(shapedData);
|
||||
hold on
|
||||
plot(awgSignal,'DisplayName','skew 0');
|
||||
plot(filtered,'DisplayName','filtered');
|
||||
plot(abs(laserfield),'DisplayName','laser');
|
||||
plot(abs(att_out),'DisplayName','att_out');
|
||||
plot(abs(fib_out),'DisplayName','att_out');
|
||||
|
||||
plot( nmlze(resample(shapedData,fadc,fdac)),'DisplayName','shapedData Data');
|
||||
plot( nmlze(resample(awgSignal,fadc,fdac*kover)),'DisplayName','AWG Data');
|
||||
plot( nmlze(scope_out),'DisplayName','scope out out');
|
||||
hold off
|
||||
|
||||
resample_out = resample(scope_out,fsym,fadc);
|
||||
|
||||
|
||||
% figure;
|
||||
% hold on
|
||||
% plot(awgSignal,'DisplayName','skew 0');
|
||||
% plot(filtered,'DisplayName','filtered');
|
||||
% plot(abs(laserfield),'DisplayName','laser');
|
||||
% plot(abs(att_out),'DisplayName','att_out');
|
||||
% plot(abs(fib_out),'DisplayName','fiber_out');
|
||||
% plot(abs(phdiod_out),'DisplayName','photo diode out');
|
||||
% hold off
|
||||
|
||||
% figure;
|
||||
% hold on
|
||||
% plot(nmlze(pamData),'DisplayName','PAM Data');
|
||||
% plot(nmlze(resample_out),'DisplayName','system out');
|
||||
% hold off
|
||||
|
||||
|
||||
function y = nmlze(x)
|
||||
y = (x-min(x)) / max((x-min(x)));
|
||||
end
|
||||
|
||||
function pam_sig = pam_mapping(bitpattern, M, unipolar)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user