Work on lab PC
- many new automations - scripts to record and save MPI and bias optimizations...
This commit is contained in:
68
projects/Lab_2024/lab_modulator_tf_sweep.m
Normal file
68
projects/Lab_2024/lab_modulator_tf_sweep.m
Normal file
@@ -0,0 +1,68 @@
|
||||
% Initialize a structure to hold parameters
|
||||
params = struct;
|
||||
|
||||
% Define the bias voltage range from 1.2V to 2.8V with 0.01V increments
|
||||
params.v_bias = 1.2:0.01:2.8;
|
||||
|
||||
% Create a DataStorage object with the defined parameters
|
||||
wh = DataStorage(params);
|
||||
|
||||
% Add a storage field for output power measurements
|
||||
wh.addStorage("p_out");
|
||||
|
||||
% Display the total number of measurement loops to be executed
|
||||
disp(['Start Measurement of ', num2str(prod(wh.dim)), ' loops...']);
|
||||
|
||||
% Initialize the Optical Attenuator (VOA) with specified settings
|
||||
voa = OptAtten(...
|
||||
"active", [1, 0, 0, 0], ... % Activate only the first channel
|
||||
"value", [0, 0, 0, 0], ... % Set attenuation values to 0 dB
|
||||
"wavelength", [1310, 1310, 1310, 1310]); % Set the wavelength for each channel
|
||||
|
||||
% Initialize the DC Power Supply with specified settings
|
||||
dcs = DC_supply(...
|
||||
"active", [1, 1], ... % Activate the first two channels
|
||||
"voltage", [v_bias, 9]); % 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
|
||||
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 %%%%%%
|
||||
% Update the DC supply voltage for the current bias voltage
|
||||
dcs.set("voltage", [v_bias, 9]);
|
||||
|
||||
%%%%% Measure VOA %%%%%%
|
||||
% Read the current values from the VOA
|
||||
voa.readvals();
|
||||
|
||||
% Store the measured output power in the DataStorage object
|
||||
wh.addValueToStorage(voa.power_state(1), 'p_out', v_bias);
|
||||
end
|
||||
|
||||
% Retrieve all stored output power measurements up to the current point
|
||||
p_out = wh.getStoValue('p_out', wh.parameter.v_bias.values);
|
||||
|
||||
% Plot the measured output power in dBm versus the negative bias voltage
|
||||
figure(90);
|
||||
plot(-wh.parameter.v_bias.values(1:numel(p_out)), p_out, 'DisplayName', 'Measured Output Power in dBm');
|
||||
xlim([-max(params.v_bias), -min(params.v_bias)]); % Set x-axis limits
|
||||
grid on; % Enable grid for better readability
|
||||
end
|
||||
|
||||
% After completing the measurements, retrieve all output power data
|
||||
p_out = wh.getStoValue('p_out', wh.parameter.v_bias.values);
|
||||
|
||||
% Plot the output power converted from dBm to linear scale (Watts)
|
||||
figure(91);
|
||||
plot(-wh.parameter.v_bias.values(1:numel(p_out)), db2pow(p_out), 'DisplayName', 'Measured Output Power in Watts');
|
||||
xlim([-max(params.v_bias), -min(params.v_bias)]); % Set x-axis limits
|
||||
grid on; % Enable grid for better readability
|
||||
Reference in New Issue
Block a user