ecoc measurements
This commit is contained in:
101
projects/run_loop.m
Normal file
101
projects/run_loop.m
Normal file
@@ -0,0 +1,101 @@
|
||||
% loop_records.m
|
||||
|
||||
% === Prepare base configuration ===
|
||||
% databasePath = 'C:\Users\sioe\Documents\MATLAB\imdd_simulation\projects\ECOC_2025\';
|
||||
databasePath = 'Z:\2025\ECOC Silas\';
|
||||
database_name = 'ecoc2025_loops.db';
|
||||
db = DBHandler("pathToDB", [databasePath, database_name]);
|
||||
conf = db.tables.Configurations;
|
||||
confPrev = db.tables.Configurations;
|
||||
|
||||
awg_upload_required = 0;
|
||||
|
||||
% Define vector parameters directly in conf:
|
||||
conf.unique_elab_id = "20250408-842b0a3078172b48dd032795226fbe683190afc4";
|
||||
conf.symbolrate = 112e9;
|
||||
conf.bitrate = conf.symbolrate .* floor(log2(6)*10)/10;
|
||||
conf.pam_level = 4;
|
||||
conf.db_mode = db_mode.no_db;
|
||||
conf.pulsef_alpha = 0.2;
|
||||
conf.v_bias = 2.5;
|
||||
conf.v_awg = 0.95;
|
||||
conf.precomp_amp = -64; %-64
|
||||
conf.wavelength = 1310;
|
||||
conf.laser_power = 11;
|
||||
conf.fiber_length = 0;
|
||||
conf.pd_in_desired = 9;
|
||||
conf.is_mpi = 1;
|
||||
conf.signal_attenuation = 0;
|
||||
conf.interference_path_length = 1000; %m
|
||||
conf.interference_attenuation = [40,20:-1:0];
|
||||
conf.pam_source = [];
|
||||
|
||||
if conf.is_mpi
|
||||
current_folder = ['mpi_',num2str(conf.interference_path_length),'m_pam',num2str(conf.pam_level)];
|
||||
else
|
||||
current_folder = 'testing';
|
||||
end
|
||||
|
||||
% Init empty loop id
|
||||
loop_id = [];
|
||||
|
||||
% === Detect vector fields automatically ===
|
||||
paramNames = fieldnames(conf);
|
||||
vectorParams = struct();
|
||||
scalarConf = conf;
|
||||
parallel_dsp = false;
|
||||
max_occurences = 1;
|
||||
for i = 1:numel(paramNames)
|
||||
thisName = paramNames{i};
|
||||
thisValue = conf.(thisName);
|
||||
if isnumeric(thisValue) && numel(thisValue) > 1
|
||||
vectorParams.(thisName) = thisValue;
|
||||
parallel_dsp = true;
|
||||
max_occurences = 10;
|
||||
else
|
||||
scalarConf.(thisName) = thisValue;
|
||||
end
|
||||
end
|
||||
|
||||
vectorFieldNames = fieldnames(vectorParams);
|
||||
|
||||
if isempty(vectorFieldNames)
|
||||
% No vector parameters, single run
|
||||
fprintf('Running single measurement (no parameter sweep)\n');
|
||||
confRequest = scalarConf;
|
||||
confRequest.bitrate = confRequest.symbolrate * floor(log2(confRequest.pam_level) * 10) / 10;
|
||||
measure_run_script
|
||||
else
|
||||
% Vector parameters found, run parameter sweep
|
||||
vectorValues = struct2cell(vectorParams);
|
||||
nParams = numel(vectorValues);
|
||||
grid = cell(1, nParams);
|
||||
[grid{:}] = ndgrid(vectorValues{:});
|
||||
totalRuns = numel(grid{1});
|
||||
fprintf('Total runs: %d\n', totalRuns);
|
||||
|
||||
for runIdx = 1:totalRuns
|
||||
confRequest = scalarConf;
|
||||
paramDisplayCell = cell(1, nParams);
|
||||
|
||||
for vIdx = 1:nParams
|
||||
fieldName = vectorFieldNames{vIdx};
|
||||
paramValue = grid{vIdx}(runIdx);
|
||||
confRequest.(fieldName) = paramValue;
|
||||
if isnumeric(paramValue)
|
||||
paramDisplayCell{vIdx} = sprintf('%s = %.4g', fieldName, paramValue);
|
||||
else
|
||||
paramDisplayCell{vIdx} = sprintf('%s = %s', fieldName, char(paramValue));
|
||||
end
|
||||
end
|
||||
|
||||
fprintf('Running measurement: %s\n', strjoin(paramDisplayCell, ', '));
|
||||
confRequest.bitrate = confRequest.symbolrate * floor(log2(confRequest.pam_level) * 10) / 10;
|
||||
% measure_run("config",confRun,"parallel",parallel_dsp,"max_occurences",max_occurences);
|
||||
measure_run_script;
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
disp('- LOOP FINISHED - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ')
|
||||
fprintf('\n')
|
||||
Reference in New Issue
Block a user