function [q,h] = pumpData(model)
% pumpData  Return pump curve data for Gould IRRI-GATOR pumps
%
% Synopsis:  [q,h] = pumpData(model)
%
% Input:  model = string name of the pump. In the current version of
%                 this function, the model must be one of 'GT07','GT10',
%                 'GT15' or 'GT20'
%
% Output:  q = flow rate in m^3/s
%          h = head in m

% -- Pump curves were obtained by digitizing the plot on the Goulds
%    with the digitize2 function from the Mathworks file exchange.
%
%    Variable names correspond to model numbers, ie. GT07 is one
%    of the GT IRRI-GATOR family of self-priming pumps designed for
%    irrigation applications
%    http://goulds.com/centrifugal-pumps-boosters/self-priming-end-suction/irri-gator-model-gt/?tab=literature
%
%    Each pump curve is first defined by an m-by-2 matrix.  The first column
%    is the flow rate in GPM.  The second column is the head in ft.  That
%    data is obtained directly from digitize2.  The convertToSI function
%    converts the two-column matrix to two vectors, q and h, where q
%    is in m^3/s and h is in m

switch model
  case 'GT07'
    [q,h] = GT07;
  case 'GT10'
    [q,h] = GT10;
  case 'GT15'
    [q,h] = GT15;
  case 'GT20'
    [q,h] = GT20;
  otherwise
    error('model = "%s" not allowed',model)
end

end

% -------------------------------------------------------------------------

function [q,h] = GT07
% GT07 Load pump data for GT07 model of Gould IRRI-GATOR

% -- Tabular data from digitizing curve on the data sheet
%    First column is flow rate in GPM.  Second column is head in ft
GT07 = [ 0.0,  105;
         7.96, 101;
        14.0,  96.9;
        19.2,  92.6;
        24.3,  87.2;
        29.2,  81.2;
        33.1,  76.0;
        36.3,  70.9;
        39.3,  64.8;
        43.6,  51.8 ];

[q,h] = convertToSI(GT07);

end
      
% -------------------------------------------------------------------------

function [q,h] = GT10
% GT10 Load pump data for GT10 model of Gould IRRI-GATOR

% -- Tabular data from digitizing curve on the data sheet
%    First column is flow rate in GPM.  Second column is head in ft
GT10 = [ 0.0,  119;
         5.57, 117;
        10.9,  114;
        19.0,  109;
        24.8,  103;
        32.5,   94.1;
        37.9,   85.3;
        45.5,   68.8;
        53.6,   48.2;
        60.1,   30.4 ];

[q,h] = convertToSI(GT10);

end

      
% -------------------------------------------------------------------------

function [q,h] = GT15
% GT15 Load pump data for GT10 model of Gould IRRI-GATOR

% -- Tabular data from digitizing curve on the data sheet
%    First column is flow rate in GPM.  Second column is head in ft
GT15 = [  0.0,  121;
          9.92, 119;
         20.0,  116;
         30.1,  111;
         40.1,  104;
         50.1,   93.4;
         55.8,   84.2;
         59.5,   75.5;
         62.5,   63.9 ];

[q,h] = convertToSI(GT15);

end

% -------------------------------------------------------------------------

function [q,h] = GT20
% GT10 Load pump data for GT20 model of Gould IRRI-GATOR

% -- Tabular data from digitizing curve on the data sheet
%    First column is flow rate in GPM.  Second column is head in ft
GT20 = [ 0.0, 127;
        10.1, 126;
        20.0, 125;
        30.2, 124;
        40.0, 121;
        50.0, 116;
        60.0, 105;
        70.2,  90.5;
        76.2,  80.5;
        81.1,  72.4;
        84.6,  65.1;
        86.3,  60.8 ];

[q,h] = convertToSI(GT20);

end

% -------------------------------------------------------------------------

function [q,h] = convertToSI(X)
% convertToSI  Convert pump curve data in (GPM,ft) to (m^3/s,m)
%
% Synopsis:  Y = convertToSI(X)
%
% Input:   X = two-column matrix of pump curve data in English units.
%              X(:,1) is the flow rate in GPM,  X(:,2) is head in feet
%
% Output:  q = vector of flow rates in m^3/s
%          h = vector of head values in m

q = X(:,1)/15850.32;    %  Convert GPM to m^3/s
h = X(:,2)*12*2.54e-2;  %  Convert ft to inches and then inches to m

end
