% OBJECT DEFINITION FILE FORMAT
%
% One row of 12 numbers for each object.  The first object
% is always a "tracer injection" object which cannot be
% deleted.  The object number is the row number.  The
% columns represent:
%
%  1) object type
%     1=tracer,2=well-mixed,3=plug-flow,4=mixing-tee,5=sink
%  2) first object-type dependent attribute (see below)
%  3) second object-type dependent attribute (see below)
%  4) outlet 1 destination object number (0=unused)
%  5) outlet 1 flowrate (Megalitres per day)
%  6) and 7) ditto for outlet 2
%  8) and 9) ditto for outlet 3
%  10) and 11) ditto for outlet 4
%  12) plot scaling factor (0=not plotted)
%
% The two object-type dependent attributes are defined as
% follows:
%
%   Type  Attribute 1           Attribute 2
%   ----  --------------------  -----------------------
%    1    injection type        tracer amount
%           0=impulse             (height)
%           1=pulse
%           2=step         
%    2    volume                (not used)
%           (Megalitres)
%    3    volume                dispersion factor
%           (Megalitres)          (see below)
%    4    (not used)            (not used)
%    5    (not used)            (not used)
%
% The dispersion factor controls the number of well-mixed
% compartments used to simulate the plug-flow vessel.  The
% dispersion factor can take a value between zero (50
% compartments) and one (10 compartments) and a linear
% interpolation is used to determine the number of compartments
% for intermediate values.
%
% The file is ASCII format with a ".rtd" extension
% automatically added to the user specified name.

%--------------- above is help info --------------------
%
% RTD Simulator - Read Object Definition File
%
% Bob Newell, January 1996
%
function [objects, fname] = rtdread
objects = [];
fname = 'new';
%
% get a file name
%
newname = input( ['Filename [' fname ...
                  '] in single quotes > '] );
if length(newname) > 0,
  fname = newname;
end;
%
% now to see if the file is there
%
fid = fopen( [fname '.rtd'] );
if fid >= 0,
  fclose( fid );
%
% now the action
%
  eval( ['load ' fname '.rtd'] );
  eval( ['objects = ' fname ';'] );
  [nobjects, n] = size( objects );
  if n == 12,
    disp( ['Read ' num2str(nobjects) ' objects'] );
  else
    objects = [];
  end;
end;
%
return;
