EPANET icon indicating copy to clipboard operation
EPANET copied to clipboard

Network with PSV converges to a wrong solution

Open eladsal opened this issue 2 months ago • 1 comments

The attached network with a PSV converges to a wrong solution, even if the upstream pressure can be maintained with an open valve.

psv.txt

The issue was reported by Tomer K.

eladsal avatar Dec 01 '25 17:12 eladsal

The network in question is displayed below:

Image

with each pipe having diameter of 250 mm and C-factor of 100. Each node has elevation of 180 m and only Node J4 has a demand of 100 cmh. The PSV setting is 70 m. With this layout the correct solution must have each pipe carrying a flow of 100 cmh resulting in a head of 68.2 at the PSV inlet. Thus the PSV cannot achieve a pressure of 70 m and it must have a status of OPEN. EPANET v2.2 produces this solution but v2.3 has the PSV ACTIVE with negligible flows in it upstream pipes and large negative pressures downstream of it that allow the demand at J4 to be met.

The cause of the problem is the following two lines that were added to the psvcoeff() function in hycoeffs.c to address issue #694 back in 2022:

    sm->Aij[sm->Ndx[k]] -= 1.0 / CBIG;             
    sm->Aii[j] += 1.0 / CBIG;

If instead we only apply those two lines when the PSV outlet pressure is positive we will obtain the correct solution for this network:

    if (hyd->NodeHead[n2] >= pr->network.Node[n2].El)
    {
        sm->Aij[sm->Ndx[k]] -= 1.0 / CBIG;             
        sm->Aii[j] += 1.0 / CBIG;
    }

I've created a new branch from dev named dev-PSV_Fix with this change. I would like to see it tested on more PSV networks before merging it into dev.

I've avoided going into detail in this post about why these two lines are needed or not since it would take a lot of space to explain. If anyone is interested I'll go ahead and do so.

LRossman avatar Dec 02 '25 20:12 LRossman

Yes, please do go ahead and explain. It will be appreciated.

Best regards

fredfurst avatar Jan 04 '26 00:01 fredfurst