Fixes bug in EN_setpipedata

See issue #876 .
This commit is contained in:
Lew Rossman
2025-09-03 15:11:49 -04:00
parent 7ba5bb269f
commit 1f24209516
2 changed files with 5 additions and 5 deletions

View File

@@ -7,7 +7,7 @@
Authors: see AUTHORS Authors: see AUTHORS
Copyright: see AUTHORS Copyright: see AUTHORS
License: see LICENSE 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].Diam = diameter;
Link[index].Kc = rough; Link[index].Kc = rough;
if (p->hydraul.Formflag == DW) Link[index].Kc /= (1000.0 * Ucf[ELEV]); 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) if (p->hydraul.OpenHflag)
{ {
Link[index].Km = 0.02517 * mloss / SQR(Link[index].Diam) / SQR(Link[index].Diam);
resistcoeff(p, index); resistcoeff(p, index);
} }
else Link[index].InitSetting = Link[index].Kc; else Link[index].InitSetting = Link[index].Kc;

View File

@@ -7,7 +7,7 @@
Authors: see AUTHORS Authors: see AUTHORS
Copyright: see AUTHORS Copyright: see AUTHORS
License: see LICENSE License: see LICENSE
Last Updated: 04/19/2025 Last Updated: 09/03/2025
****************************************************************************** ******************************************************************************
*/ */
@@ -31,7 +31,7 @@ typedef int INT4;
Various constants Various constants
---------------------------------------------- ----------------------------------------------
*/ */
#define CODEVERSION 20301 #define CODEVERSION 20302
#define MAGICNUMBER 516114521 #define MAGICNUMBER 516114521
#define ENGINE_VERSION 201 // Used for binary hydraulics file #define ENGINE_VERSION 201 // Used for binary hydraulics file
#define EOFMARK 0x1A // Use 0x04 for UNIX systems #define EOFMARK 0x1A // Use 0x04 for UNIX systems