Work on lab PC
- many new automations - scripts to record and save MPI and bias optimizations...
This commit is contained in:
@@ -108,7 +108,7 @@ classdef Duobinary
|
||||
data = data - b;
|
||||
data = data ./ 2;
|
||||
|
||||
assert(isequal((0:M-1)',unique(data)),'Check Duobinary Precoding'); %seems the signal is not unipolar
|
||||
% assert(isequal((0:M-1)',unique(data)),'Check Duobinary Precoding'); %seems the signal is not unipolar
|
||||
|
||||
% duobinary coding (1+D)
|
||||
% coeff = [1,1];
|
||||
|
||||
74
Classes/05_Lab/Exfo_laser.m
Normal file
74
Classes/05_Lab/Exfo_laser.m
Normal file
@@ -0,0 +1,74 @@
|
||||
classdef Exfo_laser
|
||||
|
||||
properties(Access=public)
|
||||
wavelength
|
||||
power
|
||||
end
|
||||
|
||||
methods (Access=public)
|
||||
|
||||
function obj = Exfo_laser(options)
|
||||
|
||||
|
||||
arguments
|
||||
options.wavelength = 1310; %dbm
|
||||
options.power = -10; %dbm
|
||||
end
|
||||
|
||||
%
|
||||
fn = fieldnames(options);
|
||||
for n = 1:numel(fn)
|
||||
try
|
||||
obj.(fn{n}) = options.(fn{n});
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function success = set(obj,options)
|
||||
|
||||
|
||||
arguments
|
||||
obj
|
||||
options.wavelength = obj.wavelength; %dbm
|
||||
options.power = obj.power; %dbm
|
||||
end
|
||||
|
||||
% Connect to the laser
|
||||
o = serialport("COM8", 9600);
|
||||
configureTerminator(o, "CR"); % Set the terminator to carriage return (CR)
|
||||
writeline(o, "*IDN?");
|
||||
pause(1);
|
||||
if o.NumBytesAvailable ~= 0
|
||||
disp(['Laser Mainframe: ', readline(o)]);
|
||||
else
|
||||
error('No connection to the mainframe');
|
||||
clear o;
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
% Function to set the wavelength of the laser
|
||||
function setLaserWavelength(~,serialObj, channel, wavelength)
|
||||
command = ['CH', num2str(channel), ':L=', num2str(wavelength)];
|
||||
writeline(serialObj, command);
|
||||
pause(0.5); % Allow time for the wavelength to change
|
||||
writeline(serialObj, ['CH', num2str(channel), ':L?']); % Query current wavelength
|
||||
current_wavelen = readline(serialObj);
|
||||
disp(['Current Wavelength: ', current_wavelen]);
|
||||
end
|
||||
|
||||
% Function to set the laser power
|
||||
function setLaserPower(~,serialObj, channel, power_dBm)
|
||||
command = ['CH', num2str(channel), ':P=', num2str(power_dBm)];
|
||||
writeline(serialObj, command);
|
||||
pause(0.2); % Allow time for power to adjust
|
||||
writeline(serialObj, ['CH', num2str(channel), ':P?']); % Query current power
|
||||
current_power = readline(serialObj);
|
||||
disp(['Current Power: ', current_power, ' dBm']);
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -128,7 +128,21 @@ classdef DataStorage < handle
|
||||
try
|
||||
tmp = obj.sto.(storageVarName){lin_idx(i)};
|
||||
if ~isempty(tmp)
|
||||
value(i,:) = tmp ;
|
||||
if isa(tmp,'Signal')
|
||||
if i == 1
|
||||
value = {};
|
||||
end
|
||||
value{i} = tmp ;
|
||||
elseif isa(tmp,'cell')
|
||||
if isa(tmp{1},'Signal')
|
||||
if i == 1
|
||||
value = {};
|
||||
end
|
||||
value{i} = tmp{1} ;
|
||||
end
|
||||
else
|
||||
value(i,:) = tmp ;
|
||||
end
|
||||
else
|
||||
errcnt = errcnt+1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user