Problem when running EPANET 2.2 built on Ubuntu

Hi all,

I installed Epanet 2.2 in my computer (Windows 10) using the .exe available at https://www.epa.gov/water-research/epanet and also in a Ubuntu server using the source code from the same website and the following Makefile

# Makefile for EPANET2

objs = epanet.o epanet2.o input1.o input2.o input3.o rules.o output.o report.o \
       inpfile.o hydraul.o smatrix.o quality.o mempool.o hash.o \
       genmmd.o hydcoeffs.o hydsolver.o hydstatus.o main.o project.o qualreact.o \
       qualroute.o

hdrs = hash.h text.h types.h funcs.h

epanet22 : $(objs)
          gcc -o epanet22 $(objs) -lm

epanet.o  : $(hdrs) enumstxt.h epanet2_2.h epanet2_enums.h
epanet2.o : $(hdrs) epanet2.h epanet2_2.h epanet2_enums.h
input1.o  : $(hdrs)
input2.o  : $(hdrs)
input3.o  : $(hdrs)
rules.o   : $(hdrs)
output.o  : $(hdrs)
report.o  : $(hdrs)
inpfile.o : $(hdrs)
hydraul.o : $(hdrs)
smatrix.o : $(hdrs)
quality.o : $(hdrs) mempool.h
mempool.o : mempool.h
hash.o    : hash.h
genmmd.o  : $(hdrs)
hydcoeffs.o : $(hdrs)
hydsolver.c : $(hdrs)
hydstatus.o : $(hdrs)
main.o : $(hdrs) epanet2.h
project.o : $(hdrs)
qualreact.o : $(hdrs)
qualroute.o : $(hdrs) mempool.h

clean :
        rm $(objs)

I tested both versions for small networks and the results were the same. However, when I tried a larger network (~30k junctions and ~50k pipes) with pumps, valves (PRV) and emitters, I found that nodal pressures were different in some cases, and more importantly I noticed there was an error in the report generated in linux

This seems very strange to me. I understand that, depending on the compiler, little variations on the results may appear, but the errors in junctions J50129 and J50230 don’t make sense to me.

Do you have any idea of what it could be? Do I have to change any option from the source code that is intended for Windows and not for Linux? Unfortunately I can’t run all my scenarios in Windows (10k scenarios) so I need to fix this problem in Ubuntu.

Thanks in advance

The fact that on Windows EPANET is 32-bit while on Ubuntu it will be 64-bit may somehow be contributing to the differences in results that you get. Try building EPANET on Ubuntu as a 32-bit app (do a search for “how to compile a 32-bit binary on a 64-bit linux machine with gcc” for info on how to do this).

Hi Seba,
we’re getting similar issues with simulations that report ‘‘simulation unbalanced’ and we’re working with 64-bit libs, but it’s on mac and windows.

I’ll post again once I have a better idea what is going wrong, though, for us, it only seems to occur when the simulation is unbalanced and generating massive pressures.

Best,
Gareth.

I noticed that increasing the length of the strings for the values in the table report I get the same results that in the GUI in Windows. To change the length you have to edit functions writenodetable and writelinktable in file report.c

For example, in writenodetable:

int i, j;
- char s[MAXLINE + 1], s1[16];
+ char s[MAXLINE + 1], s1[20+1];
double y[MAXVAR];
...
if (fabs(y[j]) > 1.e6) sprintf(s1, "%10.2e", y[j]);
- else sprintf(s1, "%10.*f", rpt->Field[j].Precision, y[j]);
+ else sprintf(s1, "%20.*f", rpt->Field[j].Precision, y[j]);
strcat(s, s1);

Similarly in writelinktable

int i, j;
- char s[MAXLINE + 1], s1[16];
+ char s[MAXLINE + 1], s1[20+1];
double y[MAXVAR];
...
if (fabs(y[j]) > 1.e6) sprintf(s1, "%10.2e", y[j]);
- else sprintf(s1, "%10.*f", rpt->Field[j].Precision, y[j]);
+ else sprintf(s1, "%20.*f", rpt->Field[j].Precision, y[j]);
}

Hope it helps you @gazcredible