New AWG M8199A now included
ExfoLaser now uses GPIB minor stuff
This commit is contained in:
@@ -22,7 +22,7 @@ classdef AwgKeysight
|
|||||||
% AWG.upload("Signal4",Signal);
|
% AWG.upload("Signal4",Signal);
|
||||||
|
|
||||||
|
|
||||||
properties(Access=protected)
|
properties(Access=public)
|
||||||
model awg_model
|
model awg_model
|
||||||
%fdac double
|
%fdac double
|
||||||
skews double
|
skews double
|
||||||
@@ -210,7 +210,6 @@ classdef AwgKeysight
|
|||||||
try
|
try
|
||||||
obj.check_lock(char(obj.model),1);
|
obj.check_lock(char(obj.model),1);
|
||||||
obj.lock_device(char(obj.model));
|
obj.lock_device(char(obj.model));
|
||||||
|
|
||||||
catch
|
catch
|
||||||
warning('Could not reach ntserver to write lock!')
|
warning('Could not reach ntserver to write lock!')
|
||||||
end
|
end
|
||||||
@@ -221,9 +220,14 @@ classdef AwgKeysight
|
|||||||
v = visadev('TCPIP0::zizou.tf.uni-kiel.de::hislip0::INSTR');
|
v = visadev('TCPIP0::zizou.tf.uni-kiel.de::hislip0::INSTR');
|
||||||
case awg_model.M8199B
|
case awg_model.M8199B
|
||||||
v = visadev('TCPIP0::localhost::hislip0::INSTR');
|
v = visadev('TCPIP0::localhost::hislip0::INSTR');
|
||||||
|
case awg_model.M8199A_ILV
|
||||||
|
v = visadev('TCPIP0::Zizou::hislip0::INSTR');
|
||||||
|
case awg_model.M8199A_ILV
|
||||||
|
v = visadev('TCPIP0::Zizou::hislip0::INSTR');
|
||||||
end
|
end
|
||||||
|
|
||||||
debug = 0;
|
debug = 0;
|
||||||
|
|
||||||
if debug
|
if debug
|
||||||
disp(['Connected to Instrument: ',char(v.Vendor),' ',char(v.Model),' SerNo:',char(v.SerialNumber)]);
|
disp(['Connected to Instrument: ',char(v.Vendor),' ',char(v.Model),' SerNo:',char(v.SerialNumber)]);
|
||||||
end
|
end
|
||||||
@@ -233,14 +237,15 @@ classdef AwgKeysight
|
|||||||
% aw=readline(v);
|
% aw=readline(v);
|
||||||
% assert(obj.numChannels==sscanf(aw, '%f'),['Wrong Channel config. AWG response: ',num2str(sscanf(aw, '%f')), ' Channels']);
|
% assert(obj.numChannels==sscanf(aw, '%f'),['Wrong Channel config. AWG response: ',num2str(sscanf(aw, '%f')), ' Channels']);
|
||||||
|
|
||||||
switch obj.model
|
|
||||||
case awg_model.M8196A
|
if obj.model == awg_model.M8196A
|
||||||
|
|
||||||
obj.writeNcheck(v,':INST:DACM FOUR');
|
obj.writeNcheck(v,':INST:DACM FOUR');
|
||||||
obj.writeNcheck(v,':ABORt');
|
obj.writeNcheck(v,':ABORt');
|
||||||
obj.writeNcheck(v,sprintf(':FREQuency:RASTer %.15g;', obj.fdac));
|
obj.writeNcheck(v,sprintf(':FREQuency:RASTer %.15g;', obj.fdac));
|
||||||
|
|
||||||
case awg_model.M8199B
|
elseif obj.model == awg_model.M8199B || obj.model == awg_model.M8199A || obj.model == awg_model.M8199A_ILV
|
||||||
|
|
||||||
obj.writeNcheck(v,':ABORt ''M2''');
|
obj.writeNcheck(v,':ABORt ''M2''');
|
||||||
obj.writeNcheck(v,sprintf(':FREQ ''M1.ClkGen'', %.15g;', obj.fdac));
|
obj.writeNcheck(v,sprintf(':FREQ ''M1.ClkGen'', %.15g;', obj.fdac));
|
||||||
|
|
||||||
@@ -257,8 +262,7 @@ classdef AwgKeysight
|
|||||||
|
|
||||||
if segm_len > 0
|
if segm_len > 0
|
||||||
|
|
||||||
switch obj.model
|
if obj.model == awg_model.M8196A
|
||||||
case awg_model.M8196A
|
|
||||||
|
|
||||||
% 1) TRAC DEl - delete the previous waveform
|
% 1) TRAC DEl - delete the previous waveform
|
||||||
obj.writeNcheck(v,sprintf(':TRACe%d:DELete %d', chan, segm_num));
|
obj.writeNcheck(v,sprintf(':TRACe%d:DELete %d', chan, segm_num));
|
||||||
@@ -278,7 +282,7 @@ classdef AwgKeysight
|
|||||||
% 5) SET OUTPUTS ON/ OFF (generation not started at this point)
|
% 5) SET OUTPUTS ON/ OFF (generation not started at this point)
|
||||||
obj.writeNcheck(v, sprintf(':OUTPut%d ON', chan));
|
obj.writeNcheck(v, sprintf(':OUTPut%d ON', chan));
|
||||||
|
|
||||||
case awg_model.M8199B
|
elseif obj.model == awg_model.M8199B || obj.model == awg_model.M8199A || obj.model == awg_model.M8199A_ILV
|
||||||
|
|
||||||
% 1) TRAC DEl - delete the previous ch waveform
|
% 1) TRAC DEl - delete the previous ch waveform
|
||||||
obj.writeNcheck(v,sprintf(':TRAC:DEL ''M2.DataOut%d'', %d', chan, segm_num));
|
obj.writeNcheck(v,sprintf(':TRAC:DEL ''M2.DataOut%d'', %d', chan, segm_num));
|
||||||
@@ -308,8 +312,7 @@ classdef AwgKeysight
|
|||||||
|
|
||||||
else
|
else
|
||||||
% If no signal defined, turn off channel
|
% If no signal defined, turn off channel
|
||||||
switch obj.model
|
if obj.model == awg_model.M8199B || obj.model == awg_model.M8199A || obj.model == awg_model.M8199A_ILV
|
||||||
case awg_model.M8199B
|
|
||||||
obj.writeNcheck(v, sprintf(':OUTP ''M2.DataOut%d'', OFF',chan));
|
obj.writeNcheck(v, sprintf(':OUTP ''M2.DataOut%d'', OFF',chan));
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -318,12 +321,11 @@ classdef AwgKeysight
|
|||||||
end
|
end
|
||||||
|
|
||||||
% Set global output on/ off to start generation
|
% Set global output on/ off to start generation
|
||||||
switch obj.model
|
if obj.model==awg_model.M8196A
|
||||||
case awg_model.M8196A
|
|
||||||
|
|
||||||
obj.writeNcheck(v,':INIT:IMMediate');
|
obj.writeNcheck(v,':INIT:IMMediate');
|
||||||
|
|
||||||
case awg_model.M8199B
|
elseif obj.model == awg_model.M8199B || obj.model == awg_model.M8199A || obj.model == awg_model.M8199A_ILV
|
||||||
|
|
||||||
% SET Ref clock out (which is conn. to scope) to 10 MHz
|
% SET Ref clock out (which is conn. to scope) to 10 MHz
|
||||||
obj.writeNcheck(v, ':OUTPut:FREQuency ''M1.RefClkOut'',10000000');
|
obj.writeNcheck(v, ':OUTPut:FREQuency ''M1.RefClkOut'',10000000');
|
||||||
@@ -331,7 +333,7 @@ classdef AwgKeysight
|
|||||||
% :OUTP:GLOB 'M1.System', OFF
|
% :OUTP:GLOB 'M1.System', OFF
|
||||||
obj.writeNcheck(v, ':OUTP:GLOB ''M1.System'', ON');
|
obj.writeNcheck(v, ':OUTP:GLOB ''M1.System'', ON');
|
||||||
obj.writeNcheck(v, ':OUTP:GLOB ''M2.System'', ON');
|
obj.writeNcheck(v, ':OUTP:GLOB ''M2.System'', ON');
|
||||||
obj.writeNcheck(v,':INIT:IMMediate ''M2''');
|
%obj.writeNcheck(v,':INIT:IMMediate ''M2''');
|
||||||
end
|
end
|
||||||
|
|
||||||
% operation ceomplete (opc)
|
% operation ceomplete (opc)
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ classdef DC_supply < handle
|
|||||||
active
|
active
|
||||||
voltage
|
voltage
|
||||||
|
|
||||||
|
|
||||||
meas_voltage
|
meas_voltage
|
||||||
meas_current
|
meas_current
|
||||||
end
|
end
|
||||||
@@ -18,7 +17,6 @@ classdef DC_supply < handle
|
|||||||
|
|
||||||
function obj = DC_supply(options)
|
function obj = DC_supply(options)
|
||||||
|
|
||||||
|
|
||||||
arguments
|
arguments
|
||||||
options.active logical = true
|
options.active logical = true
|
||||||
options.voltage double = [0,0];
|
options.voltage double = [0,0];
|
||||||
@@ -35,10 +33,14 @@ classdef DC_supply < handle
|
|||||||
assert(size(obj.voltage,1)==1,'Set Voltage for CH1 and CH2 must be given as vector [V1, V2]');
|
assert(size(obj.voltage,1)==1,'Set Voltage for CH1 and CH2 must be given as vector [V1, V2]');
|
||||||
assert(size(obj.voltage,2)==2,'Set Voltage for CH1 and CH2 must be given as vector [V1, V2]');
|
assert(size(obj.voltage,2)==2,'Set Voltage for CH1 and CH2 must be given as vector [V1, V2]');
|
||||||
|
|
||||||
|
v = obj.connectDevice();
|
||||||
|
|
||||||
|
disp(['Connected to: ', char(v.Vendor),' ', char(v.Model),' :-)']);
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function v = connectDevice(obj)
|
function v = connectDevice(obj)
|
||||||
v = visadev("GPIB1::19::INSTR");
|
v = visadev("GPIB0::19::INSTR");
|
||||||
end
|
end
|
||||||
|
|
||||||
function success = set(obj,options)
|
function success = set(obj,options)
|
||||||
@@ -51,15 +53,7 @@ classdef DC_supply < handle
|
|||||||
|
|
||||||
success = [0,0];
|
success = [0,0];
|
||||||
|
|
||||||
% %connect to device
|
v = obj.connectDevice();
|
||||||
% if exist('v','var')
|
|
||||||
% %v = visadev("GPIB1::19::INSTR");
|
|
||||||
% v = obj.connectDevice();
|
|
||||||
% else
|
|
||||||
%
|
|
||||||
% end
|
|
||||||
|
|
||||||
v = visadev("GPIB1::19::INSTR");
|
|
||||||
|
|
||||||
debug = 0;
|
debug = 0;
|
||||||
if debug
|
if debug
|
||||||
@@ -139,9 +133,9 @@ classdef DC_supply < handle
|
|||||||
|
|
||||||
function [voltage,current] = readVals(obj)
|
function [voltage,current] = readVals(obj)
|
||||||
|
|
||||||
try
|
|
||||||
%connect to device
|
%connect to device
|
||||||
v = visadev("GPIB1::19::INSTR");
|
v = obj.connectDevice;
|
||||||
|
|
||||||
debug = 0;
|
debug = 0;
|
||||||
if debug
|
if debug
|
||||||
@@ -181,9 +175,6 @@ classdef DC_supply < handle
|
|||||||
%disconnect
|
%disconnect
|
||||||
delete(v);
|
delete(v);
|
||||||
|
|
||||||
catch
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
classdef Exfo_laser < handle
|
classdef Exfo_laser < handle
|
||||||
|
|
||||||
properties(Access=private)
|
properties(Access=private)
|
||||||
serialport_number
|
connection_id
|
||||||
|
lab_interface
|
||||||
mainframe_channel
|
mainframe_channel
|
||||||
end
|
end
|
||||||
properties(Access=public)
|
properties(Access=public)
|
||||||
@@ -15,10 +16,10 @@ classdef Exfo_laser < handle
|
|||||||
|
|
||||||
function obj = Exfo_laser(options)
|
function obj = Exfo_laser(options)
|
||||||
|
|
||||||
|
|
||||||
arguments
|
arguments
|
||||||
options.safety_mode = 1;
|
options.safety_mode = 1;
|
||||||
options.serialport_number = 'COM8';
|
options.lab_interface lab_interface = lab_interface.gbib;
|
||||||
|
options.connection_id = '8';
|
||||||
options.mainframe_channel = 1;
|
options.mainframe_channel = 1;
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -30,29 +31,19 @@ classdef Exfo_laser < handle
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
v = obj.connectLaser_();
|
||||||
% Connect to the laser
|
|
||||||
o = serialport(obj.serialport_number, 9600);
|
|
||||||
configureTerminator(o, "CR", "CR"); % Set the terminator to carriage return (CR)
|
|
||||||
flush(o);
|
|
||||||
writeline(o, "*IDN?");
|
|
||||||
answ = readline(o);
|
|
||||||
|
|
||||||
if obj.safety_mode
|
|
||||||
disp(['Yay! We can talk to Instrument: ',char(answ)]);
|
|
||||||
end
|
|
||||||
|
|
||||||
% Read states the first time
|
% Read states the first time
|
||||||
obj.cur_state = obj.getLaserStatus_(o,obj.mainframe_channel);
|
obj.cur_state = obj.getLaserStatus_(v,obj.mainframe_channel);
|
||||||
obj.cur_wavelength = obj.getLaserWavelength_(o,obj.mainframe_channel);
|
obj.cur_wavelength = obj.getLaserWavelength_(v,obj.mainframe_channel);
|
||||||
obj.cur_power = obj.getLaserPower_(o,obj.mainframe_channel);
|
obj.cur_power = obj.getLaserPower_(v,obj.mainframe_channel);
|
||||||
|
|
||||||
clear o;
|
clear v;
|
||||||
|
|
||||||
if obj.safety_mode
|
if obj.safety_mode
|
||||||
warning("Safety_mode ON: Display all information. Ask when switching laser. Turn safety_mode off in class instance or during initialization Exfo_laser(...,'safety_mode',0)");
|
warning("Safety_mode ON: Display all information. Ask when switching laser. Turn safety_mode off in class instance or during initialization Exfo_laser(...,'safety_mode',0)");
|
||||||
else
|
else
|
||||||
warning("safety_mode OFF: EVERYTHING IS EXECUTED WITHOUT ASKING :-) BE SURE WHAT YOU DO");
|
disp("safety_mode OFF: EVERYTHING IS EXECUTED WITHOUT ASKING :-) BE SURE WHAT YOU DO");
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -171,20 +162,34 @@ classdef Exfo_laser < handle
|
|||||||
% Abort the operation
|
% Abort the operation
|
||||||
disp('Operation aborted. Laser remains at wavelength.');
|
disp('Operation aborted. Laser remains at wavelength.');
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end %public mehtods
|
end %public mehtods
|
||||||
methods (Access=private)
|
methods (Access=private)
|
||||||
|
|
||||||
function serialobj = connectLaser_(obj)
|
function v = connectLaser_(obj)
|
||||||
% Connect to the laser
|
% Connect to the laser
|
||||||
serialobj = serialport(obj.serialport_number, 9600);
|
|
||||||
configureTerminator(serialobj, "CR", "CR"); % Set the terminator to carriage return (CR)
|
if obj.lab_interface == lab_interface.serial
|
||||||
flush(serialobj);
|
% Connect to the laser via SERIAL (USB)
|
||||||
writeline(serialobj, "*IDN?");
|
v = serialport(obj.connection_id, 9600);
|
||||||
answ = readline(serialobj);
|
configureTerminator(v, "CR", "CR"); % Set the terminator to carriage return (CR)
|
||||||
|
elseif obj.lab_interface == lab_interface.gpib
|
||||||
|
% Connect via GPIB adress
|
||||||
|
visastring = ['GPIB0::',obj.connection_id,'::INSTR'];
|
||||||
|
v = visadev(visastring);
|
||||||
|
else
|
||||||
|
error('Interface not supported');
|
||||||
|
end
|
||||||
|
|
||||||
if obj.safety_mode
|
if obj.safety_mode
|
||||||
|
flush(v);
|
||||||
|
writeline(v, "*IDN?");
|
||||||
|
answ = readline(v);
|
||||||
disp(['Yay! We can talk to Instrument: ',char(answ)]);
|
disp(['Yay! We can talk to Instrument: ',char(answ)]);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -194,11 +199,15 @@ classdef Exfo_laser < handle
|
|||||||
|
|
||||||
writeline(serialObj, ['CH', num2str(channel), ':ENABLE?']); % Query current wavelength
|
writeline(serialObj, ['CH', num2str(channel), ':ENABLE?']); % Query current wavelength
|
||||||
|
|
||||||
|
if serialObj.Type == visalib.InterfaceType.serial
|
||||||
manual_flush = 1;
|
manual_flush = 1;
|
||||||
while manual_flush
|
while manual_flush
|
||||||
response = readline(serialObj);
|
response = readline(serialObj);
|
||||||
manual_flush = contains(response, {'OK'});
|
manual_flush = contains(response, {'OK'});
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
response = readline(serialObj);
|
||||||
|
end
|
||||||
|
|
||||||
isEnabled = 0;
|
isEnabled = 0;
|
||||||
isEnabled = contains(response, {'ENABLED'});
|
isEnabled = contains(response, {'ENABLED'});
|
||||||
@@ -211,7 +220,7 @@ classdef Exfo_laser < handle
|
|||||||
elseif ~isEnabled && isDisabled
|
elseif ~isEnabled && isDisabled
|
||||||
obj.cur_state = isEnabled;
|
obj.cur_state = isEnabled;
|
||||||
else
|
else
|
||||||
error(['Unknown Laser State ->', char(response)]);
|
error(['Quantum Laser State; your laser is ON and OFF ->', char(response)]);
|
||||||
end
|
end
|
||||||
|
|
||||||
if obj.safety_mode
|
if obj.safety_mode
|
||||||
@@ -269,8 +278,11 @@ classdef Exfo_laser < handle
|
|||||||
isEnabled = obj.getLaserStatus_(serialObj,obj.mainframe_channel);
|
isEnabled = obj.getLaserStatus_(serialObj,obj.mainframe_channel);
|
||||||
|
|
||||||
writeline(serialObj, ['CH',num2str(channel),':ENABLE']);
|
writeline(serialObj, ['CH',num2str(channel),':ENABLE']);
|
||||||
|
|
||||||
|
if serialObj.Type == visalib.InterfaceType.serial
|
||||||
response = readline(serialObj);
|
response = readline(serialObj);
|
||||||
isok = contains(response, {'OK'});
|
isok = contains(response, {'OK'});
|
||||||
|
end
|
||||||
|
|
||||||
cnt=0;
|
cnt=0;
|
||||||
while ~isEnabled || cnt>10
|
while ~isEnabled || cnt>10
|
||||||
@@ -292,25 +304,30 @@ classdef Exfo_laser < handle
|
|||||||
isEnabled = obj.getLaserStatus_(serialObj,obj.mainframe_channel);
|
isEnabled = obj.getLaserStatus_(serialObj,obj.mainframe_channel);
|
||||||
|
|
||||||
writeline(serialObj, ['CH',num2str(channel),':DISABLE']);
|
writeline(serialObj, ['CH',num2str(channel),':DISABLE']);
|
||||||
|
|
||||||
|
if serialObj.Type == visalib.InterfaceType.serial
|
||||||
response = readline(serialObj);
|
response = readline(serialObj);
|
||||||
isok = contains(response, {'OK'});
|
isok = contains(response, {'OK'});
|
||||||
|
end
|
||||||
|
|
||||||
cnt=0;
|
cnt=0;
|
||||||
while isEnabled || cnt>10
|
while isEnabled || cnt>10
|
||||||
isEnabled = obj.getLaserStatus_(serialObj,obj.mainframe_channel);
|
isEnabled = obj.getLaserStatus_(serialObj,obj.mainframe_channel);
|
||||||
pause(0.2);
|
pause(0.5);
|
||||||
cnt = cnt+1;
|
cnt = cnt+1;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if serialObj.Type == visalib.InterfaceType.serial
|
||||||
if isEnabled
|
if isEnabled
|
||||||
error('Laser not enabled but command was send')
|
error('Laser not enabled but command was send')
|
||||||
else
|
else
|
||||||
success = 1;
|
success = 1;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
% Function to SET the wavelength of the laser
|
% Function to SET the wavelength of the laser
|
||||||
function success = setLaserWavelength_(~,serialObj, channel, desiredWavelength_nm)
|
function success = setLaserWavelength_(obj,serialObj, channel, desiredWavelength_nm)
|
||||||
success = 0;
|
success = 0;
|
||||||
|
|
||||||
writeline(serialObj, ['CH',num2str(channel),':NM?']);
|
writeline(serialObj, ['CH',num2str(channel),':NM?']);
|
||||||
@@ -325,15 +342,18 @@ classdef Exfo_laser < handle
|
|||||||
command = ['CH', num2str(channel), ':L=', num2str(desiredWavelength_nm)];
|
command = ['CH', num2str(channel), ':L=', num2str(desiredWavelength_nm)];
|
||||||
writeline(serialObj, command);
|
writeline(serialObj, command);
|
||||||
|
|
||||||
|
if serialObj.Type == visalib.InterfaceType.serial
|
||||||
pause(0.2);
|
pause(0.2);
|
||||||
|
|
||||||
response = readline(serialObj);
|
response = readline(serialObj);
|
||||||
success = contains(response, 'OK');
|
success = contains(response, 'OK');
|
||||||
|
end
|
||||||
|
|
||||||
|
success = desiredWavelength_nm == obj.getLaserWavelength_(serialObj, channel);
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
% Function to SET the laser power
|
% Function to SET the laser power
|
||||||
function success = setLaserPower_(~,serialObj, channel, desiredPower_dBm)
|
function success = setLaserPower_(obj,serialObj, channel, desiredPower_dBm)
|
||||||
success = 0;
|
success = 0;
|
||||||
|
|
||||||
writeline(serialObj, ['CH',num2str(channel),':MW?']);
|
writeline(serialObj, ['CH',num2str(channel),':MW?']);
|
||||||
@@ -348,11 +368,13 @@ classdef Exfo_laser < handle
|
|||||||
command = ['CH', num2str(channel), ':P=', num2str(desiredPower_dBm)];
|
command = ['CH', num2str(channel), ':P=', num2str(desiredPower_dBm)];
|
||||||
writeline(serialObj, command);
|
writeline(serialObj, command);
|
||||||
|
|
||||||
|
if serialObj.Type == visalib.InterfaceType.serial
|
||||||
pause(0.2);
|
pause(0.2);
|
||||||
|
|
||||||
response = readline(serialObj);
|
response = readline(serialObj);
|
||||||
success = contains(response, 'OK');
|
success = contains(response, 'OK');
|
||||||
|
end
|
||||||
|
|
||||||
|
success = desiredPower_dBm == obj.getLaserPower_(serialObj, channel);
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -53,11 +53,8 @@ classdef OptAtten < handle
|
|||||||
|
|
||||||
try
|
try
|
||||||
%connect to device
|
%connect to device
|
||||||
|
|
||||||
|
|
||||||
v = visadev('TCPIP::134.245.243.248::INSTR');
|
v = visadev('TCPIP::134.245.243.248::INSTR');
|
||||||
|
|
||||||
|
|
||||||
debug = 0;
|
debug = 0;
|
||||||
if debug
|
if debug
|
||||||
disp(['Connected to Instrument: ',char(v.Vendor),' ',char(v.Model),' SerNo:',char(v.SerialNumber)]);
|
disp(['Connected to Instrument: ',char(v.Vendor),' ',char(v.Model),' SerNo:',char(v.SerialNumber)]);
|
||||||
@@ -279,6 +276,10 @@ classdef OptAtten < handle
|
|||||||
cnt = cnt+1;
|
cnt = cnt+1;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
fprintf("\n SET: CH1 %.2f dB | CH2: %.2f dB | CH3: %.2f dB | CH4: %.2f dB\n",obj.value_state(1), obj.value_state(2), obj.value_state(3), obj.value_state(4));
|
||||||
|
fprintf(" ATT: CH1 %.2f dB | CH2: %.2f dB | CH3: %.2f dB | CH4: %.2f dB\n",obj.atten_state(1), obj.atten_state(2), obj.atten_state(3), obj.atten_state(4));
|
||||||
|
fprintf(" POW: CH1 %.2f dBm | CH2: %.2f dBm | CH3: %.2f dBm | CH4: %.2f dBm \n \n",obj.power_state(1), obj.power_state(2), obj.power_state(3), obj.power_state(4));
|
||||||
|
|
||||||
delete(v);
|
delete(v);
|
||||||
|
|
||||||
catch error
|
catch error
|
||||||
@@ -292,7 +293,12 @@ classdef OptAtten < handle
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function [p1,p2,p3,p4]=readPower(obj)
|
function [p1,p2,p3,p4]=readPower(obj, options)
|
||||||
|
|
||||||
|
arguments
|
||||||
|
obj
|
||||||
|
options.silent = 0
|
||||||
|
end
|
||||||
|
|
||||||
v = visadev('TCPIP::134.245.243.248::INSTR');
|
v = visadev('TCPIP::134.245.243.248::INSTR');
|
||||||
cnt = 1;
|
cnt = 1;
|
||||||
@@ -309,6 +315,9 @@ classdef OptAtten < handle
|
|||||||
p3 = obj.power_state(3);
|
p3 = obj.power_state(3);
|
||||||
p4 = obj.power_state(4);
|
p4 = obj.power_state(4);
|
||||||
|
|
||||||
|
if options.silent == 0
|
||||||
|
fprintf("\n CH1: %.2f dB | CH2: %.2f dB | CH3: %.2f dB | CH4: %.2f dB\n \n",p1, p2, p3, p4);
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -43,13 +43,6 @@ classdef ScopeKeysight
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
switch obj.model
|
|
||||||
case scope_model.DSAZ634A
|
|
||||||
|
|
||||||
case scope_model.UXR1102A
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -68,7 +61,7 @@ classdef ScopeKeysight
|
|||||||
if isempty(obj.IPaddress)
|
if isempty(obj.IPaddress)
|
||||||
switch obj.model
|
switch obj.model
|
||||||
case scope_model.DSAZ634A
|
case scope_model.DSAZ634A
|
||||||
v=visadev('TCPIP0::keysight.tf.uni-kiel.de::inst0::INSTR');% TCPIP0::127.0.0.1::inst0::INSTR
|
v=visadev('TCPIP0::134.245.243.195::inst0::INSTR');% TCPIP0::127.0.0.1::inst0::INSTR
|
||||||
case scope_model.UXR1102A
|
case scope_model.UXR1102A
|
||||||
v=visadev('TCPIP0::testscope.tf.uni-kiel.de::inst0::INSTR');% TCPIP0::127.0.0.1::inst0::INSTR
|
v=visadev('TCPIP0::testscope.tf.uni-kiel.de::inst0::INSTR');% TCPIP0::127.0.0.1::inst0::INSTR
|
||||||
case scope_model.UXR1104B
|
case scope_model.UXR1104B
|
||||||
|
|||||||
9
Datatypes/lab_interface.m
Normal file
9
Datatypes/lab_interface.m
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
classdef lab_interface < int32
|
||||||
|
|
||||||
|
enumeration
|
||||||
|
gpib (1)
|
||||||
|
serial (2)
|
||||||
|
lan (3)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
44
projects/Lab_base_system/test_device_control.m
Normal file
44
projects/Lab_base_system/test_device_control.m
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
|
||||||
|
%% DC Source
|
||||||
|
desired_voltage = 2.1;
|
||||||
|
dcs = DC_supply("active",[1,0],"voltage",[desired_voltage, 0]);
|
||||||
|
dcs.set("voltage",[desired_voltage, 0]);
|
||||||
|
[v,i]=dcs.readVals();
|
||||||
|
|
||||||
|
%% Laser
|
||||||
|
laser = Exfo_laser("mainframe_channel",1,"safety_mode",0,"connection_id",'10','lab_interface','gpib');
|
||||||
|
laser.setWavelength(1311);
|
||||||
|
laser.setPower(0);
|
||||||
|
laser.enableLaser();
|
||||||
|
|
||||||
|
%% Optical Attenuator
|
||||||
|
voa = OptAtten("active",[2,0,0,0],"value",[-5,0,0,0],"wavelength",[1310,1310,1310,1310]);
|
||||||
|
voa.set('value',[-5,0,0,0]);
|
||||||
|
voa.readvals();
|
||||||
|
|
||||||
|
%% Construct AWG and Scope Modules %%%%%%
|
||||||
|
fdac = 256e9;
|
||||||
|
fadc = 160e9;
|
||||||
|
Scp = ScopeKeysight("model","DSAZ634A",'autoscale',1,"fadc","GSa_160","channel",[0,0,1,0],"recordLen",4000000,"removeDC",1,"extRef",0);
|
||||||
|
Awg = AwgKeysight("model","M8199A_ILV","fdac",fdac,"scaletodac",[1,1],"skews",[0,0],"voltages",[0,0.1]);
|
||||||
|
A2S = Awg2Scope(Awg,Scp,[0,3,0,0],"waitUntilClick",0); %
|
||||||
|
|
||||||
|
%%%%% Symbol Generation %%%%%%
|
||||||
|
fsym = 56e9;
|
||||||
|
M = 4;
|
||||||
|
rcalpha = 0.05;
|
||||||
|
Pform = Pulseformer("fsym",fsym,"fdac",4*fsym,"pulse","rrc","pulselength",16,"rrcalpha",rcalpha);
|
||||||
|
|
||||||
|
Pamsource = PAMsource(...
|
||||||
|
"fsym",fsym,"M",M,"order",17,"useprbs",0,...
|
||||||
|
"fs_out",fdac,...
|
||||||
|
"applyclipping",0,"clipfactor",1.5,...
|
||||||
|
"applypulseform",0,"pulseformer",Pform,...
|
||||||
|
"randkey",1,...
|
||||||
|
"db_precode",0,"db_encode",0,...
|
||||||
|
"mrds_code",0,"mrds_blocklength",512);
|
||||||
|
|
||||||
|
tx_signal = Pamsource.process();
|
||||||
|
|
||||||
|
A2S.process("signal2",tx_signal);
|
||||||
|
|
||||||
Reference in New Issue
Block a user