Skip to content
3 changes: 3 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ test_script:
on_success:
- cd %TEST_HOME%\benchmark
- appveyor PushArtifact receipt.json
- cd %EPANET_HOME%
- cd %BUILD_HOME%\bin\Release
- appveyor PushArtifact epanet2.dll

on_failure:
- cd %TEST_HOME%\benchmark
Expand Down
1 change: 1 addition & 0 deletions include/epanet2_2.h
Original file line number Diff line number Diff line change
Expand Up @@ -1953,6 +1953,7 @@ typedef struct Project *EN_Project;
*/
int DLLEXPORT EN_setruleenabled(EN_Project ph, int index, int enabled);


#if defined(__cplusplus)
}
#endif
Expand Down
3 changes: 2 additions & 1 deletion include/epanet2_enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ typedef enum {
EN_MASSBALANCE = 4, //!< Cumulative water quality mass balance ratio
EN_DEFICIENTNODES = 5, //!< Number of pressure deficient nodes
EN_DEMANDREDUCTION = 6, //!< % demand reduction at pressure deficient nodes
EN_LEAKAGELOSS = 7 //!< % flow lost to system leakage
EN_LEAKAGELOSS = 7, //!< % flow lost to system leakage
EN_ERRORNODE = 8 //!< Index of node causing ill-conditioned error
} EN_AnalysisStatistic;

/// Types of network objects
Expand Down
5 changes: 5 additions & 0 deletions src/epanet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1098,6 +1098,10 @@ int DLLEXPORT EN_getstatistic(EN_Project p, int type, double *value)
case EN_MASSBALANCE:
*value = p->quality.MassBalance.ratio;
break;
case EN_ERRORNODE:
*value = p->hydraul.ErrNode;
break;

default:
*value = 0.0;
return 251;
Expand Down Expand Up @@ -5941,3 +5945,4 @@ int DLLEXPORT EN_setruleenabled(EN_Project p, int index, int enabled)
}



2 changes: 1 addition & 1 deletion src/epanet2.c
Original file line number Diff line number Diff line change
Expand Up @@ -958,4 +958,4 @@ int DLLEXPORT ENgetruleenabled(int index, int *out_enabled)
int DLLEXPORT ENsetruleenabled(int index, int enabled)
{
return EN_setruleenabled(_defaultProject, index, enabled);
}
}
4 changes: 4 additions & 0 deletions src/hydsolver.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ int hydsolve(Project *pr, int *iter, double *relerr)
hyd->DeficientNodes = 0;
hyd->DemandReduction = 0.0;

// initialize error node
hyd->ErrNode = 0;

// Repeat iterations until convergence or trial limit is exceeded.
// (ExtraIter used to increase trials in case of status cycling.)
if (rpt->Statflag == FULL) writerelerr(pr, 0, 0);
Expand Down Expand Up @@ -191,6 +194,7 @@ int hydsolve(Project *pr, int *iter, double *relerr)
// Iterations ended - report any errors.
if (errcode > 0)
{
hyd->ErrNode = sm->Order[errcode]; // Store node causing ill-conditioned error
writehyderr(pr, sm->Order[errcode]); // Ill-conditioned matrix error
errcode = 110;
}
Expand Down
3 changes: 2 additions & 1 deletion src/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,8 @@ typedef struct {
OpenHflag, // Hydraulic system opened flag
Haltflag, // Flag to halt simulation
DeficientNodes, // Number of pressure deficient nodes
HasLeakage; // TRUE if project has non-zero leakage parameters
HasLeakage, // TRUE if project has non-zero leakage parameters
ErrNode; // Node causing ill-conditioned network error

Sleakage *Leakage; // Array of node leakage parameters

Expand Down
2 changes: 1 addition & 1 deletion tests/test_report.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ BOOST_FIXTURE_TEST_CASE(test_rprt_anlysstats, FixtureOpenClose)
BOOST_CHECK(check_cdd_double(test, ref, 3));

double temp;
error = EN_getstatistic(ph, 8, &temp);
error = EN_getstatistic(ph, 9, &temp);
BOOST_CHECK(error == 251);
}

Expand Down