From 8ab0f06ccc4c28631738b43fd5dbe91ad71c1c28 Mon Sep 17 00:00:00 2001 From: Elad Salomons Date: Thu, 13 Apr 2017 12:14:32 +0300 Subject: [PATCH] Added option to retrieve the pumps price pattern Added to ENgetlinkvalue function like the speed\status pattern. use the new EN_PRICEPATTERN constant. --- include/epanet2.bas | 1 + include/epanet2.h | 3 ++- include/epanet2.vb | 1 + src/epanet.c | 5 +++++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/epanet2.bas b/include/epanet2.bas index f08728b..3b1b8d5 100644 --- a/include/epanet2.bas +++ b/include/epanet2.bas @@ -53,6 +53,7 @@ Global Const EN_ENERGY = 13 Global Const EN_LINKQUAL = 14 'ES Global Const EN_LINKPATTERN = 15 Global Const EN_EFFICIENCY = 16 +Global Const EN_PRICEPATTERN = 17 Global Const EN_DURATION = 0 ' Time parameters Global Const EN_HYDSTEP = 1 diff --git a/include/epanet2.h b/include/epanet2.h index e8c4206..b092866 100755 --- a/include/epanet2.h +++ b/include/epanet2.h @@ -111,7 +111,8 @@ typedef enum { EN_ENERGY = 13, EN_LINKQUAL = 14, EN_LINKPATTERN = 15, - EN_EFFICIENCY = 16 + EN_EFFICIENCY = 16, + EN_PRICEPATTERN = 17 } EN_LinkProperty; /// Time parameter codes diff --git a/include/epanet2.vb b/include/epanet2.vb index 0784233..69c3231 100644 --- a/include/epanet2.vb +++ b/include/epanet2.vb @@ -57,6 +57,7 @@ Public Const EN_ENERGY = 13 Public Const EN_LINKQUAL = 14 'ES Public Const EN_LINKPATTERN = 15 Public Const EN_EFFICIENCY = 16 +Public Const EN_PRICEPATTERN = 17 Public Const EN_DURATION = 0 ' Time parameters Public Const EN_HYDSTEP = 1 diff --git a/src/epanet.c b/src/epanet.c index 2e78b02..2c25429 100755 --- a/src/epanet.c +++ b/src/epanet.c @@ -1460,6 +1460,11 @@ int DLLEXPORT ENgetlinkvalue(int index, int code, EN_API_FLOAT_TYPE *value) v = (double)Pump[PUMPINDEX(index)].Upat; break; + case EN_PRICEPATTERN: + if (Link[index].Type == PUMP) + v = (double)Pump[PUMPINDEX(index)].Epat; + break; + case EN_EFFICIENCY: getenergy(index, &a, &v); break;