Using EPANET-Matlab-Toolkit
clear all; close all;
% Load paths
start_toolkit;
% Load file
d = epanet('test.inp');
% Get link node indices # from node to node
indices = d.getLinkNodesIndex;
% Return initial length of pipes
d.getLinkLength
% Fixed length of pipes
for link_ind = 1:d.LinkCount
ind_Node1 = indices(link_ind, 1);
ind_Node2 = indices(link_ind, 2);
[latlons] = d.getNodeCoordinates([ind_Node1, ind_Node2]);
X = [latlons(1, :);latlons(2, :)];
fixLength = pdist(X, 'euclidean');
d.setLinkLength(link_ind, fixLength);
end
% Rerurn link lengths
d.getLinkLength
d.saveInputFile('fixLengths.inp');
% Unload dll
d.unload;
Or via executable:
https://www.dropbox.com/s/xyulvoywdb68ffq/FixLengths.zip?dl=0
Question thread at community.wateranalytics.org
http://community.wateranalytics.org/t/finding-pipe-lengths/899