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.

bprobjwritevalvestatus(BPRObj, status)
function bprobjwritevalvestatus(BPRObj, status)
% BPROBJWRITEVALVESTATUS sets the valve status of Jasco BPRs
% bprobjwritevalvestatus(BPRObj, status) sets the valve status of Jasco
% back-pressure regulators, where BPRObj is a valid serial port object
% (generated by bprobj) and status is 0 (valve open), 1 (valve closed), or
% 2 (valve regulated automatically).

% e.g. bprobjwritevalvestatus(BPRObj(5), 2) - sets automatic valve control
% on the BPR on COM5.

% Range:

% BPRObj = valid serial port object

% status = 0, 1, 2 or 3


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

% error handling
if ~isnumeric(status) || ~isscalar(status) || ~ismember(status, 0:3)
    % errors
    error('Valve status must be 0 (open), 1 (closed), 2 (regulated), or 3 (manual).')
end

% decides what to do depending on the command (no try-catch because each of
% the commands below has its own error handling)
switch status
    case 0
        % opens the valve
        bprobjopenvalve(BPRObj)
        
    case 1
        % closes the valve
        bprobjclosevalve(BPRObj)
        
    case 2
        % changes it to auto mode
        bprobjstart(BPRObj)
        
    case 3
        % changes it to manuak
        bprobjmanualvalve(BPRObj)
end

Contact us