Fixes #172 (adjust controls when node/link is deleted) & EN_addrule added

- Deleting controls with node/link deletion made conditional.
- New EN_addrule function added along with a test file.
- Rule structures re-named & rules.c heavily modified.
- Issue with exceeding limit on number of temporary file names fixed.
- VB declaration and DEF files updated.
This commit is contained in:
Lew Rossman
2018-11-07 23:09:47 -05:00
parent ee335ab077
commit 7443cea9d4
25 changed files with 2197 additions and 1800 deletions

View File

@@ -129,11 +129,12 @@ Both network files are available [here](https://doi.org/10.23719/1375314).
## New API functions
|Function|Description|
|--|--|
|`ENgetcurvetype`| |
|`ENinit`||
|`ENsetflowunits`||
|`ENgetdemandmodel`||
|`ENsetdemandmodel`||
|`ENsetflowunits`||
|`ENaddcontrol`||
|`ENgetdemandname`||
|`ENsetdemandname`||
|`ENsetdemandpattern`||
|`ENgetrule`||
|`ENsetrulepriority`||
@@ -142,23 +143,25 @@ Both network files are available [here](https://doi.org/10.23719/1375314).
|`ENsetpremiseindex`||
|`ENsetpremisestatus`||
|`ENsetpremisevalue`||
|`ENgettrueaction`||
|`ENsettrueaction`||
|`ENgetfalseaction`||
|`ENsetfalseaction`||
|`ENgetthenaction`||
|`ENsetthenaction`||
|`ENgetelseaction`||
|`ENsetelseaction`||
|`ENgetruleID`||
|`ENinit`||
|`ENsetheadcurveindex`||
|`ENgetcurvetype`||
|`ENsetlinknodes`||
|`ENsetlinktype`||
|`ENaddnode`||
|`ENaddlink`||
|`ENdeletelink`||
|`ENaddpattern`||
|`ENaddcontrol`||
|`ENaddrule` ||
|`ENdeletenode`||
| `ENsetnodeid` ||
| `ENsetlinkid` ||
|`ENgetdemandname`||
|`ENsetdemandname`||
|`ENdeletelink`||
|`ENdeletecontrol`||
|`ENdeleterule` ||
|`ENsetnodeid` ||
|`ENsetlinkid` ||
## API Extensions (additional definitions)
### Link value types:
@@ -180,6 +183,8 @@ Both network files are available [here](https://doi.org/10.23719/1375314).
- `EN_FLOWCHANGE`
- `EN_DEMANDDEFPAT`
- `EN_MASSBALANCE`
- `EN_UNCONDITIONAL`
- `EN_CONDITIONAL`
### Curve types:
- `EN_V_CURVE`
- `EN_P_CURVE`

View File

@@ -173,6 +173,9 @@ Public Const EN_E_CURVE = 2 ' efficiency curve
Public Const EN_H_CURVE = 3 ' head loss curve
Public Const EN_G_CURVE = 4 ' General\default curve
Public Const EN_UNCONDITIONAL = 0 ' Unconditional object deletion
Public Const EN_CONDITIONAL = 1 ' Conditional object deletion
'These are the external functions that comprise the DLL
'System Functions
@@ -211,6 +214,7 @@ Public Const EN_G_CURVE = 4 ' General\default curve
Declare Function ENsetstatusreport Lib "epanet2.dll" (ByVal code As Long) As Long
Declare Function ENgetcount Lib "epanet2.dll" (ByVal code As Long, value As Long) As Long
Declare Function ENgeterror Lib "epanet2.dll" (ByVal ErrCode As Long, ByVal ErrMsg As String, ByVal N As Long) As Long
Declare Function ENgetstatistic Lib "epanet2.dll" (ByVal code As Long, ByRef value As Single) As Long
'Analysis Options Functions
Declare Function ENgetoption Lib "epanet2.dll" (ByVal code As Long, value As Single) As Long
@@ -292,6 +296,8 @@ Public Const EN_G_CURVE = 4 ' General\default curve
Declare Function ENsetcontrol Lib "epanet2.dll" (ByVal Cindex As Long, ByVal Ctype As Long, ByVal Lindex As Long, ByVal setting As Single, ByVal Nindex As Long, ByVal Level As Single) As Long
'Rue-Based Control Functions
Declare Function ENaddrule Lib "epanet2.dll" (ByVal rule As String) As Long
Declare Function ENdeleterule Lib "epanet2.dll" (ByVal index As Long) As Long
Declare Function ENgetrule Lib "epanet2.dll" (ByVal index As Long, nPremises As Long, nTrueActions As Long, nFalseActions As Long, priority As Single) As Long
Declare Function ENgetruleID Lib "epanet2.dll" (ByVal indexRule As Long, ByVal id As String) As Long
Declare Function ENsetrulepriority Lib "epanet2.dll" (ByVal index As Long, ByVal priority As Single) As Long
@@ -300,7 +306,7 @@ Public Const EN_G_CURVE = 4 ' General\default curve
Declare Function ENsetpremiseindex Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexPremise As Long, ByVal indexObj As Long) As Long
Declare Function ENsetpremisestatus Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexPremise As Long, ByVal status As Long) As Long
Declare Function ENsetpremisevalue Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexPremise As Long, ByVal value As Single) As Long
Declare Function ENgettrueaction Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexAction As Long, indexLink As Long, status As Long, setting As Single) As Long
Declare Function ENsettrueaction Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexAction As Long, ByVal indexLink As Long, ByVal status As Long, ByVal setting As Single) As Long
Declare Function ENgetfalseaction Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexAction As Long, indexLink As Long, status As Long, setting As Single) As Long
Declare Function ENsetfalseaction Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexAction As Long, ByVal indexLink As Long, ByVal status As Long, ByVal setting As Single) As Long
Declare Function ENgetthenaction Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexAction As Long, indexLink As Long, status As Long, setting As Single) As Long
Declare Function ENsetthenaction Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexAction As Long, ByVal indexLink As Long, ByVal status As Long, ByVal setting As Single) As Long
Declare Function ENgetelseaction Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexAction As Long, indexLink As Long, status As Long, setting As Single) As Long
Declare Function ENsetelseaction Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexAction As Long, ByVal indexLink As Long, ByVal status As Long, ByVal setting As Single) As Long

View File

@@ -172,8 +172,8 @@ typedef enum {
} EN_NodeType;
typedef enum {
EN_CVPIPE = 0, /* Link types. */
EN_PIPE = 1, /* See LinkType in TYPES.H */
EN_CVPIPE = 0,
EN_PIPE = 1,
EN_PUMP = 2,
EN_PRV = 3,
EN_PSV = 4,
@@ -185,28 +185,28 @@ typedef enum {
typedef enum {
EN_NONE = 0, /* Quality analysis types. */
EN_CHEM = 1, /* See QualType in TYPES.H */
EN_CHEM = 1,
EN_AGE = 2,
EN_TRACE = 3
} EN_QualityType;
typedef enum {
EN_CONCEN = 0, /* Source quality types. */
EN_MASS = 1, /* See SourceType in TYPES.H. */
EN_MASS = 1,
EN_SETPOINT = 2,
EN_FLOWPACED = 3
} EN_SourceType;
typedef enum { /* Head loss formula: */
typedef enum { /* Head loss formula: */
EN_HW = 0, /* Hazen-Williams */
EN_DW = 1, /* Darcy-Weisbach */
EN_CM = 2 /* Chezy-Manning */
} EN_FormType; /* See FormType in TYPES.H */
} EN_HeadLossType;
typedef enum {
EN_CFS = 0, /* Flow units types. */
EN_GPM = 1, /* See FlowUnitsType */
EN_MGD = 2, /* in TYPES.H. */
EN_GPM = 1,
EN_MGD = 2,
EN_IMGD = 3,
EN_AFD = 4,
EN_LPS = 5,
@@ -277,6 +277,17 @@ typedef enum {
EN_G_CURVE = 4 /* General\default curve */
} EN_CurveType;
typedef enum {
EN_UNCONDITIONAL = 0,
EN_CONDITIONAL = 1
} EN_ActionCodeType;
typedef enum {
EN_NO_REPORT = 0,
EN_NORMAL_REPORT = 1,
EN_FULL_REPORT = 2
} EN_StatusReport;
// --- Declare the EPANET toolkit functions
#if defined(__cplusplus)
extern "C" {
@@ -286,9 +297,6 @@ extern "C" {
@brief The EPANET Project wrapper object
*/
typedef void *EN_ProjectHandle;
typedef struct EN_Pattern EN_Pattern;
typedef struct EN_Curve EN_Curve;
/**
@brief runs a complete EPANET simulation
@@ -304,7 +312,7 @@ extern "C" {
needed then the argument should be NULL.
*/
int DLLEXPORT ENepanet(const char *inpFile, const char *rptFile,
const char *binOutFile, void (*callback) (char *));
const char *binOutFile, void (*callback) (char *));
/**
@brief Initializes an EPANET session
@@ -315,7 +323,7 @@ extern "C" {
@return error code
*/
int DLLEXPORT ENinit(const char *rptFile, const char *binOutFile,
int UnitsType, int HeadlossFormula);
int UnitsType, int HeadlossFormula);
/**
@brief Opens EPANET input file & reads in network data
@@ -324,7 +332,8 @@ extern "C" {
@param binOutFile pointer to name of binary output file (to be created)
@return error code
*/
int DLLEXPORT ENopen(const char *inpFile, const char *rptFile, const char *binOutFile);
int DLLEXPORT ENopen(const char *inpFile, const char *rptFile,
const char *binOutFile);
/**
@brief Saves current data to "INP" formatted text file.
@@ -362,8 +371,12 @@ extern "C" {
/**
@brief Initializes hydraulic analysis
@param initFlag 2-digit flag where 1st (left) digit indicates if link flows should be re-initialized (1) or not (0), and 2nd digit indicates if hydraulic results should be saved to file (1) or not (0).
@param initFlag 2-digit initialization flag
@return Error code
The initialization flag is a two digit number where the 1st (left) digit
indicates if link flows should be re-initialized (1) or not (0), and the
2nd digit indicates if hydraulic results should be saved to file (1) or not (0).
*/
int DLLEXPORT ENinitH(int initFlag);
@@ -494,15 +507,16 @@ extern "C" {
/**
@brief Retrieves parameters that define a simple control
@param controlIndex Control index (position of control statement in the input file, starting from 1)
@param[out] controlType Control type code (see EPANET2.H)
@param controlIndex Position of control in list of controls added to the project
@param[out] controlType Control type code (see EN_ControlType enumeration)
@param[out] linkIndex Index of controlled link
@param[out] setting Control setting on link
@param[out] nodeIndex Index of controlling node (0 for TIMER or TIMEOFDAY control)
@param[out] level Control level (tank level, junction pressure, or time (seconds))
@return Error code
*/
int DLLEXPORT ENgetcontrol(int controlIndex, int *controlType, int *linkIndex, EN_API_FLOAT_TYPE *setting, int *nodeIndex, EN_API_FLOAT_TYPE *level);
int DLLEXPORT ENgetcontrol(int controlIndex, int *controlType, int *linkIndex,
EN_API_FLOAT_TYPE *setting, int *nodeIndex, EN_API_FLOAT_TYPE *level);
/**
@brief Retrieves the number of components of a given type in the network.
@@ -551,7 +565,7 @@ extern "C" {
@return Error code
*/
int DLLEXPORT ENgetdemandmodel(int *type, EN_API_FLOAT_TYPE *pmin,
EN_API_FLOAT_TYPE *preq, EN_API_FLOAT_TYPE *pexp);
EN_API_FLOAT_TYPE *preq, EN_API_FLOAT_TYPE *pexp);
/**
@brief Sets the type of demand model to use and its parameters
@@ -562,7 +576,7 @@ extern "C" {
@return Error code
*/
int DLLEXPORT ENsetdemandmodel(int type, EN_API_FLOAT_TYPE pmin,
EN_API_FLOAT_TYPE preq, EN_API_FLOAT_TYPE pexp);
EN_API_FLOAT_TYPE preq, EN_API_FLOAT_TYPE pexp);
/**
@brief Retrieves the index of the time pattern with specified ID
@@ -645,16 +659,18 @@ extern "C" {
/**
@brief Get the string ID of the specified node.
@param index The index of the node (first node is index 1)
@param[out] id The string ID of the specified node. Up to MAXID characters will be copied, so id must be pre-allocated by the calling code to hold at least that many characters.
@param[out] id The string ID of the specified node.
@return Error code
@see ENgetnodeindex
The ID string must be sized to hold at least MAXID characters.
*/
int DLLEXPORT ENgetnodeid(int index, char *id);
/**
@brief Get the type of node with specified index.
@param index The index of a node (first node is index 1)
@param[out] code The type code for the node.
@param[out] code The type code for the node (see the EN_NodeType enumeration)
@return Error code
*/
int DLLEXPORT ENgetnodetype(int index, int *code);
@@ -703,7 +719,8 @@ extern "C" {
@param demandIndex The index of the demand category (starting at 1)
@return Error code
*/
int DLLEXPORT ENgetbasedemand(int nodeIndex, int demandIndex, EN_API_FLOAT_TYPE *baseDemand);
int DLLEXPORT ENgetbasedemand(int nodeIndex, int demandIndex,
EN_API_FLOAT_TYPE *baseDemand);
/**
@brief Get the index of the demand pattern assigned to a node for a category index.
@@ -726,16 +743,18 @@ extern "C" {
/**
@brief Get the string ID of a link with specified index
@param index The index of a link (first link is index 1)
@param[out] id The ID of the link. Up to MAXID characters will be copied, so id must be pre-allocated by the calling code to hold at least that many characters.
@param[out] id The ID of the link.
@return Error code
@see ENgetlinkindex
The ID string must be sized to hold at least MAXID characters.
*/
int DLLEXPORT ENgetlinkid(int index, char *id);
/**
@brief Get the link type code for a specified link
@param index The index of a link (first link is index 1)
@param[out] code The type code of the link.
@param[out] code The type code of the link (see the EN_LinkType enumeration)
@return Error code
@see EN_LinkType
*/
@@ -743,12 +762,18 @@ extern "C" {
/**
@brief Set the link type code for a specified link
@param[in,out] index The index of a link before [in] and after [out] the type change.
@param code The new type code of the link.
@param[in,out] index The index of a link before [in] and after [out] the type change
@param code The new type code of the link (see EN_LinkType).
@param actionCode Action taken if any controls contain the link.
@return Error code
@see EN_LinkType
@see the EN_LinkType enumeration
If 'actionCode' is EN_UNCONDITIONAL then all simple and rule-based controls that
contain the link are deleted when the link's type is changed. If set to
EN_CONDITIONAL then the type change is cancelled if the link appears in any
control and an error code is returned.
*/
int DLLEXPORT ENsetlinktype(int *index, EN_LinkType code);
int DLLEXPORT ENsetlinktype(int *index, EN_LinkType Code, int actionCode);
/**
@brief Get the indexes of a link's start- and end-nodes.
@@ -779,7 +804,8 @@ extern "C" {
@param[out] yValues The curve's y-values. Pointer must be freed by client.
@return Error code.
*/
int DLLEXPORT ENgetcurve(int curveIndex, char* id, int *nValues, EN_API_FLOAT_TYPE **xValues, EN_API_FLOAT_TYPE **yValues);
int DLLEXPORT ENgetcurve(int curveIndex, char* id, int *nValues,
EN_API_FLOAT_TYPE **xValues, EN_API_FLOAT_TYPE **yValues);
/**
@brief Retrieves the curve index for a specified pump index.
@@ -816,23 +842,27 @@ extern "C" {
int DLLEXPORT ENgetcurvetype(int curveIndex, int *outType);
/**
@brief Get the version number. This number is to be interpreted with implied decimals, i.e., "20100" == "2(.)01(.)00"
@brief Get the version number.
@param[out] version The version of EPANET
@return Error code.
The version number is to be interpreted with implied decimals, i.e.,
"20100" == "2(.)01(.)00"
*/
int DLLEXPORT ENgetversion(int *version);
/**
@brief Specify parameters to add a new simple control
@brief Add a new simple control to the project.
@param[out] cindex The index of the new control. First control is index 1.
@param ctype The type code to set for this control.
@param ctype The type of control to add (see EN_ControlType).
@param lindex The index of a link to control.
@param setting The control setting applied to the link.
@param nindex The index of a node used to control the link, or 0 for TIMER / TIMEOFDAY control.
@param level control point (tank level, junction pressure, or time in seconds).
@return Error code.
*/
int DLLEXPORT ENaddcontrol(int *cindex, int ctype, int lindex, EN_API_FLOAT_TYPE setting, int nindex, EN_API_FLOAT_TYPE level);
int DLLEXPORT ENaddcontrol(int *cindex, int ctype, int lindex,
EN_API_FLOAT_TYPE setting, int nindex, EN_API_FLOAT_TYPE level);
/**
@brief Delete an existing simple control
@@ -842,16 +872,17 @@ extern "C" {
int DLLEXPORT ENdeletecontrol(int cindex);
/**
@brief Specify parameters to define a simple control
@param cindex The index of the control to edit. First control is index 1.
@param ctype The type code to set for this control.
@brief Set the parameters of an existing simple control.
@param cindex The index of the control. First control is index 1.
@param ctype The type of control to use (see EN_ControlType).
@param lindex The index of a link to control.
@param setting The control setting applied to the link.
@param nindex The index of a node used to control the link, or 0 for TIMER / TIMEOFDAY control.
@param level control point (tank level, junction pressure, or time in seconds).
@return Error code.
*/
int DLLEXPORT ENsetcontrol(int cindex, int ctype, int lindex, EN_API_FLOAT_TYPE setting, int nindex, EN_API_FLOAT_TYPE level);
int DLLEXPORT ENsetcontrol(int cindex, int ctype, int lindex,
EN_API_FLOAT_TYPE setting, int nindex, EN_API_FLOAT_TYPE level);
/**
@brief Change the ID name for a node.
@@ -945,137 +976,142 @@ extern "C" {
int DLLEXPORT ENsetoption(int code, EN_API_FLOAT_TYPE v);
/**
@brief Sets the level of hydraulic status reporting.
@param code Status reporting code.
@brief Set the level of hydraulic status reporting.
@param code Status reporting code (see EN_StatusReport).
@return Error code.
*/
int DLLEXPORT ENsetstatusreport(int code);
/**
@brief Sets type of quality analysis called for
@param qualcode WQ parameter code, EN_QualityType
@param chemname Name of WQ constituent
@param chemunits Concentration units of WQ constituent
@param tracenode ID of node being traced (if applicable)
@brief Set the type of quality analysis called for.
@param qualcode Type of analysis to be made (see EN_QualityType).
@param chemname Name of the quality constituent.
@param chemunits Concentration units of the constituent.
@param tracenode ID of node being traced (if applicable).
@return Error code.
@see EN_QualityType
chemname and chemunits only apply when WQ analysis is for chemical. tracenode only applies when WQ analysis is source tracing.
Note: "chemname" and "chemunits" only apply when "qualcode" is EN_CHEM.
"tracenode" only applies when 'qualcode" is EN_TRACE.
*/
int DLLEXPORT ENsetqualtype(int qualcode, char *chemname, char *chemunits, char *tracenode);
int DLLEXPORT ENsetqualtype(int qualcode, char *chemname, char *chemunits,
char *tracenode);
/**
@brief Get quality analysis information (type, chemical name, units, trace node ID)
@param[out] qualcode The EN_QualityType code being used.
@param[out] chemname The name of the WQ constituent.
@param[out] chemunits The cencentration units of the WQ constituent.
@param[out] tracenode The trace node ID.
@brief Get information about the type of water quality analysis requested.
@param[out] qualcode Type of analysis to be made (see EN_QualityType).
@param[out] chemname Name of the quality constituent.
@param[out] chemunits Concentration units of the constituent.
@param[out] tracenode ID of node being traced (if applicable).
@return Error code.
@see EN_QualityType
*/
int DLLEXPORT ENgetqualinfo(int *qualcode, char *chemname, char *chemunits, int *tracenode);
int DLLEXPORT ENgetqualinfo(int *qualcode, char *chemname, char *chemunits,
int *tracenode);
/**
@brief Sets the node's demand name for a category.
@param nodeIndex The index of a node.
@param demandIdx The index of a demand category.
@param demandName The demand name for the selected category.
@brief Set the name of a node's demand category.
@param nodeIndex The node's index.
@param demandIdx Index of the node's demand.
@param demandName Name for the category the demand belongs to.
@return Error code.
@see ENgetdemandname
*/
int DLLEXPORT ENsetdemandname(int nodeIndex, int demandIdx, char *demandName);
/**
@brief Retrieves the node's demand name for a category.
@param nodeIndex The index of a node.
@param demandIdx The index of a demand category.
@param demandName The demand name for the selected category.
@brief Retrieve the name of a node's demand category.
@param nodeIndex The node's index.
@param demandIdx Index of the node's demand.
@param demandName[out] Name of the category the demand belongs to.
@return Error code.
@see ENsetdemandname
*/
int DLLEXPORT ENgetdemandname(int nodeIndex, int demandIdx, char *demandName);
/**
@brief Sets the node's base demand for a category.
@param nodeIndex The index of a node.
@param demandIdx The index of a demand category.
@param baseDemand The base demand multiplier for the selected category.
@brief Set a node's base demand for a demand category.
@param nodeIndex The node's index.
@param demandIndex The index of one of the node's demand categories.
@param baseDemand The base demand for the selected category.
@return Error code.
@see ENgetbasedemand
*/
int DLLEXPORT ENsetbasedemand(int nodeIndex, int demandIdx, EN_API_FLOAT_TYPE baseDemand);
int DLLEXPORT ENsetbasedemand(int nodeIndex, int demandIndex,
EN_API_FLOAT_TYPE baseDemand);
/**
@brief Sets the index of the demand pattern assigned to a node for a category index.
@param nodeIndex The index of a node (first node is index 1).
@param demandIndex The index of a category (first category is index 1).
@param pattIndex The index of the pattern for this node and category.
@brief Set the time pattern assigned to a node's demand category.
@param nodeIndex The node's index.
@param demandIndex The index of one of the node's demand categories.
@param pattIndex The index of a time pattern applied to this demand category.
@return Error code
*/
int DLLEXPORT ENsetdemandpattern(int nodeIndex, int demandIdx, int patIndex);
int DLLEXPORT ENsetdemandpattern(int nodeIndex, int demandIndex, int patIndex);
/**
@brief Retrieves index of curve with specific ID.
@param id The ID of a curve.
@param[out] index The index of the named curve
@brief Retrieve the index of a curve given its name.
@param id The ID name of a curve.
@param[out] index The index of the named curve.
@return Error code.
@see ENgetcurveid
*/
int DLLEXPORT ENgetcurveindex(char *id, int *index);
/**
@brief Retrieves ID of a curve with specific index.
@brief Retrieve the ID name of a curve given its index.
@param index The index of a curve.
@param[out] id The ID of the curve specified.
@param[out] id The ID of the specified curve.
@return Error code.
@see ENsetcurveindex
NOTE: 'id' must be able to hold MAXID characters
NOTE: 'id' must be sized to hold MAXID characters.
*/
int DLLEXPORT ENgetcurveid(int index, char *id);
/**
@brief Retrieves number of points in a curve
@brief Retrieve the number of points in a curve.
@param index The index of a curve.
@param[out] len The length of the curve coordinate list
@param[out] len The number of data points assigned to the curve.
@return Error code.
@see ENgetcurvevalue
*/
int DLLEXPORT ENgetcurvelen(int index, int *len);
/**
@brief retrieves x,y point for a specific point number and curve
@param curveIndex The index of a curve
@param pointIndex The index of a point in the curve
@brief Retrieve an x,y data point for a curve.
@param curveIndex The index of a curve.
@param pointIndex The index of a point in the curve.
@param[out] x The x-value of the specified point.
@param[out] y The y-value of the specified point.
@return Error code.
@see ENgetcurvelen ENsetcurvevalue
*/
int DLLEXPORT ENgetcurvevalue(int curveIndex, int pointIndex, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y);
int DLLEXPORT ENgetcurvevalue(int curveIndex, int pointIndex,
EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y);
/**
@brief Sets x,y point for a specific point and curve.
@brief Set the x and y values for a curve's data point.
@param curveIndex The index of a curve.
@param pointIndex The index of a point in the curve.
@param x The x-value of the point.
@param y The y-value of the point.
@return Error code.
*/
int DLLEXPORT ENsetcurvevalue(int curveIndex, int pointIndex, EN_API_FLOAT_TYPE x, EN_API_FLOAT_TYPE y);
int DLLEXPORT ENsetcurvevalue(int curveIndex, int pointIndex,
EN_API_FLOAT_TYPE x, EN_API_FLOAT_TYPE y);
/**
@brief Sets x,y values for a specified curve.
@brief Set the x,y values for all points on a curve.
@param index The index of a curve.
@param x An array of x-values for the curve.
@param y An array of y-values for the curve.
@param len The length of the arrays x and y.
@param len The length of the arrays for x and y.
@return Error code.
*/
int DLLEXPORT ENsetcurve(int index, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y, int len);
int DLLEXPORT ENsetcurve(int index, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y,
int len);
/**
@brief Adds a new curve appended to the end of the existing curves.
@brief Add a new curve to the project.
@param id The name of the curve to be added.
@return Error code.
@see ENgetcurveindex ENsetcurve
@@ -1083,164 +1119,201 @@ extern "C" {
int DLLEXPORT ENaddcurve(char *id);
/**
@brief Gets the number of premises, true actions, and false actions and the priority of an existing rule-based control.
@param index The index of a rule-based control.
@param nPremises The number of conditions in a rule-based control.
@param nTrueActions The number of actions that are executed when the conditions in the rule-based control are met.
@param nFalseActions The number of actions that are executed when the conditions in the rule-based control are not met.
@param priority The priority of a rule-based control.
@brief Get summary information for a rule-based control.
@param index The control's index.
@param[out] nPremises Number of premises in the IF section of the control.
@param[out] nThenActions Number of THEN actions in the control.
@param nElseActions[out] Number of ELSE actions in the control.
@param priority[out] Rule's priority.
@return Error code.
*/
int DLLEXPORT ENgetrule(int index, int *nPremises, int *nTrueActions, int *nFalseActions, EN_API_FLOAT_TYPE *priority);
int DLLEXPORT ENgetrule(int index, int *nPremises, int *nTrueActions,
int *nFalseActions, EN_API_FLOAT_TYPE *priority);
/**
@brief Sets the priority of the existing rule-based control.
@param index The index of a rule-based control.
@param priority The priority to be set in the rule-based control.
@brief Set the priority of a rule-based control.
@param index The control's index.
@param priority The priority assigned to the control.
@return Error code.
*/
int DLLEXPORT ENsetrulepriority(int index, EN_API_FLOAT_TYPE priority);
/**
@brief Gets the components of a premise/condition in an existing rule-based control.
@param indexRule The index of a rule-based control.
@param indexPremise The index of the premise.
@param logop The logiv operator (IF/AND/OR) in the premise
@param object The object (e.g. TANK) the premise is looking at.
@param indexObj The index of the object (e.g. the index of the tank).
@param variable The variable to be checked (e.g. level).
@param relop The relashionship operator (e.g. LARGER THAN) in the premise.
@param status The status of the object to be checked (e.g. CLOSED)
@param value The value of the variable to be checked (e.g. 5.5)
@brief Get the components of a premise in a rule-based control.
@param ruleIndex The control's index.
@param premiseIndex The premise's index.
@param logop[out] Logical operator (IF/AND/OR) of the premise
@param object[out] Type of object (e.g. TANK) the premise is looking at.
@param objIndex[out] Index of the object (e.g. the index of the tank).
@param variable[out] Index of the variable to be checked (e.g. LEVEL).
@param relop[out] Relationship operator (e.g. ABOVE) in the premise.
@param status[out] Status of the object being checked (e.g. CLOSED)
@param value[out] Setting of the variable being checked (e.g. 5.5)
@return Error code.
*/
int DLLEXPORT ENgetpremise(int indexRule, int indexPremise, int *logop, int *object, int *indexObj, int *variable, int *relop, int *status, EN_API_FLOAT_TYPE *value);
int DLLEXPORT ENgetpremise(int ruleIndex, int premiseIndex, int *logop,
int *object, int *objIndex, int *variable,
int *relop, int *status, EN_API_FLOAT_TYPE *value);
/**
@brief Sets the components of a premise/condition in an existing rule-based control.
@param indexRule The index of a rule-based control.
@param indexPremise The index of the premise.
@param logop The logiv operator (IF/AND/OR) in the premise
@param object The object (e.g. TANK) the premise is looking at.
@param indexObj The index of the object (e.g. the index of the tank).
@param variable The variable to be checked (e.g. level).
@param relop The relashionship operator (e.g. LARGER THAN) in the premise.
@param status The status of the object to be checked (e.g. CLOSED)
@param value The value of the variable to be checked (e.g. 5.5)
@brief Set the components of a premise in a rule-based control.
@param ruleIndex The control's index.
@param premiseIndex The premise's index.
@param logop Logical operator (IF/AND/OR) of the premise
@param object Type of object (e.g. TANK) the premise is looking at.
@param objIndex Index of the object (e.g. the index of the tank).
@param variable Index of the variable to be checked (e.g. LEVEL).
@param relop Relationship operator (e.g. ABOVE) in the premise.
@param status Status of the object being checked (e.g. CLOSED)
@param value Setting of the variable being checked (e.g. 5.5)
@return Error code.
*/
int DLLEXPORT ENsetpremise(int indexRule, int indexPremise, int logop, int object, int indexObj, int variable, int relop, int status, EN_API_FLOAT_TYPE value);
int DLLEXPORT ENsetpremise(int ruleIndex, int premiseIndex, int logop,
int object, int objIndex, int variable, int relop,
int status, EN_API_FLOAT_TYPE value);
/**
@brief Sets the index of an object in a premise of an existing rule-based control.
@param indexRule The index of a rule-based control.
@param indexPremise The index of the premise.
@param indexObj The index of the object (e.g. the index of the tank).
@brief Set the index of an object in a premise of a rule-based control.
@param ruleIndex The control's index.
@param premiseIndex The premise's index.
@param objIndex The index of the premise's object (e.g. the index of the tank).
@return Error code.
*/
int DLLEXPORT ENsetpremiseindex(int indexRule, int indexPremise, int indexObj);
int DLLEXPORT ENsetpremiseindex(int ruleIndex, int premiseIndex, int objIndex);
/**
@brief Sets the status in a premise of an existing rule-based control.
@param indexRule The index of a rule-based control.
@param indexPremise The index of the premise.
@param status The status of the object to be checked (e.g. CLOSED)
@brief Set the status in a premise of a rule-based control.
@param ruleIndex The control's index.
@param premiseIndex The premise's index.
@param status The status of the object being checked (e.g. CLOSED)
@return Error code.
*/
int DLLEXPORT ENsetpremisestatus(int indexRule, int indexPremise, int status);
int DLLEXPORT ENsetpremisestatus(int ruleIndex, int premiseIndex, int status);
/**
@brief Sets the value in a premise of an existing rule-based control.
@param indexRule The index of a rule-based control.
@param indexPremise The index of the premise.
@param value The value of the variable to be checked (e.g. 5.5)
@brief Set the value in a premise of a rule-based control.
@param ruleIndex The control's index.
@param premiseIndex The premise's index.
@param value The value of the premise's variable being checked (e.g. 5.5)
@return Error code.
*/
int DLLEXPORT ENsetpremisevalue(int indexRule, int indexPremise, EN_API_FLOAT_TYPE value);
int DLLEXPORT ENsetpremisevalue(int ruleIndex, int premiseIndex,
EN_API_FLOAT_TYPE value);
/**
@brief Gets the components of a true-action in an existing rule-based control.
@param indexRule The index of a rule-based control.
@param indexAction The index of the action when the conditions in the rule are met.
@param indexLink The index of the link in the action (e.g. index of Pump 1)
@param status The status of the link (e.g. CLOSED)
@param setting The value of the link (e.g. pump speed 0.9)
@brief Get the components of a THEN action in a rule-based control.
@param ruleIndex The control's index.
@param actionIndex Index of the THEN action to retrieve.
@param linkIndex[out] Index of the link in the action (e.g. index of Pump 1)
@param status[out] Status of the link (e.g. CLOSED)
@param setting[out] Value of the link's setting (e.g. pump speed 0.9)
@return Error code.
*/
int DLLEXPORT ENgettrueaction(int indexRule, int indexAction, int *indexLink, int *status, EN_API_FLOAT_TYPE *setting);
int DLLEXPORT ENgetthenaction(int ruleIndex, int actionIndex, int *linkIndex,
int *status, EN_API_FLOAT_TYPE *setting);
/**
@brief Sets the components of a true-action in an existing rule-based control.
@param indexRule The index of a rule-based control.
@param indexAction The index of the action when the conditions in the rule are met.
@param indexLink The index of the link in the action (e.g. index of Pump 1)
@param status The status of the link (e.g. CLOSED)
@param setting The value of the link (e.g. pump speed 0.9)
@brief Set the components of a THEN action in a rule-based control.
@param ruleIndex The control's index.
@param actionIndex Index of the THEN action to modify.
@param linkIndex Index of the link in the action (e.g. index of Pump 1)
@param status Status assigned to the link (e.g. CLOSED)
@param setting Setting value assigned to the link (e.g. pump speed 0.9)
@return Error code.
*/
int DLLEXPORT ENsettrueaction(int indexRule, int indexAction, int indexLink, int status, EN_API_FLOAT_TYPE setting);
int DLLEXPORT ENsetthenaction(int ruleIndex, int actionIndex, int linkIndex,
int status, EN_API_FLOAT_TYPE setting);
/**
@brief Gets the components of a false-action in an existing rule-based control.
@param indexRule The index of a rule-based control.
@param indexAction The index of the action when the conditions in the rule are not met.
@param indexLink The index of the link in the action (e.g. index of Pump 1)
@param status The status of the link (e.g. CLOSED)
@param setting The value of the link (e.g. pump speed 0.9)
@brief Get the components of an ELSE action in a rule-based control.
@param ruleIndex The control's index.
@param actionIndex Index of the ELSE action to retrieve.
@param linkIndex[out] Index of the link in the action (e.g. index of Pump 1).
@param status[out] Status of the link (e.g. CLOSED).
@param setting[out] Value of the link's setting (e.g. pump speed 0.9)
@return Error code.
*/
int DLLEXPORT ENgetfalseaction(int indexRule, int indexAction, int *indexLink, int *status, EN_API_FLOAT_TYPE *setting);
int DLLEXPORT ENgetelseaction(int ruleIndex, int actionIndex, int *linkIndex,
int *status, EN_API_FLOAT_TYPE *setting);
/**
@brief Sets the components of a false-action in an existing rule-based control.
@param indexRule The index of a rule-based control.
@param indexAction The index of the action when the conditions in the rule are not met.
@param indexLink The index of the link in the action (e.g. index of Pump 1)
@param status The status of the link (e.g. CLOSED)
@param setting The value of the link (e.g. pump speed 0.9)
@brief Set the components of an ELSE action in a rule-based control.
@param ruleIndex The control's index.
@param actionIndex Index of the ELSE action being modified.
@param linkIndex Index of the link in the action (e.g. index of Pump 1)
@param status Status assigned to the link (e.g. CLOSED)
@param setting Setting value assigned to the link (e.g. pump speed 0.9)
@return Error code.
*/
int DLLEXPORT ENsetfalseaction(int indexRule, int indexAction, int indexLink, int status, EN_API_FLOAT_TYPE setting);
int DLLEXPORT ENsetelseaction(int ruleIndex, int actionIndex, int linkIndex,
int status, EN_API_FLOAT_TYPE setting);
/**
@brief Returns the ID of a rule.
@param indexRule The index of a rule-based control.
@param id The ID of the rule
@brief Get the ID name of a rule-based control.
@param index The rule's index.
@param id[out] The rule's ID name.
@return Error code.
*/
int DLLEXPORT ENgetruleID(int indexRule, char* id);
int DLLEXPORT ENgetruleID(int index, char* id);
/**
@brief Adds a new node
@brief Delete a rule-based control.
@param index The rule's index.
@return Error code.
*/
int DLLEXPORT ENdeleterule(int index);
/**
@brief Add a new node to the project.
@param id The name of the node to be added.
@param nodeType The node type code
@param nodeType The type of node being added (see EN_NodeType)
@return Error code.
*/
int DLLEXPORT ENaddnode(char *id, EN_NodeType nodeType);
/**
@brief Adds a new link
@brief Add a new link to the project.
@param id The name of the link to be added.
@param linkType The link type code
@param fromNode The id of the from node
@param toNode The id of the to node
@param linkType The type of link being added (see EN_LinkType)
@param fromNode The id of the link's starting node
@param toNode The id of the link's ending node
@return Error code.
*/
int DLLEXPORT ENaddlink(char *id, EN_LinkType linkType, char *fromNode, char *toNode);
/**
@brief Deletes a node
@param nodeIndex The node index
@brief Add a new control rule to the project.
@param rule Text of the rule following the format used in an INP file.
@return Error code.
*/
int DLLEXPORT ENdeletenode(int nodeIndex);
int DLLEXPORT ENaddrule(char *rule);
/**
@brief Deletes a link
@param linkIndex The link index
@brief Delete a node from the project.
@param index The index of the node to be deleted.
@param actionCode The action taken if any control contains the node and its links.
@return Error code.
If 'actionCode' is EN_UNCONDITIONAL then the node, its incident links and all
simple and rule-based controls that contain them are deleted. If set to
EN_CONDITIONAL then the node is not deleted if it or its incident links appear
in any controls and an error code is returned.
*/
int DLLEXPORT ENdeletelink(int linkIndex);
int DLLEXPORT ENdeletenode(int index, int actionCode);
/**
@brief Delete a link from the project.
@param index The index of the link to be deleted.
@param ctrlsCode The action taken if any control contains the link.
@return Error code.
If 'actionCode' is EN_UNCONDITIONAL then the link an all simple and rule-based
controls that contain it are deleted. If set to EN_CONDITIONAL then the link
is not deleted if it appears in any control and an error code is returned.
*/
int DLLEXPORT ENdeletelink(int index, int actionCode);
/***************************************************
@@ -1252,18 +1325,17 @@ extern "C" {
int DLLEXPORT EN_deleteproject(EN_ProjectHandle *ph);
int DLLEXPORT EN_runproject(EN_ProjectHandle ph, const char *f1,
const char *f2, const char *f3, void (*pviewprog)(char *));
const char *f2, const char *f3, void (*pviewprog)(char *));
void DLLEXPORT EN_clearError(EN_ProjectHandle ph);
int DLLEXPORT EN_checkError(EN_ProjectHandle ph, char** msg_buffer);
//int DLLEXPORT EN_epanet(EN_ProjectHandle ph, const char *f1, const char *f2,
// const char *f3, void(*pviewprog)(char *));
int DLLEXPORT EN_init(EN_ProjectHandle ph, const char *rptFile, const char *binOutFile,
EN_FlowUnits UnitsType, EN_FormType HeadlossFormula);
int DLLEXPORT EN_init(EN_ProjectHandle ph, const char *rptFile,
const char *binOutFile, EN_FlowUnits unitsType,
EN_HeadLossType headLossType);
int DLLEXPORT EN_open(EN_ProjectHandle ph, const char *inpFile,
const char *rptFile, const char *binOutFile);
const char *rptFile, const char *binOutFile);
int DLLEXPORT EN_saveinpfile(EN_ProjectHandle ph, const char *filename);
@@ -1272,7 +1344,7 @@ extern "C" {
int DLLEXPORT EN_saveH(EN_ProjectHandle ph);
int DLLEXPORT EN_openH(EN_ProjectHandle ph);
int DLLEXPORT EN_initH(EN_ProjectHandle ph, int EN_SaveOption);
int DLLEXPORT EN_initH(EN_ProjectHandle ph, int saveFlag);
int DLLEXPORT EN_runH(EN_ProjectHandle ph, long *currentTime);
int DLLEXPORT EN_nextH(EN_ProjectHandle ph, long *tStep);
int DLLEXPORT EN_closeH(EN_ProjectHandle ph);
@@ -1290,95 +1362,152 @@ extern "C" {
int DLLEXPORT EN_report(EN_ProjectHandle ph);
int DLLEXPORT EN_resetreport(EN_ProjectHandle ph);
int DLLEXPORT EN_setreport(EN_ProjectHandle ph, char *reportFormat);
int DLLEXPORT EN_setreport(EN_ProjectHandle ph, char *reportCommand);
int DLLEXPORT EN_getcontrol(EN_ProjectHandle ph, int controlIndex, int *controlType, int *linkIndex, EN_API_FLOAT_TYPE *setting, int *nodeIndex, EN_API_FLOAT_TYPE *level);
int DLLEXPORT EN_getcontrol(EN_ProjectHandle ph, int controlIndex,
int *controlType, int *linkIndex, EN_API_FLOAT_TYPE *setting,
int *nodeIndex, EN_API_FLOAT_TYPE *level);
int DLLEXPORT EN_getcount(EN_ProjectHandle ph, EN_CountType code, int *count);
int DLLEXPORT EN_getoption(EN_ProjectHandle ph, EN_Option opt, EN_API_FLOAT_TYPE *value);
int DLLEXPORT EN_getoption(EN_ProjectHandle ph, EN_Option opt,
EN_API_FLOAT_TYPE *value);
int DLLEXPORT EN_gettimeparam(EN_ProjectHandle ph, int code, long *value);
int DLLEXPORT EN_getflowunits(EN_ProjectHandle ph, int *code);
int DLLEXPORT EN_setflowunits(EN_ProjectHandle ph, int code);
int DLLEXPORT EN_getpatternindex(EN_ProjectHandle ph, char *id, int *index);
int DLLEXPORT EN_getpatternid(EN_ProjectHandle ph, int index, char *id);
int DLLEXPORT EN_getpatternlen(EN_ProjectHandle ph, int index, int *len);
int DLLEXPORT EN_getpatternvalue(EN_ProjectHandle ph, int index, int period, EN_API_FLOAT_TYPE *value);
int DLLEXPORT EN_getaveragepatternvalue(EN_ProjectHandle ph, int index, EN_API_FLOAT_TYPE *value);
int DLLEXPORT EN_getpatternvalue(EN_ProjectHandle ph, int index, int period,
EN_API_FLOAT_TYPE *value);
int DLLEXPORT EN_getaveragepatternvalue(EN_ProjectHandle ph, int index,
EN_API_FLOAT_TYPE *value);
int DLLEXPORT EN_getqualtype(EN_ProjectHandle ph, int *qualcode, int *tracenode);
int DLLEXPORT EN_geterror(int errcode, char *errmsg, int maxLen);
int DLLEXPORT EN_getstatistic(EN_ProjectHandle ph, int code, EN_API_FLOAT_TYPE* value);
int DLLEXPORT EN_getstatistic(EN_ProjectHandle ph, int code,
EN_API_FLOAT_TYPE* value);
int DLLEXPORT EN_getnodeindex(EN_ProjectHandle ph, char *id, int *index);
int DLLEXPORT EN_getnodeid(EN_ProjectHandle ph, int index, char *id);
int DLLEXPORT EN_getnodetype(EN_ProjectHandle ph, int index, int *code);
int DLLEXPORT EN_getnodevalue(EN_ProjectHandle ph, int index, int code, EN_API_FLOAT_TYPE *value);
int DLLEXPORT EN_getcoord(EN_ProjectHandle ph, int index, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y);
int DLLEXPORT EN_setcoord(EN_ProjectHandle ph, int index, EN_API_FLOAT_TYPE x, EN_API_FLOAT_TYPE y);
int DLLEXPORT EN_getnumdemands(EN_ProjectHandle ph, int nodeIndex, int *numDemands);
int DLLEXPORT EN_getbasedemand(EN_ProjectHandle ph, int nodeIndex, int demandIndex, EN_API_FLOAT_TYPE *baseDemand);
int DLLEXPORT EN_getdemandpattern(EN_ProjectHandle ph, int nodeIndex, int demandIndex, int *pattIndex);
int DLLEXPORT EN_getnodevalue(EN_ProjectHandle ph, int index, int code,
EN_API_FLOAT_TYPE *value);
int DLLEXPORT EN_getcoord(EN_ProjectHandle ph, int index, EN_API_FLOAT_TYPE *x,
EN_API_FLOAT_TYPE *y);
int DLLEXPORT EN_setcoord(EN_ProjectHandle ph, int index, EN_API_FLOAT_TYPE x,
EN_API_FLOAT_TYPE y);
int DLLEXPORT EN_getnumdemands(EN_ProjectHandle ph, int nodeIndex,
int *numDemands);
int DLLEXPORT EN_getbasedemand(EN_ProjectHandle ph, int nodeIndex,
int demandIndex, EN_API_FLOAT_TYPE *baseDemand);
int DLLEXPORT EN_getdemandpattern(EN_ProjectHandle ph, int nodeIndex,
int demandIndex, int *pattIndex);
int DLLEXPORT EN_getlinkindex(EN_ProjectHandle ph, char *id, int *index);
int DLLEXPORT EN_getlinkid(EN_ProjectHandle ph, int index, char *id);
int DLLEXPORT EN_getlinktype(EN_ProjectHandle ph, int index, EN_LinkType *code);
int DLLEXPORT EN_getlinknodes(EN_ProjectHandle ph, int index, int *node1, int *node2);
int DLLEXPORT EN_getlinkvalue(EN_ProjectHandle ph, int index, EN_LinkProperty code, EN_API_FLOAT_TYPE *value);
int DLLEXPORT EN_getcurve(EN_ProjectHandle ph, int curveIndex, char* id, int *nValues, EN_API_FLOAT_TYPE **xValues, EN_API_FLOAT_TYPE **yValues);
int DLLEXPORT EN_getheadcurveindex(EN_ProjectHandle ph, int pumpIndex, int *curveIndex);
int DLLEXPORT EN_setheadcurveindex(EN_ProjectHandle ph, int pumpIndex, int curveIndex);
int DLLEXPORT EN_getlinknodes(EN_ProjectHandle ph, int index, int *node1,
int *node2);
int DLLEXPORT EN_getlinkvalue(EN_ProjectHandle ph, int index,
EN_LinkProperty code, EN_API_FLOAT_TYPE *value);
int DLLEXPORT EN_getcurve(EN_ProjectHandle ph, int curveIndex, char* id,
int *nValues, EN_API_FLOAT_TYPE **xValues,
EN_API_FLOAT_TYPE **yValues);
int DLLEXPORT EN_getheadcurveindex(EN_ProjectHandle ph, int pumpIndex,
int *curveIndex);
int DLLEXPORT EN_setheadcurveindex(EN_ProjectHandle ph, int pumpIndex,
int curveIndex);
int DLLEXPORT EN_getpumptype(EN_ProjectHandle ph, int linkIndex, int *outType);
int DLLEXPORT EN_getcurvetype(EN_ProjectHandle ph, int curveIndex, int *outType);
int DLLEXPORT EN_getversion(int *version);
int DLLEXPORT EN_addcontrol(EN_ProjectHandle ph, int *cindex, int ctype, int lindex, EN_API_FLOAT_TYPE setting, int nindex, EN_API_FLOAT_TYPE level);
int DLLEXPORT EN_setcontrol(EN_ProjectHandle ph, int cindex, int ctype, int lindex, EN_API_FLOAT_TYPE setting, int nindex, EN_API_FLOAT_TYPE level);
int DLLEXPORT EN_addcontrol(EN_ProjectHandle ph, int *cindex, int ctype,
int lindex, EN_API_FLOAT_TYPE setting, int nindex,
EN_API_FLOAT_TYPE level);
int DLLEXPORT EN_setcontrol(EN_ProjectHandle ph, int cindex, int ctype,
int lindex, EN_API_FLOAT_TYPE setting, int nindex,
EN_API_FLOAT_TYPE level);
int DLLEXPORT EN_setnodeid(EN_ProjectHandle ph, int index, char *newid);
int DLLEXPORT EN_setnodevalue(EN_ProjectHandle ph, int index, int code, EN_API_FLOAT_TYPE v);
int DLLEXPORT EN_setnodevalue(EN_ProjectHandle ph, int index, int code,
EN_API_FLOAT_TYPE v);
int DLLEXPORT EN_setlinkid(EN_ProjectHandle ph, int index, char *newid);
int DLLEXPORT EN_setlinknodes(EN_ProjectHandle ph, int index, int node1, int node2);
int DLLEXPORT EN_setlinktype(EN_ProjectHandle ph, int *index, EN_LinkType code);
int DLLEXPORT EN_setlinkvalue(EN_ProjectHandle ph, int index, int code, EN_API_FLOAT_TYPE v);
int DLLEXPORT EN_setlinknodes(EN_ProjectHandle ph, int index, int node1,
int node2);
int DLLEXPORT EN_setlinktype(EN_ProjectHandle ph, int *index, EN_LinkType type,
int actionCode);
int DLLEXPORT EN_setlinkvalue(EN_ProjectHandle ph, int index, int code,
EN_API_FLOAT_TYPE v);
int DLLEXPORT EN_addpattern(EN_ProjectHandle ph, char *id);
int DLLEXPORT EN_setpattern(EN_ProjectHandle ph, int index, EN_API_FLOAT_TYPE *f, int len);
int DLLEXPORT EN_setpatternvalue(EN_ProjectHandle ph, int index, int period, EN_API_FLOAT_TYPE value);
int DLLEXPORT EN_setpattern(EN_ProjectHandle ph, int index,
EN_API_FLOAT_TYPE *f, int len);
int DLLEXPORT EN_setpatternvalue(EN_ProjectHandle ph, int index, int period,
EN_API_FLOAT_TYPE value);
int DLLEXPORT EN_settimeparam(EN_ProjectHandle ph, int code, long value);
int DLLEXPORT EN_setoption(EN_ProjectHandle ph, int code, EN_API_FLOAT_TYPE v);
int DLLEXPORT EN_setstatusreport(EN_ProjectHandle ph, int code);
int DLLEXPORT EN_setqualtype(EN_ProjectHandle ph, int qualcode, char *chemname, char *chemunits, char *tracenode);
int DLLEXPORT EN_setqualtype(EN_ProjectHandle ph, int qualcode, char *chemname,
char *chemunits, char *tracenode);
int DLLEXPORT EN_getdemandmodel(EN_ProjectHandle ph, int *type, EN_API_FLOAT_TYPE *pmin,
EN_API_FLOAT_TYPE *preq, EN_API_FLOAT_TYPE *pexp);
EN_API_FLOAT_TYPE *preq, EN_API_FLOAT_TYPE *pexp);
int DLLEXPORT EN_setdemandmodel(EN_ProjectHandle ph, int type, EN_API_FLOAT_TYPE pmin,
EN_API_FLOAT_TYPE preq, EN_API_FLOAT_TYPE pexp);
EN_API_FLOAT_TYPE preq, EN_API_FLOAT_TYPE pexp);
int DLLEXPORT EN_setdemandname(EN_ProjectHandle ph, int nodeIndex, int demandIdx, char *demandName);
int DLLEXPORT EN_getdemandname(EN_ProjectHandle ph, int nodeIndex, int demandIdx, char *demandName);
int DLLEXPORT EN_getqualinfo(EN_ProjectHandle ph, int *qualcode, char *chemname, char *chemunits, int *tracenode);
int DLLEXPORT EN_setbasedemand(EN_ProjectHandle ph, int nodeIndex, int demandIdx, EN_API_FLOAT_TYPE baseDemand);
int DLLEXPORT EN_setdemandpattern(EN_ProjectHandle ph, int nodeIndex, int demandIdx, int patIndex);
int DLLEXPORT EN_setdemandname(EN_ProjectHandle ph, int nodeIndex,
int demandIdx, char *demandName);
int DLLEXPORT EN_getdemandname(EN_ProjectHandle ph, int nodeIndex,
int demandIdx, char *demandName);
int DLLEXPORT EN_getqualinfo(EN_ProjectHandle ph, int *qualcode,
char *chemname, char *chemunits, int *tracenode);
int DLLEXPORT EN_setbasedemand(EN_ProjectHandle ph, int nodeIndex,
int demandIndex, EN_API_FLOAT_TYPE baseDemand);
int DLLEXPORT EN_setdemandpattern(EN_ProjectHandle ph, int nodeIndex,
int demandIndex, int patIndex);
int DLLEXPORT EN_getcurveindex(EN_ProjectHandle ph, char *id, int *index);
int DLLEXPORT EN_getcurveid(EN_ProjectHandle ph, int index, char *id);
int DLLEXPORT EN_getcurvelen(EN_ProjectHandle ph, int index, int *len);
int DLLEXPORT EN_getcurvevalue(EN_ProjectHandle ph, int curveIndex, int pointIndex, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y);
int DLLEXPORT EN_setcurvevalue(EN_ProjectHandle ph, int curveIndex, int pointIndex, EN_API_FLOAT_TYPE x, EN_API_FLOAT_TYPE y);
int DLLEXPORT EN_setcurve(EN_ProjectHandle ph, int index, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y, int len);
int DLLEXPORT EN_getcurvevalue(EN_ProjectHandle ph, int curveIndex,
int pointIndex, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y);
int DLLEXPORT EN_setcurvevalue(EN_ProjectHandle ph, int curveIndex,
int pointIndex, EN_API_FLOAT_TYPE x, EN_API_FLOAT_TYPE y);
int DLLEXPORT EN_setcurve(EN_ProjectHandle ph, int index, EN_API_FLOAT_TYPE *x,
EN_API_FLOAT_TYPE *y, int len);
int DLLEXPORT EN_addcurve(EN_ProjectHandle ph, char *id);
int DLLEXPORT EN_getrule(EN_ProjectHandle ph, int index, int *nPremises, int *nTrueActions, int *nFalseActions, EN_API_FLOAT_TYPE *priority);
int DLLEXPORT EN_setrulepriority(EN_ProjectHandle ph, int index, EN_API_FLOAT_TYPE priority);
int DLLEXPORT EN_getpremise(EN_ProjectHandle ph, int indexRule, int indexPremise, int *logop, int *object, int *indexObj, int *variable, int *relop, int *status, EN_API_FLOAT_TYPE *value);
int DLLEXPORT EN_setpremise(EN_ProjectHandle ph, int indexRule, int indexPremise, int logop, int object, int indexObj, int variable, int relop, int status, EN_API_FLOAT_TYPE value);
int DLLEXPORT EN_setpremiseindex(EN_ProjectHandle ph, int indexRule, int indexPremise, int indexObj);
int DLLEXPORT EN_setpremisestatus(EN_ProjectHandle ph, int indexRule, int indexPremise, int status);
int DLLEXPORT EN_setpremisevalue(EN_ProjectHandle ph, int indexRule, int indexPremise, EN_API_FLOAT_TYPE value);
int DLLEXPORT EN_gettrueaction(EN_ProjectHandle ph, int indexRule, int indexAction, int *indexLink, int *status, EN_API_FLOAT_TYPE *setting);
int DLLEXPORT EN_settrueaction(EN_ProjectHandle ph, int indexRule, int indexAction, int indexLink, int status, EN_API_FLOAT_TYPE setting);
int DLLEXPORT EN_getfalseaction(EN_ProjectHandle ph, int indexRule, int indexAction, int *indexLink, int *status, EN_API_FLOAT_TYPE *setting);
int DLLEXPORT EN_setfalseaction(EN_ProjectHandle ph, int indexRule, int indexAction, int indexLink, int status, EN_API_FLOAT_TYPE setting);
int DLLEXPORT EN_getruleID(EN_ProjectHandle ph, int indexRule, char* id);
int DLLEXPORT EN_getrule(EN_ProjectHandle ph, int index, int *nPremises,
int *nThenActions, int *nElseActions, EN_API_FLOAT_TYPE *priority);
int DLLEXPORT EN_setrulepriority(EN_ProjectHandle ph, int index,
EN_API_FLOAT_TYPE priority);
int DLLEXPORT EN_getpremise(EN_ProjectHandle ph, int ruleIndex, int premiseIndex,
int *logop, int *object, int *objIndex, int *variable, int *relop,
int *status, EN_API_FLOAT_TYPE *value);
int DLLEXPORT EN_setpremise(EN_ProjectHandle ph, int ruleIndex, int premiseIndex,
int logop, int object, int objIndex, int variable, int relop,
int status, EN_API_FLOAT_TYPE value);
int DLLEXPORT EN_setpremiseindex(EN_ProjectHandle ph, int ruleIndex,
int premiseIndex, int objIndex);
int DLLEXPORT EN_setpremisestatus(EN_ProjectHandle ph, int ruleIndex,
int premiseIndex, int status);
int DLLEXPORT EN_setpremisevalue(EN_ProjectHandle ph, int ruleIndex,
int premiseIndex, EN_API_FLOAT_TYPE value);
int DLLEXPORT EN_getthenaction(EN_ProjectHandle ph, int ruleIndex,
int actionIndex, int *linkIndex, int *status,
EN_API_FLOAT_TYPE *setting);
int DLLEXPORT EN_setthenaction(EN_ProjectHandle ph, int ruleIndex,
int actionIndex, int linkIndex, int status,
EN_API_FLOAT_TYPE setting);
int DLLEXPORT EN_getelseaction(EN_ProjectHandle ph, int ruleIndex,
int actionIndex, int *linkIndex, int *status,
EN_API_FLOAT_TYPE *setting);
int DLLEXPORT EN_setelseaction(EN_ProjectHandle ph, int ruleIndex,
int actionIndex, int linkIndex, int status,
EN_API_FLOAT_TYPE setting);
int DLLEXPORT EN_getruleID(EN_ProjectHandle ph, int index, char* id);
int DLLEXPORT EN_addnode(EN_ProjectHandle ph, char *id, EN_NodeType nodeType);
int DLLEXPORT EN_addlink(EN_ProjectHandle ph, char *id, EN_LinkType linkType, char *fromNode, char *toNode);
int DLLEXPORT EN_deletenode(EN_ProjectHandle ph, int nodeIndex);
int DLLEXPORT EN_deletelink(EN_ProjectHandle ph, int linkIndex);
int DLLEXPORT EN_deletecontrol(EN_ProjectHandle ph, int controlIndex);
int DLLEXPORT EN_addlink(EN_ProjectHandle ph, char *id, EN_LinkType linkType,
char *fromNode, char *toNode);
int DLLEXPORT EN_addrule(EN_ProjectHandle ph, char *rule);
int DLLEXPORT EN_deletenode(EN_ProjectHandle ph, int index, int actionCode);
int DLLEXPORT EN_deletelink(EN_ProjectHandle ph, int index, int actionCode);
int DLLEXPORT EN_deletecontrol(EN_ProjectHandle ph, int index);
int DLLEXPORT EN_deleterule(EN_ProjectHandle ph, int index);
#if defined(__cplusplus)
}

View File

@@ -176,6 +176,9 @@ Public Const EN_E_CURVE = 2 ' efficiency curve
Public Const EN_H_CURVE = 3 ' head loss curve
Public Const EN_G_CURVE = 4 ' General\default curve
Public Const EN_UNCONDITIONAL = 0 ' Unconditional object deletion
Public Const EN_CONDITIONAL = 1 ' Conditional object deletion
'These are the external functions that comprise the DLL
'System Functions
@@ -296,6 +299,8 @@ Public Const EN_G_CURVE = 4 ' General\default curve
Declare Function ENsetcontrol Lib "epanet2.dll" (ByVal Cindex As Int32, ByVal CtlType As Int32, ByVal Lindex As Int32, ByVal Setting As Single, ByVal Nindex As Int32, ByVal Level As Single) As Int32
'Rule-Based Control Functions
Declare Function ENaddrule Lib "epanet2.dll" (ByVal rule As String) as Int32
Declare Function ENdeleterule Lib "epanet2.dll" (ByVal index As Int32) As Int32
Declare Function ENgetrule Lib "epanet2.dll" (ByVal index As Int32, ByRef nPremises As Int32, ByRef nTrueActions As Int32, ByRef nFalseActions As Int32, ByRef priority As Single) As Int32
Declare Function ENgetruleID Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal id As StringBuilder) As Int32
Declare Function ENsetrulepriority Lib "epanet2.dll" (ByVal index As Int32, ByVal priority As Single) As Int32
@@ -304,9 +309,9 @@ Public Const EN_G_CURVE = 4 ' General\default curve
Declare Function ENsetpremiseindex Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexPremise As Int32, ByVal indexObj As Int32) As Int32
Declare Function ENsetpremisestatus Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexPremise As Int32, ByVal status As Int32) As Int32
Declare Function ENsetpremisevalue Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexPremise As Int32, ByVal value As Single) As Int32
Declare Function ENgettrueaction Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexAction As Int32, ByRef indexLink As Int32, ByRef status As Int32, ByRef setting As Single) As Int32
Declare Function ENsettrueaction Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexAction As Int32, ByVal indexLink As Int32, ByVal status As Int32, ByVal setting As Single) As Int32
Declare Function ENgetfalseaction Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexAction As Int32, ByRef indexLink As Int32, ByRef status As Int32, ByRef setting As Single) As Int32
Declare Function ENsetfalseaction Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexAction As Int32, ByVal indexLink As Int32, ByVal status As Int32, ByVal setting As Single) As Int32
Declare Function ENgetthenaction Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexAction As Int32, ByRef indexLink As Int32, ByRef status As Int32, ByRef setting As Single) As Int32
Declare Function ENsetthenaction Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexAction As Int32, ByVal indexLink As Int32, ByVal status As Int32, ByVal setting As Single) As Int32
Declare Function ENgetelseaction Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexAction As Int32, ByRef indexLink As Int32, ByRef status As Int32, ByRef setting As Single) As Int32
Declare Function ENsetelseaction Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexAction As Int32, ByVal indexLink As Int32, ByVal status As Int32, ByVal setting As Single) As Int32
End Module

File diff suppressed because it is too large Load Diff

View File

@@ -25,7 +25,7 @@ DAT(208,ENERR_SPEC_UNDEF_NODE,"undefined Node")
DAT(209,ENERR_ILLEGAL_VAL_NODE,"illegal value for Node")
DAT(210,ENERR_SPEC_UNDEF_LINK,"specified for undefined Link")
DAT(211,ENERR_ILLEGAL_VAL_LINK,"illegal value for Link")
DAT(212,ENERR_TRACE_NODE,"trace node")
DAT(212,ENERR_TRACE_NODE,"invalid trace node")
DAT(213,ENERR_ILLEGAL_OPT,"illegal option value in section")
DAT(214,ENERR_TOO_MANY_CHAR,"following line of section contains too many characters")
DAT(215,ENERR_DUPLICATE_ID,"duplicate ID")
@@ -33,6 +33,7 @@ DAT(216,ENERR_UNDEF_PUMP,"data specified for undefined Pump")
DAT(217,ENERR_INVALID_DATA_PUMP,"invalid data for Pump")
DAT(219,ENERR_ILLEGAL_CON_TANK,"illegally connected to a tank")
DAT(220,ENERR_ILLEGAL_CON_VALVE,"illegally connected to another valve")
DAT(221,ENERR_RULE_CLAUSE, "mis-placed rule clause")
DAT(222,ENERR_SAME_START_END,"same start and end nodes")
@@ -48,12 +49,15 @@ DAT(241,ENERR_UNDEF_CONTROL,"refers to undefined control")
DAT(250,ENERR_INVALID_FORMAT,"function call contains invalid format")
DAT(251,ENERR_INVALID_CODE,"function call contains invalid parameter code")
DAT(253,ENERR_NO_DEMAND_CAT,"Function call error - No such demand category index")
DAT(254,ENERR_NO_COORDS,"Function call error - Node have no coordinates")
DAT(255,ENERR_COORDS_NOT_LOADED,"Function call error - Coordinates were not loaded")
DAT(253,ENERR_NO_DEMAND_CAT,"function applied to nonexistent demand category")
DAT(254,ENERR_NO_COORDS,"function applied to node with no coordinates")
DAT(255,ENERR_COORDS_NOT_LOADED,"function fails because no node coordinates were supplied")
DAT(257,ENERR_NO_RULE,"rule does not exist")
DAT(258,ENERR_NO_CONDITION_ACTION,"condition or action index specified in rule does not exist")
DAT(257,ENERR_NO_RULE,"function applied to nonexistent rule")
DAT(258,ENERR_NO_CONDITION_ACTION,"function applied to nonexistent rule clause")
DAT(260,ENERR_DEL_TRACE_NODE,"cannot delete node assigned as a Trace Node")
DAT(261,ENERR_DEL_NODE_LINK, "cannot delete a node or link contained in a control")
DAT(301,ENERR_FILES_ARE_SAME,"identical file names")
DAT(302,ENERR_CANT_OPEN_INP,"cannot open input file")

View File

@@ -29,8 +29,6 @@ AUTHOR: L. Rossman
#ifndef FUNCS_H
#define FUNCS_H
#include "types.h"
void initpointers(EN_Project *pr); /* Initializes pointers */
int allocdata(EN_Project *pr); /* Allocates memory */
void freeTmplist(STmplist *); /* Frees items in linked list */
@@ -41,7 +39,7 @@ int openfiles(EN_Project *pr, const char *,
int openhydfile(EN_Project *pr); /* Opens hydraulics file */
int openoutfile(EN_Project *pr); /* Opens binary output file */
int strcomp(const char *, const char *); /* Compares two strings */
char* getTmpName(EN_Project *p, char* fname); /* Gets temporary file name */
char* getTmpName(char* fname); /* Gets temporary file name */
double interp(int n, double x[], double y[],
double xx); /* Interpolates a data curve */
@@ -118,16 +116,19 @@ void changestatus(EN_Network *net, int, StatType,
double); /* Changes status of a link */
/* -------------- RULES.C --------------*/
void initrules(rules_t *rules); /* Initializes rule base */
void initrules(EN_Project *pr); /* Initializes rule base */
void addrule(parser_data_t *par, char *); /* Adds rule to rule base */
int allocrules(EN_Project *pr); /* Allocates memory for rule */
void adjustrules(EN_Project *pr, int, int); // Shifts object indices down
void adjusttankrules(EN_Project *pr); // Shifts tank indices up
int ruledata(EN_Project *pr); /* Processes rule input data */
int checkrules(EN_Project *pr, long); /* Checks all rules */
void freerules(EN_Project *pr); /* Frees rule base memory */
int writeRuleinInp(EN_Project *pr, FILE *f, /* Writes rule to an INP file */
int RuleIdx);
void deleterule(EN_Project *pr, int); // Deletes a rule
void freerules(EN_Project *pr); /* Frees rule base memory */
int writerule(EN_Project *pr, FILE *, int); /* Writes rule to an INP file */
void ruleerrmsg(EN_Project *pr); /* Reports rule parser error */
Spremise *getpremise(Spremise *, int); // Retrieves a rule's premise
Saction *getaction(Saction *, int); // Retrieves a rule's action
/* ------------- REPORT.C --------------*/
int writereport(EN_Project *pr); /* Writes formatted report */
@@ -169,8 +170,8 @@ void setlinksetting(EN_Project *pr, int, double,
int tanktimestep(EN_Project *pr, long *); /* Time till tanks fill/drain */
void getenergy(EN_Project *pr, int, double *,
double *); /* Computes link energy use */
double tankvolume(EN_Project *pr, int,double); /* Finds tank vol. from grade */
double tankgrade(EN_Project *pr, int,double); /* Finds tank grade from vol. */
double tankvolume(EN_Project *pr, int, double); /* Finds tank vol. from grade */
double tankgrade(EN_Project *pr, int, double); /* Finds tank grade from vol. */
/* ----------- HYDSOLVER.C - ----------*/
int hydsolve(EN_Project *pr, int *,double *); /* Solves network equations */

View File

@@ -14,6 +14,7 @@ HYDCOEFFS.C -- hydraulic coefficients for the EPANET Program
#include <stdlib.h>
#endif
#include <math.h>
#include "types.h"
#include "funcs.h"
@@ -82,8 +83,8 @@ void resistcoeff(EN_Project *pr, int k)
// ... Link is a pipe. Compute resistance based on headloss formula.
// Friction factor for D-W formula gets included during head loss
// calculation.
case EN_CVPIPE:
case EN_PIPE:
case CVPIPE:
case PIPE:
e = link->Kc; // Roughness coeff.
d = link->Diam; // Diameter
L = link->Len; // Length
@@ -108,7 +109,7 @@ void resistcoeff(EN_Project *pr, int k)
break;
// ... Link is a pump. Use huge resistance.
case EN_PUMP:
case PUMP:
link->R = CBIG;
break;
@@ -138,25 +139,25 @@ void headlosscoeffs(EN_Project *pr)
{
switch (net->Link[k].Type)
{
case EN_CVPIPE:
case EN_PIPE:
case CVPIPE:
case PIPE:
pipecoeff(pr, k);
break;
case EN_PUMP:
case PUMP:
pumpcoeff(pr, k);
break;
case EN_PBV:
case PBV:
pbvcoeff(pr, k);
break;
case EN_TCV:
case TCV:
tcvcoeff(pr, k);
break;
case EN_GPV:
case GPV:
gpvcoeff(pr, k);
break;
case EN_FCV:
case EN_PRV:
case EN_PSV:
case FCV:
case PRV:
case PSV:
if (hyd->LinkSetting[k] == MISSING) valvecoeff(pr, k);
else hyd->solver.P[k] = 0.0;
}
@@ -317,13 +318,13 @@ void valvecoeffs(EN_Project *pr)
// Call valve-specific function
switch (link->Type)
{
case EN_PRV:
case PRV:
prvcoeff(pr, k, n1, n2);
break;
case EN_PSV:
case PSV:
psvcoeff(pr, k, n1, n2);
break;
case EN_FCV:
case FCV:
fcvcoeff(pr, k, n1, n2);
break;
default: continue;

View File

@@ -54,9 +54,10 @@ AUTHOR: L. Rossman
#include <stdlib.h>
#endif
#include <math.h>
#include "text.h"
#include "types.h"
#include "funcs.h"
#include "text.h"
#define QZERO 1.e-6 /* Equivalent to zero flow */
@@ -146,8 +147,8 @@ void inithyd(EN_Project *pr, int initflag)
/* Start active control valves in ACTIVE position */
if (
(link->Type == EN_PRV || link->Type == EN_PSV
|| link->Type == EN_FCV) && (link->Kc != MISSING)
(link->Type == PRV || link->Type == PSV
|| link->Type == FCV) && (link->Kc != MISSING)
) hyd->LinkStatus[i] = ACTIVE;
/*** Updated 3/1/01 ***/
@@ -391,7 +392,7 @@ void initlinkflow(EN_Project *pr, int i, char s, double k)
if (s == CLOSED) {
hyd->LinkFlows[i] = QZERO;
}
else if (link->Type == EN_PUMP) {
else if (link->Type == PUMP) {
hyd->LinkFlows[i] = k * n->Pump[findpump(n,i)].Q0;
}
else {
@@ -421,8 +422,8 @@ void setlinkflow(EN_Project *pr, int k, double dh)
switch (link->Type)
{
case EN_CVPIPE:
case EN_PIPE:
case CVPIPE:
case PIPE:
/* For Darcy-Weisbach formula: */
/* use approx. inverse of formula. */
@@ -447,7 +448,7 @@ void setlinkflow(EN_Project *pr, int k, double dh)
break;
case EN_PUMP:
case PUMP:
/* Convert headloss to pump head gain */
dh = -dh;
@@ -492,15 +493,15 @@ void setlinkstatus(EN_Project *pr, int index, char value, StatType *s, double *
{
EN_Network *net = &pr->network;
Slink *link = &net->Link[index];
EN_LinkType t = link->Type;
LinkType t = link->Type;
/* Status set to open */
if (value == 1) {
/* Adjust link setting for pumps & valves */
if (t == EN_PUMP) {
if (t == PUMP) {
*k = 1.0;
}
if (t > EN_PUMP && t != EN_GPV) {
if (t > PUMP && t != GPV) {
*k = MISSING;
}
/* Reset link flow if it was originally closed */
@@ -510,10 +511,10 @@ void setlinkstatus(EN_Project *pr, int index, char value, StatType *s, double *
/* Status set to closed */
else if (value == 0) {
/* Adjust link setting for pumps & valves */
if (t == EN_PUMP) {
if (t == PUMP) {
*k = 0.0;
}
if (t > EN_PUMP && t != EN_GPV) {
if (t > PUMP && t != GPV) {
*k = MISSING;
}
/* Reset link flow if it was originally open */
@@ -536,10 +537,10 @@ void setlinksetting(EN_Project *pr, int index, double value, StatType *s, doubl
{
EN_Network *net = &pr->network;
Slink *link = &net->Link[index];
EN_LinkType t = link->Type;
LinkType t = link->Type;
/* For a pump, status is OPEN if speed > 0, CLOSED otherwise */
if (t == EN_PUMP)
if (t == PUMP)
{
*k = value;
if (value > 0 && *s <= CLOSED) {
@@ -551,7 +552,7 @@ void setlinksetting(EN_Project *pr, int index, double value, StatType *s, doubl
}
/* For FCV, activate it */
else if (t == EN_FCV) {
else if (t == FCV) {
*k = value;
*s = ACTIVE;
}
@@ -709,7 +710,7 @@ int controls(EN_Project *pr)
s2 = control->Status;
k1 = hyd->LinkSetting[k];
k2 = k1;
if (link->Type > EN_PIPE) {
if (link->Type > PIPE) {
k2 = control->Setting;
}
if (s1 != s2 || k1 != k2) {
@@ -891,7 +892,7 @@ void controltimestep(EN_Project *pr, long *tstep)
/* Check if rule actually changes link status or setting */
k = control->Link;
link = &net->Link[k];
if ( (link->Type > EN_PIPE && hyd->LinkSetting[k] != control->Setting)
if ( (link->Type > PIPE && hyd->LinkSetting[k] != control->Setting)
|| (hyd->LinkStatus[k] != control->Status) ) {
*tstep = t;
}
@@ -1103,7 +1104,7 @@ void getenergy(EN_Project *pr, int k, double *kw, double *eff)
dh = ABS(hyd->NodeHead[link->N1] - hyd->NodeHead[link->N2]);
/* For pumps, find effic. at current flow */
if (link->Type == EN_PUMP)
if (link->Type == PUMP)
{
j = findpump(net,k);
e = hyd->Epump;

View File

@@ -18,9 +18,10 @@ The solver implements Todini's Global Gradient Algorithm.
#include <stdlib.h>
#endif
#include <math.h>
#include "text.h"
#include "types.h"
#include "funcs.h"
#include "text.h"
// Hydraulic balance error for network being analyzed
typedef struct {
@@ -241,7 +242,7 @@ int badvalve(EN_Project *pr, int n)
report_options_t *rep = &pr->report;
time_options_t *time = &pr->time_options;
Slink *link;
EN_LinkType t;
LinkType t;
for (i = 1; i <= net->Nvalves; i++)
{
@@ -252,7 +253,7 @@ int badvalve(EN_Project *pr, int n)
if (n == n1 || n == n2)
{
t = link->Type;
if (t == EN_PRV || t == EN_PSV || t == EN_FCV)
if (t == PRV || t == PSV || t == FCV)
{
if (hyd->LinkStatus[k] == ACTIVE)
{
@@ -261,7 +262,7 @@ int badvalve(EN_Project *pr, int n)
sprintf(pr->Msg, FMT61, clocktime(rep->Atime, time->Htime), link->ID);
writeline(pr, pr->Msg);
}
if (link->Type == EN_FCV)
if (link->Type == FCV)
{
hyd->LinkStatus[k] = XFCV;
}
@@ -332,15 +333,15 @@ int pswitch(EN_Project *pr)
link = &net->Link[k];
change = 0;
s = hyd->LinkStatus[k];
if (link->Type == EN_PIPE)
if (link->Type == PIPE)
{
if (s != net->Control[i].Status) change = 1;
}
if (link->Type == EN_PUMP)
if (link->Type == PUMP)
{
if (hyd->LinkSetting[k] != net->Control[i].Setting) change = 1;
}
if (link->Type >= EN_PRV)
if (link->Type >= PRV)
{
if (hyd->LinkSetting[k] != net->Control[i].Setting) change = 1;
else if (hyd->LinkSetting[k] == MISSING && s != net->Control[i].Status)
@@ -353,7 +354,7 @@ int pswitch(EN_Project *pr)
if (change)
{
hyd->LinkStatus[k] = net->Control[i].Status;
if (link->Type > EN_PIPE)
if (link->Type > PIPE)
{
hyd->LinkSetting[k] = net->Control[i].Setting;
}
@@ -450,7 +451,7 @@ void newlinkflows(EN_Project *pr, Hydbalance *hbal, double *qsum, double *dqsum
dq *= hyd->RelaxFactor;
// Prevent flow in constant HP pumps from going negative
if (link->Type == EN_PUMP)
if (link->Type == PUMP)
{
n = findpump(net, k);
if (net->Pump[n].Ptype == CONST_HP && dq > hyd->LinkFlows[k])

View File

@@ -63,12 +63,12 @@ int valvestatus(EN_Project *pr)
// Evaluate valve's new status
switch (link->Type)
{
case EN_PRV:
case PRV:
hset = net->Node[n2].El + hyd->LinkSetting[k];
hyd->LinkStatus[k] = prvstatus(pr, k, status, hset,
hyd->NodeHead[n1], hyd->NodeHead[n2]);
break;
case EN_PSV:
case PSV:
hset = net->Node[n1].El + hyd->LinkSetting[k];
hyd->LinkStatus[k] = psvstatus(pr, k, status, hset,
hyd->NodeHead[n1], hyd->NodeHead[n2]);
@@ -129,19 +129,19 @@ int linkstatus(EN_Project *pr)
}
// Check for status changes in CVs and pumps
if (link->Type == EN_CVPIPE)
if (link->Type == CVPIPE)
{
hyd->LinkStatus[k] = cvstatus(pr, hyd->LinkStatus[k], dh,
hyd->LinkFlows[k]);
}
if (link->Type == EN_PUMP && hyd->LinkStatus[k] >= OPEN &&
if (link->Type == PUMP && hyd->LinkStatus[k] >= OPEN &&
hyd->LinkSetting[k] > 0.0)
{
hyd->LinkStatus[k] = pumpstatus(pr, k, -dh);
}
// Check for status changes in non-fixed FCVs
if (link->Type == EN_FCV && hyd->LinkSetting[k] != MISSING)
if (link->Type == FCV && hyd->LinkSetting[k] != MISSING)
{
hyd->LinkStatus[k] = fcvstatus(pr, k, status, hyd->NodeHead[n1],
hyd->NodeHead[n2]);
@@ -430,7 +430,7 @@ void tankstatus(EN_Project *pr, int k, int n1, int n2)
if (hyd->NodeHead[n1] >= tank->Hmax - hyd->Htol)
{
// Case 1: Link is a pump discharging into tank
if (link->Type == EN_PUMP)
if (link->Type == PUMP)
{
if (link->N2 == n1) hyd->LinkStatus[k] = TEMPCLOSED;
}
@@ -447,7 +447,7 @@ void tankstatus(EN_Project *pr, int k, int n1, int n2)
if (hyd->NodeHead[n1] <= tank->Hmin + hyd->Htol)
{
// Case 1: Link is a pump discharging from tank
if (link->Type == EN_PUMP)
if (link->Type == PUMP)
{
if (link->N1 == n1) hyd->LinkStatus[k] = TEMPCLOSED;
}

View File

@@ -26,14 +26,12 @@ data describing a piping network to a file in EPANET's text format.
#else
#include <stdlib.h>
#endif
#include <math.h>
#include "hash.h"
#include "text.h"
#include "types.h"
#include "funcs.h"
#include <math.h>
//#define EXTERN extern
//#include "vars.h"
#include "hash.h"
#include "text.h"
/* Defined in enumstxt.h in EPANET.C */
extern char *LinkTxt[];
@@ -216,7 +214,7 @@ int saveinpfile(EN_Project *pr, const char *fname)
fprintf(f, s_PIPES);
for (i = 1; i <= net->Nlinks; i++) {
link = &net->Link[i];
if (link->Type <= EN_PIPE) {
if (link->Type <= PIPE) {
d = link->Diam;
kc = link->Kc;
if (hyd->Formflag == DW)
@@ -229,7 +227,7 @@ int saveinpfile(EN_Project *pr, const char *fname)
sprintf(s1, "%12.4f %12.4f", kc, km);
else
sprintf(s1, "%12.4f %12.4f", kc, km);
if (link->Type == EN_CVPIPE)
if (link->Type == CVPIPE)
sprintf(s2, "CV");
else if (link->Stat == CLOSED)
sprintf(s2, "CLOSED");
@@ -295,12 +293,12 @@ int saveinpfile(EN_Project *pr, const char *fname)
if (kc == MISSING)
kc = 0.0;
switch (link->Type) {
case EN_FCV:
case FCV:
kc *= pr->Ucf[FLOW];
break;
case EN_PRV:
case EN_PSV:
case EN_PBV:
case PRV:
case PSV:
case PBV:
kc *= pr->Ucf[PRESSURE];
break;
default:
@@ -312,7 +310,7 @@ int saveinpfile(EN_Project *pr, const char *fname)
sprintf(s, " %-31s %-31s %-31s %12.4f %5s", link->ID, net->Node[link->N1].ID,
net->Node[link->N2].ID, d * pr->Ucf[DIAM], LinkTxt[link->Type]);
if (link->Type == EN_GPV && (j = ROUND(link->Kc)) > 0)
if (link->Type == GPV && (j = ROUND(link->Kc)) > 0)
sprintf(s1, "%-31s %12.4f", net->Curve[j].ID, km);
else
sprintf(s1, "%12.4f %12.4f", kc, km);
@@ -355,12 +353,12 @@ int saveinpfile(EN_Project *pr, const char *fname)
fprintf(f, s_STATUS);
for (i = 1; i <= net->Nlinks; i++) {
link = &net->Link[i];
if (link->Type <= EN_PUMP) {
if (link->Type <= PUMP) {
if (link->Stat == CLOSED)
fprintf(f, "\n %-31s %s", link->ID, StatTxt[CLOSED]);
/* Write pump speed here for pumps with old-style pump curve input */
else if (link->Type == EN_PUMP) {
else if (link->Type == PUMP) {
n = findpump(net, i);
pump = &net->Pump[n];
if (pump->Hcurve == 0 && pump->Ptype != CONST_HP &&
@@ -419,12 +417,12 @@ int saveinpfile(EN_Project *pr, const char *fname)
else {
kc = control->Setting;
switch (link->Type) {
case EN_PRV:
case EN_PSV:
case EN_PBV:
case PRV:
case PSV:
case PBV:
kc *= pr->Ucf[PRESSURE];
break;
case EN_FCV:
case FCV:
kc *= pr->Ucf[FLOW];
break;
default:
@@ -467,8 +465,8 @@ int saveinpfile(EN_Project *pr, const char *fname)
fprintf(f, "\n\n");
fprintf(f, s_RULES);
for (i = 1; i <= net->Nrules; i++) {
fprintf(f, "\nRULE %s", pr->rules.Rule[i].label);
errcode = writeRuleinInp(pr, f, i);
fprintf(f, "\nRULE %s", pr->network.Rule[i].label);
errcode = writerule(pr, f, i);
fprintf(f, "\n");
}
@@ -528,7 +526,7 @@ int saveinpfile(EN_Project *pr, const char *fname)
fprintf(f, "\n ROUGHNESS CORRELATION %-.6f", qu->Rfactor);
for (i = 1; i <= net->Nlinks; i++) {
link = &net->Link[i];
if (link->Type > EN_PIPE)
if (link->Type > PIPE)
continue;
if (link->Kb != qu->Kbulk)
fprintf(f, "\n BULK %-31s %-.6f", link->ID, link->Kb * SECperDAY);

View File

@@ -27,11 +27,11 @@ AUTHOR: L. Rossman
#ifndef __APPLE__
#include <malloc.h>
#endif
#include "types.h"
#include "funcs.h"
#include "hash.h"
#include "text.h"
#include "types.h"
#include "epanet2.h"
#include "funcs.h"
#include <math.h>
/*
@@ -107,8 +107,6 @@ void setdefaults(EN_Project *pr)
strncpy(pr->Title[0], "", TITLELEN);
strncpy(pr->Title[1], "", TITLELEN);
strncpy(pr->Title[2], "", TITLELEN);
strncpy(out->TmpDir, "", MAXFNAME);
strncpy(out->TmpFname, "", MAXFNAME);
strncpy(out->HydFname, "", MAXFNAME);
strncpy(pr->MapFname, "", MAXFNAME);
strncpy(qu->ChemName, t_CHEMICAL, MAXID);
@@ -324,7 +322,7 @@ void adjustdata(EN_Project *pr)
/* See if default reaction coeffs. apply */
for (i = 1; i <= net->Nlinks; i++) {
Slink *link = &net->Link[i];
if (link->Type > EN_PIPE)
if (link->Type > PIPE)
continue;
if (link->Kb == MISSING)
link->Kb = qu->Kbulk; /* Bulk coeff. */
@@ -406,9 +404,8 @@ int inittanks(EN_Project *pr)
/* Report error in levels if found */
if (levelerr) {
char errMsg[MAXMSG+1];
EN_geterror(225, errMsg, MAXMSG);
sprintf(pr->Msg, "%s node: %s", errMsg, net->Node[tank->Node].ID);
sprintf(pr->Msg, "%s node: %s", geterrmsg(225, pr->Msg),
net->Node[tank->Node].ID);
writeline(pr, pr->Msg);
errcode = 200;
}
@@ -629,7 +626,7 @@ void convertunits(EN_Project *pr)
/* Convert units of link parameters */
for (k = 1; k <= net->Nlinks; k++) {
link = &net->Link[k];
if (link->Type <= EN_PIPE) {
if (link->Type <= PIPE) {
/* Convert pipe parameter units: */
/* - for Darcy-Weisbach formula, convert roughness */
/* from millifeet (or mm) to ft (or m) */
@@ -647,7 +644,7 @@ void convertunits(EN_Project *pr)
link->Kw /= SECperDAY;
}
else if (link->Type == EN_PUMP) {
else if (link->Type == PUMP) {
/* Convert units for pump curve parameters */
i = findpump(net, k);
pump = &net->Pump[i];
@@ -676,12 +673,12 @@ void convertunits(EN_Project *pr)
link->Km = 0.02517 * link->Km / SQR(link->Diam) / SQR(link->Diam);
if (link->Kc != MISSING)
switch (link->Type) {
case EN_FCV:
case FCV:
link->Kc /= pr->Ucf[FLOW];
break;
case EN_PRV:
case EN_PSV:
case EN_PBV:
case PRV:
case PSV:
case PBV:
link->Kc /= pr->Ucf[PRESSURE];
break;
default:
@@ -716,12 +713,12 @@ void convertunits(EN_Project *pr)
/* Convert units on valve settings */
if (control->Setting != MISSING) {
switch (link->Type) {
case EN_PRV:
case EN_PSV:
case EN_PBV:
case PRV:
case PSV:
case PBV:
control->Setting /= pr->Ucf[PRESSURE];
break;
case EN_FCV:
case FCV:
control->Setting /= pr->Ucf[FLOW];
default:
break;

View File

@@ -31,12 +31,12 @@ The following utility functions are all called from INPUT3.C
#ifndef __APPLE__
#include <malloc.h>
#endif
#include <math.h>
#include "types.h"
#include "funcs.h"
#include "hash.h"
#include "text.h"
#include "types.h"
#include "epanet2.h"
#include "funcs.h"
#include <math.h>
#define MAXERRS 10 /* Max. input errors reported */
@@ -206,9 +206,6 @@ int readdata(EN_Project *pr)
/* Check if max. length exceeded */
if (strlen(line) >= MAXLINE) {
// char errMsg[MAXMSG+1];
// EN_geterror(214, errMsg, MAXMSG);
// sprintf(pr->Msg, "%s section: %s", errMsg, SectTxt[sect]);
sprintf(pr->Msg, "%s section: %s", geterrmsg(214, pr->Msg), SectTxt[sect]);
writeline(pr, pr->Msg);
writeline(pr, line);
@@ -317,7 +314,12 @@ int newline(EN_Project *pr, int sect, char *line)
case _CONTROLS:
return (controldata(pr));
case _RULES:
return (ruledata(pr)); /* See RULES.C */
if (ruledata(pr) > 0)
{
ruleerrmsg(pr);
return 200;
}
else return 0;
case _SOURCES:
return (sourcedata(pr));
case _EMITTERS:

View File

@@ -26,12 +26,12 @@ All functions in this module are called from newline() in INPUT2.C.
#ifndef __APPLE__
#include <malloc.h>
#endif
#include "epanet2.h"
#include <math.h>
#include "types.h"
#include "funcs.h"
#include "hash.h"
#include "text.h"
#include "types.h"
#include <math.h>
/* Defined in enumstxt.h in EPANET.C */
extern char *MixTxt[];
@@ -98,7 +98,7 @@ int juncdata(EN_Project *pr)
node->S = NULL;
node->Ke = 0.0;
node->Rpt = 0;
node->Type = EN_JUNCTION;
node->Type = JUNCTION;
strcpy(node->Comment, par->Comment);
@@ -214,7 +214,7 @@ int tankdata(EN_Project *pr)
node->C0 = 0.0; /* Init. quality. */
node->S = NULL; /* WQ source data */
node->Ke = 0.0; /* Emitter coeff. */
node->Type = (diam == 0) ? EN_RESERVOIR : EN_TANK;
node->Type = (diam == 0) ? RESERVOIR : TANK;
strcpy(node->Comment, par->Comment);
tank->Node = i; /* Node index. */
tank->H0 = initlevel; /* Init. level. */
@@ -258,7 +258,7 @@ int pipedata(EN_Project *pr)
int j1, /* Start-node index */
j2, /* End-node index */
n; /* # data items */
EN_LinkType type = EN_PIPE; /* Link type */
LinkType type = PIPE; /* Link type */
StatType status = OPEN; /* Link status */
double length, /* Link length */
diam, /* Link diameter */
@@ -298,7 +298,7 @@ int pipedata(EN_Project *pr)
/* Case where either loss coeff. or status supplied */
if (n == 7) {
if (match(par->Tok[6], w_CV))
type = EN_CVPIPE;
type = CVPIPE;
else if (match(par->Tok[6], w_CLOSED))
status = CLOSED;
else if (match(par->Tok[6], w_OPEN))
@@ -312,7 +312,7 @@ int pipedata(EN_Project *pr)
if (!getfloat(par->Tok[6], &lcoeff))
return (202);
if (match(par->Tok[7], w_CV))
type = EN_CVPIPE;
type = CVPIPE;
else if (match(par->Tok[7], w_CLOSED))
status = CLOSED;
else if (match(par->Tok[7], w_OPEN))
@@ -401,7 +401,7 @@ int pumpdata(EN_Project *pr)
link->Km = 0.0; /* Horsepower. */
link->Kb = 0.0;
link->Kw = 0.0;
link->Type = EN_PUMP; /* Link type. */
link->Type = PUMP; /* Link type. */
link->Stat = OPEN; /* Link status. */
link->Rpt = 0; /* Report flag. */
strcpy(link->Comment, par->Comment);
@@ -514,24 +514,24 @@ int valvedata(EN_Project *pr)
return (222);
if (match(par->Tok[4], w_PRV))
type = EN_PRV;
type = PRV;
else if (match(par->Tok[4], w_PSV))
type = EN_PSV;
type = PSV;
else if (match(par->Tok[4], w_PBV))
type = EN_PBV;
type = PBV;
else if (match(par->Tok[4], w_FCV))
type = EN_FCV;
type = FCV;
else if (match(par->Tok[4], w_TCV))
type = EN_TCV;
type = TCV;
else if (match(par->Tok[4], w_GPV))
type = EN_GPV;
type = GPV;
else
return (201); /* Illegal valve type.*/
if (!getfloat(par->Tok[3], &diam))
return (202);
if (diam <= 0.0)
return (202); /* Illegal diameter.*/
if (type == EN_GPV) { /* Headloss curve for GPV */
if (type == GPV) { /* Headloss curve for GPV */
t = findID(par->Tok[5], par->Curvelist);
if (t == NULL) {
return (206);
@@ -549,7 +549,7 @@ int valvedata(EN_Project *pr)
/* Check that PRV, PSV, or FCV not connected to a tank & */
/* check for illegal connections between pairs of valves.*/
if ((j1 > net->Njuncs || j2 > net->Njuncs) &&
(type == EN_PRV || type == EN_PSV || type == EN_FCV))
(type == PRV || type == PSV || type == FCV))
return (219);
if (!valvecheck(pr, type, j1, j2))
return (220);
@@ -820,7 +820,7 @@ int controldata(EN_Project *pr)
n; /* # data items */
StatType status = ACTIVE; /* Link status */
ControlType c_type; /* control type */
EN_LinkType l_type; /* Link Type */
LinkType l_type; /* Link Type */
double setting = MISSING, /* Link setting */
time = 0.0, /* Simulation time */
level = 0.0; /* Pressure or tank level */
@@ -836,24 +836,24 @@ int controldata(EN_Project *pr)
if (k == 0)
return (204);
l_type = net->Link[k].Type;
if (l_type == EN_CVPIPE) {
if (l_type == CVPIPE) {
return (207); /* Cannot control check valve. */
}
/*** Updated 9/7/00 ***/
/* Parse control setting into a status level or numerical setting. */
if (match(par->Tok[2], w_OPEN)) {
status = OPEN;
if (l_type == EN_PUMP)
if (l_type == PUMP)
setting = 1.0;
if (l_type == EN_GPV)
if (l_type == GPV)
setting = net->Link[k].Kc;
} else if (match(par->Tok[2], w_CLOSED)) {
status = CLOSED;
if (l_type == EN_PUMP)
if (l_type == PUMP)
setting = 0.0;
if (l_type == EN_GPV)
if (l_type == GPV)
setting = net->Link[k].Kc;
} else if (l_type == EN_GPV) {
} else if (l_type == GPV) {
return (206);
} else if (!getfloat(par->Tok[2], &setting)) {
return (202);
@@ -863,7 +863,7 @@ int controldata(EN_Project *pr)
/* Set status for pump in case speed setting was supplied */
/* or for pipe if numerical setting was supplied */
if (l_type == EN_PUMP || l_type == EN_PIPE) {
if (l_type == PUMP || l_type == PIPE) {
if (setting != MISSING) {
if (setting < 0.0)
return (202);
@@ -1321,12 +1321,12 @@ int statusdata(EN_Project *pr)
if ((j = findlink(net, par->Tok[0])) == 0)
return (0);
/* Cannot change status of a Check Valve */
if (net->Link[j].Type == EN_CVPIPE)
if (net->Link[j].Type == CVPIPE)
return (211);
/*** Updated 9/7/00 ***/
/* Cannot change setting for a GPV */
if (net->Link[j].Type == EN_GPV && status == ACTIVE)
if (net->Link[j].Type == GPV && status == ACTIVE)
return (211);
changestatus(net, j, status, y);
@@ -1398,7 +1398,7 @@ int energydata(EN_Project *pr)
k = findlink(net,par->Tok[1]); /* Check that pump exists */
if (k == 0)
return (216);
if (Link[k].Type != EN_PUMP)
if (Link[k].Type != PUMP)
return (216);
j = findpump(net, k);
} else
@@ -2150,7 +2150,7 @@ int valvecheck(EN_Project *pr, int type, int j1, int j2)
EN_Network *net = &pr->network;
int k, vj1, vj2;
EN_LinkType vtype;
LinkType vtype;
/* Examine each existing valve */
for (k = 1; k <= net->Nvalves; k++) {
@@ -2161,35 +2161,35 @@ int valvecheck(EN_Project *pr, int type, int j1, int j2)
vtype = link->Type;
/* Cannot have two PRVs sharing downstream nodes or in series */
if (vtype == EN_PRV && type == EN_PRV) {
if (vtype == PRV && type == PRV) {
if (vj2 == j2 || vj2 == j1 || vj1 == j2)
return (0);
}
/* Cannot have two PSVs sharing upstream nodes or in series */
if (vtype == EN_PSV && type == EN_PSV) {
if (vtype == PSV && type == PSV) {
if (vj1 == j1 || vj1 == j2 || vj2 == j1)
return (0);
}
/* Cannot have PSV connected to downstream node of PRV */
if (vtype == EN_PSV && type == EN_PRV && vj1 == j2)
if (vtype == PSV && type == PRV && vj1 == j2)
return (0);
if (vtype == EN_PRV && type == EN_PSV && vj2 == j1)
if (vtype == PRV && type == PSV && vj2 == j1)
return (0);
/*** Updated 3/1/01 ***/
/* Cannot have PSV connected to downstream node of FCV */
/* nor have PRV connected to upstream node of FCV */
if (vtype == EN_FCV && type == EN_PSV && vj2 == j1)
if (vtype == FCV && type == PSV && vj2 == j1)
return (0);
if (vtype == EN_FCV && type == EN_PRV && vj1 == j2)
if (vtype == FCV && type == PRV && vj1 == j2)
return (0);
/*** Updated 4/14/05 ***/
if (vtype == EN_PSV && type == EN_FCV && vj1 == j2)
if (vtype == PSV && type == FCV && vj1 == j2)
return (0);
if (vtype == EN_PRV && type == EN_FCV && vj2 == j1)
if (vtype == PRV && type == FCV && vj2 == j1)
return (0);
}
return (1);
@@ -2213,10 +2213,10 @@ void changestatus(EN_Network *net, int j, StatType status, double y)
{
Slink *link = &net->Link[j];
if (link->Type == EN_PIPE || link->Type == EN_GPV) {
if (link->Type == PIPE || link->Type == GPV) {
if (status != ACTIVE)
link->Stat = status;
} else if (link->Type == EN_PUMP) {
} else if (link->Type == PUMP) {
if (status == ACTIVE) {
link->Kc = y;
status = OPEN;
@@ -2226,7 +2226,7 @@ void changestatus(EN_Network *net, int j, StatType status, double y)
link->Kc = 1.0;
}
link->Stat = status;
} else if (link->Type >= EN_PRV) {
} else if (link->Type >= PRV) {
link->Kc = y;
link->Stat = status;
if (status != ACTIVE) {

View File

@@ -19,12 +19,12 @@ AUTHOR: L. Rossman
#else
#include <stdlib.h>
#endif
#include "funcs.h"
#include "text.h"
#include "types.h"
#include <math.h>
#include "types.h"
#include "funcs.h"
#include "hash.h"
#include "text.h"
/* write x[1] to x[n] to file */
size_t f_save(REAL4 *x, int n, FILE *file) {
@@ -139,7 +139,7 @@ int savenetdata(EN_Project *pr)
f_save(x, net->Nlinks, outFile);
for (i = 1; i <= net->Nlinks; i++) {
if (net->Link[i].Type != EN_PUMP)
if (net->Link[i].Type != PUMP)
x[i] = (REAL4)(net->Link[i].Diam * pr->Ucf[DIAM]);
else
x[i] = 0.0f;
@@ -500,7 +500,7 @@ int linkoutput(EN_Project *pr, int j, REAL4 *x, double ucf)
break;
case VELOCITY:
for (i = 1; i <= net->Nlinks; i++) {
if (net->Link[i].Type == EN_PUMP)
if (net->Link[i].Type == PUMP)
x[i] = 0.0f;
else {
q = ABS(hyd->LinkFlows[i]);
@@ -515,9 +515,9 @@ int linkoutput(EN_Project *pr, int j, REAL4 *x, double ucf)
x[i] = 0.0f;
else {
h = hyd->NodeHead[net->Link[i].N1] - hyd->NodeHead[net->Link[i].N2];
if (net->Link[i].Type != EN_PUMP)
if (net->Link[i].Type != PUMP)
h = ABS(h);
if (net->Link[i].Type <= EN_PIPE)
if (net->Link[i].Type <= PIPE)
x[i] = (REAL4)(1000.0 * h / net->Link[i].Len);
else
x[i] = (REAL4)(h * ucf);
@@ -537,22 +537,22 @@ int linkoutput(EN_Project *pr, int j, REAL4 *x, double ucf)
double setting = hyd->LinkSetting[i];
if (setting != MISSING)
switch (net->Link[i].Type) {
case EN_CVPIPE:
case EN_PIPE:
case CVPIPE:
case PIPE:
x[i] = (REAL4)setting;
break;
case EN_PUMP:
case PUMP:
x[i] = (REAL4)setting;
break;
case EN_PRV:
case EN_PSV:
case EN_PBV:
case PRV:
case PSV:
case PBV:
x[i] = (REAL4)(setting * pr->Ucf[PRESSURE]);
break;
case EN_FCV:
case FCV:
x[i] = (REAL4)(setting * pr->Ucf[FLOW]);
break;
case EN_TCV:
case TCV:
x[i] = (REAL4)setting;
break;
default:
@@ -573,7 +573,7 @@ int linkoutput(EN_Project *pr, int j, REAL4 *x, double ucf)
/* u = velocity, g = grav. accel., h = head */
/*loss, d = diam., & L = pipe length */
for (i = 1; i <= net->Nlinks; i++) {
if (net->Link[i].Type <= EN_PIPE && ABS(hyd->LinkFlows[i]) > TINY) {
if (net->Link[i].Type <= PIPE && ABS(hyd->LinkFlows[i]) > TINY) {
h = ABS(hyd->NodeHead[net->Link[i].N1] - hyd->NodeHead[net->Link[i].N2]);
f = 39.725 * h * pow(net->Link[i].Diam, 5) / net->Link[i].Len / SQR(hyd->LinkFlows[i]);
x[i] = (REAL4)f;

View File

@@ -495,7 +495,7 @@ double findsourcequal(EN_Project *pr, int n, double volin, double volout, long t
{
// Concentration Source:
case CONCEN:
if (net->Node[n].Type == EN_JUNCTION)
if (net->Node[n].Type == JUNCTION)
{
// ... source requires a negative demand at the node
if (hyd->NodeDemand[n] < 0.0)

View File

@@ -52,7 +52,7 @@ char setreactflag(EN_Project *pr)
{
for (i = 1; i <= net->Nlinks; i++)
{
if (net->Link[i].Type <= EN_PIPE)
if (net->Link[i].Type <= PIPE)
{
if (net->Link[i].Kb != 0.0 || net->Link[i].Kw != 0.0) return 1;
}
@@ -127,7 +127,7 @@ void reactpipes(EN_Project *pr, long dt)
for (k = 1; k <= net->Nlinks; k++)
{
// Skip non-pipe links (pumps & valves)
if (net->Link[k].Type != EN_PIPE) continue;
if (net->Link[k].Type != PIPE) continue;
rsum = 0.0;
vsum = 0.0;

View File

@@ -94,7 +94,7 @@ void transport(EN_Project *pr, long tstep)
}
// ... if node is a junction, add on any external outflow (e.g., demands)
if (net->Node[n].Type == EN_JUNCTION)
if (net->Node[n].Type == JUNCTION)
{
volout += MAX(0.0, hyd->NodeDemand[n]);
}
@@ -204,7 +204,7 @@ double findnodequal(EN_Project *pr, int n, double volin,
quality_t *qual = &pr->quality;
// Node is a junction - update its water quality
if (net->Node[n].Type == EN_JUNCTION)
if (net->Node[n].Type == JUNCTION)
{
// ... dilute inflow with any external negative demand
volin -= MIN(0.0, hyd->NodeDemand[n]) * tstep;
@@ -217,7 +217,7 @@ double findnodequal(EN_Project *pr, int n, double volin,
}
// Node is a tank - use its mixing model to update its quality
else if (net->Node[n].Type == EN_TANK)
else if (net->Node[n].Type == TANK)
{
qual->NodeQual[n] = mixtank(pr, n, volin, massin, volout);
}
@@ -232,7 +232,7 @@ double findnodequal(EN_Project *pr, int n, double volin,
{
// ... quality added to network is difference between tracer
// concentration (100 mg/L) and current node quality
if (net->Node[n].Type == EN_RESERVOIR) qual->SourceQual = 100.0;
if (net->Node[n].Type == RESERVOIR) qual->SourceQual = 100.0;
else qual->SourceQual = MAX(100.0 - qual->NodeQual[n], 0.0);
qual->NodeQual[n] = 100.0;
}
@@ -246,14 +246,14 @@ double findnodequal(EN_Project *pr, int n, double volin,
// Combine source quality with node quality
switch (net->Node[n].Type)
{
case EN_JUNCTION:
case JUNCTION:
qual->NodeQual[n] += qual->SourceQual;
return qual->NodeQual[n];
case EN_TANK:
case TANK:
return qual->NodeQual[n] + qual->SourceQual;
case EN_RESERVOIR:
case RESERVOIR:
qual->NodeQual[n] = qual->SourceQual;
return qual->SourceQual;
}
@@ -382,21 +382,21 @@ void updatemassbalance(EN_Project *pr, int n, double massin,
switch (net->Node[n].Type)
{
// Junctions lose mass from outflow demand & gain it from source inflow
case EN_JUNCTION:
case JUNCTION:
masslost = MAX(0.0, hyd->NodeDemand[n]) * tstep * qual->NodeQual[n];
massadded = qual->SourceQual * volout;
break;
// Reservoirs add mass from quality source if specified or from a fixed
// initial quality
case EN_RESERVOIR:
case RESERVOIR:
masslost = massin;
if (qual->SourceQual > 0.0) massadded = qual->SourceQual * volout;
else massadded = qual->NodeQual[n] * volout;
break;
// Tanks add mass only from external source inflow
case EN_TANK:
case TANK:
massadded = qual->SourceQual * volout;
break;
}
@@ -664,7 +664,7 @@ void initsegs(EN_Project *pr)
{
qual->FirstSeg[k] = NULL;
qual->LastSeg[k] = NULL;
if (net->Link[k].Type == EN_PIPE)
if (net->Link[k].Type == PIPE)
{
v = LINKVOL(k);
j = net->Link[k].N2;

View File

@@ -32,13 +32,13 @@ formatted string S to the report file.
#else
#include <stdlib.h>
#endif
#include <math.h>
#include <time.h>
#include "types.h"
#include "funcs.h"
#include "hash.h"
#include "text.h"
#include "types.h"
#include <math.h>
#include <time.h>
#undef WINDOWS
#ifdef _WIN32
@@ -692,7 +692,7 @@ void writelinktable(EN_Project *pr, Pfloat *x)
}
/* Note if link is a pump or valve */
if ((j = Link[i].Type) > EN_PIPE) {
if ((j = Link[i].Type) > PIPE) {
strcat(s, " ");
strcat(s, LinkTxt[j]);
}
@@ -909,12 +909,12 @@ void writestatchange(EN_Project *pr, int k, char s1, char s2)
setting = LinkSetting[k]; // Link[k].Kc;
switch (Link[k].Type) {
case EN_PRV:
case EN_PSV:
case EN_PBV:
case PRV:
case PSV:
case PBV:
setting *= Ucf[PRESSURE];
break;
case EN_FCV:
case FCV:
setting *= Ucf[FLOW];
default:
break;
@@ -1243,9 +1243,9 @@ void marknodes(EN_Project *pr, int m, int *nodelist, char *marked)
/* Check if valve connection is in correct direction */
switch (net->Link[k].Type) {
case EN_CVPIPE:
case EN_PRV:
case EN_PSV:
case CVPIPE:
case PRV:
case PSV:
if (j == net->Link[k].N1) {
continue;
}

File diff suppressed because it is too large Load Diff

View File

@@ -20,7 +20,7 @@ AUTHOR: L. Rossman
#ifndef TYPES_H
#define TYPES_H
#include "epanet2.h"
//#include "epanet2.h"
#include "hash.h"
#include "util/errormanager.h"
#include <stdio.h>
@@ -103,7 +103,7 @@ typedef int INT4;
---------------------------------------------------------------------
*/
#define MEMCHECK(x) (((x) == NULL) ? 101 : 0 )
#define FREE(x) if ((x)) free((x))
#define FREE(x) do { free(x); (x) = NULL; } while(0)
/*
---------------------------------------------------------------------
@@ -130,25 +130,47 @@ typedef int INT4;
*/
#define ERRCODE(x) (errcode = ((errcode>100) ? (errcode) : (x)))
/*
----------------------------------------------
Global Enumeration Types
----------------------------------------------
*/
typedef enum {
NODE = 0,
LINK = 1
} ObjectType;
typedef enum {
JUNCTION = 0,
RESERVOIR = 1,
TANK = 2
} NodeType;
typedef enum {
CVPIPE = 0,
PIPE = 1,
PUMP = 2,
PRV = 3,
PSV = 4,
PBV = 5,
FCV = 6,
TCV = 7,
GPV = 8
} LinkType;
typedef enum {
USE, /* use from previous run */
SAVE, /* save after current run */
SCRATCH
} Hydtype; /* use temporary file */
SCRATCH /* use temporary file */
} HydFiletype;
typedef enum {
NONE, /* no quality analysis */
CHEM, /* analyze a chemical */
AGE, /* analyze water age */
TRACE
} QualType; /* trace % of flow from a source */
TRACE /* trace % of flow from a source */
} QualType;
typedef enum {
V_CURVE, /* volume curve */
@@ -169,8 +191,8 @@ typedef enum {
CONCEN, /* inflow concentration */
MASS, /* mass inflow booster */
SETPOINT, /* setpoint booster */
FLOWPACED
} SourceType; /* flow paced booster */
FLOWPACED /* flow paced booster */
} SourceType;
typedef enum {
LOWLEVEL, /* act when grade below set level */
@@ -189,14 +211,14 @@ typedef enum {
XFCV, /* FCV cannot supply flow */
XPRESSURE, /* valve cannot supply pressure */
FILLING, /* tank filling */
EMPTYING
} StatType; /* tank emptying */
EMPTYING /* tank emptying */
} StatType;
typedef enum {
HW, /* Hazen-Williams */
DW, /* Darcy-Weisbach */
CM /* Chezy-Manning */
} FormType;
} HeadLossType;
typedef enum {
US, /* US */
@@ -398,7 +420,7 @@ typedef struct /* NODE OBJECT */
double C0; /* Initial quality */
double Ke; /* Emitter coeff. */
char Rpt; /* Reporting flag */
EN_NodeType Type; /* Node Type */
NodeType Type; /* Node Type */
char Comment[MAXMSG+1]; /* Node Comment */
} Snode;
@@ -416,7 +438,7 @@ typedef struct /* LINK OBJECT */
double R; /* Flow resistance */
double Rc; /* Reaction coeff. */
double Qa; // Low flow limit
EN_LinkType Type; /* Link type */
LinkType Type; // Link type */
StatType Stat; /* Initial status */
char Rpt; /* Reporting flag */
char Comment[MAXMSG+1]; /* Link Comment */
@@ -514,7 +536,7 @@ typedef struct s_Premise /* Rule Premise Clause */
int status; /* Variable's status */
double value; /* Variable's value */
struct s_Premise *next;
} Premise;
} Spremise;
typedef struct s_Action /* Rule Action Clause */
{
@@ -522,24 +544,23 @@ typedef struct s_Action /* Rule Action Clause */
int status; /* Link's status */
double setting; /* Link's setting */
struct s_Action *next;
} Action;
} Saction;
typedef struct s_aRule /* Control Rule Structure */
typedef struct /* Control Rule Structure */
{
char label[MAXID+1]; /* Rule character label */
char label[MAXID+1]; /* Rule label */
double priority; /* Priority level */
Premise *Pchain; /* Linked list of premises */
Action *Tchain; /* Linked list of actions if true */
Action *Fchain; /* Linked list of actions if false */
//struct s_aRule *next;
} aRule;
Spremise *Premises; /* Linked list of premises */
Saction *ThenActions; /* Linked list of THEN actions */
Saction *ElseActions; /* Linked list of ELSE actions */
} Srule;
typedef struct s_ActItem /* Action list item */
typedef struct s_ActionItem /* Action list item */
{
int ruleindex; /* Index of rule action belongs to */
struct s_Action *action; /* An action structure */
struct s_ActItem *next;
} ActItem;
int ruleIndex; /* Index of rule action belongs to */
Saction *action; /* An action structure */
struct s_ActionItem *next;
} SactionList;
typedef struct
{
@@ -707,12 +728,9 @@ typedef struct {
char
HydFname[MAXFNAME+1], /* Hydraulics file name */
OutFname[MAXFNAME+1], /* Binary output file name */
TmpFname[MAXFNAME+1], /* Temporary file name */
TmpDir[MAXFNAME+1], /* Temporary directory name */
Outflag, /* Output file flag */
Hydflag; /* Hydraulics flag */
long
HydOffset, /* Hydraulics file byte offset */
OutOffset1, /* 1st output file byte offset */
@@ -734,18 +752,6 @@ typedef struct {
} save_options_t;
typedef struct {
aRule *Rule; /* Array of rules */
ActItem *ActList; /* Linked list of action items */
int RuleState; /* State of rule interpreter */
long Time1; /* Start of rule evaluation time interval (sec) */
Premise *Plast; /* Previous premise clause */
Action *Tlast; /* Previous true action */
Action *Flast; /* Previous false action */
} rules_t;
/*
** NOTE: Hydraulic analysis of the pipe network at a given point in time
** is done by repeatedly solving a linearized version of the
@@ -851,6 +857,16 @@ typedef struct {
} hydraulics_t;
typedef struct {
SactionList *ActionList; /* Linked list of action items */
int RuleState; /* State of rule interpreter */
int Errcode; // Rule parser error code
long Time1; /* Start of rule evaluation time interval (sec) */
Spremise *LastPremise; /* Previous premise clause */
Saction *LastThenAction; /* Previous THEN action */
Saction *LastElseAction; /* Previous ELSE action */
} rules_t;
typedef struct {
int Nnodes, /* Number of network nodes */
Ntanks, /* Number of tanks */
@@ -863,17 +879,18 @@ typedef struct {
Nrules, /* Number of control rules */
Npats, /* Number of time patterns */
Ncurves, /* Number of data curves */
Ncoords; /* Number of Coords */
Ncoords; /* Number of node coordinates */
Snode *Node; /* Node data */
Slink *Link; /* Link data */
Stank *Tank; /* Tank data */
Spump *Pump; /* Pump data */
Svalve *Valve; /* Valve data */
Spattern *Pattern; /* Time patterns */
Scurve *Curve; /* Curve data */
Scoord *Coord; /* Coordinate data */
Scontrol *Control; /* Control data */
Snode *Node; /* Node array */
Slink *Link; /* Link array */
Stank *Tank; /* Tank array */
Spump *Pump; /* Pump array */
Svalve *Valve; /* Valve array */
Spattern *Pattern; /* Time pattern array */
Scurve *Curve; /* Data curve array */
Scoord *Coord; /* Node coordinate array */
Scontrol *Control; /* Simple controls array */
Srule *Rule; /* Rule-based controls array */
HashTable
*NodeHashTable,
*LinkHashTable; /* Hash tables for ID labels */
@@ -896,18 +913,21 @@ typedef struct EN_Project {
out_file_t out_files;
save_options_t save_options;
double Ucf[MAXVAR];
double Ucf[MAXVAR]; // Unit conversion factors
char
Openflag, /// Toolkit open flag
Warnflag, /// Warning flag
Msg[MAXMSG+1], /// General-purpose string: errors, messages
Title[MAXTITLE][TITLELEN+1],/// Project title
MapFname[MAXFNAME+1]; /// Map file name
Openflag, // Toolkit open flag
Warnflag, // Warning flag
Msg[MAXMSG+1], // General-purpose string: errors, messages
Title[MAXTITLE][TITLELEN+1], // Project title
MapFname[MAXFNAME+1], // Map file name
TmpHydFname[MAXFNAME+1], // Temporary hydraulics file name
TmpOutFname[MAXFNAME+1], // Temporary output file name
TmpStatFname[MAXFNAME+1]; // Temporary statistic file name
error_handle_t* error_handle; //Simple error manager
error_handle_t* error_handle; // Simple error manager
void (* viewprog) (char *); /* Pointer to progress viewing function */
void (* viewprog) (char *); // Pointer to progress viewing function
} EN_Project;

109
tests/test_addrule.cpp Normal file
View File

@@ -0,0 +1,109 @@
// Test of EN_addrule, EN_deletenode & EN_deletelink EPANET API Functions
#define _CRT_SECURE_NO_DEPRECATE
/*
This is a test for the API functions that adds rules and deletes
nodes and links from a project. Deletion can be conditional on
node or link appearing in any simple or rule-based controls.
*/
//#define NO_BOOST
#ifndef NO_BOOST
#define BOOST_TEST_MODULE "toolkit"
#include <boost/test/included/unit_test.hpp>
#endif
#include <iostream>
#include <string>
#include "epanet2.h"
#define DATA_PATH_INP "./net1.inp"
#define DATA_PATH_RPT "./test.rpt"
#define DATA_PATH_OUT "./test.out"
#ifdef NO_BOOST
#define BOOST_REQUIRE(x) (((x)) ? cout << "\nPassed at line " << __LINE__ : cout << "\nFailed at line " << __LINE__ )
#endif
using namespace std;
char R1[] = "RULE 1 \n IF NODE 2 LEVEL < 100 \n THEN LINK 9 STATUS = OPEN";
char R2[] = "RULE 2\nIF SYSTEM TIME = 4\nTHEN LINK 9 STATUS = CLOSED\nAND LINK 31 STATUS = CLOSED";
char R3[] = "RULE 3\nIF NODE 23 PRESSURE ABOVE 140\nAND NODE 2 LEVEL > 120\n"
"THEN LINK 113 STATUS = CLOSED\nELSE LINK 22 STATUS = CLOSED";
#ifndef NO_BOOST
BOOST_AUTO_TEST_SUITE (test_toolkit)
BOOST_AUTO_TEST_CASE(test_setlinktype)
#else
int main(int argc, char *argv[])
#endif
{
int error = 0;
int ruleCount, nP, nTA, nEA;
int link113, node23, link22, pump9_before, pump9_after;
float priority;
EN_ProjectHandle ph = NULL;
EN_createproject(&ph);
std::string path_inp = std::string(DATA_PATH_INP);
std::string path_rpt = std::string(DATA_PATH_RPT);
std::string path_out = std::string(DATA_PATH_OUT);
error = EN_open(ph, path_inp.c_str(), path_rpt.c_str(), "");
BOOST_REQUIRE(error == 0);
// Add the 3 rules to the project
error = EN_addrule(ph, R1);
BOOST_REQUIRE(error == 0);
error = EN_addrule(ph, R2);
BOOST_REQUIRE(error == 0);
error = EN_addrule(ph, R3);
BOOST_REQUIRE(error == 0);
// Check that rules were added
error = EN_getcount(ph, EN_RULECOUNT, &ruleCount);
BOOST_REQUIRE(ruleCount == 3);
// Check the number of clauses in rule 3
error = EN_getrule(ph, 3, &nP, &nTA, &nEA, &priority);
BOOST_REQUIRE(nP == 2);
BOOST_REQUIRE(nTA == 1);
BOOST_REQUIRE(nTA == 1);
// Try to delete link 113 conditionally which will fail
// because it's in rule 3
EN_getlinkindex(ph, "113", &link113);
error = EN_deletelink(ph, link113, EN_CONDITIONAL);
BOOST_REQUIRE(error == 261);
// Delete node 23 unconditionally which will result in the
// deletion of rule 3 as well as links 22 and 113
EN_getnodeindex(ph, "23", &node23);
EN_getlinkindex(ph, "22", &link22);
EN_getlinkindex(ph, "9", &pump9_before);
error = EN_deletenode(ph, node23, EN_UNCONDITIONAL);
BOOST_REQUIRE(error == 0);
// Check that there are now only 2 rules
error = EN_getcount(ph, EN_RULECOUNT, &ruleCount);
BOOST_REQUIRE(ruleCount == 2);
// Check that link 22 no longer exists
error = EN_getlinkindex(ph, "22", &link22);
BOOST_REQUIRE(error > 0);
// Check that the index of pump9 has been reduced by 2
error = EN_getlinkindex(ph, "9", &pump9_after);
BOOST_REQUIRE(pump9_before - pump9_after == 2);
// Close and delete project
error = EN_close(ph);
BOOST_REQUIRE(error == 0);
EN_deleteproject(&ph);
}
#ifndef NO_BOOST
BOOST_AUTO_TEST_SUITE_END()
#endif

View File

@@ -54,7 +54,7 @@ BOOST_AUTO_TEST_CASE(test_setlinktype)
BOOST_REQUIRE(error == 0);
error = EN_setlinknodes(ph, p113, n113_2, n113_1);
BOOST_REQUIRE(error == 0);
error = EN_setlinktype(ph, &p113, EN_CVPIPE);
error = EN_setlinktype(ph, &p113, EN_CVPIPE, 0);
BOOST_REQUIRE(error == 0);
// Get index & diameter of pipe 121 connected to node 31
@@ -64,7 +64,7 @@ BOOST_AUTO_TEST_CASE(test_setlinktype)
BOOST_REQUIRE(error == 0);
// Replace it with a PRV
error = EN_setlinktype(ph, &p121, EN_PRV);
error = EN_setlinktype(ph, &p121, EN_PRV, 0);
BOOST_REQUIRE(error == 0);
// Set diameter & setting of new PRV

View File

@@ -1,15 +1,38 @@
LIBRARY EPANET2.DLL
EXPORTS
ENaddpattern = _ENaddpattern@4
ENaddcontrol = _ENaddcontrol@24
ENaddcurve = _ENaddcurve@4
ENaddlink = _ENaddlink@16
ENaddnode = _ENaddnode@8
ENaddpattern = _ENaddpattern@4
ENaddrule = _ENaddrule@4
ENclose = _ENclose@0
ENcloseH = _ENcloseH@0
ENcloseQ = _ENcloseQ@0
ENepanet = _ENepanet@16
ENcloseQ = _ENcloseQ@0
ENdeletecontrol = _ENdeletecontrol@4
ENdeletelink = _ENdeletelink@4
ENdeletenode = _ENdeletenode@4
ENdeleterule = _ENdeleterule@4
ENepanet = _ENepanet@16
ENgetaveragepatternvalue = _ENgetaveragepatternvalue@8
ENgetbasedemand = _ENgetbasedemand@12
ENgetcontrol = _ENgetcontrol@24
ENgetcoord = _ENgetcoord@12
ENgetcount = _ENgetcount@8
ENgetcurve = _ENgetcurve@20
ENgetcurveid = _ENgetcurveid@8
ENgetcurveindex = _ENgetcurveindex@8
ENgetcurvelen = _ENgetcurvelen@8
ENgetcurvetype = _ENgetcurvetype@8
ENgetcurvevalue = _ENgetcurvevalue@16
ENgetdemandmodel = _ENgetdemandmodel@16
ENgetdemandname = _ENgetdemandname@12
ENgetdemandpattern = _ENgetdemandpattern@12
ENgetelseaction = _ENgetfalseaction@20
ENgeterror = _ENgeterror@12
ENgetflowunits = _ENgetflowunits@4
ENgetheadcurveindex = _ENgetheadcurveindex@8
ENgetlinkid = _ENgetlinkid@8
ENgetlinkindex = _ENgetlinkindex@8
ENgetlinknodes = _ENgetlinknodes@12
@@ -19,86 +42,69 @@ EXPORTS
ENgetnodeindex = _ENgetnodeindex@8
ENgetnodetype = _ENgetnodetype@8
ENgetnodevalue = _ENgetnodevalue@12
ENgetnumdemands = _ENgetnumdemands@8
ENgetoption = _ENgetoption@8
ENgetpatternid = _ENgetpatternid@8
ENgetpatternindex = _ENgetpatternindex@8
ENgetpatternlen = _ENgetpatternlen@8
ENgetpatternvalue = _ENgetpatternvalue@12
ENgetpremise = _ENgetpremise@36
ENgetpumptype = _ENgetpumptype@8
ENgetqualinfo = _ENgetqualinfo@16
ENgetqualtype = _ENgetqualtype@8
ENgetrule = _ENgetrule@20
ENgetruleID = _ENgetruleID@8
ENgetstatistic = _ENgetstatistic@8
ENgetthenaction = _ENgettrueaction@20
ENgettimeparam = _ENgettimeparam@8
ENgetversion = _ENgetversion@4
ENgetversion = _ENgetversion@4
ENinit = _ENinit@16
ENinitH = _ENinitH@4
ENinitQ = _ENinitQ@4
ENnextH = _ENnextH@4
ENnextQ = _ENnextQ@4
ENnextQ = _ENnextQ@4
ENopen = _ENopen@12
ENopenH = _ENopenH@0
ENopenQ = _ENopenQ@0
ENopenQ = _ENopenQ@0
ENreport = _ENreport@0
ENresetreport = _ENresetreport@0
ENrunH = _ENrunH@4
ENrunQ = _ENrunQ@4
ENrunQ = _ENrunQ@4
ENsaveH = _ENsaveH@0
ENsavehydfile = _ENsavehydfile@4
ENsaveinpfile = _ENsaveinpfile@4
ENaddcontrol = _ENaddcontrol@24
ENsetbasedemand = _ENsetbasedemand@12
ENsetcontrol = _ENsetcontrol@24
ENsetlinkvalue = _ENsetlinkvalue@12
ENsetcoord = _ENsetcoord@12
ENsetcurve = _ENsetcurve@16
ENsetcurvevalue = _ENsetcurvevalue@16
ENsetdemandmodel = _ENsetdemandmodel@16
ENsetdemandname = _ENsetdemandname@12
ENsetdemandpattern = _ENsetdemandpattern@12
ENsetelseaction = _ENsetfalseaction@20
ENsetflowunits = _ENsetflowunits@4
ENsetheadcurveindex = _ENsetheadcurveindex@8
ENsetlinkid = _ENsetlinkid@8
ENsetlinknodes = _ENsetlinknodes@12
ENsetlinktype = _ENsetlinktype@8
ENsetlinkvalue = _ENsetlinkvalue@12
ENsetnodeid = _ENsetnodeid@8
ENsetnodevalue = _ENsetnodevalue@12
ENsetoption = _ENsetoption@8
ENsetpattern = _ENsetpattern@12
ENsetpatternvalue = _ENsetpatternvalue@12
ENsetqualtype = _ENsetqualtype@16
ENsetreport = _ENsetreport@4
ENsetstatusreport = _ENsetstatusreport@4
ENsettimeparam = _ENsettimeparam@8
ENsolveH = _ENsolveH@0
ENsolveQ = _ENsolveQ@0
ENstepQ = _ENstepQ@4
ENusehydfile = _ENusehydfile@4
ENwriteline = _ENwriteline@4
ENgetnumdemands = _ENgetnumdemands@8
ENgetbasedemand = _ENgetbasedemand@12
ENgetdemandpattern = _ENgetdemandpattern@12
ENgetcurve = _ENgetcurve@20
ENgetstatistic = _ENgetstatistic@8
ENgetcoord = _ENgetcoord@12
ENsetcoord = _ENsetcoord@12
ENgetqualinfo = _ENgetqualinfo@16
ENsetbasedemand = _ENsetbasedemand@12
ENsetdemandpattern = _ENsetdemandpattern@12
ENgetaveragepatternvalue = _ENgetaveragepatternvalue@8
ENgetheadcurveindex = _ENgetheadcurveindex@8
ENsetheadcurveindex = _ENsetheadcurveindex@8
ENgetpumptype = _ENgetpumptype@8
ENgetcurveindex = _ENgetcurveindex@8
ENgetcurveid = _ENgetcurveid@8
ENgetcurvelen = _ENgetcurvelen@8
ENgetcurvevalue = _ENgetcurvevalue@16
ENsetcurvevalue = _ENsetcurvevalue@16
ENsetcurve = _ENsetcurve@16
ENaddcurve = _ENaddcurve@4
ENgetrule = _ENgetrule@20
ENsetrulepriority = _ENsetrulepriority@8
ENgetpremise = _ENgetpremise@36
ENsetpremise = _ENsetpremise@36
ENsetpremiseindex = _ENsetpremiseindex@12
ENsetpremisestatus = _ENsetpremisestatus@12
ENsetpremisevalue = _ENsetpremisevalue@12
ENgettrueaction = _ENgettrueaction@20
ENsettrueaction = _ENsettrueaction@20
ENgetfalseaction = _ENgetfalseaction@20
ENsetfalseaction = _ENsetfalseaction@20
ENgetruleID = _ENgetruleID@8
ENsetflowunits = _ENsetflowunits@4
ENaddnode = _ENaddnode@8
ENaddlink = _ENaddlink@16
ENdeletelink = _ENdeletelink@4
ENdeletenode = _ENdeletenode@4
ENsetlinktype = _ENsetlinktype@8
ENgetdemandmodel = _ENgetdemandmodel@16
ENsetdemandmodel = _ENsetdemandmodel@16
ENgetcurvetype = _ENgetcurvetype@8
ENinit = _ENinit@16
ENgetdemandname = _ENgetdemandname@12
ENsetdemandname = _ENsetdemandname@12
ENsetqualtype = _ENsetqualtype@16
ENsetreport = _ENsetreport@4
ENsetrulepriority = _ENsetrulepriority@8
ENsetstatusreport = _ENsetstatusreport@4
ENsetthenaction = _ENsettrueaction@20
ENsettimeparam = _ENsettimeparam@8
ENsolveH = _ENsolveH@0
ENsolveQ = _ENsolveQ@0
ENstepQ = _ENstepQ@4
ENusehydfile = _ENusehydfile@4
ENwriteline = _ENwriteline@4