77 Authors: see AUTHORS
88 Copyright: see AUTHORS
99 License: see LICENSE
10- Last Updated: 01/28 /2026
10+ Last Updated: 02/17 /2026
1111 ******************************************************************************
1212*/
1313
@@ -1470,7 +1470,7 @@ int DLLEXPORT EN_setflowunits(EN_Project p, int units)
14701470{
14711471 Network * net = & p -> network ;
14721472
1473- int i , j , oldUnitFlag ;
1473+ int i , j ;
14741474 double qfactor , vfactor , hfactor , efactor , pfactor , dfactor , xfactor , yfactor ;
14751475 double dcf , pcf , hcf , qcf ;
14761476 double * Ucf = p -> Ucf ;
@@ -1485,7 +1485,6 @@ int DLLEXPORT EN_setflowunits(EN_Project p, int units)
14851485 pfactor = Ucf [PRESSURE ];
14861486 dfactor = Ucf [DEMAND ];
14871487
1488- oldUnitFlag = p -> parser .Unitsflag ;
14891488 p -> parser .Flowflag = units ;
14901489 switch (units )
14911490 {
@@ -1501,23 +1500,17 @@ int DLLEXPORT EN_setflowunits(EN_Project p, int units)
15011500 p -> parser .Unitsflag = US ;
15021501 break ;
15031502 }
1504-
1505- // Revise pressure units depending on flow units
1506- if (oldUnitFlag != p -> parser .Unitsflag )
1507- {
1508- if (p -> parser .Unitsflag == US ) p -> parser .Pressflag = PSI ;
1509- else p -> parser .Pressflag = METERS ;
1510- }
15111503 initunits (p );
15121504
1513- // Update pressure units in rules
1505+ // Update units in rules
15141506 dcf = Ucf [DEMAND ] / dfactor ;
15151507 pcf = Ucf [PRESSURE ] / pfactor ;
15161508 hcf = Ucf [HEAD ] / hfactor ;
15171509 qcf = Ucf [FLOW ] / qfactor ;
15181510 updateruleunits (p , dcf , pcf , hcf , qcf );
15191511
1520- //update curves
1512+ //update curves after making sure that all curve types are correctly set
1513+ assigncurvetypes (net );
15211514 for (i = 1 ; i <= net -> Ncurves ; i ++ )
15221515 {
15231516 switch (net -> Curve [i ].Type )
0 commit comments