From 949022ed494ddee363f680c58566ddc7235e7971 Mon Sep 17 00:00:00 2001 From: james uber Date: Fri, 22 May 2020 11:45:52 -0400 Subject: [PATCH] API access to incontrols() for information about node/link controls participation allowing access to incontrols() for getting information about whether a node or link participates in a simple or rule-based control. --- include/epanet2_enums.h | 6 ++++-- src/epanet.c | 8 ++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/epanet2_enums.h b/include/epanet2_enums.h index 32d8171..8956d7b 100644 --- a/include/epanet2_enums.h +++ b/include/epanet2_enums.h @@ -63,7 +63,8 @@ typedef enum { EN_TANKVOLUME = 24, //!< Current computed tank volume (read only) EN_MAXVOLUME = 25, //!< Tank maximum volume (read only) EN_CANOVERFLOW = 26, //!< Tank can overflow (= 1) or not (= 0) - EN_DEMANDDEFICIT = 27 //!< Amount that full demand is reduced under PDA (read only) + EN_DEMANDDEFICIT = 27,//!< Amount that full demand is reduced under PDA (read only) + EN_NODE_INCONTROL = 28 //!< Is present in any simple or rule-based control (= 1) or not (= 0) } EN_NodeProperty; /// Link properties @@ -94,7 +95,8 @@ typedef enum { EN_PUMP_HCURVE = 19, //!< Pump head v. flow curve index EN_PUMP_ECURVE = 20, //!< Pump efficiency v. flow curve index EN_PUMP_ECOST = 21, //!< Pump average energy price - EN_PUMP_EPAT = 22 //!< Pump energy price time pattern index + EN_PUMP_EPAT = 22, //!< Pump energy price time pattern index + EN_LINK_INCONTROL = 23 //!< Is present in any simple or rule-based control (= 1) or not (= 0) } EN_LinkProperty; /// Time parameters diff --git a/src/epanet.c b/src/epanet.c index 46e7211..04d74af 100644 --- a/src/epanet.c +++ b/src/epanet.c @@ -2254,6 +2254,10 @@ int DLLEXPORT EN_getnodevalue(EN_Project p, int index, int property, double *val (hyd->NodeDemand[index] - hyd->EmitterFlow[index])) * Ucf[FLOW]; break; + case EN_NODE_INCONTROL: + v = (double)incontrols(p, NODE, index); + break; + default: return 251; } @@ -3787,6 +3791,10 @@ int DLLEXPORT EN_getlinkvalue(EN_Project p, int index, int property, double *val } break; + case EN_LINK_INCONTROL: + v = (double)incontrols(p, LINK, index); + break; + default: return 251; }