Finding Pipe Lengths


#1

Hello,

I have created a pipe network but have forgotten to turn on Auto-Length for the majority of my pipes. How can I get these pipe lengths estimated without having to redraw each pipe?


#2

you do not need to draw again, use Epanet to edit the lengths and others. Or you can also edit in the text file with INP format


#3

How do I get it to estimate the pipe length if I do not know its length?


#4

Hi @mikebernal21, you can use EPANET-MATLAB Toolkit:

like this:

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;

#5

or with executable:

image


#6

Thanks everyone, but I found an easier way for those like myself who do not like/understand coding very much. I found that if I have Auto-Length on, and I move each junction from one spot back to the original spot, each connected pipe will have its length automatically estimated.