46 lines
2.0 KiB
Matlab
46 lines
2.0 KiB
Matlab
|
|
|
|
run_id = 231;
|
|
|
|
savePath = 'Z:\2025\ECOC Silas\ecoc_2025\';
|
|
databasePath = 'C:\Users\Silas\Documents\MATLAB\imdd_simulation\projects\ECOC_2025\';
|
|
database_name = 'ecoc2025_loops.db';
|
|
db = DBHandler("type","mysql");
|
|
% db = DBHandler("pathToDB", [databasePath, database_name],"type","sqlite");
|
|
|
|
filterParams = db.tables;
|
|
filterParams.Configurations = struct('run_id', run_id);
|
|
|
|
selectedFields = {'Runs.run_id','Runs.tx_bits_path','Runs.tx_signal_path','Runs.tx_symbols_path','Runs.rx_sync_path','Runs.rx_raw_path',...
|
|
'Configurations.db_mode','Configurations.pam_level','Configurations.bitrate','Configurations.symbolrate','Configurations.fiber_length','Configurations.wavelength','Configurations.precomp_amp','Measurements.power_rop','Configurations.v_bias',...
|
|
'Configurations.interference_attenuation'};
|
|
|
|
[dataTable,sql_query] = db.queryDB(filterParams, selectedFields);
|
|
|
|
[~, uniqueIdx] = unique(dataTable.run_id); % Get unique run_id indices
|
|
dataTable = dataTable(uniqueIdx,:); % Extract unique configurations for each run_id
|
|
|
|
fsym = dataTable.symbolrate;
|
|
M = double(dataTable.pam_level);
|
|
duob_mode = db_mode.(strrep(char(dataTable.db_mode),'"',''));
|
|
|
|
Tx_signal = load([savePath, char(dataTable.tx_signal_path)]);
|
|
Tx_signal = Tx_signal.Digi_sig;
|
|
|
|
Tx_bits = load([savePath, char(dataTable.tx_bits_path)]);
|
|
Tx_bits = Tx_bits.Bits;
|
|
Symbols_mapped = PAMmapper(M,0).map(Tx_bits);
|
|
Symbols_mapped.fs = dataTable.symbolrate;
|
|
|
|
Symbols = load([savePath, char(dataTable.tx_symbols_path)]);
|
|
Symbols = Symbols.Symbols;
|
|
|
|
Scpe_sig_raw = load([savePath, char(dataTable.rx_raw_path(1))]);
|
|
Scpe_sig_raw = Scpe_sig_raw.Scpe_sig_raw;
|
|
Scpe_sig_resampled = Scpe_sig_raw.resample("fs_in",Scpe_sig_raw.fs,"fs_out",2*fsym);
|
|
[~,Scpe_cell,found_sync,~,shifts] = Scpe_sig_resampled.tsynch("reference",Symbols,"fs_ref",dataTable.symbolrate,"debug_plots",1);
|
|
|
|
shifts_mus = shifts./Scpe_sig_resampled.fs .*1e6;
|
|
Scpe_sig_raw.plot("displayname",['Scope Signal (Run ID: ',num2str(run_id)],"fignum",2024,"clear",1);
|
|
hold on;
|
|
xline(shifts_mus,'HandleVisibility','off'); |