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

@@ -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