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.

function bprobjmanualvalve(BPRObj)
% BPROBJMANUALVALVE turns the BPR to manual valve regulation
% bprobjmanualvalve(BPRObj) changes valve regulation to manual

% e.g. bprobjclosevalve(BPRObj(5)) changes the Jasco BPR valve regulation
% to manual (attached to COM5)

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

% gets the current valve status
valveStatus = bprobjreadvalvestatus(BPRObj);

% try-catched for robustness
    %chooses action depending on the current status
    switch valveStatus
        case {0, 1}
            % its open or closed, so it'll won't work, must turn it to auto
            % first...
            bprobjcomm(BPRObj, '#0x24 2')

            % only now can we change it to manual
            bprobjcomm(BPRObj, '#23 1')

        case 2
            % its auto-regulated, only need to send it once
            bprobjcomm(BPRObj, '#23 1')

        case 3
            % its manually regulated so we don't need to do anything

    % get the new valve status
    newValveStatus = bprobjreadvalvestatus(BPRObj);

    % it errored
    error('Unknown valve error - could not close the BPR valve.  Current valve status: %d', newValveStatus)

Contact us