cantera/interfaces/matlab/toolbox/@FlowDevice/FlowDevice.m
Ingmar Schoegl d263566670 [Reactor] Deprecating magic numbers.
* add deprecation warning for int ReactorBase::type() (to be changed after Cantera 2.5)
 * introduce temporary std::string ReactorBase::typeStr() (to be renamed after Cantera 2.5)
 * deprecate all functions using the old call and introduce associated temporary functions
2019-08-01 15:37:48 -04:00

41 lines
1.4 KiB
Matlab

function x = FlowDevice(typ)
% FLOWDEVICE FlowDevice class constructor.
% x = FlowDevice(typ)
% Base class for devices that allow flow between reactors.
% :mat:func:`FlowDevice` objects are assumed to be adiabatic,
% non-reactive, and have negligible internal volume, so that they are
% internally always in steady-state even if the upstream and downstream
% reactors are not. The fluid enthalpy, chemical composition, and mass
% flow rate are constant across a :mat:func:`FlowDevice`, and the
% pressure difference equals the difference in pressure between the
% upstream and downstream reactors.
%
% See also: :mat:func:`MassFlowController`, :mat:func:`Valve`
%
% :param typ:
% Type of :mat:func:`FlowDevice` to be created. ``typ='MassFlowController'``
% for :mat:func:`MassFlowController`, ``typ='PressureController'`` for
% :mat:func:`PressureController` and ``typ='Valve'`` for
% :mat:func:`Valve`
% :return:
% Instance of class :mat:func:`FlowDevice`
%
if nargin == 0
typ = 'MassFlowController';
end
if isa(typ, 'double')
warning('Definition via integer type to be deprecated after Cantera 2.5')
device_types = {'MassFlowController', 'PressureController', 'Valve'};
typ = device_types(typ);
end
x.type = char(typ);
x.index = flowdevicemethods(0, x.type);
if x.index < 0
error(geterr);
end
x.upstream = -1;
x.downstream = -1;
x = class(x, 'FlowDevice');