VSP efficiency + retrieving efficiency directly (#81)
* VSP efficiency + retrieving efficiency directly Changes to the getenergy function (in hydraulic.c) to compute the correct efficiency of variable speed pumps according to the affinity laws. Changes to epanet2.h and epanet.c are for retrieving the efficiency of pumps throught the ENgetlinkvalue function (code 16 for efficiency) * Update epanet.c * VSP efficiency (incl. bas and vb file) - bas and vb file have been updated with code 16 for efficiency. - Retrieving efficiency case has been improved.
This commit is contained in:
committed by
Sam Hatchett
parent
8b4a03d349
commit
1d071d19ba
@@ -1458,7 +1458,11 @@ int DLLEXPORT ENgetlinkvalue(int index, int code, EN_API_FLOAT_TYPE *value)
|
||||
if (Link[index].Type == PUMP)
|
||||
v = (double)Pump[PUMPINDEX(index)].Upat;
|
||||
break;
|
||||
|
||||
|
||||
case EN_EFFICIENCY:
|
||||
getenergy(index, &a, &v);
|
||||
break;
|
||||
|
||||
default: return(251);
|
||||
}
|
||||
*value = (EN_API_FLOAT_TYPE)v;
|
||||
|
||||
@@ -998,6 +998,7 @@ void getenergy(int k, double *kw, double *eff)
|
||||
{
|
||||
int i,j;
|
||||
double dh, q, e;
|
||||
double q4eff; //q4eff=flow at nominal speed to compute efficiency
|
||||
|
||||
/*** Updated 6/24/02 ***/
|
||||
/* No energy if link is closed */
|
||||
@@ -1019,7 +1020,11 @@ void getenergy(int k, double *kw, double *eff)
|
||||
j = PUMPINDEX(k);
|
||||
e = Epump;
|
||||
if ( (i = Pump[j].Ecurve) > 0)
|
||||
e = interp(Curve[i].Npts,Curve[i].X,Curve[i].Y,q*Ucf[FLOW]);
|
||||
{
|
||||
q4eff = q/LinkSetting[k];
|
||||
e = interp(Curve[i].Npts,Curve[i].X, Curve[i].Y, q4eff*Ucf[FLOW]);
|
||||
}
|
||||
// e = interp(Curve[i].Npts,Curve[i].X,Curve[i].Y,q*Ucf[FLOW]); //old line of code
|
||||
e = MIN(e, 100.0);
|
||||
e = MAX(e, 1.0);
|
||||
e /= 100.0;
|
||||
|
||||
Reference in New Issue
Block a user