Merge commit '1b554f2d252c0bae558330a96a11c4d8ffa652ac'
This commit is contained in:
@@ -215,7 +215,7 @@ classdef AwgKeysight
|
|||||||
switch obj.model
|
switch obj.model
|
||||||
case awg_model.M8196A
|
case awg_model.M8196A
|
||||||
v = visadev('TCPIP0::zizou.tf.uni-kiel.de::hislip0::INSTR');
|
v = visadev('TCPIP0::zizou.tf.uni-kiel.de::hislip0::INSTR');
|
||||||
case awg_model.M8196A
|
case awg_model.M8199B
|
||||||
v = visadev('TCPIP0::localhost::hislip0::INSTR');
|
v = visadev('TCPIP0::localhost::hislip0::INSTR');
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -224,10 +224,10 @@ classdef AwgKeysight
|
|||||||
disp(['Connected to Instrument: ',char(v.Vendor),' ',char(v.Model),' SerNo:',char(v.SerialNumber)]);
|
disp(['Connected to Instrument: ',char(v.Vendor),' ',char(v.Model),' SerNo:',char(v.SerialNumber)]);
|
||||||
end
|
end
|
||||||
|
|
||||||
%check if channel config matches
|
% %check if channel config matches (ONLY FOR M8196...)
|
||||||
writeline(v,'*opt?');
|
% writeline(v,'*opt?');
|
||||||
aw=readline(v);
|
% aw=readline(v);
|
||||||
assert(obj.numChannels==sscanf(aw, '%f'),['Wrong Channel config. AWG response: ',num2str(sscanf(aw, '%f')), ' Channels']);
|
% assert(obj.numChannels==sscanf(aw, '%f'),['Wrong Channel config. AWG response: ',num2str(sscanf(aw, '%f')), ' Channels']);
|
||||||
|
|
||||||
switch obj.model
|
switch obj.model
|
||||||
case awg_model.M8196A
|
case awg_model.M8196A
|
||||||
@@ -276,33 +276,27 @@ classdef AwgKeysight
|
|||||||
|
|
||||||
case awg_model.M8199B
|
case awg_model.M8199B
|
||||||
|
|
||||||
% 1) TRAC DEl - delete the previous waveform
|
% 1) TRAC DEl - delete the previous ch waveform
|
||||||
xfprintf(f, sprintf(':TRAC:DEL ''M2.DataOut1'', %d', segm_num), 1);
|
obj.writeNcheck(v,sprintf(':TRAC:DEL ''M2.DataOut%d'', %d', chan, segm_num));
|
||||||
xfprintf(f, sprintf(':TRAC:DEL ''M2.DataOut2'', %d', segm_num), 1);
|
|
||||||
|
|
||||||
% 2) TRAC DEF - define properties of waveform
|
% 2) TRAC DEF - define properties of waveform
|
||||||
xfprintf(f, sprintf(':TRAC:DEF ''M2.DataOut1'', %d,%d', segm_num, len));
|
obj.writeNcheck(v,sprintf(':TRAC:DEF ''M2.DataOut%d'', %d,%d', chan, segm_num, segm_len));
|
||||||
xfprintf(f, sprintf(':TRAC:DEF ''M2.DataOut2'', %d,%d', segm_num, len));
|
% xfprintf(f, sprintf(':TRAC:DEF ''M2.DataOut1'', %d,%d', segm_num, len));
|
||||||
|
|
||||||
% 3) TRAC DATA - load the new waveform
|
% 3) TRAC DATA - load the new waveform
|
||||||
|
|
||||||
% Example command: :TRAC:DATA 'M1.DataOut1', 1, 0 , -127,-126,,-1,0,1,,127,-127,,-1,0,1,,127
|
% Example command: :TRAC:DATA 'M1.DataOut1', 1, 0 , -127,-126,,-1,0,1,,127,-127,,-1,0,1,,127
|
||||||
% means : :TRAC:DATA 'identifier' , <segment_id>, <offset>, <block>|<numeric_values>
|
% means : :TRAC:DATA 'identifier' , <segment_id>, <offset>, <block>|<numeric_values>
|
||||||
|
offset = 0;
|
||||||
cmd = sprintf(':TRAC:DATA ''M2.DataOut1'', %d,%d,', segm_num, offset);
|
cmd = sprintf(':TRAC:DATA ''M2.DataOut%d'', %d,%d,',chan, segm_num, offset);
|
||||||
binblockwrite(f, data(1+offset:offset+len), dataFormat, cmd);
|
binblockwrite(v, signal{chan}, 'int8', cmd);
|
||||||
|
|
||||||
cmd = sprintf(':TRAC:DATA ''M2.DataOut2'', %d,%d,', segm_num, offset);
|
|
||||||
binblockwrite(f, data(1+offset:offset+len), dataFormat, cmd);
|
|
||||||
|
|
||||||
% 4) SET VOLTAGE (not possible to set 0v)
|
% 4) SET VOLTAGE (not possible to set 0v)
|
||||||
xfprintf(f, sprintf(':VOLT:AMPL ''M2.DataOut1'', %gv', awg_volt(1)));
|
obj.writeNcheck(v, sprintf(':VOLT:AMPL ''M2.DataOut%d'', %gv',chan, obj.voltages(chan)));
|
||||||
xfprintf(f, sprintf(':VOLT:AMPL ''M2.DataOut2'', %gv', awg_volt(2)));
|
|
||||||
% xfprintf(f, ':VOLT:AMPL ''M2.DataOut2'', 0.1v');
|
% xfprintf(f, ':VOLT:AMPL ''M2.DataOut2'', 0.1v');
|
||||||
|
|
||||||
% 5) SET OUTPUTS ON/ OFF
|
% 5) SET OUTPUTS ON/ OFF
|
||||||
xfprintf(f, ':OUTP ''M2.DataOut1'', ON'); %sioe 11.23: Hier habe ich absichtlich auf OFF gestellt, wenn Kanal nicht bentigt!
|
obj.writeNcheck(v, sprintf(':OUTP ''M2.DataOut%d'', ON',chan)); %sioe 11.23: Hier habe ich absichtlich auf OFF gestellt, wenn Kanal nicht bentigt!
|
||||||
xfprintf(f, ':OUTP ''M2.DataOut2'', ON');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -319,6 +313,9 @@ classdef AwgKeysight
|
|||||||
|
|
||||||
case awg_model.M8199B
|
case awg_model.M8199B
|
||||||
|
|
||||||
|
% SET Ref clock out (which is conn. to scope) to 100 MHz
|
||||||
|
obj.writeNcheck(v, ':OUTPut:FREQuency ''M1.RefClkOut'',100000000');
|
||||||
|
|
||||||
% :OUTP:GLOB 'M1.System', OFF
|
% :OUTP:GLOB 'M1.System', OFF
|
||||||
obj.writeNcheck(v, ':OUTP:GLOB ''M1.System'', ON');
|
obj.writeNcheck(v, ':OUTP:GLOB ''M1.System'', ON');
|
||||||
obj.writeNcheck(v, ':OUTP:GLOB ''M2.System'', ON');
|
obj.writeNcheck(v, ':OUTP:GLOB ''M2.System'', ON');
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
classdef DC_supply
|
classdef DC_supply < handle
|
||||||
% Simple control of DC supply via fixed GBIB address.
|
% Simple control of DC supply via fixed GBIB address.
|
||||||
% Agilent E3646A
|
% Agilent E3646A
|
||||||
% No OVP or OCP implementation
|
% No OVP or OCP implementation
|
||||||
@@ -8,6 +8,10 @@ classdef DC_supply
|
|||||||
properties(Access=public)
|
properties(Access=public)
|
||||||
active
|
active
|
||||||
voltage
|
voltage
|
||||||
|
|
||||||
|
|
||||||
|
meas_voltage
|
||||||
|
meas_current
|
||||||
end
|
end
|
||||||
|
|
||||||
methods (Access=public)
|
methods (Access=public)
|
||||||
@@ -33,6 +37,10 @@ classdef DC_supply
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function v = connectDevice(obj)
|
||||||
|
v = visadev("GPIB1::19::INSTR");
|
||||||
|
end
|
||||||
|
|
||||||
function success = set(obj,options)
|
function success = set(obj,options)
|
||||||
|
|
||||||
|
|
||||||
@@ -44,7 +52,14 @@ classdef DC_supply
|
|||||||
success = [0,0];
|
success = [0,0];
|
||||||
|
|
||||||
try
|
try
|
||||||
%connect to device
|
% %connect to device
|
||||||
|
% if exist('v','var')
|
||||||
|
% %v = visadev("GPIB1::19::INSTR");
|
||||||
|
% v = obj.connectDevice();
|
||||||
|
% else
|
||||||
|
%
|
||||||
|
% end
|
||||||
|
|
||||||
v = visadev("GPIB1::19::INSTR");
|
v = visadev("GPIB1::19::INSTR");
|
||||||
|
|
||||||
debug = 0;
|
debug = 0;
|
||||||
@@ -121,5 +136,55 @@ classdef DC_supply
|
|||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function [voltage,current] = readVals(obj)
|
||||||
|
|
||||||
|
try
|
||||||
|
%connect to device
|
||||||
|
v = visadev("GPIB1::19::INSTR");
|
||||||
|
|
||||||
|
debug = 0;
|
||||||
|
if debug
|
||||||
|
disp(['Connected to Instrument: ',char(v.Vendor),' ',char(v.Model),' SerNo:',char(v.SerialNumber)]);
|
||||||
|
end
|
||||||
|
|
||||||
|
cmd = 'INST:SEL?';
|
||||||
|
writeline(v, cmd);
|
||||||
|
prev_selected_channel = readline(v);
|
||||||
|
|
||||||
|
for ch = 1:2
|
||||||
|
|
||||||
|
% choose channel
|
||||||
|
cmd = ['INST:SEL OUT',num2str(ch)];
|
||||||
|
writeline(v, cmd);
|
||||||
|
|
||||||
|
% get current voltage level
|
||||||
|
cmd = 'VOLT?';
|
||||||
|
writeline(v, cmd);
|
||||||
|
voltage(ch) = str2num(readline(v));
|
||||||
|
|
||||||
|
% get current voltage level
|
||||||
|
cmd = 'MEAS:CURR?';
|
||||||
|
writeline(v, cmd);
|
||||||
|
current(ch) = str2num(readline(v));
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
% set channel back to prev. selected one
|
||||||
|
cmd = ['INST:SEL ',char(strtrim(prev_selected_channel))];
|
||||||
|
writeline(v, cmd);
|
||||||
|
|
||||||
|
obj.meas_voltage = voltage;
|
||||||
|
obj.meas_current = current;
|
||||||
|
|
||||||
|
%disconnect
|
||||||
|
delete(v);
|
||||||
|
|
||||||
|
catch
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,68 +1,136 @@
|
|||||||
|
measurement_name = 'MZM_SD40';
|
||||||
|
|
||||||
% Initialize a structure to hold parameters
|
% Initialize a structure to hold parameters
|
||||||
params = struct;
|
params = struct;
|
||||||
|
|
||||||
% Define the bias voltage range from 1.2V to 2.8V with 0.01V increments
|
% Define the bias voltage range from 1.2V to 2.8V with 0.01V increments
|
||||||
params.v_bias = 1.2:0.01:2.8;
|
params.v_bias = 0:0.1:6;
|
||||||
|
|
||||||
% Create a DataStorage object with the defined parameters
|
% Create a DataStorage object with the defined parameters
|
||||||
wh = DataStorage(params);
|
wh = DataStorage(params);
|
||||||
|
|
||||||
% Add a storage field for output power measurements
|
% Add a storage field for output power measurements
|
||||||
wh.addStorage("p_out");
|
wh.addStorage("p_out");
|
||||||
|
wh.addStorage("i_draw");
|
||||||
|
wh.addStorage("v_set");
|
||||||
|
|
||||||
% Display the total number of measurement loops to be executed
|
% Display the total number of measurement loops to be executed
|
||||||
disp(['Start Measurement of ', num2str(prod(wh.dim)), ' loops...']);
|
disp(['Start Measurement of ', num2str(prod(wh.dim)), ' loops...']);
|
||||||
|
|
||||||
|
|
||||||
% Initialize the Optical Attenuator (VOA) with specified settings
|
% Initialize the Optical Attenuator (VOA) with specified settings
|
||||||
voa = OptAtten(...
|
voa = OptAtten(...
|
||||||
"active", [1, 0, 0, 0], ... % Activate only the first channel
|
"active", [0, 1, 0, 0], ... % Activate only the first channel
|
||||||
"value", [0, 0, 0, 0], ... % Set attenuation values to 0 dB
|
"value", [0, 0, 0, 0], ... % Set attenuation values to 0 dB
|
||||||
"wavelength", [1310, 1310, 1310, 1310]); % Set the wavelength for each channel
|
"wavelength", [1310, 1310, 1310, 1310]); % Set the wavelength for each channel
|
||||||
|
% Set the VOA active channels and attenuation values
|
||||||
|
voa.set('active', [0, 1, 0, 0], 'value', [0, 0, 0, 0]);
|
||||||
|
|
||||||
|
|
||||||
% Initialize the DC Power Supply with specified settings
|
% Initialize the DC Power Supply with specified settings
|
||||||
dcs = DC_supply(...
|
v_bias_init = wh.parameter.v_bias.values(1);
|
||||||
"active", [1, 1], ... % Activate the first two channels
|
|
||||||
"voltage", [v_bias, 9]); % Set initial voltages for channels
|
dcs = DC_supply(...
|
||||||
|
"active", [1, 0], ... % Activate the first two channels
|
||||||
|
"voltage", [v_bias_init, 0]); % Set initial voltages for channels
|
||||||
|
|
||||||
% Set the VOA active channels and attenuation values
|
|
||||||
voa.set('active', [1, 0, 0, 0], 'value', [0, 0, 0, 0]);
|
|
||||||
|
|
||||||
% Loop over each bias voltage value to perform measurements
|
% Loop over each bias voltage value to perform measurements
|
||||||
for v_bias = wh.parameter.v_bias.values
|
for v_bias = wh.parameter.v_bias.values
|
||||||
try
|
|
||||||
% Try to retrieve existing output power measurement to avoid repetition
|
|
||||||
p_out = wh2.getStoValue('p_out', v_bias);
|
|
||||||
wh.addValueToStorage(p_out, 'p_out', v_bias);
|
|
||||||
catch
|
|
||||||
% If no existing measurement, proceed with the measurement
|
|
||||||
|
|
||||||
%%%%% SET Voltages %%%%%%
|
%%%%% SET Voltages %%%%%%
|
||||||
% Update the DC supply voltage for the current bias voltage
|
% Update the DC supply voltage for the current bias voltage
|
||||||
dcs.set("voltage", [v_bias, 9]);
|
dcs.set("voltage", [v_bias, 0]);
|
||||||
|
|
||||||
|
%%%%% Measure Voltages %%%%%%
|
||||||
|
[v,c] = dcs.readVals();
|
||||||
|
|
||||||
|
% assert(v(1)==v_bias,['Desired voltage is ', num2str(v_bias),'V but currently is ', num2str(v(1)), ' V ']);
|
||||||
|
|
||||||
%%%%% Measure VOA %%%%%%
|
%%%%% Measure VOA %%%%%%
|
||||||
% Read the current values from the VOA
|
% Read the current values from the VOA
|
||||||
voa.readvals();
|
voa.readvals();
|
||||||
|
|
||||||
% Store the measured output power in the DataStorage object
|
% Store the measured output power in the DataStorage object
|
||||||
wh.addValueToStorage(voa.power_state(1), 'p_out', v_bias);
|
wh.addValueToStorage(voa.power_state(2), 'p_out', v_bias);
|
||||||
end
|
wh.addValueToStorage(c(1), 'i_draw', v_bias);
|
||||||
|
wh.addValueToStorage(v(1), 'v_set', v_bias);
|
||||||
|
|
||||||
% Retrieve all stored output power measurements up to the current point
|
% Retrieve all stored output power measurements up to the current point
|
||||||
p_out = wh.getStoValue('p_out', wh.parameter.v_bias.values);
|
p_opt_out = wh.getStoValue('p_out', wh.parameter.v_bias.values);
|
||||||
|
|
||||||
% Plot the measured output power in dBm versus the negative bias voltage
|
% Plot the measured output power in dBm versus the negative bias voltage
|
||||||
figure(90);
|
% Plot the output power converted from dBm to linear scale (Watts)
|
||||||
plot(-wh.parameter.v_bias.values(1:numel(p_out)), p_out, 'DisplayName', 'Measured Output Power in dBm');
|
figure(91);
|
||||||
xlim([-max(params.v_bias), -min(params.v_bias)]); % Set x-axis limits
|
clf
|
||||||
|
hold on
|
||||||
|
plot(wh.parameter.v_bias.values(1:numel(p_opt_out)), db2pow(p_opt_out), 'DisplayName', 'Measured Output Power in Watts','LineWidth',2);
|
||||||
|
xlim([min(params.v_bias), max(params.v_bias)]); % Set x-axis limits
|
||||||
grid on; % Enable grid for better readability
|
grid on; % Enable grid for better readability
|
||||||
|
xlabel('applied voltage in V')
|
||||||
|
ylabel('measured optical power in dB')
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
save(['C:\Users\sioe\Nextcloud\Dokumente\02_Ablage_Office\HighSpeedMeasurement_2024\Messreihe_TFLN_MZM\',measurement_name],'wh');
|
||||||
|
|
||||||
|
p_opt_in = 0; %dbm
|
||||||
% After completing the measurements, retrieve all output power data
|
% After completing the measurements, retrieve all output power data
|
||||||
p_out = wh.getStoValue('p_out', wh.parameter.v_bias.values);
|
p_opt_out = wh.getStoValue('p_out', wh.parameter.v_bias.values);
|
||||||
|
transmission = p_opt_out;
|
||||||
|
i_draw = wh.getStoValue('i_draw', wh.parameter.v_bias.values);
|
||||||
|
v_set = wh.getStoValue('v_set', wh.parameter.v_bias.values);
|
||||||
|
|
||||||
|
power_draw = i_draw .* v_set .* 1e3; %watt
|
||||||
|
resistance = v_set ./ i_draw;
|
||||||
|
i_draw = i_draw.* 1e3;
|
||||||
|
|
||||||
% Plot the output power converted from dBm to linear scale (Watts)
|
% Plot the output power converted from dBm to linear scale (Watts)
|
||||||
|
cols = linspecer(4);
|
||||||
|
c = 1;
|
||||||
|
linstyle = '-';
|
||||||
|
|
||||||
figure(91);
|
figure(91);
|
||||||
plot(-wh.parameter.v_bias.values(1:numel(p_out)), db2pow(p_out), 'DisplayName', 'Measured Output Power in Watts');
|
hold on
|
||||||
xlim([-max(params.v_bias), -min(params.v_bias)]); % Set x-axis limits
|
subplot(2,2,1)
|
||||||
|
hold on
|
||||||
|
plot(power_draw, transmission, 'DisplayName', measurement_name,'LineWidth',1,'Marker','none','Color',cols(c,:),'LineStyle',linstyle);
|
||||||
|
title('MZM Attenuation')
|
||||||
|
xlim([min(power_draw), max(power_draw)]); % Set x-axis limits
|
||||||
grid on; % Enable grid for better readability
|
grid on; % Enable grid for better readability
|
||||||
|
xlabel('DUT Power (mW)');
|
||||||
|
ylabel('Transmission in dB');
|
||||||
|
legend
|
||||||
|
|
||||||
|
subplot(2,2,2)
|
||||||
|
hold on
|
||||||
|
plot(v_set, i_draw, 'DisplayName', measurement_name,'LineWidth',1,'Marker','none','Color',cols(c,:),'LineStyle',linstyle);
|
||||||
|
title('Voltage vs. Current')
|
||||||
|
xlim([min(v_set), max(v_set)]); % Set x-axis limits
|
||||||
|
grid on; % Enable grid for better readability
|
||||||
|
xlabel('Voltage (mA)');
|
||||||
|
ylabel('Current (mA)');
|
||||||
|
legend
|
||||||
|
|
||||||
|
subplot(2,2,3)
|
||||||
|
hold on
|
||||||
|
plot(power_draw, db2pow(transmission), 'DisplayName', measurement_name,'LineWidth',1,'Marker','none','Color',cols(c,:),'LineStyle',linstyle);
|
||||||
|
title('Measured Output Power in Watt')
|
||||||
|
xlim([min(power_draw), max(power_draw)]); % Set x-axis limits
|
||||||
|
grid on; % Enable grid for better readability
|
||||||
|
xlabel('DUT Power (mW)');
|
||||||
|
ylabel('Trabnsmission in %');
|
||||||
|
legend
|
||||||
|
|
||||||
|
subplot(2,2,4)
|
||||||
|
hold on
|
||||||
|
plot(power_draw, resistance, 'DisplayName', measurement_name,'LineWidth',1,'Marker','none','Color',cols(c,:),'LineStyle',linstyle);
|
||||||
|
title('Heater Resistance = U/I')
|
||||||
|
xlim([min(power_draw), max(power_draw)]); % Set x-axis limits
|
||||||
|
grid on; % Enable grid for better readability
|
||||||
|
xlabel('DUT Power (mW)');
|
||||||
|
ylabel('Resistance in Ohm');
|
||||||
|
ylim([455, 470])
|
||||||
|
legend
|
||||||
|
|
||||||
|
disp('Measurement Complete!')
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
|
|
||||||
folderpath = 'C:\Users\sioe\Nextcloud\Dokumente\02_Ablage_Office\Lab_Data_24\sir_sweep_pam4\';
|
folderpath = 'C:\Users\sioe\Nextcloud\Dokumente\02_Ablage_Office\Lab_Data_24\sir_sweep_sd40\';
|
||||||
experiment_name = 'PAM4_DB_encoded_10km_';
|
experiment_name = 'PAM4_56_v2';
|
||||||
|
|
||||||
%%% SIR Sweep for MPI Experiment %%%
|
%%% SIR Sweep for MPI Experiment %%%
|
||||||
params = struct;
|
params = struct;
|
||||||
|
|
||||||
params.vbias = [2.45];
|
params.vbias = [2.5];
|
||||||
params.awg_vpp = [0.25];
|
params.awg_vpp = [0.35];
|
||||||
params.eq_mode = [4];
|
params.eq_mode = [2];
|
||||||
params.i_atten = [0:4:40];
|
params.i_atten = [0:4:40];
|
||||||
|
|
||||||
wh = DataStorage(params);
|
wh = DataStorage(params);
|
||||||
@@ -23,13 +23,13 @@ wh.addStorage("signals");
|
|||||||
precomp_path = "C:\Users\sioe\Documents\MATLAB\imdd_simulation\projects\standard_system\";
|
precomp_path = "C:\Users\sioe\Documents\MATLAB\imdd_simulation\projects\standard_system\";
|
||||||
precomp_fn = "lab_mpi_setup_2";
|
precomp_fn = "lab_mpi_setup_2";
|
||||||
precomp_mode = 2; %0=do nothing ; 1= measure; 2=precomp active
|
precomp_mode = 2; %0=do nothing ; 1= measure; 2=precomp active
|
||||||
precomp_amp_max = 5;
|
precomp_amp_max = 2;
|
||||||
|
|
||||||
M = 4;
|
M = 4;
|
||||||
pn_key = 2;
|
pn_key = 2;
|
||||||
usemrds = 0;
|
usemrds = 0;
|
||||||
fsym = 92e9;
|
fsym = 68e9;
|
||||||
fdac = 92e9;
|
fdac = 256e9;
|
||||||
awg_vpp = 0.35;
|
awg_vpp = 0.35;
|
||||||
fadc = 160e9;
|
fadc = 160e9;
|
||||||
rrcalpha = 0.05;
|
rrcalpha = 0.05;
|
||||||
@@ -60,21 +60,6 @@ for eq_mode = wh.parameter.eq_mode.values
|
|||||||
sprintf('Progress: %d/%d\nEstimated time remaining: %.2f hours\nEstimated time remaining: %.2f hours', ...
|
sprintf('Progress: %d/%d\nEstimated time remaining: %.2f hours\nEstimated time remaining: %.2f hours', ...
|
||||||
loopcnt, looptotal, estimatedTimeRemaining/60/60, estimatedTotalTime/60/60));
|
loopcnt, looptotal, estimatedTimeRemaining/60/60, estimatedTotalTime/60/60));
|
||||||
|
|
||||||
try
|
|
||||||
|
|
||||||
z
|
|
||||||
ber = wh2.getStoValue('ber',v_bias,awg_vpp,eq_mode,precomp_amp_max);
|
|
||||||
assert(~isempty(ber),'err')
|
|
||||||
rop = wh2.getStoValue('rop',v_bias,awg_vpp,eq_mode,precomp_amp_max);
|
|
||||||
assert(~isempty(rop))
|
|
||||||
pd_in = wh2.getStoValue('pd_in',v_bias,awg_vpp,eq_mode,precomp_amp_max);
|
|
||||||
assert(~isempty(pd_in))
|
|
||||||
M = wh2.getStoValue('m',v_bias,awg_vpp,eq_mode,precomp_amp_max);
|
|
||||||
assert(~isempty(M))
|
|
||||||
|
|
||||||
catch
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
switch eq_mode
|
switch eq_mode
|
||||||
@@ -93,6 +78,7 @@ for eq_mode = wh.parameter.eq_mode.values
|
|||||||
db_coding_approach = 0;
|
db_coding_approach = 0;
|
||||||
|
|
||||||
db_precode = db_coding_approach || db_channel_approach;
|
db_precode = db_coding_approach || db_channel_approach;
|
||||||
|
|
||||||
case 3
|
case 3
|
||||||
ffe_only = 0;
|
ffe_only = 0;
|
||||||
postfilter_approach = 0;
|
postfilter_approach = 0;
|
||||||
@@ -122,8 +108,9 @@ for eq_mode = wh.parameter.eq_mode.values
|
|||||||
|
|
||||||
%%%%% Construct AWG and Scope Modules %%%%%%
|
%%%%% Construct AWG and Scope Modules %%%%%%
|
||||||
SCP = ScopeKeysight("model","DSAZ634A",'autoscale',1,"fadc",'GSa_160',"channel",[1,0],"recordLen",2000000,"removeDC",1);
|
SCP = ScopeKeysight("model","DSAZ634A",'autoscale',1,"fadc",'GSa_160',"channel",[1,0],"recordLen",2000000,"removeDC",1);
|
||||||
AWG = AwgKeysight("model","M8196A","fdac",fdac,"scaletodac",[1,1,1,1],"skews",[0,0,0,0],"voltages",[0,0,0,awg_vpp]);
|
%AWG = AwgKeysight("model","M8196A","fdac",fdac,"scaletodac",[1,1,1,1],"skews",[0,0,0,0],"voltages",[0,0,0,awg_vpp]);
|
||||||
A2S = Awg2Scope(AWG,SCP,[0,0,0,1]);
|
AWG = AwgKeysight("model","M8199B","fdac",fdac,"scaletodac",[1,1],"skews",[0,0],"voltages",[0,awg_vpp]);
|
||||||
|
A2S = Awg2Scope(AWG,SCP,[0,1,0,0]);
|
||||||
|
|
||||||
%%%%% Symbol Generation %%%%%%
|
%%%%% Symbol Generation %%%%%%
|
||||||
Pform = Pulseformer("fsym",fsym,"fdac",4*fsym,"pulse","rrc","pulselength",16,"rrcalpha",rrcalpha);
|
Pform = Pulseformer("fsym",fsym,"fdac",4*fsym,"pulse","rrc","pulselength",16,"rrcalpha",rrcalpha);
|
||||||
@@ -146,6 +133,8 @@ for eq_mode = wh.parameter.eq_mode.values
|
|||||||
%%%%% Resample to DAC rate %%%%%%
|
%%%%% Resample to DAC rate %%%%%%
|
||||||
Digi_sig = Digi_sig.resample("fs_out",AWG.fdac);
|
Digi_sig = Digi_sig.resample("fs_out",AWG.fdac);
|
||||||
|
|
||||||
|
Digi_sig = Filter('filtdegree',5,"f_cutoff",1.1*(fsym/log2(M)),"fs",Digi_sig.fs,"filterType",filtertypes.gaussian).process(Digi_sig);
|
||||||
|
|
||||||
|
|
||||||
%%%%% Plot and Save Routine 1 %%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%% Plot and Save Routine 1 %%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
Digi_sig.spectrum("displayname","Normal Tx","fignum",10);
|
Digi_sig.spectrum("displayname","Normal Tx","fignum",10);
|
||||||
@@ -157,7 +146,7 @@ for eq_mode = wh.parameter.eq_mode.values
|
|||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
%%%%% AWG --> Scope %%%%%%
|
%%%%% AWG --> Scope %%%%%%
|
||||||
[~,~,~,Scpe_sig] = A2S.process("signal4",Digi_sig);
|
[~,Scpe_sig,~,~] = A2S.process("signal2",Digi_sig);
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
Scpe_sig.spectrum("displayname","Scope PSD","fignum",20);
|
Scpe_sig.spectrum("displayname","Scope PSD","fignum",20);
|
||||||
@@ -203,8 +192,34 @@ for eq_mode = wh.parameter.eq_mode.values
|
|||||||
|
|
||||||
%%%%% EQUALIZE %%%%%%
|
%%%%% EQUALIZE %%%%%%
|
||||||
Eq = FFE("epochs_tr",5,"epochs_dd",5,"len_tr",4096*2,"mu_dd",1e-4,"mu_tr",0,"order",50,"sps",2,"decide",0);
|
Eq = FFE("epochs_tr",5,"epochs_dd",5,"len_tr",4096*2,"mu_dd",1e-4,"mu_tr",0,"order",50,"sps",2,"decide",0);
|
||||||
Eq = VNLE("epochs_tr",5,"epochs_dd",5,"len_tr",4096*2,"mu_dd",[0.0004 0.0005 0.0006],"mu_tr",0,"order",[50,7,7],"sps",2,"decide",1);
|
% Eq = VNLE("epochs_tr",5,"epochs_dd",5,"len_tr",4096*2,"mu_dd",[0.0004 0.0005 0.0006],"mu_tr",0,"order",[50,7,7],"sps",2,"decide",1);
|
||||||
Eq = EQ("Ne",[50,7,7],"Nb",[0,0,0],"training_length",4096*2,"training_loops",5,"dd_loops",5,"K",2,"DCmu",0.0,"DDmu",[0.0004 0.0004 0.0004 0.0004 ],"DFEmu",0.005,"FFEmu",0,"plotfinal",0,"ideal_dfe",1);
|
Eq = EQ("Ne",[50,7,7],"Nb",[0,0,0],"training_length",4096*2,"training_loops",5,"dd_loops",5,"K",2,"DCmu",0.0,"DDmu",[0.0004 0.0004 0.0004 0.0004 ],"DFEmu",0.005,"FFEmu",0,"plotfinal",0,"ideal_dfe",1);
|
||||||
|
Eq = EQ("Ne",[50,0,0],"Nb",[0,0,0],"training_length",4096*2,"training_loops",5,"dd_loops",5,"K",2,"DCmu",0.0,"DDmu",[0.0004 0.0004 0.0004 0.0004 ],"DFEmu",0.005,"FFEmu",0,"plotfinal",0,"ideal_dfe",1);
|
||||||
|
|
||||||
|
|
||||||
|
S = Scpe_sig.signal;
|
||||||
|
% recursion
|
||||||
|
N1 = 201;
|
||||||
|
% Initialize the moving sum for the first window
|
||||||
|
half_window = (N1 - 1) / 2;
|
||||||
|
moving_sum = sum(S(1:N1));
|
||||||
|
|
||||||
|
% Calculate the first element of R1
|
||||||
|
cic_filtrd(1:half_window+1) = S(1:half_window+1) - (moving_sum / N1);
|
||||||
|
|
||||||
|
% Loop over the signal and apply the recursive moving average subtraction
|
||||||
|
for n = (half_window+2):(length(S)-half_window)
|
||||||
|
% Update the moving sum by subtracting the oldest value and adding the new one
|
||||||
|
moving_sum = moving_sum - S(n-half_window-1) + S(n+half_window);
|
||||||
|
|
||||||
|
% Calculate the new value of R1
|
||||||
|
cic_filtrd(n) = S(n) - (moving_sum / N1);
|
||||||
|
end
|
||||||
|
cic_filtrd(n+1:length(S)) = S(n+1:length(S)) - (moving_sum / N1);
|
||||||
|
|
||||||
|
Scpe_sig_ = Scpe_sig;
|
||||||
|
Scpe_sig_.signal = cic_filtrd';
|
||||||
|
|
||||||
|
|
||||||
if ffe_only %%%%%%%%%%%%%%%%%%%%%%%%%%%
|
if ffe_only %%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
@@ -212,7 +227,6 @@ for eq_mode = wh.parameter.eq_mode.values
|
|||||||
|
|
||||||
EQ_sig.plot("fignum",50,"displayname",'After EQ');
|
EQ_sig.plot("fignum",50,"displayname",'After EQ');
|
||||||
|
|
||||||
|
|
||||||
Rx_bits = PAMmapper(M,0).demap(EQ_sig);
|
Rx_bits = PAMmapper(M,0).demap(EQ_sig);
|
||||||
[~,errors_bm,ber,errors] = calc_ber(Rx_bits.signal,Bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
[~,errors_bm,ber,errors] = calc_ber(Rx_bits.signal,Bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
||||||
|
|
||||||
@@ -231,46 +245,62 @@ for eq_mode = wh.parameter.eq_mode.values
|
|||||||
|
|
||||||
elseif postfilter_approach %%%%%%%%%%%%%%%%%%%%%%%%%%%
|
elseif postfilter_approach %%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
[EQ_sig] = Eq.process(Scpe_sig,Symbols);
|
[EQ_sig, Noi] = Eq.process(Scpe_sig_,Symbols);
|
||||||
|
|
||||||
EQ_sig.plot("fignum",50,"displayname",'After EQ','clear',1);
|
% EQ_sig.plot("displayname",'After VNLE','fignum',90,'clear',1);
|
||||||
|
|
||||||
Noi = EQ_sig-Symbols;
|
% Quantization is too far from orig. symbols ->
|
||||||
|
% error psd is quite different
|
||||||
|
% Sym_ = PAMmapper(M,0).quantize(EQ_sig);
|
||||||
|
% Noi_ = Sym_-EQ_sig;
|
||||||
|
% Noi_.normalize('mode','rms').spectrum('displayname','Noise PSD','fignum',1234,'normalizeTo0dB',1,'normalizeToNyquist',1,'color',cols(nc+1,:));
|
||||||
|
|
||||||
Rx_bits = PAMmapper(M,0).demap(EQ_sig);
|
Rx_bits = PAMmapper(M,0).demap(EQ_sig);
|
||||||
[~,errors_bm,ber_ffe_only,errors] = calc_ber(Rx_bits.signal,Bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
[~,~,ber_vnle,~] = calc_ber(Rx_bits.signal,Bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
||||||
|
|
||||||
|
EQ_sig.normalize('mode','rms').spectrum('displayname','EQ Out','fignum',1234,'normalizeTo0dB',1,'normalizeToNyquist',1,'color',cols(nc,:));
|
||||||
|
|
||||||
|
Noi.normalize('mode','rms').spectrum('displayname','Noise PSD optimal','fignum',1234,'normalizeTo0dB',1,'normalizeToNyquist',1,'color',cols(nc+1,:));
|
||||||
|
|
||||||
|
for nc = 1:3
|
||||||
|
|
||||||
nc = 2;
|
|
||||||
burg_coeff = arburg(Noi.signal,nc);
|
burg_coeff = arburg(Noi.signal,nc);
|
||||||
|
|
||||||
EQ_sig = EQ_sig.filter(burg_coeff,1);
|
EQ_sig_filt = EQ_sig.filter(burg_coeff,1);
|
||||||
|
|
||||||
if 1
|
% EQ_sig.spectrum("displayname","Signal Spectrum after Postfilter","fignum",1234);
|
||||||
Noi.spectrum('displayname','Noise PSD','fignum',123)
|
|
||||||
[h,w] = freqz(1,burg_coeff,length(Noi),"whole",Noi.fs);
|
EQ_sig_mlse = MLSE("DIR",burg_coeff,"duobinary_output",0,"M",M,"trellis_states",PAMmapper(M,0).levels).process(EQ_sig_filt);
|
||||||
h = h/max(abs(h));
|
|
||||||
hold on
|
% EQ_sig.spectrum("displayname","Signal Spectrum after MLSE","fignum",1234);
|
||||||
w_ = (w - Noi.fs/2);
|
|
||||||
plot(w_.*1e-9,20*log10(fftshift(h)),'DisplayName',['', num2str(nc), ' coefficients for burg alg.']);
|
|
||||||
end
|
|
||||||
|
|
||||||
if 0
|
if 0
|
||||||
figure(53);
|
cols = linspecer(12);
|
||||||
constellation = unique(Symbols.signal);
|
|
||||||
received = NaN(numel(constellation),length(Symbols));
|
EQ_sig_filt.normalize('mode','rms').spectrum('displayname','Noise PSD','fignum',1234,'normalizeTo0dB',1,'normalizeToNyquist',1,'color',cols(nc+2,:));
|
||||||
for lvl = 1:numel(constellation)
|
|
||||||
received(lvl,Symbols.signal==constellation(lvl)) = EQ_sig.signal(Symbols.signal==constellation(lvl));
|
% [h,w] = freqz(1,burg_coeff,length(Noi),"whole",Noi.fs);
|
||||||
|
% h = h/max(abs(h));
|
||||||
|
% hold on
|
||||||
|
% w_ = (w - Noi.fs/2);
|
||||||
|
% figure(123)
|
||||||
|
% plot(w_.*1e-9,20*log10(fftshift(h)),'DisplayName',['', num2str(nc), ' coefficients for burg alg.']);
|
||||||
|
|
||||||
|
[h,w] = freqz(1,burg_coeff,length(Noi),"whole");
|
||||||
|
h = h/max(abs(h));
|
||||||
hold on
|
hold on
|
||||||
histogram(received(lvl,:),1000,"EdgeAlpha",0);
|
w_ = (w - pi);
|
||||||
end
|
plot(w_,20*log10(fftshift(h)),'DisplayName',['', num2str(nc), ' coefficients for burg alg.']);
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
EQ_sig = MLSE("DIR",burg_coeff,"duobinary_output",0,"M",M,"trellis_states",PAMmapper(M,0).levels).process(EQ_sig);
|
Rx_bits = PAMmapper(M,0).demap(EQ_sig_mlse);
|
||||||
|
[~,errors_bm,ber(nc),errors] = calc_ber(Rx_bits.signal,Bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
||||||
|
% disp(['BER: ',sprintf('%.1E',ber_mlse(i,j)),' - - ROP: ',num2str(patten(i)),'dBm - - PAM-',num2str(M),' - - ',num2str(fsym*1e-9),' GBd']);
|
||||||
|
|
||||||
Rx_bits = PAMmapper(M,0).demap(EQ_sig);
|
end
|
||||||
[~,errors_bm,ber,errors] = calc_ber(Rx_bits.signal,Bits.signal,"skip_front",100,"skip_end",150,"returnErrorLocation",1);
|
|
||||||
|
|
||||||
disp(['FFE: ',sprintf('%.1E',ber_ffe_only),' -> PF -> MLSE: ',sprintf('%.1E',ber),' dB | PD_in: ',num2str(pd_in),' dBm']);
|
disp(['FFE: ',sprintf('%.1E',ber_vnle),' -> PF -> MLSE: ',sprintf('%.1E',ber(nc)),' dB | PD_in: ',num2str(pd_in),' dBm']);
|
||||||
|
|
||||||
elseif db_channel_approach %%%%%%%%%%%%%%%%%%%%%%%%%%%
|
elseif db_channel_approach %%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
@@ -301,8 +331,8 @@ for eq_mode = wh.parameter.eq_mode.values
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
|
wh.addValueToStorage(ber_vnle,'vnle',v_bias,awg_vpp,eq_mode,i_atten);
|
||||||
wh.addValueToStorage(ber,'ber',v_bias,awg_vpp,eq_mode,i_atten);
|
wh.addValueToStorage(ber,'ber',v_bias,awg_vpp,eq_mode,i_atten);
|
||||||
wh.addValueToStorage(pd_in,'pd_in',v_bias,awg_vpp,eq_mode,i_atten);
|
wh.addValueToStorage(pd_in,'pd_in',v_bias,awg_vpp,eq_mode,i_atten);
|
||||||
wh.addValueToStorage(Rx_bits,'signals',v_bias,awg_vpp,eq_mode,i_atten);
|
wh.addValueToStorage(Rx_bits,'signals',v_bias,awg_vpp,eq_mode,i_atten);
|
||||||
@@ -337,18 +367,12 @@ awg_vpp = wh.parameter.awg_vpp.values(1);
|
|||||||
eq_mode = wh.parameter.eq_mode.values(1);
|
eq_mode = wh.parameter.eq_mode.values(1);
|
||||||
|
|
||||||
bers = wh.getStoValue('ber',v_bias,awg_vpp,eq_mode,i_atten_vals);
|
bers = wh.getStoValue('ber',v_bias,awg_vpp,eq_mode,i_atten_vals);
|
||||||
|
sirs = wh.getStoValue('sir',v_bias,awg_vpp,eq_mode,i_atten_vals);
|
||||||
figure(90);
|
figure(90);
|
||||||
hold on; % Retain the plot so new points can be added without complete redraw
|
hold on; % Retain the plot so new points can be added without complete redraw
|
||||||
|
|
||||||
% Plot the data and get the line handle
|
% Plot the data and get the line handle
|
||||||
hLine = plot(i_atten_vals, bers, "LineWidth", 0.5, "LineStyle", "-", "Marker", ".", "MarkerSize", 15, "DisplayName", experiment_name);
|
plot(sirs, bers, "LineWidth", 0.5, "LineStyle", "-", "Marker", ".", "MarkerSize", 15, "DisplayName", experiment_name);
|
||||||
|
|
||||||
% Customize the data tips
|
|
||||||
% Set labels for existing data tip rows
|
|
||||||
hLine.DataTipTemplate.DataTipRows(1).Label = 'Fsym';
|
|
||||||
hLine.DataTipTemplate.DataTipRows(2).Label = 'BER';
|
|
||||||
hLine.DataTipTemplate.DataTipRows(2).Format = '%.2e'; % Format BER as "3e-4"
|
|
||||||
|
|
||||||
|
|
||||||
% Continue with the rest of your plot settings
|
% Continue with the rest of your plot settings
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user