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 bprobjclosevalve(BPRObj)
% BPROBJCLOSEVALVE closes the Jasco BPR valve
% bprobjclosevalve(BPRObj) fully closes the Jasco BPR valve

% e.g. bprobjclosevalve(BPRObj(5)) fully closes the Jasco BPR valve
% attached to COM5

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

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

% try-catch for robustness
    % chooses action depending on the current status
    switch valveStatus
        case 0
            % its open, so it'll error, must turn it to auto first...
            bprobjcomm(BPRObj, '#0x24 2')

            % only now can we close it
            bprobjcomm(BPRObj, '#0x24 1')

        case 1
            % its closed, we don't need to do anything

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

        case 3
            % its manually regulated (and we don't know what the "normal"
            % setting is set to

            % set it to auto to guaruntee (sp!) that taking it off manual works
            % properly
            bprobjcomm(BPRObj, '#0x24 2')

            % turn manual off
            bprobjcomm(BPRObj, '#23 0')

            % now close it
            bprobjcomm(BPRObj, '#0x24 1')

    % 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