Adds new pattern, curve and reporting functions to API

This commit is contained in:
Lew Rossman
2019-02-20 12:43:32 -05:00
parent aef6e29bd6
commit fcbbbf9b2e
13 changed files with 562 additions and 8 deletions

View File

@@ -253,6 +253,7 @@ Public Const EN_R_IS_ACTIVE = 3
'Reporting Functions
Declare Function ENwriteline Lib "epanet2.dll" (ByVal line As String) As Long
Declare Function ENreport Lib "epanet2.dll" () As Long
Declare Function ENcopyreport Lib "epanet2.dll" (ByVal filename As String) As Long
Declare Function ENclearreport Lib "epanet2.dll" () As Long
Declare Function ENresetreport Lib "epanet2.dll" () As Long
Declare Function ENsetreport Lib "epanet2.dll" (ByVal format As String) As Long
@@ -318,8 +319,10 @@ Public Const EN_R_IS_ACTIVE = 3
'Time Pattern Functions
Declare Function ENaddpattern Lib "epanet2.dll" (ByVal id As String) As Long
Declare Function ENdeletepattern Lib "epanet2.dll" (ByVal index As Long) As Long
Declare Function ENgetpatternindex Lib "epanet2.dll" (ByVal id As String, index As Long) As Long
Declare Function ENgetpatternid Lib "epanet2.dll" (ByVal index As Long, ByVal id As String) As Long
Declare Function ENsetpatternid Lib "epanet2.dll" (ByVal index As Long, ByVal newid As String) As Long
Declare Function ENgetpatternlen Lib "epanet2.dll" (ByVal index As Long, len_ As Long) As Long
Declare Function ENgetpatternvalue Lib "epanet2.dll" (ByVal index As Long, ByVal period As Long, value As Single) As Long
Declare Function ENsetpatternvalue Lib "epanet2.dll" (ByVal index As Long, ByVal period As Long, ByVal value As Single) As Long
@@ -328,8 +331,10 @@ Public Const EN_R_IS_ACTIVE = 3
'Data Curve Functions
Declare Function ENaddcurve Lib "epanet2.dll" (ByVal id As String) As Long
Declare Function ENdeletecurve Lib "epanet2.dll" (ByVal index As Long) As Long
Declare Function ENgetcurveindex Lib "epanet2.dll" (ByVal id As String, index As Long) As Long
Declare Function ENgetcurveid Lib "epanet2.dll" (ByVal index As Long, ByVal id As String) As Long
Declare Function ENsetcurveid Lib "epanet2.dll" (ByVal index As Long, ByVal newid As String) As Long
Declare Function ENgetcurvelen Lib "epanet2.dll" (ByVal index As Long, len_ As Long) As Long
Declare Function ENgetcurvetype Lib "epanet2.dll" (ByVal index As Long, type_ As Long) As Long
Declare Function ENgetcurvevalue Lib "epanet2.dll" (ByVal curveIndex As Long, ByVal pointIndex As Long, x As Single, y As Single) As Long

View File

@@ -11,9 +11,12 @@ EXPORTS
ENclose = _ENclose@0
ENcloseH = _ENcloseH@0
ENcloseQ = _ENcloseQ@0
ENcopyreport = _ENcopyreport@4
ENdeletecontrol = _ENdeletecontrol@4
ENdeletecurve = _ENdeletecurve@4
ENdeletelink = _ENdeletelink@8
ENdeletenode = _ENdeletenode@8
ENdeletepattern = _ENdeletepattern@4
ENdeleterule = _ENdeleterule@4
ENepanet = _ENepanet@16
ENgetaveragepatternvalue = _ENgetaveragepatternvalue@8
@@ -79,7 +82,8 @@ EXPORTS
ENsetbasedemand = _ENsetbasedemand@12
ENsetcontrol = _ENsetcontrol@24
ENsetcoord = _ENsetcoord@12
ENsetcurve = _ENsetcurve@16
ENsetcurve = _ENsetcurve@16
ENsetcurveid = _ENsetcurveid@8
ENsetcurvevalue = _ENsetcurvevalue@16
ENsetdemandmodel = _ENsetdemandmodel@16
ENsetdemandname = _ENsetdemandname@12
@@ -95,7 +99,8 @@ EXPORTS
ENsetnodeid = _ENsetnodeid@8
ENsetnodevalue = _ENsetnodevalue@12
ENsetoption = _ENsetoption@8
ENsetpattern = _ENsetpattern@12
ENsetpattern = _ENsetpattern@12
ENsetpatternid = _ENsetpatternid@8
ENsetpatternvalue = _ENsetpatternvalue@12
ENsetpipedata = _ENsetpipedata@20
ENsetpremise = _ENsetpremise@36

View File

@@ -137,6 +137,8 @@ extern "C" {
int DLLEXPORT ENreport();
int DLLEXPORT ENcopyreport(char *filename);
int DLLEXPORT ENclearreport();
int DLLEXPORT ENresetreport();
@@ -292,10 +294,14 @@ extern "C" {
int DLLEXPORT ENaddpattern(char *id);
int DLLEXPORT ENdeletepattern(int index);
int DLLEXPORT ENgetpatternindex(char *id, int *index);
int DLLEXPORT ENgetpatternid(int index, char *id);
int DLLEXPORT ENsetpatternid(int index, char *id);
int DLLEXPORT ENgetpatternlen(int index, int *len);
int DLLEXPORT ENgetpatternvalue(int index, int period, EN_API_FLOAT_TYPE *value);
@@ -314,10 +320,14 @@ extern "C" {
int DLLEXPORT ENaddcurve(char *id);
int DLLEXPORT ENdeletecurve(int index);
int DLLEXPORT ENgetcurveindex(char *id, int *index);
int DLLEXPORT ENgetcurveid(int index, char *id);
int DLLEXPORT ENsetcurveid(int index, char *id);
int DLLEXPORT ENgetcurvelen(int index, int *len);
int DLLEXPORT ENgetcurvetype(int index, int *type);

View File

@@ -258,6 +258,7 @@ Public Const EN_R_IS_ACTIVE = 3
'Reporting Functions
Declare Function ENwriteline Lib "epanet2.dll" (ByVal line As String) As Int32
Declare Function ENreport Lib "epanet2.dll" () As Int32
Declare Function ENcopyreport Lib "epanet2.dll" (ByVal filename As String) As Int32
Declare Function ENclearreport Lib "epanet2.dll" () As Int32
Declare Function ENresetreport Lib "epanet2.dll" () As Int32
Declare Function ENsetreport Lib "epanet2.dll" (ByVal format As String) As Int32
@@ -323,8 +324,10 @@ Public Const EN_R_IS_ACTIVE = 3
'Time Pattern Functions
Declare Function ENaddpattern Lib "epanet2.dll" (ByVal id As String) As Int32
Declare Function ENdeletepattern Lib "epanet2.dll" (ByVal index As Int32) As Int32
Declare Function ENgetpatternindex Lib "epanet2.dll" (ByVal id As String, index As Int32) As Int32
Declare Function ENgetpatternid Lib "epanet2.dll" (ByVal index As Int32, ByVal id As String) As Int32
Declare Function ENsetpatternid Lib "epanet2.dll" (ByVal index As Int32, ByVal newid As String) As Int32
Declare Function ENgetpatternlen Lib "epanet2.dll" (ByVal index As Int32, len_ As Int32) As Int32
Declare Function ENgetpatternvalue Lib "epanet2.dll" (ByVal index As Int32, ByVal period As Int32, value As Single) As Int32
Declare Function ENsetpatternvalue Lib "epanet2.dll" (ByVal index As Int32, ByVal period As Int32, ByVal value As Single) As Int32
@@ -333,8 +336,10 @@ Public Const EN_R_IS_ACTIVE = 3
'Data Curve Functions
Declare Function ENaddcurve Lib "epanet2.dll" (ByVal id As String) As Int32
Declare Function ENdeletecurve Lib "epanet2.dll" (ByVal index As Int32) As Int32
Declare Function ENgetcurveindex Lib "epanet2.dll" (ByVal id As String, index As Int32) As Int32
Declare Function ENgetcurveid Lib "epanet2.dll" (ByVal index As Int32, ByVal id As String) As Int32
Declare Function ENsetcurveid Lib "epanet2.dll" (ByVal index As Int32, ByVal newid As String) As Int32
Declare Function ENgetcurvelen Lib "epanet2.dll" (ByVal index As Int32, len_ As Int32) As Int32
Declare Function ENgetcurvetype Lib "epanet2.dll" (ByVal index As Int32, type_ As Int32) As Int32
Declare Function ENgetcurvevalue Lib "epanet2.dll" (ByVal curveIndex As Int32, ByVal pointIndex As Int32, x As Single, y As Single) As Int32

View File

@@ -128,6 +128,7 @@ typedef struct Project *EN_Project;
/**
@brief Retrieves the title lines of the project
@param ph an EPANET project handle.
@param[out] line1 first title line
@param[out] line2 second title line
@param[out] line3 third title line
@@ -137,6 +138,7 @@ typedef struct Project *EN_Project;
/**
@brief Sets the title lines of the project
@param ph an EPANET project handle.
@param line1 first title line
@param line2 second title line
@param line3 third title line
@@ -517,10 +519,21 @@ typedef struct Project *EN_Project;
*/
int DLLEXPORT EN_report(EN_Project ph);
/**
@brief Copies the current contents of a project's report file to another file.
@param ph an EPANET project handle.
@param filename the full path name of the destination file.
@return an error code.
This function allows toolkit clients to retrieve the contents of a project's
report file while the project is still open.
*/
int DLLEXPORT EN_copyreport(EN_Project ph, char *filename);
/**
@brief Clears the contents of a project's report file.
@param ph an EPANET project handle.
@return and error code.
@return an error code.
*/
int DLLEXPORT EN_clearreport(EN_Project ph);
@@ -1185,6 +1198,14 @@ typedef struct Project *EN_Project;
*/
int DLLEXPORT EN_addpattern(EN_Project ph, char *id);
/**
@brief Deletes a time pattern from a project.
@param ph an EPANET project handle.
@param index the time pattern's index (starting from 1).
@return an error code.
*/
int DLLEXPORT EN_deletepattern(EN_Project ph, int index);
/**
@brief Retrieves the index of a time pattern given its ID name.
@param ph an EPANET project handle.
@@ -1205,6 +1226,17 @@ typedef struct Project *EN_Project;
*/
int DLLEXPORT EN_getpatternid(EN_Project ph, int index, char *id);
/**
@brief Changes the ID name of a time pattern given its index.
@param ph an EPANET project handle.
@param index a time pattern index (starting from 1).
@param id the time pattern's new ID name.
@return an error code.
The new ID name must not exceed @ref EN_MAXID characters.
*/
int DLLEXPORT EN_setpatternid(EN_Project ph, int index, char *id);
/**
@brief Retrieves the number of time periods in a time pattern.
@param ph an EPANET project handle.
@@ -1274,6 +1306,14 @@ typedef struct Project *EN_Project;
*/
int DLLEXPORT EN_addcurve(EN_Project ph, char *id);
/**
@brief Deletes a data curve from a project.
@param ph an EPANET project handle.
@param index the data curve's index (starting from 1).
@return an error code.
*/
int DLLEXPORT EN_deletecurve(EN_Project ph, int index);
/**
@brief Retrieves the index of a curve given its ID name.
@param ph an EPANET project handle.
@@ -1294,6 +1334,17 @@ typedef struct Project *EN_Project;
*/
int DLLEXPORT EN_getcurveid(EN_Project ph, int index, char *id);
/**
@brief Changes the ID name of a data curve given its index.
@param ph an EPANET project handle.
@param index a data curve index (starting from 1).
@param id the data curve's new ID name.
@return an error code.
The new ID name must not exceed @ref EN_MAXID characters.
*/
int DLLEXPORT EN_setcurveid(EN_Project ph, int index, char *id);
/**
@brief Retrieves the number of points in a curve.
@param ph an EPANET project handle.