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.

gilsonpumpobjwriteinletpress(gilsonPumpObj, inletPress)
function gilsonpumpobjwriteinletpress(gilsonPumpObj, inletPress)
% GILSONPUMPOBJWRITEINLETPRESS writes the inlet pressure of Gilson 30x pump
% gilsonpumpobjwriteinletpress(gilsonPumpObj, inletPress) writes the
% inlet pressure of Gilson 30x pumps, where gilsonPumpObj is a valid
% serial object generated by gilsonPumpObj, and inletPress is a valid
% inlet pressure.

% error handling
if nargin < 2
    % errors
    error('Insufficient arguments.')

% deviceID
deviceID = 1;

% gets the maximum possible pressure (ignores the rest of the possible
% arguments)
maxPossiblePress = gilsonpumpobjreadmaxpossiblepress(gilsonPumpObj);

% error handling of inletPress
if ~isnumeric(inletPress) || ~isscalar(inletPress) || isnan(inletPress) || ~isreal(inletPress) || inletPress < 0 || inletPress > maxPossiblePress
    % errors
    error('Inlet pressure must be an integer between 0 and %d.', maxPossiblePress)

% checks that a module is installed first
if ~strcmp(manometricModule, 'None')
    % defines the extra keystrokes necessary to navigate through the extra
    % screen (compressibility) that is present if a module is installed
    keyStrokes = 'a';
    % defines it as empty
    keyStrokes = '';

% rounds the inlet pressure
roundInletPress = round(inletPress);

% checks the inlet pressure
if inletPress ~= roundInletPress
    % rounds the number
    inletPress = roundInletPress;
    % display a warning
    warning('Gilson30xWriteInletPress:ValueTooPrecise', 'Supplied inlet pressure was not an integer so has been rounded off.')

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

% goes to the inlet pressure screen, enters the new value, then navigates
% back to the flow screen
gilsonpumpobjcomm('write', gilsonPumpObj, deviceID, ['Kaa', keyStrokes, 'aa', num2str(inletPress), 'Ee']);

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

Contact us