OpenWaterAnalytics / EPANET

The Water Distribution System Hydraulic and Water Quality Analysis Toolkit
MIT License
281 stars 205 forks source link

Head loss error and flow change criteria are not checked #661

Closed allenmlowe closed 2 years ago

allenmlowe commented 2 years ago

Function hasconverged in hydrosolver does not usually process headloss error and flow change because the default value for HeadErrorLimit and FlowChangeLimit is 0.0.

// Check that head loss error and flow change criteria are met
if (hyd->HeadErrorLimit > 0.0 &&
    hbal->maxheaderror > hyd->HeadErrorLimit) return 0;
if (hyd->FlowChangeLimit > 0.0 &&
    hbal->maxflowchange > hyd->FlowChangeLimit) return 0;

Solution is to change default to 0.01 or remove the check for > 0.0

allenmlowe commented 2 years ago

Using the latest code, at 4:00 AM, P-1 has only a flow of 0.03 L/s because the iteration stopped iterating despite more than 8753m max head error. This only happens when P-1 has a constant power entered, not with pump curves.

HeadError HeadError.inp.txt