EPANET-Toolkit-- Add pipe from reservoir to node

Hi, I need to add new pipes from the reservoir to node. I executed the code as follow;

clear; close(‘all’); clc;
start_toolkit;

d = epanet(‘Net2-emitter1-tank-assignment-LPS.inp’);
disp(‘Add a pipe’)
d.plot;

fromReservoir = d.getNodeReservoirNameID{38};
toNode = d.getNodeNameID{14};
node_index = d.addLinkPipe(‘Pipe’,fromReservoir,toNode);

d.plot(‘links’,‘yes’);
% Unload library
d.unload

There is an error of #fromReservoir = d.getNodeReservoirNameID{38};

Thank you so much

Hi @TRJ,

The Net2 .inp Network does not have a reservoir.

maybe try with the tank:

clear; close('all'); clc;
start_toolkit;

d = epanet('Net2.inp');
disp('Add a pipe')
d.plot;

fromTank = d.getNodeTankNameID{1};
toNode = d.getNodeNameID{14};
node_index = d.addLinkPipe('Pipe',fromTank,toNode);

d.plot('links','yes');
% Unload library
d.unload 

Thanks,