commit old stuff from lab
This commit is contained in:
@@ -8,14 +8,14 @@ end
|
||||
precomp_path = "C:\Users\sioe\Documents\MATLAB\imdd_simulation\projects\ECOC_2025\";
|
||||
precomp_fn = "precomp_1km_1mm_cable_70ghz_pd_shf_t850_2p8_bias_shot2";
|
||||
precomp_mode = 2; %0=do nothing ; 1= measure; 2=precomp active
|
||||
run_lab_automation = 1;
|
||||
run_lab_automation = 0;
|
||||
|
||||
%% Configuration
|
||||
|
||||
conf = confRequest;
|
||||
referenceFields = fieldnames(db.tables.Configurations);
|
||||
|
||||
assert(isequal(fieldnames(conf), referenceFields), 'Fieldnames do not match the reference structure!');
|
||||
% assert(isequal(fieldnames(conf), referenceFields), 'Fieldnames do not match the reference structure!');
|
||||
|
||||
%% Lab Automation
|
||||
|
||||
@@ -41,24 +41,65 @@ if run_lab_automation
|
||||
end
|
||||
voa.set('value',[0,conf.pd_in_desired,conf.signal_attenuation,conf.interference_attenuation]);
|
||||
|
||||
if voa.power_state(3) > -24 || voa.power_state(1)+ voa.atten_state(4) > -38
|
||||
if voa.power_state(3) > -24 || voa.power_state(1)+ voa.atten_state(4) > -37
|
||||
holdAndShowValue
|
||||
end
|
||||
|
||||
|
||||
% PDFA
|
||||
if ~exist('pdfa','var')
|
||||
pdfa = Thor_PDFA("safety_mode",0,"serialport_number",'COM15');
|
||||
end
|
||||
|
||||
% Construct AWG and Scope Modules %%%%%%
|
||||
fdac = 224e9;
|
||||
fadc = 160e9;
|
||||
Scp = ScopeKeysight("model","DSAZ634A",'autoscale',0,"fadc","GSa_160","channel",[0,0,1,0],"recordLen",recordlen,"removeDC",1,"extRef",1);
|
||||
Awg = AwgKeysight("model","M8199A_ILV","fdac",fdac,"scaletodac",[1,1],"skews",[0,0],"voltages",[0,conf.v_awg]);
|
||||
A2S = Awg2Scope(Awg,Scp,[0,0,3,0],"waitUntilClick",0);
|
||||
|
||||
end
|
||||
|
||||
% if conf.symbolrate == 72e9
|
||||
% if conf.pam_level == 2
|
||||
% conf.v_awg = 0.55;
|
||||
% conf.pulsef_alpha = 0.6;
|
||||
% elseif conf.pam_level == 4
|
||||
% conf.v_awg = 0.55;
|
||||
% conf.pulsef_alpha =0.6;
|
||||
% elseif conf.pam_level == 6
|
||||
% conf.v_awg = 0.55;
|
||||
% conf.pulsef_alpha = 0.6;
|
||||
% elseif conf.pam_level == 8
|
||||
% conf.v_awg = 0.55;
|
||||
% conf.pulsef_alpha = 0.6;
|
||||
% end
|
||||
% elseif conf.symbolrate == 96e9
|
||||
% if conf.pam_level == 2
|
||||
% conf.v_awg = 0.8;
|
||||
% conf.pulsef_alpha = 0.2;
|
||||
% elseif conf.pam_level == 4
|
||||
% conf.v_awg = 0.8;
|
||||
% conf.pulsef_alpha = 0.2;
|
||||
% elseif conf.pam_level == 6
|
||||
% conf.v_awg = 0.8;
|
||||
% conf.pulsef_alpha = 0.2;
|
||||
% elseif conf.pam_level == 8
|
||||
% conf.v_awg = 0.8;
|
||||
% conf.pulsef_alpha = 0.2;
|
||||
% end
|
||||
% elseif conf.symbolrate == 112e9
|
||||
% if conf.pam_level == 2
|
||||
% conf.v_awg = 0.85;
|
||||
% conf.pulsef_alpha = 0.2;
|
||||
% elseif conf.pam_level == 4
|
||||
% conf.v_awg = 0.85;
|
||||
% conf.pulsef_alpha = 0.2;
|
||||
% elseif conf.pam_level == 6
|
||||
% conf.v_awg = 0.85;
|
||||
% conf.pulsef_alpha = 0.2;
|
||||
% elseif conf.pam_level == 8
|
||||
% conf.v_awg = 0.85;
|
||||
% conf.pulsef_alpha = 0.2;
|
||||
% end
|
||||
% end
|
||||
|
||||
awg_upload_required = 1;
|
||||
if any(confPrev.pam_level == conf.pam_level) && any(confPrev.symbolrate == conf.symbolrate)
|
||||
awg_upload_required = 0;
|
||||
end
|
||||
|
||||
%% Signal generation and transmission
|
||||
if awg_upload_required || isempty(loop_id)
|
||||
@@ -69,6 +110,13 @@ if awg_upload_required || isempty(loop_id)
|
||||
sequence_order = min(18,sequence_order);
|
||||
end
|
||||
|
||||
% Construct AWG and Scope Modules %%%%%%
|
||||
fdac = 224e9;
|
||||
fadc = 160e9;
|
||||
Scp = ScopeKeysight("model","DSAZ634A",'autoscale',0,"fadc","GSa_160","channel",[0,0,1,0],"recordLen",recordlen,"removeDC",1,"extRef",1);
|
||||
Awg = AwgKeysight("model","M8199A_ILV","fdac",fdac,"scaletodac",[1,1],"skews",[0,0],"voltages",[0,conf.v_awg]);
|
||||
A2S = Awg2Scope(Awg,Scp,[0,0,3,0],"waitUntilClick",0);
|
||||
|
||||
Pamsource = PAMsource(...
|
||||
"fsym",conf.symbolrate,"M",conf.pam_level,"order",sequence_order,"useprbs",1,...
|
||||
"fs_out",fdac,...
|
||||
@@ -79,11 +127,11 @@ if awg_upload_required || isempty(loop_id)
|
||||
"randkey",1,...
|
||||
"duobinary_mode", conf.db_mode);
|
||||
|
||||
conf.pam_source = Pamsource;
|
||||
confPrev = conf;
|
||||
|
||||
[Digi_sig,Symbols,Bits] = Pamsource.process();
|
||||
|
||||
figure(10);clf;
|
||||
Digi_sig.spectrum("displayname",'Tx Pulse Shaped','fignum',10,'normalizeTo0dB',1);
|
||||
|
||||
|
||||
%%%%% Precompensation Routine %%%%%%
|
||||
if precomp_mode == 1 % measure channel
|
||||
@@ -94,11 +142,13 @@ if awg_upload_required || isempty(loop_id)
|
||||
Digi_sig = precomp_est.precomp(Digi_sig,'maxampdb',conf.precomp_amp,'loadPath',precomp_path,'fileName',precomp_fn);
|
||||
end
|
||||
|
||||
% Digi_sig.spectrum("displayname",'Tx Spectrum','fignum',10,'normalizeTo0dB',0);
|
||||
Digi_sig.spectrum("displayname",'Tx Pre-Emphasized','fignum',10,'normalizeTo0dB',1);
|
||||
|
||||
%%%%% Resample to DAC rate %%%%%%
|
||||
Digi_sig = Digi_sig.resample("fs_out",Awg.fdac);
|
||||
|
||||
Digi_sig.spectrum("displayname",'Tx Resampled','fignum',10,'normalizeTo0dB',1);
|
||||
|
||||
% [~,~,Scpe_sig_raw,~] = A2S.process("signal2",Digi_sig);
|
||||
|
||||
Awg.upload("signal2",Digi_sig);
|
||||
@@ -113,6 +163,8 @@ if precomp_mode == 1
|
||||
return; % End routine if precomp mode is active
|
||||
end
|
||||
|
||||
confPrev = conf;
|
||||
|
||||
%% Save static TX data (only once)
|
||||
currentTime = datetime('now', 'Format', 'yyyyMMdd_HHmmss');
|
||||
timeStr = char(currentTime);
|
||||
@@ -142,7 +194,7 @@ for recIdx = 1:n_recording
|
||||
end
|
||||
|
||||
% Plot spectrum and time domain (optional)
|
||||
% Scpe_sig_raw.spectrum("displayname", 'Rx Spectrum', 'fignum', 10, 'normalizeTo0dB', 0);
|
||||
Scpe_sig_raw.spectrum("displayname", 'Rx Spectrum', 'fignum', 10, 'normalizeTo0dB', 0);
|
||||
Scpe_sig_raw.plot("clear", 1, "displayname", 'Rx Signal', 'fignum', 11);
|
||||
|
||||
%% Save Routine
|
||||
@@ -153,7 +205,6 @@ for recIdx = 1:n_recording
|
||||
rx_raw_path = [filesep, current_folder, filesep, filename, '_rx_signal_raw'];
|
||||
save([savePath, rx_raw_path], "Scpe_sig_raw");
|
||||
|
||||
|
||||
% Check if loop_id is already created
|
||||
if isempty(loop_id)
|
||||
newLoop = db.tables.LoopControl;
|
||||
@@ -165,7 +216,6 @@ for recIdx = 1:n_recording
|
||||
fprintf('LoopControl entry created: loop_id = %d\n', loop_id);
|
||||
end
|
||||
|
||||
|
||||
%% Append to Runs Table
|
||||
newRun = db.tables.Runs;
|
||||
newRun.run_id = NaN;
|
||||
@@ -183,6 +233,8 @@ for recIdx = 1:n_recording
|
||||
%% Append to Configurations Table
|
||||
conf.configuration_id = NaN;
|
||||
conf.run_id = run_id;
|
||||
conf.bitrate = conf.symbolrate .* floor(log2(6)*10)/10;
|
||||
conf.pam_source = Pamsource;
|
||||
db.appendToTable('Configurations', conf);
|
||||
|
||||
%% Append to Measurements Table
|
||||
@@ -210,6 +262,11 @@ for recIdx = 1:n_recording
|
||||
[out, a] = submit_dsp(run_id, databasePath, database_name, savePath, ...
|
||||
"parallel", parallel_dsp, "max_occurences", max_occurences);
|
||||
end
|
||||
if awg_upload_required
|
||||
[out, a] = submit_dsp(run_id, databasePath, database_name, savePath, ...
|
||||
"parallel", 0, "max_occurences", 1);
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user