1function install(f, upstream, downstream)
2% INSTALL  Install a flow device between reactors or reservoirs.
3% install(f, upstream, downstream)
4% :param f:
5%     Instance of class :mat:func:`FlowDevice` to install
6% :param upstream:
7%     Upstream :mat:func:`Reactor` or :mat:func:`Reservoir`
8% :param downstream:
9%     Downstream :mat:func:`Reactor` or :mat:func:`Reservoir`
10% :return:
11%     Instance of class :mat:func:`FlowDevice`
12%
13
14if nargin == 3
15    if ~isa(upstream, 'Reactor') || ~isa(downstream, 'Reactor')
16        error(['Flow devices can only be installed between reactors or' ...
17            ' reservoirs'])
18    end
19    i = reactor_hndl(upstream);
20    j = reactor_hndl(downstream);
21    ok = flowdevicemethods(2, f.index, i, j);
22    if ok < 0
23        error(geterr)
24    end
25else
26    error('install requires 3 arguments')
27end
28