exponenta event banner

Установка выходного напряжения и измерение от источника питания Keysight ® AgE3633A DC с помощью драйвера IVI-C

В этом примере показано, как инициализировать драйвер, прочитать несколько свойств драйвера, установить выходное напряжение, включить все выходы и измерить выходное напряжение, отключить все выходы и измерить выходное напряжение с помощью Keysight Technologies E3633A источника питания постоянного тока и вывести результат в MATLAB ®.

Требования

В этом примере требуется следующее:

  • Библиотеки ввода-вывода Keysight версии 17.1 или более поздней

  • Keysight E36xx Источник питания постоянного тока IVI версии 1.2.0.0 или более поздней

Перечисление доступных драйверов IVI-C на компьютере

Здесь перечислены драйверы IVI, установленные на компьютере.

IviInfo = instrhwinfo('ivi');
IviInfo.Modules
ans = 

  Columns 1 through 6

    'Ag33220'    'Ag3352x'    'Ag34410'    'Ag34970'    'Ag532xx'    'AgAC6800'

  Columns 7 through 11

    'AgE36xx'    'AgInfiniiVision'    'AgMD1'    'AgRfSigGen'    'AgXSAn'

  Columns 12 through 13

    'KtRFPowerMeter'    'rsspecan'

Создание драйвера прибора MATLAB и подключение к прибору

% Create the MATLAB instrument driver
makemid('AgE36xx','AgE3633A.mdd')

% Use icdevice with the MATLAB instrument driver name and instrument's
% resource name to create a device object. In this example the instrument
% is connected by GPIB at board index 0 and primary address 1.
myInstrument = icdevice('AgE3633A.mdd', 'GPIB0::01::INSTR','optionstring','simulate=true');

% Connect driver instance
connect(myInstrument);

Определение атрибутов и переменных

% These values are defined in the driver's header file 'AgE36xx.h'
IVI_ATTR_BASE = 1000000;
IVI_CLASS_ATTR_BASE = IVI_ATTR_BASE + 250000;
AGE36XX_ATTR_VOLTAGE_LEVEL = IVI_CLASS_ATTR_BASE + 1;
AGE36XX_VAL_MEASURE_VOLTAGE = 1;

Получить общие свойства устройства

Запрос информации о водителе и приборе

DriverIdentification = get(myInstrument,'Inherentiviattributesdriveridentification');
InstrumentIdentification = get(myInstrument,'Inherentiviattributesinstrumentidentification');
Utility = get(myInstrument, 'Utility');
Revision = invoke(Utility, 'revisionquery');
Vendor = get(DriverIdentification, 'Specific_Driver_Vendor');
Description = get(DriverIdentification, 'Specific_Driver_Description');
InstrumentModel = get(InstrumentIdentification, 'Instrument_Model');
FirmwareRev = get(InstrumentIdentification, 'Instrument_Firmware_Revision');

% Print the queried driver properties
fprintf('Revision:        %s\n', Revision);
fprintf('Vendor:          %s\n', Vendor);
fprintf('Description:     %s\n', Description);
fprintf('InstrumentModel: %s\n', InstrumentModel);
fprintf('FirmwareRev:     %s\n', FirmwareRev);
fprintf(' \n');
Revision:        1.2.1.0 
Vendor:          Agilent Technologies
Description:     IVI driver for the Agilent E36xx family of programmable power supplies [Compiled for 64-bit.]
InstrumentModel: E3633A
FirmwareRev:     Sim1.2.1.0
 

Установить выходное напряжение

Configuration = get(myInstrument, 'Configuration');
invoke(Configuration, 'configurevoltagelevel', 'Output1', 1.23);
fprintf('Output 1 set to: 1.23 Volts \n');
Output 1 set to: 1.23 Volts 

Включить все выходы и измерить выходное напряжение

Outputs = get(myInstrument, 'Outputs');
set(Outputs, 'Enabled', true);
fprintf('All outputs enabled \n');

% The measured voltage should read as the set value.
Action = get(myInstrument, 'Action');
MeasVal = invoke(Action, 'measure', 'Output1', AGE36XX_VAL_MEASURE_VOLTAGE);
fprintf('Output 1 Measurement = %.4g Volts\n', MeasVal);
All outputs enabled 
Output 1 Measurement = 1.23 Volts

Отключение всех выходов и измерение выходного напряжения

set(Outputs, 'Enabled', false);
fprintf('All outputs disabled\n');

% Since all outputs have been disabled, the measured voltage should be 0.
MeasVal = invoke(Action, 'measure', 'Output1', AGE36XX_VAL_MEASURE_VOLTAGE);
fprintf('Output 1 Measurement = %.4g Volts\n\n', MeasVal);
All outputs disabled
Output 1 Measurement = 0 Volts

Отображение ошибок драйвера

% If there are any errors, query the driver to retrieve and display them.
ErrorNum = 1;
while (ErrorNum ~= 0)
    [ErrorNum, ErrorMsg] = invoke(Utility, 'errorquery');
    fprintf('ErrorQuery: %d, %s\n', ErrorNum, ErrorMsg);
end
ErrorQuery: 0, No error. 

Отключить объект устройства и очистить

disconnect(myInstrument);
% Remove instrument objects from memory.
delete(myInstrument);

Дополнительная информация:

В этом примере показана установка выходного напряжения и измерение источника питания постоянного тока с помощью драйвера IVI. Как только измеренное напряжение извлекается из прибора, MATLAB может использоваться для визуализации и выполнения анализа данных с использованием богатой библиотеки функций в Toolbox™ Toolbox™ обработки сигналов и систем связи. С помощью Toolbox™ управления приборами можно автоматизировать управление приборами и создать тестовые системы, использующие MATLAB для выполнения анализа, который может оказаться невозможным с использованием встроенных возможностей аппаратных средств.