Code covered by the BSD License  

Highlights from
CO2gui - lab control and automation

CO2gui - lab control and automation



06 Jan 2010 (Updated )

Software used for controlling and data logging lab equipment.

gilsonpumpobjwritecompressibility(gilsonPumpObj, compressibility)
function gilsonpumpobjwritecompressibility(gilsonPumpObj, compressibility)
% GILSONPUMPOBJWRITECOMPRESSIBILITY writes compressibility to Gilson 30x's
% gilsonpumpobjwritecompressibility(gilsonPumpObj, compressibility) writes
% the compressibility to Gilson 30x pumps, where gilsonPumpObj is a valid
% serial object generated by gilsonPumpObj, and compressibility is an
% integer from 0 to 2000 (Mbar^-1).

% error handling
if nargin < 2
    % errors
    error('Insufficient arguments.')
elseif ~isnumeric(compressibility) || ~isscalar(compressibility) || ~isreal(compressibility) || compressibility < 0 || compressibility > 2000
    % errors
    error('Compressibility must be an integer from 0 to 2000 (Mbar^-1).')

% deviceID
deviceID = 1;

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

% rounds the compressibility
roundCompressibility = round(compressibility);

% checks the compressibility
if compressibility ~= roundCompressibility
    % rounds the number
    compressibility = roundCompressibility;
    % display a warning
    warning('Gilson30xWriteCompressibility:ValueTooPrecise', 'Supplied compressibility was not an integer so has been rounded off.')

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

% no easy way of writing compressibility, so need to navigate into the
% correct menu

% goes to the compressibility screen, enters the new value, then navigates
% back to the flow screen
gilsonpumpobjcomm('write', gilsonPumpObj, deviceID, ['Kaaa', num2str(compressibility), 'Ee']);

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

Contact us