From 3be813facb21fad593fa18f517ab4ed4e10cc804 Mon Sep 17 00:00:00 2001 From: james uber Date: Thu, 23 Sep 2021 11:04:19 -0400 Subject: [PATCH] Return MISSING as initial valve setting If the initial setting is indeed MISSING, that means the status of the valve has been set to OPEN or CLOSED, and the valve is non-functional (until the setting is changed by a control). This change is required to be able to accurately see the initial setting, because the status does not distinguish between open and active valves. --- src/epanet.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/epanet.c b/src/epanet.c index 7cb2b0b..2bee08a 100644 --- a/src/epanet.c +++ b/src/epanet.c @@ -3635,8 +3635,7 @@ int DLLEXPORT EN_getlinkvalue(EN_Project p, int index, int property, double *val { return EN_getlinkvalue(p, index, EN_ROUGHNESS, value); } - if (Link[index].Kc == MISSING) v = 0.0; - else v = Link[index].Kc; + v = Link[index].Kc; switch (Link[index].Type) { case PRV: @@ -3649,6 +3648,9 @@ int DLLEXPORT EN_getlinkvalue(EN_Project p, int index, int property, double *val default: break; } + if (Link[index].Kc == MISSING) { + v = MISSING; + } break; case EN_KBULK: