Code covered by the BSD License  

Highlights from
CO2gui - lab control and automation

CO2gui - lab control and automation

by

 

06 Jan 2010 (Updated )

Software used for controlling and data logging lab equipment.

gilsonpumpobjreadcompressibility(gilsonPumpObj)
function compressibility = gilsonpumpobjreadcompressibility(gilsonPumpObj)
% GILSONPUMPOBJREADCOMPRESSIBILITY reads compressibility from Gilson 30x's
% gilsonpumpobjreadcompressibility(gilsonPumpObj) reads the compressibility
% from Gilson 30x pumps, where gilsonPumpObj is a valid serial object
% generated by gilsonPumpObj. compressibility is returned as an integer
% from 0 to 2000 (Mbar^-1).

% checks the number of arguments
error(nargchk(1, 1, nargin))

% deviceID
deviceID = 1;

% checks that a manometric module is installed first
if strcmp(gilsonpumpobjreadmanometricmodule(gilsonPumpObj), 'None')
    % errors
    error('Cannot read compressibility if manometric module not installed.')
end

% the official way would be (if it worked...), where compressFraction is
% one ten thousandth of the stroke volume - from 0 to 10000
% compressFraction = str2double(gilsonpumpobjcomm('write', gilsonPumpObj, deviceID, 'z'));

% no easy way of reading compressibility, so need to navigate into the
% correct menu
gilsonpumpobjmainmenu(gilsonPumpObj)

% goes to the compressibility screen
gilsonpumpobjcomm('write', gilsonPumpObj, deviceID, 'Kaaa');

% sets the top line out to be read first
gilsonpumpobjcomm('write', gilsonPumpObj, deviceID, 'W0');

% reads out the top line
topLine = gilsonpumpobjcomm('read', gilsonPumpObj, deviceID, 'W');

% removes the 'W0=' prefix
topLine = topLine(4:end);

% pulls out the numeric part
compressibility = str2double(topLine(isstrprop(topLine, 'digit')));

% goes back to the flow menu
gilsonpumpobjcomm('write', gilsonPumpObj, deviceID, 'Ke');

% reconnects the keypad
gilsonpumpobjcomm('write', gilsonPumpObj, deviceID, 'K');

Contact us