From 1f24209516bc82f7c0718babd5e598aaa07279b4 Mon Sep 17 00:00:00 2001 From: Lew Rossman Date: Wed, 3 Sep 2025 15:11:49 -0400 Subject: [PATCH] Fixes bug in EN_setpipedata See issue #876 . --- src/epanet.c | 6 +++--- src/types.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/epanet.c b/src/epanet.c index b2fa631..e8a31b4 100644 --- a/src/epanet.c +++ b/src/epanet.c @@ -7,7 +7,7 @@ Authors: see AUTHORS Copyright: see AUTHORS License: see LICENSE - Last Updated: 04/23/2025 + Last Updated: 09/03/2025 ****************************************************************************** */ @@ -4340,11 +4340,11 @@ int DLLEXPORT EN_setpipedata(EN_Project p, int index, double length, Link[index].Diam = diameter; Link[index].Kc = rough; if (p->hydraul.Formflag == DW) Link[index].Kc /= (1000.0 * Ucf[ELEV]); + Link[index].Km = 0.02517 * mloss / SQR(Link[index].Diam) / SQR(Link[index].Diam); - // Update minor loss factor & pipe flow resistance + // Update pipe flow resistance if (p->hydraul.OpenHflag) { - Link[index].Km = 0.02517 * mloss / SQR(Link[index].Diam) / SQR(Link[index].Diam); resistcoeff(p, index); } else Link[index].InitSetting = Link[index].Kc; diff --git a/src/types.h b/src/types.h index aaa8f88..6f65e01 100755 --- a/src/types.h +++ b/src/types.h @@ -7,7 +7,7 @@ Authors: see AUTHORS Copyright: see AUTHORS License: see LICENSE - Last Updated: 04/19/2025 + Last Updated: 09/03/2025 ****************************************************************************** */ @@ -31,7 +31,7 @@ typedef int INT4; Various constants ---------------------------------------------- */ -#define CODEVERSION 20301 +#define CODEVERSION 20302 #define MAGICNUMBER 516114521 #define ENGINE_VERSION 201 // Used for binary hydraulics file #define EOFMARK 0x1A // Use 0x04 for UNIX systems