Merge branch 'main' of https://cau-git.rz.uni-kiel.de/nt/mitarbeiter/silas/imdd_simulation
This commit is contained in:
@@ -355,7 +355,7 @@ classdef Signal
|
||||
end
|
||||
|
||||
if isempty(options.fft_length)
|
||||
options.fft_length = 2^(nextpow2(length(obj.signal))-6);
|
||||
options.fft_length = 2^(nextpow2(length(obj.signal))-9);
|
||||
end
|
||||
|
||||
if options.normalizeToNyquist == 0
|
||||
@@ -844,9 +844,9 @@ classdef Signal
|
||||
|
||||
mode = 1;
|
||||
|
||||
histpoints = 1024*2; %% verticale resolution
|
||||
histpoints = 2048; %% verticale resolution
|
||||
histpoints = floor(histpoints/2)*2+1; %% to have the eye digram centered around one point make the vertical resolution uneven
|
||||
histpoints_horizontal = 512*2; %% horizontal resolution
|
||||
histpoints_horizontal = 2048; %% horizontal resolution
|
||||
hist_data=zeros(histpoints,histpoints_horizontal ); %% initilize eye diagram
|
||||
|
||||
if isa(obj,'Opticalsignal')
|
||||
@@ -905,16 +905,22 @@ classdef Signal
|
||||
hist_data(:,n)=flip(nn.'); %without flip, the eye is upside down :-(
|
||||
end
|
||||
|
||||
ax = gca;
|
||||
|
||||
plot_data = 20*log10(hist_data);
|
||||
plot_data(plot_data==-Inf) = 0;
|
||||
|
||||
imagesc(plot_data);
|
||||
|
||||
|
||||
|
||||
% beautify
|
||||
colormap(cbrewer2("Blues",4096));
|
||||
|
||||
cm=flip(cbrewer2("RdYlBu",4096));
|
||||
% cm=flip(cbrewer2("RdBu",4096));
|
||||
cm(1,:) = [1,1,1];
|
||||
cm(1,:) = [0,0,0];
|
||||
colormap(cm);
|
||||
% colormap('turbo');
|
||||
ax.Colormap(1,:) = [1,1,1];
|
||||
% ax.CLim = [0 50];
|
||||
if isa(obj,'Opticalsignal')
|
||||
title(['Optical Eye ',options.displayname])
|
||||
ylabel("Power in mW");
|
||||
|
||||
@@ -43,7 +43,7 @@ classdef PAMsource
|
||||
options.mrds_blocklength = 512;
|
||||
|
||||
options.applypulseform = 1;
|
||||
options.pulseformer Pulseformer;
|
||||
options.pulseformer;
|
||||
|
||||
options.fs_out ;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ classdef AwgKeysight
|
||||
% AWG.upload("Signal4",Signal);
|
||||
|
||||
|
||||
properties(Access=protected)
|
||||
properties(Access=public)
|
||||
model awg_model
|
||||
%fdac double
|
||||
skews double
|
||||
@@ -210,7 +210,6 @@ classdef AwgKeysight
|
||||
try
|
||||
obj.check_lock(char(obj.model),1);
|
||||
obj.lock_device(char(obj.model));
|
||||
|
||||
catch
|
||||
warning('Could not reach ntserver to write lock!')
|
||||
end
|
||||
@@ -221,9 +220,14 @@ classdef AwgKeysight
|
||||
v = visadev('TCPIP0::zizou.tf.uni-kiel.de::hislip0::INSTR');
|
||||
case awg_model.M8199B
|
||||
v = visadev('TCPIP0::localhost::hislip0::INSTR');
|
||||
case awg_model.M8199A_ILV
|
||||
v = visadev('TCPIP0::Zizou::hislip0::INSTR');
|
||||
case awg_model.M8199A_ILV
|
||||
v = visadev('TCPIP0::Zizou::hislip0::INSTR');
|
||||
end
|
||||
|
||||
debug = 0;
|
||||
|
||||
if debug
|
||||
disp(['Connected to Instrument: ',char(v.Vendor),' ',char(v.Model),' SerNo:',char(v.SerialNumber)]);
|
||||
end
|
||||
@@ -233,14 +237,15 @@ classdef AwgKeysight
|
||||
% aw=readline(v);
|
||||
% assert(obj.numChannels==sscanf(aw, '%f'),['Wrong Channel config. AWG response: ',num2str(sscanf(aw, '%f')), ' Channels']);
|
||||
|
||||
switch obj.model
|
||||
case awg_model.M8196A
|
||||
|
||||
if obj.model == awg_model.M8196A
|
||||
|
||||
obj.writeNcheck(v,':INST:DACM FOUR');
|
||||
obj.writeNcheck(v,':ABORt');
|
||||
obj.writeNcheck(v,sprintf(':FREQuency:RASTer %.15g;', obj.fdac));
|
||||
|
||||
case awg_model.M8199B
|
||||
elseif obj.model == awg_model.M8199B || obj.model == awg_model.M8199A || obj.model == awg_model.M8199A_ILV
|
||||
|
||||
obj.writeNcheck(v,':ABORt ''M2''');
|
||||
obj.writeNcheck(v,sprintf(':FREQ ''M1.ClkGen'', %.15g;', obj.fdac));
|
||||
|
||||
@@ -257,8 +262,7 @@ classdef AwgKeysight
|
||||
|
||||
if segm_len > 0
|
||||
|
||||
switch obj.model
|
||||
case awg_model.M8196A
|
||||
if obj.model == awg_model.M8196A
|
||||
|
||||
% 1) TRAC DEl - delete the previous waveform
|
||||
obj.writeNcheck(v,sprintf(':TRACe%d:DELete %d', chan, segm_num));
|
||||
@@ -278,7 +282,7 @@ classdef AwgKeysight
|
||||
% 5) SET OUTPUTS ON/ OFF (generation not started at this point)
|
||||
obj.writeNcheck(v, sprintf(':OUTPut%d ON', chan));
|
||||
|
||||
case awg_model.M8199B
|
||||
elseif obj.model == awg_model.M8199B || obj.model == awg_model.M8199A || obj.model == awg_model.M8199A_ILV
|
||||
|
||||
% 1) TRAC DEl - delete the previous ch waveform
|
||||
obj.writeNcheck(v,sprintf(':TRAC:DEL ''M2.DataOut%d'', %d', chan, segm_num));
|
||||
@@ -308,8 +312,7 @@ classdef AwgKeysight
|
||||
|
||||
else
|
||||
% If no signal defined, turn off channel
|
||||
switch obj.model
|
||||
case awg_model.M8199B
|
||||
if obj.model == awg_model.M8199B || obj.model == awg_model.M8199A || obj.model == awg_model.M8199A_ILV
|
||||
obj.writeNcheck(v, sprintf(':OUTP ''M2.DataOut%d'', OFF',chan));
|
||||
end
|
||||
|
||||
@@ -318,12 +321,11 @@ classdef AwgKeysight
|
||||
end
|
||||
|
||||
% Set global output on/ off to start generation
|
||||
switch obj.model
|
||||
case awg_model.M8196A
|
||||
if obj.model==awg_model.M8196A
|
||||
|
||||
obj.writeNcheck(v,':INIT:IMMediate');
|
||||
|
||||
case awg_model.M8199B
|
||||
elseif obj.model == awg_model.M8199B || obj.model == awg_model.M8199A || obj.model == awg_model.M8199A_ILV
|
||||
|
||||
% SET Ref clock out (which is conn. to scope) to 10 MHz
|
||||
obj.writeNcheck(v, ':OUTPut:FREQuency ''M1.RefClkOut'',10000000');
|
||||
@@ -331,7 +333,7 @@ classdef AwgKeysight
|
||||
% :OUTP:GLOB 'M1.System', OFF
|
||||
obj.writeNcheck(v, ':OUTP:GLOB ''M1.System'', ON');
|
||||
obj.writeNcheck(v, ':OUTP:GLOB ''M2.System'', ON');
|
||||
obj.writeNcheck(v,':INIT:IMMediate ''M2''');
|
||||
%obj.writeNcheck(v,':INIT:IMMediate ''M2''');
|
||||
end
|
||||
|
||||
% operation ceomplete (opc)
|
||||
|
||||
@@ -9,7 +9,6 @@ classdef DC_supply < handle
|
||||
active
|
||||
voltage
|
||||
|
||||
|
||||
meas_voltage
|
||||
meas_current
|
||||
end
|
||||
@@ -18,7 +17,6 @@ classdef DC_supply < handle
|
||||
|
||||
function obj = DC_supply(options)
|
||||
|
||||
|
||||
arguments
|
||||
options.active logical = true
|
||||
options.voltage double = [0,0];
|
||||
@@ -35,10 +33,14 @@ classdef DC_supply < handle
|
||||
assert(size(obj.voltage,1)==1,'Set Voltage for CH1 and CH2 must be given as vector [V1, V2]');
|
||||
assert(size(obj.voltage,2)==2,'Set Voltage for CH1 and CH2 must be given as vector [V1, V2]');
|
||||
|
||||
v = obj.connectDevice();
|
||||
|
||||
disp(['Connected to: ', char(v.Vendor),' ', char(v.Model),' :-)']);
|
||||
|
||||
end
|
||||
|
||||
function v = connectDevice(obj)
|
||||
v = visadev("GPIB1::19::INSTR");
|
||||
v = visadev("GPIB0::19::INSTR");
|
||||
end
|
||||
|
||||
function success = set(obj,options)
|
||||
@@ -51,15 +53,7 @@ classdef DC_supply < handle
|
||||
|
||||
success = [0,0];
|
||||
|
||||
% %connect to device
|
||||
% if exist('v','var')
|
||||
% %v = visadev("GPIB1::19::INSTR");
|
||||
% v = obj.connectDevice();
|
||||
% else
|
||||
%
|
||||
% end
|
||||
|
||||
v = visadev("GPIB1::19::INSTR");
|
||||
v = obj.connectDevice();
|
||||
|
||||
debug = 0;
|
||||
if debug
|
||||
@@ -139,9 +133,9 @@ classdef DC_supply < handle
|
||||
|
||||
function [voltage,current] = readVals(obj)
|
||||
|
||||
try
|
||||
|
||||
%connect to device
|
||||
v = visadev("GPIB1::19::INSTR");
|
||||
v = obj.connectDevice;
|
||||
|
||||
debug = 0;
|
||||
if debug
|
||||
@@ -181,9 +175,6 @@ classdef DC_supply < handle
|
||||
%disconnect
|
||||
delete(v);
|
||||
|
||||
catch
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
classdef Exfo_laser < handle
|
||||
|
||||
properties(Access=private)
|
||||
serialport_number
|
||||
connection_id
|
||||
lab_interface
|
||||
mainframe_channel
|
||||
end
|
||||
properties(Access=public)
|
||||
@@ -15,10 +16,10 @@ classdef Exfo_laser < handle
|
||||
|
||||
function obj = Exfo_laser(options)
|
||||
|
||||
|
||||
arguments
|
||||
options.safety_mode = 1;
|
||||
options.serialport_number = 'COM8';
|
||||
options.lab_interface lab_interface = lab_interface.gbib;
|
||||
options.connection_id = '8';
|
||||
options.mainframe_channel = 1;
|
||||
end
|
||||
|
||||
@@ -30,29 +31,19 @@ classdef Exfo_laser < handle
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
% Connect to the laser
|
||||
o = serialport(obj.serialport_number, 9600);
|
||||
configureTerminator(o, "CR", "CR"); % Set the terminator to carriage return (CR)
|
||||
flush(o);
|
||||
writeline(o, "*IDN?");
|
||||
answ = readline(o);
|
||||
|
||||
if obj.safety_mode
|
||||
disp(['Yay! We can talk to Instrument: ',char(answ)]);
|
||||
end
|
||||
v = obj.connectLaser_();
|
||||
|
||||
% Read states the first time
|
||||
obj.cur_state = obj.getLaserStatus_(o,obj.mainframe_channel);
|
||||
obj.cur_wavelength = obj.getLaserWavelength_(o,obj.mainframe_channel);
|
||||
obj.cur_power = obj.getLaserPower_(o,obj.mainframe_channel);
|
||||
obj.cur_state = obj.getLaserStatus_(v,obj.mainframe_channel);
|
||||
obj.cur_wavelength = obj.getLaserWavelength_(v,obj.mainframe_channel);
|
||||
obj.cur_power = obj.getLaserPower_(v,obj.mainframe_channel);
|
||||
|
||||
clear o;
|
||||
clear v;
|
||||
|
||||
if obj.safety_mode
|
||||
warning("Safety_mode ON: Display all information. Ask when switching laser. Turn safety_mode off in class instance or during initialization Exfo_laser(...,'safety_mode',0)");
|
||||
else
|
||||
warning("safety_mode OFF: EVERYTHING IS EXECUTED WITHOUT ASKING :-) BE SURE WHAT YOU DO");
|
||||
disp("safety_mode OFF: EVERYTHING IS EXECUTED WITHOUT ASKING :-) BE SURE WHAT YOU DO");
|
||||
end
|
||||
end
|
||||
|
||||
@@ -171,20 +162,34 @@ classdef Exfo_laser < handle
|
||||
% Abort the operation
|
||||
disp('Operation aborted. Laser remains at wavelength.');
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
end %public mehtods
|
||||
methods (Access=private)
|
||||
|
||||
function serialobj = connectLaser_(obj)
|
||||
function v = connectLaser_(obj)
|
||||
% Connect to the laser
|
||||
serialobj = serialport(obj.serialport_number, 9600);
|
||||
configureTerminator(serialobj, "CR", "CR"); % Set the terminator to carriage return (CR)
|
||||
flush(serialobj);
|
||||
writeline(serialobj, "*IDN?");
|
||||
answ = readline(serialobj);
|
||||
|
||||
if obj.lab_interface == lab_interface.serial
|
||||
% Connect to the laser via SERIAL (USB)
|
||||
v = serialport(obj.connection_id, 9600);
|
||||
configureTerminator(v, "CR", "CR"); % Set the terminator to carriage return (CR)
|
||||
elseif obj.lab_interface == lab_interface.gpib
|
||||
% Connect via GPIB adress
|
||||
visastring = ['GPIB0::',obj.connection_id,'::INSTR'];
|
||||
v = visadev(visastring);
|
||||
else
|
||||
error('Interface not supported');
|
||||
end
|
||||
|
||||
if obj.safety_mode
|
||||
flush(v);
|
||||
writeline(v, "*IDN?");
|
||||
answ = readline(v);
|
||||
disp(['Yay! We can talk to Instrument: ',char(answ)]);
|
||||
end
|
||||
end
|
||||
@@ -194,11 +199,15 @@ classdef Exfo_laser < handle
|
||||
|
||||
writeline(serialObj, ['CH', num2str(channel), ':ENABLE?']); % Query current wavelength
|
||||
|
||||
if serialObj.Type == visalib.InterfaceType.serial
|
||||
manual_flush = 1;
|
||||
while manual_flush
|
||||
response = readline(serialObj);
|
||||
manual_flush = contains(response, {'OK'});
|
||||
end
|
||||
else
|
||||
response = readline(serialObj);
|
||||
end
|
||||
|
||||
isEnabled = 0;
|
||||
isEnabled = contains(response, {'ENABLED'});
|
||||
@@ -211,14 +220,14 @@ classdef Exfo_laser < handle
|
||||
elseif ~isEnabled && isDisabled
|
||||
obj.cur_state = isEnabled;
|
||||
else
|
||||
error(['Unknown Laser State ->', char(response)]);
|
||||
error(['Quantum Laser State; your laser is ON and OFF ->', char(response)]);
|
||||
end
|
||||
|
||||
if obj.safety_mode
|
||||
if isEnabled
|
||||
disp(['Laser ', num2str(channel) ,' is currently ON -> ', char(response)]);
|
||||
elseif isDisabled
|
||||
disp(['Laser ', num2str(channel) ,' is currently OFF ->', char(response)]);
|
||||
disp(['Laser ', num2str(channel) ,' is currently OFF -> ', char(response)]);
|
||||
else
|
||||
error(['Unknown Laser State ->', char(response)]);
|
||||
end
|
||||
@@ -269,8 +278,11 @@ classdef Exfo_laser < handle
|
||||
isEnabled = obj.getLaserStatus_(serialObj,obj.mainframe_channel);
|
||||
|
||||
writeline(serialObj, ['CH',num2str(channel),':ENABLE']);
|
||||
|
||||
if serialObj.Type == visalib.InterfaceType.serial
|
||||
response = readline(serialObj);
|
||||
isok = contains(response, {'OK'});
|
||||
end
|
||||
|
||||
cnt=0;
|
||||
while ~isEnabled || cnt>10
|
||||
@@ -292,25 +304,30 @@ classdef Exfo_laser < handle
|
||||
isEnabled = obj.getLaserStatus_(serialObj,obj.mainframe_channel);
|
||||
|
||||
writeline(serialObj, ['CH',num2str(channel),':DISABLE']);
|
||||
|
||||
if serialObj.Type == visalib.InterfaceType.serial
|
||||
response = readline(serialObj);
|
||||
isok = contains(response, {'OK'});
|
||||
end
|
||||
|
||||
cnt=0;
|
||||
while isEnabled || cnt>10
|
||||
isEnabled = obj.getLaserStatus_(serialObj,obj.mainframe_channel);
|
||||
pause(0.2);
|
||||
pause(0.5);
|
||||
cnt = cnt+1;
|
||||
end
|
||||
|
||||
if serialObj.Type == visalib.InterfaceType.serial
|
||||
if isEnabled
|
||||
error('Laser not enabled but command was send')
|
||||
else
|
||||
success = 1;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
% Function to SET the wavelength of the laser
|
||||
function success = setLaserWavelength_(~,serialObj, channel, desiredWavelength_nm)
|
||||
function success = setLaserWavelength_(obj,serialObj, channel, desiredWavelength_nm)
|
||||
success = 0;
|
||||
|
||||
writeline(serialObj, ['CH',num2str(channel),':NM?']);
|
||||
@@ -325,15 +342,18 @@ classdef Exfo_laser < handle
|
||||
command = ['CH', num2str(channel), ':L=', num2str(desiredWavelength_nm)];
|
||||
writeline(serialObj, command);
|
||||
|
||||
if serialObj.Type == visalib.InterfaceType.serial
|
||||
pause(0.2);
|
||||
|
||||
response = readline(serialObj);
|
||||
success = contains(response, 'OK');
|
||||
end
|
||||
|
||||
success = desiredWavelength_nm == obj.getLaserWavelength_(serialObj, channel);
|
||||
|
||||
end
|
||||
|
||||
% Function to SET the laser power
|
||||
function success = setLaserPower_(~,serialObj, channel, desiredPower_dBm)
|
||||
function success = setLaserPower_(obj,serialObj, channel, desiredPower_dBm)
|
||||
success = 0;
|
||||
|
||||
writeline(serialObj, ['CH',num2str(channel),':MW?']);
|
||||
@@ -348,11 +368,13 @@ classdef Exfo_laser < handle
|
||||
command = ['CH', num2str(channel), ':P=', num2str(desiredPower_dBm)];
|
||||
writeline(serialObj, command);
|
||||
|
||||
if serialObj.Type == visalib.InterfaceType.serial
|
||||
pause(0.2);
|
||||
|
||||
response = readline(serialObj);
|
||||
success = contains(response, 'OK');
|
||||
end
|
||||
|
||||
success = desiredPower_dBm == obj.getLaserPower_(serialObj, channel);
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -53,11 +53,8 @@ classdef OptAtten < handle
|
||||
|
||||
try
|
||||
%connect to device
|
||||
|
||||
|
||||
v = visadev('TCPIP::134.245.243.248::INSTR');
|
||||
|
||||
|
||||
debug = 0;
|
||||
if debug
|
||||
disp(['Connected to Instrument: ',char(v.Vendor),' ',char(v.Model),' SerNo:',char(v.SerialNumber)]);
|
||||
@@ -279,6 +276,10 @@ classdef OptAtten < handle
|
||||
cnt = cnt+1;
|
||||
end
|
||||
|
||||
fprintf("\n SET: CH1 %.2f dB | CH2: %.2f dB | CH3: %.2f dB | CH4: %.2f dB\n",obj.value_state(1), obj.value_state(2), obj.value_state(3), obj.value_state(4));
|
||||
fprintf(" ATT: CH1 %.2f dB | CH2: %.2f dB | CH3: %.2f dB | CH4: %.2f dB\n",obj.atten_state(1), obj.atten_state(2), obj.atten_state(3), obj.atten_state(4));
|
||||
fprintf(" POW: CH1 %.2f dBm | CH2: %.2f dBm | CH3: %.2f dBm | CH4: %.2f dBm \n \n",obj.power_state(1), obj.power_state(2), obj.power_state(3), obj.power_state(4));
|
||||
|
||||
delete(v);
|
||||
|
||||
catch error
|
||||
@@ -292,7 +293,12 @@ classdef OptAtten < handle
|
||||
end
|
||||
end
|
||||
|
||||
function [p1,p2,p3,p4]=readPower(obj)
|
||||
function [p1,p2,p3,p4]=readPower(obj, options)
|
||||
|
||||
arguments
|
||||
obj
|
||||
options.silent = 0
|
||||
end
|
||||
|
||||
v = visadev('TCPIP::134.245.243.248::INSTR');
|
||||
cnt = 1;
|
||||
@@ -309,6 +315,9 @@ classdef OptAtten < handle
|
||||
p3 = obj.power_state(3);
|
||||
p4 = obj.power_state(4);
|
||||
|
||||
if options.silent == 0
|
||||
fprintf("\n CH1: %.2f dB | CH2: %.2f dB | CH3: %.2f dB | CH4: %.2f dB\n \n",p1, p2, p3, p4);
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -43,13 +43,6 @@ classdef ScopeKeysight
|
||||
end
|
||||
end
|
||||
|
||||
switch obj.model
|
||||
case scope_model.DSAZ634A
|
||||
|
||||
case scope_model.UXR1102A
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
@@ -68,7 +61,7 @@ classdef ScopeKeysight
|
||||
if isempty(obj.IPaddress)
|
||||
switch obj.model
|
||||
case scope_model.DSAZ634A
|
||||
v=visadev('TCPIP0::keysight.tf.uni-kiel.de::inst0::INSTR');% TCPIP0::127.0.0.1::inst0::INSTR
|
||||
v=visadev('TCPIP0::134.245.243.195::inst0::INSTR');% TCPIP0::127.0.0.1::inst0::INSTR
|
||||
case scope_model.UXR1102A
|
||||
v=visadev('TCPIP0::testscope.tf.uni-kiel.de::inst0::INSTR');% TCPIP0::127.0.0.1::inst0::INSTR
|
||||
case scope_model.UXR1104B
|
||||
|
||||
9
Datatypes/lab_interface.m
Normal file
9
Datatypes/lab_interface.m
Normal file
@@ -0,0 +1,9 @@
|
||||
classdef lab_interface < int32
|
||||
|
||||
enumeration
|
||||
gpib (1)
|
||||
serial (2)
|
||||
lan (3)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -26,6 +26,10 @@ function [eq_package] = vnle(eq_,M,rx_signal,tx_symbols,tx_bits,options)
|
||||
end
|
||||
|
||||
%FFE or VNLE
|
||||
if length(rx_signal)/2 == length(tx_symbols)+0.5
|
||||
rx_signal.signal = rx_signal.signal(1:end-1);
|
||||
elseif length(rx_signal)/2 == length(tx_symbols)-1
|
||||
end
|
||||
[eq_signal_sd,eq_noise] = eq_.process(rx_signal,tx_symbols);
|
||||
|
||||
eq_signal_hd = PAMmapper(M,0).quantize(eq_signal_sd);
|
||||
@@ -78,9 +82,12 @@ function [eq_package] = vnle(eq_,M,rx_signal,tx_symbols,tx_bits,options)
|
||||
eq_package.evm_lvl = evm_lvl;
|
||||
eq_package.inf_rate_vnle = inf_rate;
|
||||
|
||||
eq_package.snr = snr(eq_signal_sd.signal,eq_noise.signal);
|
||||
|
||||
|
||||
if options.showAnalysis
|
||||
|
||||
snr(eq_signal_sd.signal,eq_noise.signal);
|
||||
fprintf(['VNLE EVM lvl: ',repmat('%.3f ',1,numel(evm_lvl)),' \n'],evm_lvl);
|
||||
|
||||
fprintf('VNLE BER: %.2e \n',ber);
|
||||
|
||||
51
Functions/Theory/Neuer Ordner/duobinary_histogram.m
Normal file
51
Functions/Theory/Neuer Ordner/duobinary_histogram.m
Normal file
@@ -0,0 +1,51 @@
|
||||
|
||||
|
||||
|
||||
figure(2)
|
||||
tiledlayout(1,3)
|
||||
cols = linspecer(5);
|
||||
cnt = 1;
|
||||
for m = [4,6,8]
|
||||
|
||||
M = m;
|
||||
fsym = 112e9;
|
||||
fdac = 256e9;
|
||||
|
||||
[Digi_sig,Symbols,Tx_bits] = PAMsource(...
|
||||
"fsym",fsym,"M",M,"order",19,"useprbs",1,...
|
||||
"fs_out",fdac,...
|
||||
"applyclipping",0,"clipfactor",1.5,...
|
||||
"applypulseform",0,"pulseformer",NaN,...
|
||||
"randkey",33,...
|
||||
"db_precode",1,"db_encode",0,...
|
||||
"mrds_code",0,"mrds_blocklength",512).process();
|
||||
|
||||
Symbols_pre = Duobinary().precode(Symbols);
|
||||
|
||||
Symbols_db = Duobinary().encode(Symbols_pre);
|
||||
|
||||
if M == 4
|
||||
Symbols_db.signal = Symbols_db.signal .*sqrt(2.5);
|
||||
elseif M == 6
|
||||
Symbols_db.signal = Symbols_db.signal .*sqrt(5.8);
|
||||
elseif M == 8
|
||||
Symbols_db.signal = Symbols_db.signal .*sqrt(10.5);
|
||||
end
|
||||
|
||||
% figure(1)
|
||||
% hold on
|
||||
% histogram(Symbols_db.signal,"EdgeAlpha",0.3,"Normalization","probability");
|
||||
|
||||
|
||||
% figure(1)
|
||||
nexttile
|
||||
hold on
|
||||
bar(unique(Symbols_db.signal),histcounts(int32(Symbols_db.signal),"Normalization","probability"),"FaceColor",cols(cnt,:),"FaceAlpha",0.6,"BarWidth",1-(0.2*cnt),"LineWidth",0.5,"EdgeColor",'black','DisplayName',['Duobinary PAM-',num2str(M)]);
|
||||
xticks(unique(Symbols_db.signal));
|
||||
ylim([0 0.26]);
|
||||
xlabel("Symbol")
|
||||
|
||||
|
||||
cnt = cnt+1,
|
||||
|
||||
end
|
||||
18
Functions/Theory/Neuer Ordner/duobinary_transferfunction.m
Normal file
18
Functions/Theory/Neuer Ordner/duobinary_transferfunction.m
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
|
||||
% Define the filter taps
|
||||
h_ = {[1],[1 1],[1 2 1],[1 3 3 1]};
|
||||
|
||||
for i = 1:length(h_)
|
||||
h = h_{i};
|
||||
|
||||
[H, w] = freqz(h, 1, 1024, 1);
|
||||
|
||||
figure(1);
|
||||
hold on
|
||||
plot(w, 10*log10(abs(H)), 'LineWidth', 2,'DisplayName',['$(1+D)^2$']); %todo
|
||||
xlabel('Normalized Frequency');
|
||||
ylabel('Amplitude in dB');
|
||||
grid on;
|
||||
ylim([-20,10])
|
||||
end
|
||||
@@ -4,9 +4,9 @@ params = struct;
|
||||
|
||||
params.M = [4];
|
||||
params.datarate = [184];
|
||||
params.rop = [-12:-5];
|
||||
params.rop = [-5];
|
||||
|
||||
precomp_mode = 0; %0=do nothing ; 1= measure; 2=precomp active
|
||||
precomp_mode = 1; %0=do nothing ; 1= measure; 2=precomp active
|
||||
postfilter = 0; % noise whiten. approach -> Postfilter + MLSE
|
||||
|
||||
db_precode = 0;
|
||||
@@ -124,7 +124,7 @@ for M = wh.parameter.M.values
|
||||
Opt_sig = Fiber("fsimu",Opt_sig.fs,"fiber_length",link_length/1000,"alpha",0.3,"D",0,"lambda0",1310,"gamma",0,"Dslope",0.07).process(Opt_sig);
|
||||
|
||||
% Receiver ROP curve
|
||||
parfor i = 1:i_
|
||||
for i = 1:i_
|
||||
|
||||
rop=wh.parameter.rop.values(i);
|
||||
|
||||
|
||||
@@ -6,15 +6,20 @@ if 1
|
||||
uloops.precomp = [0];
|
||||
uloops.db_precode = [0];
|
||||
uloops.bitrate = [330].*1e9; %[300,330,360,390,420,450,480]
|
||||
uloops.precomp = [1];
|
||||
uloops.db_precode = [0];
|
||||
uloops.bitrate = [300,330,360,390,420,450,480].*1e9; %[300,330,360,390,420,450,480]
|
||||
% uloops.bitrate = 390e9;
|
||||
% uloops.laser_wavelength = [1293,1297.5,1302,1306.5,1310,1313.4,1318,1322.7,1327.4];
|
||||
uloops.laser_wavelength = [1293];
|
||||
uloops.M = [4];
|
||||
uloops.laser_wavelength = [1310];
|
||||
uloops.M = [6];
|
||||
uloops.link_length = [2]; % 1,2,3,5,6,8,10
|
||||
wh = DataStorage(uloops);
|
||||
wh.addStorage("ber");
|
||||
|
||||
wh = submit_simulations(wh,"parallel",0,"simulation_mode",1);
|
||||
wh = submit_simulations(wh,"parallel",0,"simulation_mode",0);
|
||||
end
|
||||
|
||||
wh_ana = wh;
|
||||
@@ -30,7 +35,7 @@ alpha = {};
|
||||
ber_dfe = {};
|
||||
ngmi = [];
|
||||
|
||||
wavelength=1293;
|
||||
wavelength=uloops.laser_wavelength;
|
||||
for m = [4,6,8]
|
||||
%1302
|
||||
%VNLE
|
||||
@@ -40,14 +45,14 @@ for m = [4,6,8]
|
||||
ber_vnle = cellfun(@(x) x.vnle_pf_package{1,1}.ber_vnle, a);
|
||||
|
||||
%MLSE
|
||||
precomp = 0;
|
||||
precode = 1;
|
||||
% precomp = 0;
|
||||
% precode = 1;
|
||||
a = wh_ana.getStoValue('ber',precomp, precode, uloops.bitrate , wavelength, m, uloops.link_length);
|
||||
ber_mlse = cellfun(@(x) x.vnle_pf_package{1,1}.ber_mlse, a);
|
||||
|
||||
%DB
|
||||
precomp = 0;
|
||||
precode = 1;
|
||||
% precomp = 0;
|
||||
% precode = 1;
|
||||
a = wh_ana.getStoValue('ber',precomp, precode, uloops.bitrate , wavelength, m, uloops.link_length);
|
||||
ber_dbtgt = cellfun(@(x) x.dbtgt_package{1,1}.ber, a);
|
||||
|
||||
|
||||
@@ -240,10 +240,11 @@ else
|
||||
%
|
||||
% Raw_signal = Filter('filtdegree',4,"f_cutoff",Symbols.fs.*0.55,"fs",Raw_signal.fs,"filterType",filtertypes.gaussian,"active",true).process(Raw_signal);
|
||||
%
|
||||
% Scpe_cell{1}.eye(fsym,M,"displayname",'eye','fignum',227);
|
||||
Scpe_cell{1}.eye(fsym,M,"displayname",'eye','fignum',227);
|
||||
%
|
||||
% Raw_signal.spectrum("normalizeTo0dB",0,"fignum",336,"fft_length",2^12);
|
||||
% Raw_signal.move_it_spectrum("fignum",334);
|
||||
% Raw_signal.move_it_spectrum("fignum",334);
|
||||
|
||||
fsym = Symbols.fs;
|
||||
|
||||
@@ -259,7 +260,7 @@ vnle_dfe_package = {};
|
||||
dbtgt_package = {};
|
||||
|
||||
|
||||
proc_occ = min(8,length(Scpe_cell));
|
||||
proc_occ = min(1,length(Scpe_cell));
|
||||
for occ = 1:proc_occ
|
||||
|
||||
Scpe_sig = Scpe_cell{occ};
|
||||
|
||||
44
projects/Lab_base_system/test_device_control.m
Normal file
44
projects/Lab_base_system/test_device_control.m
Normal file
@@ -0,0 +1,44 @@
|
||||
|
||||
%% DC Source
|
||||
desired_voltage = 2.1;
|
||||
dcs = DC_supply("active",[1,0],"voltage",[desired_voltage, 0]);
|
||||
dcs.set("voltage",[desired_voltage, 0]);
|
||||
[v,i]=dcs.readVals();
|
||||
|
||||
%% Laser
|
||||
laser = Exfo_laser("mainframe_channel",1,"safety_mode",0,"connection_id",'10','lab_interface','gpib');
|
||||
laser.setWavelength(1311);
|
||||
laser.setPower(0);
|
||||
laser.enableLaser();
|
||||
|
||||
%% Optical Attenuator
|
||||
voa = OptAtten("active",[2,0,0,0],"value",[-5,0,0,0],"wavelength",[1310,1310,1310,1310]);
|
||||
voa.set('value',[-5,0,0,0]);
|
||||
voa.readvals();
|
||||
|
||||
%% Construct AWG and Scope Modules %%%%%%
|
||||
fdac = 256e9;
|
||||
fadc = 160e9;
|
||||
Scp = ScopeKeysight("model","DSAZ634A",'autoscale',1,"fadc","GSa_160","channel",[0,0,1,0],"recordLen",4000000,"removeDC",1,"extRef",0);
|
||||
Awg = AwgKeysight("model","M8199A_ILV","fdac",fdac,"scaletodac",[1,1],"skews",[0,0],"voltages",[0,0.1]);
|
||||
A2S = Awg2Scope(Awg,Scp,[0,3,0,0],"waitUntilClick",0); %
|
||||
|
||||
%%%%% Symbol Generation %%%%%%
|
||||
fsym = 56e9;
|
||||
M = 4;
|
||||
rcalpha = 0.05;
|
||||
Pform = Pulseformer("fsym",fsym,"fdac",4*fsym,"pulse","rrc","pulselength",16,"rrcalpha",rcalpha);
|
||||
|
||||
Pamsource = PAMsource(...
|
||||
"fsym",fsym,"M",M,"order",17,"useprbs",0,...
|
||||
"fs_out",fdac,...
|
||||
"applyclipping",0,"clipfactor",1.5,...
|
||||
"applypulseform",0,"pulseformer",Pform,...
|
||||
"randkey",1,...
|
||||
"db_precode",0,"db_encode",0,...
|
||||
"mrds_code",0,"mrds_blocklength",512);
|
||||
|
||||
tx_signal = Pamsource.process();
|
||||
|
||||
A2S.process("signal2",tx_signal);
|
||||
|
||||
Reference in New Issue
Block a user