Merge branch 'dev-2.1-doxy-markup' into dev-2.1
updates comment blocks to oxygen-compatible, and adds release notes (draft)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[](https://travis-ci.org/OpenWaterAnalytics/EPANET)
|
||||
|
||||
EPANET
|
||||
EPANET {#epanet_readme}
|
||||
======
|
||||
|
||||
The EPANET Library is a pressurized pipe network hydraulic and water quality analysis toolkit written in C.
|
||||
|
||||
101
ReleaseNotes2_1.md
Normal file
101
ReleaseNotes2_1.md
Normal file
@@ -0,0 +1,101 @@
|
||||
#Release Notes for EPANET 2.1
|
||||
|
||||
The last update to the EPANET engine was "Build 2.00.12" in February of 2008. Since that time, a community effort to update and extend the open-source code has emerged. This group has made a number of bug-fixes and API additions that help to improve the EPANET engine for everyone. Version 2.1 is now released after 8.5 years.
|
||||
|
||||
Contributors to this version (listed in order of first contribution):
|
||||
|
||||
- Lew Rossman
|
||||
- Michael Tryby
|
||||
- Feng Shang
|
||||
- James Uber
|
||||
- Tom Taxon
|
||||
- Sam Hatchett
|
||||
- Hyoungmin Woo
|
||||
- Jinduan Chen
|
||||
- Yunier Soad
|
||||
- Mike Kane
|
||||
- Demetrios Eliades
|
||||
- Will Furnass
|
||||
- Steffen Macke
|
||||
- Mariosmsk
|
||||
- Elad Salomons
|
||||
- Maurizio Cingi
|
||||
- Bryant McDonnell
|
||||
|
||||
##API Additions (new functions):
|
||||
- `ENgetaveragepatternvalue`
|
||||
- `ENgetstatistic`
|
||||
- `ENgetcoord / ENsetcoord`
|
||||
- `ENgetpumptype`
|
||||
- `ENgetqualinfo`
|
||||
|
||||
###Demands
|
||||
- `ENgetnumdemands`
|
||||
- `ENgetbasedemand / ENsetbasedemand`
|
||||
- `ENgetdemandpattern`
|
||||
|
||||
###Curves
|
||||
- `ENgetcurve`
|
||||
- `ENgetcurveid`
|
||||
- `ENgetcurvelen`
|
||||
- `ENgetcurvevalue`
|
||||
- `ENsetcurvevalue`
|
||||
- `ENsetcurve`
|
||||
- `ENaddcurve`
|
||||
- `ENgetheadcurveindex`
|
||||
- `ENgetcurveindex`
|
||||
|
||||
|
||||
##API Extensions (additional parameters)
|
||||
###node value types:
|
||||
- `EN_TANKVOLUME`
|
||||
- `EN_MAXVOLUME`
|
||||
|
||||
###link value types:
|
||||
- `EN_LINKQUAL`
|
||||
- `EN_LINKPATTERN`
|
||||
|
||||
###time parameters:
|
||||
- `EN_STARTTIME`
|
||||
- `EN_HTIME`
|
||||
- `EN_QTIME`
|
||||
- `EN_HALTFLAG`
|
||||
- `EN_NEXTEVENT`
|
||||
|
||||
###(new) statistic values:
|
||||
- `EN_ITERATIONS`
|
||||
- `EN_RELATIVEERROR`
|
||||
|
||||
###pump types
|
||||
- `EN_CONST_HP`
|
||||
- `EN_POWER_FUNC`
|
||||
- `EN_CUSTOM`
|
||||
|
||||
##Notable Performance Improvements, Bug Fixes, Usage Features, and other notes
|
||||
- updated hash table algorithm
|
||||
- fixed memory leak when saving output
|
||||
- enables interleaved hydraulic and water quality analysis steps:
|
||||
|
||||
```
|
||||
ENopenH();
|
||||
ENinitH(0);
|
||||
ENinitQ(EN_NOSAVE);
|
||||
do {
|
||||
ENrunH(&t);
|
||||
ENrunQ(&qt);
|
||||
ENnextQ(&qstep);
|
||||
// collect results
|
||||
ENnextH(&tstep);
|
||||
} while (tstep > 0);
|
||||
ENcloseQ();
|
||||
ENcloseH();
|
||||
```
|
||||
|
||||
- engine code and command-line executable are now in separate implementation files
|
||||
- parameter `#define` directives are now enumerated values
|
||||
- main header now contains doxygen-compatible comment blocks for auto-generated documentation
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -59,6 +59,8 @@
|
||||
2255754917551234009946B1 /* report.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F7E1068369500641384 /* report.c */; };
|
||||
2255754A17551234009946B1 /* rules.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F7F1068369500641384 /* rules.c */; };
|
||||
2255754B17551234009946B1 /* smatrix.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F801068369500641384 /* smatrix.c */; };
|
||||
225762C51C068A3900484EC7 /* Net1.inp in CopyFiles */ = {isa = PBXBuildFile; fileRef = 225762C31C068A2A00484EC7 /* Net1.inp */; };
|
||||
225762C61C068A3B00484EC7 /* Net2.inp in CopyFiles */ = {isa = PBXBuildFile; fileRef = 225762C41C068A2A00484EC7 /* Net2.inp */; };
|
||||
226537E0179EDEEB00258C60 /* epanet2.h in Headers */ = {isa = PBXBuildFile; fileRef = 22322FA9106836B000641384 /* epanet2.h */; };
|
||||
22CD9A5E1B27898E00B65E83 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 22CD9A5D1B27898E00B65E83 /* main.c */; };
|
||||
22CD9A611B278BB900B65E83 /* libepanet-static.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2255753B17551217009946B1 /* libepanet-static.a */; };
|
||||
@@ -89,6 +91,8 @@
|
||||
dstSubfolderSpec = 6;
|
||||
files = (
|
||||
223109E61BA865930030AAE8 /* Net3.inp in CopyFiles */,
|
||||
225762C51C068A3900484EC7 /* Net1.inp in CopyFiles */,
|
||||
225762C61C068A3B00484EC7 /* Net2.inp in CopyFiles */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -106,8 +110,6 @@
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
223109E31BA8658A0030AAE8 /* Net3.inp */ = {isa = PBXFileReference; lastKnownFileType = text; name = Net3.inp; path = "../../example-networks/Net3.inp"; sourceTree = "<group>"; };
|
||||
223109E41BA8658A0030AAE8 /* sampletown.inp */ = {isa = PBXFileReference; lastKnownFileType = text; name = sampletown.inp; path = "../../example-networks/sampletown.inp"; sourceTree = "<group>"; };
|
||||
223109E51BA8658A0030AAE8 /* simplenet.inp */ = {isa = PBXFileReference; lastKnownFileType = text; name = simplenet.inp; path = "../../example-networks/simplenet.inp"; sourceTree = "<group>"; };
|
||||
223109F31BA869DA0030AAE8 /* runepanet copy */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "runepanet copy"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
22310A091BA869F30030AAE8 /* libepanet-static copy.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libepanet-static copy.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
22322F66106833BB00641384 /* runepanet */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = runepanet; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
@@ -133,6 +135,8 @@
|
||||
22322F841068369500641384 /* vars.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = vars.h; path = ../../src/vars.h; sourceTree = SOURCE_ROOT; };
|
||||
22322FA9106836B000641384 /* epanet2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 2; name = epanet2.h; path = ../../include/epanet2.h; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||
2255753B17551217009946B1 /* libepanet-static.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libepanet-static.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
225762C31C068A2A00484EC7 /* Net1.inp */ = {isa = PBXFileReference; lastKnownFileType = text; name = Net1.inp; path = "../../example-networks/Net1.inp"; sourceTree = "<group>"; };
|
||||
225762C41C068A2A00484EC7 /* Net2.inp */ = {isa = PBXFileReference; lastKnownFileType = text; name = Net2.inp; path = "../../example-networks/Net2.inp"; sourceTree = "<group>"; };
|
||||
22CD9A5D1B27898E00B65E83 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = main.c; path = ../../run/main.c; sourceTree = "<group>"; };
|
||||
22E107B21C163E5300689CED /* outputapi.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = outputapi.c; path = ../../tools/outputapi/outputapi.c; sourceTree = "<group>"; };
|
||||
22E107B31C163E5300689CED /* outputapi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = outputapi.h; path = ../../tools/outputapi/outputapi.h; sourceTree = "<group>"; };
|
||||
@@ -236,8 +240,8 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
223109E31BA8658A0030AAE8 /* Net3.inp */,
|
||||
223109E41BA8658A0030AAE8 /* sampletown.inp */,
|
||||
223109E51BA8658A0030AAE8 /* simplenet.inp */,
|
||||
225762C31C068A2A00484EC7 /* Net1.inp */,
|
||||
225762C41C068A2A00484EC7 /* Net2.inp */,
|
||||
);
|
||||
name = "sample networks";
|
||||
sourceTree = "<group>";
|
||||
@@ -544,6 +548,7 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
@@ -562,6 +567,7 @@
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = "";
|
||||
};
|
||||
@@ -573,6 +579,7 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
@@ -590,6 +597,7 @@
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
SDKROOT = "";
|
||||
};
|
||||
name = Release;
|
||||
@@ -654,6 +662,7 @@
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "";
|
||||
INFOPLIST_PREPROCESSOR_DEFINITIONS = "";
|
||||
PRODUCT_NAME = runepanet;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -665,6 +674,7 @@
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "";
|
||||
INFOPLIST_PREPROCESSOR_DEFINITIONS = "";
|
||||
PRODUCT_NAME = runepanet;
|
||||
SDKROOT = macosx;
|
||||
ZERO_LINK = NO;
|
||||
};
|
||||
name = Release;
|
||||
@@ -681,6 +691,7 @@
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -695,6 +706,7 @@
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "EN_API_FLOAT_TYPE=double";
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
43
doc/How-to-use-the-toolkit.dox
Normal file
43
doc/How-to-use-the-toolkit.dox
Normal file
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
@page how-to-use How to Use the Toolkit
|
||||
|
||||
The following topics briefly describe how to accomplish some basic tasks for which the Toolkit would be used. See the Example Applications topic for code listings of complete applications of the Toolkit.
|
||||
|
||||
@section open-close Opening and Closing the Toolkit
|
||||
|
||||
The Toolkit must open an EPANET [Input File](Input-File) to obtain a description of the pipe network to be analyzed before any of its other functions can be called. (The exception to this is the @ref ENepanet function, which performs a complete hydraulic/water quality simulation similar to a command line execution of EPANET). Once all analysis is completed, it must close itself down to free all allocated memory. The functions for doing this are @ref ENopen and @ref ENclose, respectively. An example of using these functions is shown below.
|
||||
|
||||
~~~~~~~~~~~~~~~{.c}
|
||||
char *f1, // Name of input file
|
||||
*f2, // name of report file
|
||||
*f3; // name of output file (can be blank)
|
||||
int errcode;
|
||||
errcode = ENopen(f1, f2, f3);
|
||||
if (errcode > 0) {
|
||||
ENclose();
|
||||
return;
|
||||
}
|
||||
{ Call functions that perform desired analysis }
|
||||
ENclose();
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
@section parameters Retrieving and Setting Network Parameters
|
||||
|
||||
The Toolkit has various functions available for retrieving and setting the parameters that define the design and operation of the pipe network being analyzed. The names of retrieval functions all begin with `ENget` (e.g., [ENgetnodevalue](ENgetnodevalue), [ENgetoption](ENgetoption), etc.) while the functions used for setting parameter values begin with `ENset` (e.g., [ENsetnodevalue](ENsetnodevalue), [ENsetoption](ENsetoption), etc.).
|
||||
|
||||
Most of these functions use an index number to reference a specific network component (such as a node, link, or time pattern). This number is simply the position of the component in the list of all components of similar type (e.g., node 10 is the tenth node, starting from 1, in the network) and is not the same as the ID label assigned to the component in the Input File being processed. A series of functions exist to determine a component's index number given its ID label (see [ENgetlinkindex](ENgetlinkindex), [ENgetnodeindex](ENgetnodeindex), and [ENgetpatternindex](ENgetpatternindex)). Likewise, functions exist to retrieve a component's ID label given its index number (see [ENgetlinkid](ENgetlinkid), [ENgetnodeid](ENgetnodeid), and [ENgetpatternid](ENgetpatternid)). The [ENgetcount](ENgetcount) function can be used to determine the number of different components in the network.
|
||||
|
||||
The code below is an example of using the parameter retrieval and setting functions. It changes all pipes with diameter of 10 inches to 12 inches.
|
||||
|
||||
~~~~~~~~~~~~~~~{.c}
|
||||
int i, Nlinks;
|
||||
float D;
|
||||
ENgetcount(EN_LINKCOUNT, &Nlinks);
|
||||
for (i = 1; i <= Nlinks; i++) {
|
||||
ENgetlinkvalue(i, EN_DIAMETER, &D);
|
||||
if (D == 10) ENsetlinkvalue(i, EN_DIAMETER, 12);
|
||||
}
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
*/
|
||||
23
doc/Toolkit-Overview.dox
Normal file
23
doc/Toolkit-Overview.dox
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
@page toolkit-overview Toolkit Overview
|
||||
|
||||
|
||||
The Programmer's Toolkit is an extension of the EPANET simulation package. EPANET performs extended period simulation of hydraulic and water quality behavior within pressurized pipe networks. A network can consist of pipes, nodes (pipe junctions), pumps, valves and storage tanks or reservoirs. EPANET tracks the flow of water in each pipe, the pressure at each node, the height of water in each tank, and the concentration of a chemical species throughout the network during a multi-time period simulation. In addition to chemical species, water age and source tracing can also be simulated.
|
||||
|
||||
The Toolkit provides a series of functions that allow programmers to customize the use of EPANET's hydraulic and water quality solution engine to their own applications. Before using the Toolkit one should become familiar with the way that EPANET represents a pipe network and the design and operating information it requires to perform a simulation. This information can be obtained from reading EPANET's on-line Help file or from the EPANET Users Manual.
|
||||
|
||||
A typical usage of the Toolkit functions to analyze a distribution system might look as follows:
|
||||
|
||||
1. Use the @ref ENopen function to open the Toolkit system, along with an EPANET [Input file](Input-File).
|
||||
2. Use the `ENsetxxx` series of functions to change selected system characteristics.
|
||||
3. Run a full hydraulic simulation using the @ref ENsolveH function (which automatically saves results to a [Hydraulics file](Hydraulics-File)) or use the @ref ENopenH - @ref ENinitH - @ref ENrunH - @ref ENnextH - @ref ENcloseH series of functions to step through a hydraulic simulation, accessing results along the way with the `ENgetxxx` series of functions.
|
||||
4. Run a full water quality simulation using @ref ENsolveQ (which automatically saves hydraulic and water quality results to an [Output file](Output-File)) or use the @ref ENopenQ - @ref ENinitQ - @ref ENrunQ - @ref ENnextQ (or @ref ENstepQ) - @ref ENcloseQ series of functions to step through a water quality simulation, accessing results along the way with the `ENgetxxx` series of functions.
|
||||
5. Return to Step 2 to run additional analyses or use the @ref ENreport function to write a formatted report to the [Report file](Report-File).
|
||||
6. Call the @ref ENclose function to close all files and release system memory.
|
||||
|
||||
More specific examples of using the functions can be found in the [Example Applications](Example-Applications) topic.
|
||||
|
||||
|
||||
- @subpage how-to-use
|
||||
|
||||
*/
|
||||
2404
doc/doxyfile
Normal file
2404
doc/doxyfile
Normal file
File diff suppressed because it is too large
Load Diff
12
doc/main.dox
Executable file
12
doc/main.dox
Executable file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
@mainpage EPANET Open Source
|
||||
|
||||
The EPANET Open-Source Library is a pressurized pipe network hydraulic and water quality analysis toolkit, originally developed by USEPA, written in C.
|
||||
|
||||
__Note:__ This repository is not affiliated with, or endorsed by, the USEPA. For the "official" release of EPANET (2.00.12 UI and Toolkit) please go to the [EPA's GitHub repo](https://github.com/USEPA/Water-Distribution-Network-Model) or [the USEPA website](http://www2.epa.gov/water-research/epanet). It is also not the graphical user interface version. This is the hydraulic and water quality solver engine.
|
||||
|
||||
However, if you are interested in extending EPANET for academic, personal, or commercial use, then you've come to the right place. For community discussion, FAQ, and roadmapping of the project, go to the [Community Forum](http://community.wateranalytics.org/category/epanet).
|
||||
|
||||
- @subpage toolkit-overview "Toolkit Overview"
|
||||
|
||||
*/
|
||||
12
doc/modules_controls.dox
Normal file
12
doc/modules_controls.dox
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
|
||||
@defgroup Controls Managing Controls
|
||||
|
||||
|
||||
@addtogroup Controls
|
||||
@{
|
||||
@enum EN_ControlType
|
||||
@fn int ENgetcontrol(int controlIndex, int *controlType, int *linkIndex, EN_API_FLOAT_TYPE *setting, int *nodeIndex, EN_API_FLOAT_TYPE *level)
|
||||
@fn int ENsetcontrol(int cindex, int ctype, int lindex, EN_API_FLOAT_TYPE setting, int nindex, EN_API_FLOAT_TYPE level)
|
||||
@}
|
||||
*/
|
||||
20
doc/modules_curves.dox
Normal file
20
doc/modules_curves.dox
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
|
||||
@defgroup Curves
|
||||
|
||||
|
||||
@addtogroup Curves
|
||||
@{
|
||||
@fn int ENgetcurve(int curveIndex, char* id, int *nValues, EN_API_FLOAT_TYPE **xValues, EN_API_FLOAT_TYPE **yValues)
|
||||
@fn int ENgetheadcurveindex(int index, int *curveindex)
|
||||
@fn int ENgetpumptype(int index, int *type)
|
||||
@fn int ENgetheadcurve(int linkIndex, char *curveId)
|
||||
@fn int ENgetcurveindex(char *id, int *index)
|
||||
@fn int ENgetcurveid(int index, char *id)
|
||||
@fn int ENgetcurvelen(int index, int *len)
|
||||
@fn int ENgetcurvevalue(int index, int pnt, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y)
|
||||
@fn int ENsetcurvevalue(int index, int pnt, EN_API_FLOAT_TYPE x, EN_API_FLOAT_TYPE y)
|
||||
@fn int ENsetcurve(int index, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y, int len)
|
||||
@fn int ENaddcurve(char *id)
|
||||
@}
|
||||
*/
|
||||
20
doc/modules_filemanagement.dox
Normal file
20
doc/modules_filemanagement.dox
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
|
||||
@defgroup FileManagement File Management
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@addtogroup FileManagement
|
||||
@{
|
||||
@fn int ENwriteline (char *line)
|
||||
@fn int ENreport ()
|
||||
@fn int ENresetreport ()
|
||||
@fn int ENsetreport (char *reportFormat)
|
||||
@fn int ENopen (char *inpFile, char *rptFile, char *binOutFile)
|
||||
@fn int ENsaveinpfile (char *filename)
|
||||
@fn int ENclose()
|
||||
@}
|
||||
*/
|
||||
41
doc/modules_hydraulicfunctions.dox
Normal file
41
doc/modules_hydraulicfunctions.dox
Normal file
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
|
||||
@defgroup HydraulicFunctions Hydraulic Analysis
|
||||
|
||||
~~~~~~~~~~~~~~~{.c}
|
||||
int errcode;
|
||||
long t, tstep;
|
||||
|
||||
errcode = ENopenH();
|
||||
if (!errcode) {
|
||||
errcode = ENinitH(EN_SAVE);
|
||||
if (!errcode) {
|
||||
do {
|
||||
tstep = 0;
|
||||
ERRCODE(ENrunH(&t));
|
||||
ERRCODE(ENnextH(&tstep));
|
||||
} while (tstep > 0);
|
||||
}
|
||||
}
|
||||
|
||||
ENcloseH();
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
|
||||
@addtogroup HydraulicFunctions
|
||||
@{
|
||||
|
||||
@fn int ENsolveH()
|
||||
@fn int ENsaveH()
|
||||
@fn int ENopenH()
|
||||
@fn int ENinitH(int initFlag)
|
||||
@fn int ENrunH(long *currentTime)
|
||||
@fn int ENnextH(long *tStep)
|
||||
@fn int ENcloseH()
|
||||
@fn int ENsavehydfile(char *filename)
|
||||
@fn int ENusehydfile(char *filename)
|
||||
@fn int ENgetstatistic(int code, EN_API_FLOAT_TYPE* value)
|
||||
|
||||
@}
|
||||
*/
|
||||
16
doc/modules_networkinfo.dox
Normal file
16
doc/modules_networkinfo.dox
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
|
||||
@defgroup NetworkInfo Network Info
|
||||
|
||||
|
||||
@addtogroup NetworkInfo
|
||||
@{
|
||||
@fn int ENgetcount (int code, int *count)
|
||||
@fn int ENgetnodeindex (char *id, int *index)
|
||||
@fn int ENgetnodeid (int index, char *id)
|
||||
@fn int ENgetnodetype (int index, int *code)
|
||||
@fn int ENgetnodevalue (int index, int code, EN_API_FLOAT_TYPE *value)
|
||||
@fn int ENgetcoord (int index, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y)
|
||||
@fn int ENsetcoord (int index, EN_API_FLOAT_TYPE x, EN_API_FLOAT_TYPE y)
|
||||
@}
|
||||
*/
|
||||
14
doc/modules_patterns.dox
Normal file
14
doc/modules_patterns.dox
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
|
||||
@defgroup Patterns
|
||||
|
||||
|
||||
@addtogroup Patterns
|
||||
@{
|
||||
@fn int ENgetpatternindex (char *id, int *index)
|
||||
@fn int ENgetpatternid (int index, char *id)
|
||||
@fn int ENgetpatternlen (int index, int *len)
|
||||
@fn int ENgetpatternvalue (int index, int period, EN_API_FLOAT_TYPE *value)
|
||||
@fn int ENgetaveragepatternvalue (int index, EN_API_FLOAT_TYPE *value)
|
||||
@}
|
||||
*/
|
||||
17
doc/modules_qualityfunctions.dox
Normal file
17
doc/modules_qualityfunctions.dox
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
|
||||
@defgroup QualityFunctions Water Quality Functions
|
||||
|
||||
|
||||
|
||||
@addtogroup QualityFunctions
|
||||
@{
|
||||
@fn int ENsolveQ ()
|
||||
@fn int ENopenQ ()
|
||||
@fn int ENinitQ (int saveFlag)
|
||||
@fn int ENrunQ (long *currentTime)
|
||||
@fn int ENnextQ (long *tStep)
|
||||
@fn int ENstepQ (long *timeLeft)
|
||||
@fn int ENcloseQ ()
|
||||
@}
|
||||
*/
|
||||
14
doc/modules_toolkitoptions.dox
Normal file
14
doc/modules_toolkitoptions.dox
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
|
||||
@defgroup ToolkitOptions Toolkit Options
|
||||
|
||||
|
||||
@addtogroup ToolkitOptions
|
||||
@{
|
||||
@fn int ENgetoption (int code, EN_API_FLOAT_TYPE *value)
|
||||
@fn int ENgettimeparam (int code, long *value)
|
||||
@fn int ENgetflowunits (int *code)
|
||||
@fn int ENgetqualtype (int *qualcode, int *tracenode)
|
||||
@fn int ENgeterror (int errcode, char *errmsg, int maxLen)
|
||||
@}
|
||||
*/
|
||||
@@ -1,3 +1,8 @@
|
||||
/** @file epanet2.h
|
||||
@see http://github.com/openwateranalytics/epanet
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
*******************************************************************
|
||||
|
||||
@@ -15,6 +20,7 @@
|
||||
*******************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#ifndef EPANET2_H
|
||||
#define EPANET2_H
|
||||
|
||||
@@ -57,231 +63,844 @@
|
||||
|
||||
// --- Define the EPANET toolkit constants
|
||||
|
||||
#define EN_ELEVATION 0 /* Node parameters */
|
||||
#define EN_BASEDEMAND 1
|
||||
#define EN_PATTERN 2
|
||||
#define EN_EMITTER 3
|
||||
#define EN_INITQUAL 4
|
||||
#define EN_SOURCEQUAL 5
|
||||
#define EN_SOURCEPAT 6
|
||||
#define EN_SOURCETYPE 7
|
||||
#define EN_TANKLEVEL 8
|
||||
#define EN_DEMAND 9
|
||||
#define EN_HEAD 10
|
||||
#define EN_PRESSURE 11
|
||||
#define EN_QUALITY 12
|
||||
#define EN_SOURCEMASS 13
|
||||
#define EN_INITVOLUME 14
|
||||
#define EN_MIXMODEL 15
|
||||
#define EN_MIXZONEVOL 16
|
||||
/// Node property codes
|
||||
typedef enum {
|
||||
EN_ELEVATION = 0, /**< Node Elevation */
|
||||
EN_BASEDEMAND = 1, /**< Node Base Demand, from last demand category */
|
||||
EN_PATTERN = 2, /**< Node Demand Pattern */
|
||||
EN_EMITTER = 3, /**< Node Emitter Coefficient */
|
||||
EN_INITQUAL = 4, /**< Node initial quality */
|
||||
EN_SOURCEQUAL = 5, /**< Node source quality */
|
||||
EN_SOURCEPAT = 6, /**< Node source pattern index */
|
||||
EN_SOURCETYPE = 7, /**< Node source type */
|
||||
EN_TANKLEVEL = 8, /**< Tank Level */
|
||||
EN_DEMAND = 9, /**< Node current simulated demand */
|
||||
EN_HEAD = 10, /**< Node Head value */
|
||||
EN_PRESSURE = 11, /**< Node pressure value */
|
||||
EN_QUALITY = 12, /**< Node quality value */
|
||||
EN_SOURCEMASS = 13, /**< Node source mass value */
|
||||
EN_INITVOLUME = 14, /**< Tank or Reservoir initial volume */
|
||||
EN_MIXMODEL = 15, /**< Tank mixing model */
|
||||
EN_MIXZONEVOL = 16, /**< Tank mixing zone volume */
|
||||
EN_TANKDIAM = 17, /**< Tank diameter */
|
||||
EN_MINVOLUME = 18, /**< Tank minimum volume */
|
||||
EN_VOLCURVE = 19, /**< Tank volume curve index */
|
||||
EN_MINLEVEL = 20, /**< Tank minimum level */
|
||||
EN_MAXLEVEL = 21, /**< Tank maximum level */
|
||||
EN_MIXFRACTION = 22, /**< Tank mixing fraction */
|
||||
EN_TANK_KBULK = 23, /**< Tank bulk decay coefficient */
|
||||
EN_TANKVOLUME = 24, /**< Tank current volume */
|
||||
EN_MAXVOLUME = 25 /**< Tank maximum volume */
|
||||
} EN_NodeProperty;
|
||||
|
||||
#define EN_TANKDIAM 17
|
||||
#define EN_MINVOLUME 18
|
||||
#define EN_VOLCURVE 19
|
||||
#define EN_MINLEVEL 20
|
||||
#define EN_MAXLEVEL 21
|
||||
#define EN_MIXFRACTION 22
|
||||
#define EN_TANK_KBULK 23
|
||||
#define EN_TANKVOLUME 24
|
||||
#define EN_MAXVOLUME 25
|
||||
/// Link property codes
|
||||
typedef enum {
|
||||
EN_DIAMETER = 0,
|
||||
EN_LENGTH = 1,
|
||||
EN_ROUGHNESS = 2,
|
||||
EN_MINORLOSS = 3,
|
||||
EN_INITSTATUS = 4,
|
||||
EN_INITSETTING = 5,
|
||||
EN_KBULK = 6,
|
||||
EN_KWALL = 7,
|
||||
EN_FLOW = 8,
|
||||
EN_VELOCITY = 9,
|
||||
EN_HEADLOSS = 10,
|
||||
EN_STATUS = 11,
|
||||
EN_SETTING = 12,
|
||||
EN_ENERGY = 13,
|
||||
EN_LINKQUAL = 14,
|
||||
EN_LINKPATTERN = 15
|
||||
} EN_LinkProperty;
|
||||
|
||||
#define EN_DIAMETER 0 /* Link parameters */
|
||||
#define EN_LENGTH 1
|
||||
#define EN_ROUGHNESS 2
|
||||
#define EN_MINORLOSS 3
|
||||
#define EN_INITSTATUS 4
|
||||
#define EN_INITSETTING 5
|
||||
#define EN_KBULK 6
|
||||
#define EN_KWALL 7
|
||||
#define EN_FLOW 8
|
||||
#define EN_VELOCITY 9
|
||||
#define EN_HEADLOSS 10
|
||||
#define EN_STATUS 11
|
||||
#define EN_SETTING 12
|
||||
#define EN_ENERGY 13
|
||||
#define EN_LINKQUAL 14
|
||||
#define EN_LINKPATTERN 15
|
||||
/// Time parameter codes
|
||||
typedef enum {
|
||||
EN_DURATION = 0,
|
||||
EN_HYDSTEP = 1,
|
||||
EN_QUALSTEP = 2,
|
||||
EN_PATTERNSTEP = 3,
|
||||
EN_PATTERNSTART = 4,
|
||||
EN_REPORTSTEP = 5,
|
||||
EN_REPORTSTART = 6,
|
||||
EN_RULESTEP = 7,
|
||||
EN_STATISTIC = 8,
|
||||
EN_PERIODS = 9,
|
||||
EN_STARTTIME = 10,
|
||||
EN_HTIME = 11,
|
||||
EN_QTIME = 12,
|
||||
EN_HALTFLAG = 13,
|
||||
EN_NEXTEVENT = 14
|
||||
} EN_TimeProperty;
|
||||
|
||||
#define EN_DURATION 0 /* Time parameters */
|
||||
#define EN_HYDSTEP 1
|
||||
#define EN_QUALSTEP 2
|
||||
#define EN_PATTERNSTEP 3
|
||||
#define EN_PATTERNSTART 4
|
||||
#define EN_REPORTSTEP 5
|
||||
#define EN_REPORTSTART 6
|
||||
#define EN_RULESTEP 7
|
||||
#define EN_STATISTIC 8
|
||||
#define EN_PERIODS 9
|
||||
#define EN_STARTTIME 10 /* Added TNT 10/2/2009 */
|
||||
#define EN_HTIME 11
|
||||
#define EN_QTIME 12
|
||||
#define EN_HALTFLAG 13
|
||||
#define EN_NEXTEVENT 14
|
||||
|
||||
#define EN_ITERATIONS 0
|
||||
#define EN_RELATIVEERROR 1
|
||||
typedef enum {
|
||||
EN_ITERATIONS = 0,
|
||||
EN_RELATIVEERROR = 1
|
||||
} EN_AnalysisStatistic;
|
||||
|
||||
#define EN_NODECOUNT 0 /* Component counts */
|
||||
#define EN_TANKCOUNT 1
|
||||
#define EN_LINKCOUNT 2
|
||||
#define EN_PATCOUNT 3
|
||||
#define EN_CURVECOUNT 4
|
||||
#define EN_CONTROLCOUNT 5
|
||||
typedef enum {
|
||||
EN_NODECOUNT = 0, /**< Number of Nodes (Juntions + Tanks + Reservoirs) */
|
||||
EN_TANKCOUNT = 1, /**< Number of Tanks */
|
||||
EN_LINKCOUNT = 2, /**< Number of Links (Pipes + Pumps + Valves) */
|
||||
EN_PATCOUNT = 3, /**< Number of Time Patterns */
|
||||
EN_CURVECOUNT = 4, /**< Number of Curves */
|
||||
EN_CONTROLCOUNT = 5 /**< Number of Control Statements */
|
||||
} EN_CountType;
|
||||
|
||||
#define EN_JUNCTION 0 /* Node types */
|
||||
#define EN_RESERVOIR 1
|
||||
#define EN_TANK 2
|
||||
typedef enum {
|
||||
EN_JUNCTION = 0,
|
||||
EN_RESERVOIR = 1,
|
||||
EN_TANK = 2
|
||||
} EN_NodeType;
|
||||
|
||||
#define EN_CVPIPE 0 /* Link types. */
|
||||
#define EN_PIPE 1 /* See LinkType in TYPES.H */
|
||||
#define EN_PUMP 2
|
||||
#define EN_PRV 3
|
||||
#define EN_PSV 4
|
||||
#define EN_PBV 5
|
||||
#define EN_FCV 6
|
||||
#define EN_TCV 7
|
||||
#define EN_GPV 8
|
||||
|
||||
#define EN_NONE 0 /* Quality analysis types. */
|
||||
#define EN_CHEM 1 /* See QualType in TYPES.H */
|
||||
#define EN_AGE 2
|
||||
#define EN_TRACE 3
|
||||
typedef enum {
|
||||
EN_CVPIPE = 0, /* Link types. */
|
||||
EN_PIPE = 1, /* See LinkType in TYPES.H */
|
||||
EN_PUMP = 2,
|
||||
EN_PRV = 3,
|
||||
EN_PSV = 4,
|
||||
EN_PBV = 5,
|
||||
EN_FCV = 6,
|
||||
EN_TCV = 7,
|
||||
EN_GPV = 8
|
||||
} EN_LinkType;
|
||||
|
||||
#define EN_CONCEN 0 /* Source quality types. */
|
||||
#define EN_MASS 1 /* See SourceType in TYPES.H. */
|
||||
#define EN_SETPOINT 2
|
||||
#define EN_FLOWPACED 3
|
||||
|
||||
#define EN_CFS 0 /* Flow units types. */
|
||||
#define EN_GPM 1 /* See FlowUnitsType */
|
||||
#define EN_MGD 2 /* in TYPES.H. */
|
||||
#define EN_IMGD 3
|
||||
#define EN_AFD 4
|
||||
#define EN_LPS 5
|
||||
#define EN_LPM 6
|
||||
#define EN_MLD 7
|
||||
#define EN_CMH 8
|
||||
#define EN_CMD 9
|
||||
typedef enum {
|
||||
EN_NONE = 0, /* Quality analysis types. */
|
||||
EN_CHEM = 1, /* See QualType in TYPES.H */
|
||||
EN_AGE = 2,
|
||||
EN_TRACE = 3
|
||||
} EN_QualityType;
|
||||
|
||||
#define EN_TRIALS 0 /* Misc. options */
|
||||
#define EN_ACCURACY 1
|
||||
#define EN_TOLERANCE 2
|
||||
#define EN_EMITEXPON 3
|
||||
#define EN_DEMANDMULT 4
|
||||
typedef enum {
|
||||
EN_CONCEN = 0, /* Source quality types. */
|
||||
EN_MASS = 1, /* See SourceType in TYPES.H. */
|
||||
EN_SETPOINT = 2,
|
||||
EN_FLOWPACED = 3
|
||||
} EN_SourceType;
|
||||
|
||||
#define EN_LOWLEVEL 0 /* Control types. */
|
||||
#define EN_HILEVEL 1 /* See ControlType */
|
||||
#define EN_TIMER 2 /* in TYPES.H. */
|
||||
#define EN_TIMEOFDAY 3
|
||||
typedef enum {
|
||||
EN_CFS = 0, /* Flow units types. */
|
||||
EN_GPM = 1, /* See FlowUnitsType */
|
||||
EN_MGD = 2, /* in TYPES.H. */
|
||||
EN_IMGD = 3,
|
||||
EN_AFD = 4,
|
||||
EN_LPS = 5,
|
||||
EN_LPM = 6,
|
||||
EN_MLD = 7,
|
||||
EN_CMH = 8,
|
||||
EN_CMD = 9
|
||||
} EN_FlowUnits;
|
||||
|
||||
#define EN_AVERAGE 1 /* Time statistic types. */
|
||||
#define EN_MINIMUM 2 /* See TstatType in TYPES.H */
|
||||
#define EN_MAXIMUM 3
|
||||
#define EN_RANGE 4
|
||||
|
||||
#define EN_MIX1 0 /* Tank mixing models */
|
||||
#define EN_MIX2 1
|
||||
#define EN_FIFO 2
|
||||
#define EN_LIFO 3
|
||||
/// Simulation Option codes
|
||||
typedef enum {
|
||||
EN_TRIALS = 0,
|
||||
EN_ACCURACY = 1,
|
||||
EN_TOLERANCE = 2,
|
||||
EN_EMITEXPON = 3,
|
||||
EN_DEMANDMULT = 4
|
||||
} EN_Option;
|
||||
|
||||
#define EN_NOSAVE 0 /* Save-results-to-file flag */
|
||||
#define EN_SAVE 1
|
||||
typedef enum {
|
||||
EN_LOWLEVEL = 0, /* Control types. */
|
||||
EN_HILEVEL = 1, /* See ControlType */
|
||||
EN_TIMER = 2, /* in TYPES.H. */
|
||||
EN_TIMEOFDAY = 3
|
||||
} EN_ControlType;
|
||||
|
||||
|
||||
|
||||
typedef enum {
|
||||
EN_AVERAGE = 1, /* Time statistic types. */
|
||||
EN_MINIMUM = 2, /* See TstatType in TYPES.H */
|
||||
EN_MAXIMUM = 3,
|
||||
EN_RANGE = 4
|
||||
} EN_StatisticType;
|
||||
|
||||
|
||||
|
||||
typedef enum {
|
||||
EN_MIX1 = 0, /* Tank mixing models */
|
||||
EN_MIX2 = 1,
|
||||
EN_FIFO = 2,
|
||||
EN_LIFO = 3
|
||||
} EN_MixingModel;
|
||||
|
||||
|
||||
|
||||
typedef enum {
|
||||
EN_NOSAVE = 0,
|
||||
EN_SAVE = 1,
|
||||
EN_INITFLOW = 10,
|
||||
EN_SAVE_AND_INIT = 11
|
||||
} EN_SaveOption;
|
||||
|
||||
|
||||
|
||||
typedef enum {
|
||||
EN_CONST_HP = 0, /* constant horsepower */
|
||||
EN_POWER_FUNC = 1, /* power function */
|
||||
EN_CUSTOM = 2 /* user-defined custom curve */
|
||||
} EN_CurveType;
|
||||
|
||||
#define EN_INITFLOW 10 /* Re-initialize flows flag */
|
||||
|
||||
#define EN_CONST_HP 0 /* constant horsepower */
|
||||
#define EN_POWER_FUNC 1 /* power function */
|
||||
#define EN_CUSTOM 2 /* user-defined custom curve */
|
||||
|
||||
// --- Declare the EPANET toolkit functions
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
/**
|
||||
@brief runs a complete EPANET simulation
|
||||
@param inpFile pointer to name of input file (must exist)
|
||||
@param rptFile pointer to name of report file (to be created)
|
||||
@param binOutFile pointer to name of binary output file (to be created)
|
||||
@param callback a callback function that takes a character string (char *) as its only parameter.
|
||||
@return error code
|
||||
|
||||
The callback function should reside in and be used by the calling
|
||||
code to display the progress messages that EPANET generates
|
||||
as it carries out its computations. If this feature is not
|
||||
needed then the argument should be NULL.
|
||||
*/
|
||||
int DLLEXPORT ENepanet(char *inpFile, char *rptFile, char *binOutFile, void (*callback) (char *));
|
||||
|
||||
/**
|
||||
@brief Opens EPANET input file & reads in network data
|
||||
@param inpFile pointer to name of input file (must exist)
|
||||
@param rptFile pointer to name of report file (to be created)
|
||||
@param binOutFile pointer to name of binary output file (to be created)
|
||||
@return error code
|
||||
*/
|
||||
int DLLEXPORT ENopen(char *inpFile, char *rptFile, char *binOutFile);
|
||||
|
||||
/**
|
||||
@brief Saves current data to "INP" formatted text file.
|
||||
@param filename The file path to create
|
||||
@return Error code
|
||||
*/
|
||||
int DLLEXPORT ENsaveinpfile(char *filename);
|
||||
|
||||
/**
|
||||
@brief Frees all memory and files used by EPANET
|
||||
@return Error code
|
||||
*/
|
||||
int DLLEXPORT ENclose();
|
||||
|
||||
/**
|
||||
@brief Solves the network hydraulics for all time periods
|
||||
@return Error code
|
||||
*/
|
||||
int DLLEXPORT ENsolveH();
|
||||
|
||||
/**
|
||||
@brief Saves hydraulic results to binary file
|
||||
@return Error code
|
||||
|
||||
Must be called before ENreport() if no WQ simulation has been made.
|
||||
Should not be called if ENsolveQ() will be used.
|
||||
*/
|
||||
int DLLEXPORT ENsaveH();
|
||||
|
||||
/**
|
||||
@brief Sets up data structures for hydraulic analysis
|
||||
@return Error code
|
||||
*/
|
||||
int DLLEXPORT ENopenH();
|
||||
|
||||
/**
|
||||
@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).
|
||||
@return Error code
|
||||
*/
|
||||
int DLLEXPORT ENinitH(int initFlag);
|
||||
|
||||
/**
|
||||
@brief Run a hydraulic solution period
|
||||
@param[out] currentTime The current simulation time in seconds
|
||||
@return Error or warning code
|
||||
@see ENsolveH
|
||||
|
||||
This function is used in a loop with ENnextH() to run
|
||||
an extended period hydraulic simulation.
|
||||
See ENsolveH() for an example.
|
||||
*/
|
||||
int DLLEXPORT ENrunH(long *currentTime);
|
||||
|
||||
/**
|
||||
@brief Determine time (in seconds) until next hydraulic event
|
||||
@param[out] tStep Time (seconds) until next hydraulic event. 0 marks end of simulation period.
|
||||
@return Error code
|
||||
|
||||
This function is used in a loop with ENrunH() to run an extended period hydraulic simulation.
|
||||
See ENsolveH() for an example.
|
||||
*/
|
||||
int DLLEXPORT ENnextH(long *tStep);
|
||||
|
||||
|
||||
/**
|
||||
@brief Frees data allocated by hydraulics solver
|
||||
@return Error code
|
||||
*/
|
||||
int DLLEXPORT ENcloseH();
|
||||
|
||||
/**
|
||||
@brief Copies binary hydraulics file to disk
|
||||
@param filename Name of file to be created
|
||||
@return Error code
|
||||
*/
|
||||
int DLLEXPORT ENsavehydfile(char *filename);
|
||||
|
||||
/**
|
||||
@brief Opens previously saved binary hydraulics file
|
||||
@param filename Name of file to be used
|
||||
@return Error code
|
||||
*/
|
||||
int DLLEXPORT ENusehydfile(char *filename);
|
||||
|
||||
/**
|
||||
@brief Solves for network water quality in all time periods
|
||||
@return Error code
|
||||
*/
|
||||
int DLLEXPORT ENsolveQ();
|
||||
|
||||
/**
|
||||
@brief Sets up data structures for WQ analysis
|
||||
@return Error code
|
||||
*/
|
||||
int DLLEXPORT ENopenQ();
|
||||
|
||||
/**
|
||||
@brief Initializes water quality analysis
|
||||
@param saveFlag EN_SAVE (1) if results saved to file, EN_NOSAVE (0) if not
|
||||
@return Error code
|
||||
*/
|
||||
int DLLEXPORT ENinitQ(int saveFlag);
|
||||
|
||||
/**
|
||||
@brief Retrieves hydraulic & WQ results at time t.
|
||||
@param[out] currentTime Current simulation time, in seconds.
|
||||
@return Error code
|
||||
|
||||
This function is used in a loop with ENnextQ() to run
|
||||
an extended period WQ simulation. See ENsolveQ() for
|
||||
an example.
|
||||
*/
|
||||
int DLLEXPORT ENrunQ(long *currentTime);
|
||||
|
||||
/**
|
||||
@brief Advances WQ simulation to next hydraulic event.
|
||||
@param[out] tStep Time in seconds until next hydraulic event. 0 marks end of simulation period.
|
||||
@return Error code
|
||||
|
||||
This function is used in a loop with ENrunQ() to run
|
||||
an extended period WQ simulation. See ENsolveQ() for
|
||||
an example.
|
||||
*/
|
||||
int DLLEXPORT ENnextQ(long *tStep);
|
||||
|
||||
/**
|
||||
@brief Advances WQ simulation by a single WQ time step
|
||||
@param[out] timeLeft Time left in overall simulation (in seconds)
|
||||
@return Error code
|
||||
|
||||
This function is used in a loop with ENrunQ() to run
|
||||
an extended period WQ simulation.
|
||||
*/
|
||||
int DLLEXPORT ENstepQ(long *timeLeft);
|
||||
|
||||
/**
|
||||
@brief Frees data allocated by water quality solver.
|
||||
@return Error code.
|
||||
*/
|
||||
int DLLEXPORT ENcloseQ();
|
||||
|
||||
/**
|
||||
@brief Writes line of text to the report file.
|
||||
@param line Text string to write
|
||||
@return Error code.
|
||||
*/
|
||||
int DLLEXPORT ENwriteline(char *line);
|
||||
|
||||
/**
|
||||
@brief Writes simulation report to the report file
|
||||
@return Error code
|
||||
*/
|
||||
int DLLEXPORT ENreport();
|
||||
|
||||
/**
|
||||
@brief Resets report options to default values
|
||||
@return Error code
|
||||
*/
|
||||
int DLLEXPORT ENresetreport();
|
||||
|
||||
/**
|
||||
@brief Processes a reporting format command
|
||||
@return Error code
|
||||
*/
|
||||
int DLLEXPORT ENsetreport(char *reportFormat);
|
||||
|
||||
int DLLEXPORT ENgetcontrol(int controlIndex, int *controlType, int *linkIdx, EN_API_FLOAT_TYPE *setting, int *nodeIdx, EN_API_FLOAT_TYPE *level);
|
||||
/**
|
||||
@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[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);
|
||||
|
||||
/**
|
||||
@brief Retrieves the number of components of a given type in the network.
|
||||
@param code Component code (see EPANET2.H)
|
||||
@param[out] count Number of components in network
|
||||
@return Error code
|
||||
*/
|
||||
int DLLEXPORT ENgetcount(int code, int *count);
|
||||
|
||||
/**
|
||||
@brief Gets value for an analysis option
|
||||
@param code Option code (see EPANET2.H)
|
||||
@param[out] value Option value
|
||||
@return Error code
|
||||
*/
|
||||
int DLLEXPORT ENgetoption(int code, EN_API_FLOAT_TYPE *value);
|
||||
|
||||
/**
|
||||
@brief Retrieves value of specific time parameter.
|
||||
@param code Time parameter code
|
||||
@param[out] value Value of time parameter.
|
||||
@return Error code
|
||||
*/
|
||||
int DLLEXPORT ENgettimeparam(int code, long *value);
|
||||
|
||||
/**
|
||||
@brief Retrieves the flow units code
|
||||
@param[out] code Code of flow units in use
|
||||
@return Error code
|
||||
*/
|
||||
int DLLEXPORT ENgetflowunits(int *code);
|
||||
|
||||
/**
|
||||
@brief Retrieves the index of the time pattern with specified ID
|
||||
@param id String ID of the time pattern
|
||||
@param[out] index Index of the specified time pattern
|
||||
@return Error code
|
||||
@see ENgetpatternid
|
||||
*/
|
||||
int DLLEXPORT ENgetpatternindex(char *id, int *index);
|
||||
|
||||
/**
|
||||
@brief Retrieves ID of a time pattern with specific index.
|
||||
@param index The index of a time pattern.
|
||||
@param[out] id The string ID of the time pattern.
|
||||
@return Error code
|
||||
@see ENgetpatternindex
|
||||
*/
|
||||
int DLLEXPORT ENgetpatternid(int index, char *id);
|
||||
|
||||
/**
|
||||
@brief Retrieves the number of multipliers in a time pattern.
|
||||
@param index The index of a time pattern.
|
||||
@param[out] len The length of the time pattern.
|
||||
@return Error code
|
||||
*/
|
||||
int DLLEXPORT ENgetpatternlen(int index, int *len);
|
||||
|
||||
/**
|
||||
@brief Retrive a multiplier from a pattern for a specific time period.
|
||||
@param index The index of a time pattern
|
||||
@param period The pattern time period. First time period is 1.
|
||||
@param[out] value Pattern multiplier
|
||||
@return Error code
|
||||
*/
|
||||
int DLLEXPORT ENgetpatternvalue(int index, int period, EN_API_FLOAT_TYPE *value);
|
||||
|
||||
/**
|
||||
@brief Retrieve the average multiplier value in a time pattern
|
||||
@param index The index of a time pattern
|
||||
@param[out] value The average of all of this time pattern's values
|
||||
@return Error code
|
||||
*/
|
||||
int DLLEXPORT ENgetaveragepatternvalue(int index, EN_API_FLOAT_TYPE *value);
|
||||
|
||||
/**
|
||||
@brief Retrieve the type of quality analytis to be run.
|
||||
@param[out] qualcode The quality analysis code number.
|
||||
@param[out] tracenode The index of node being traced, if qualcode == trace
|
||||
@return Error code
|
||||
@see ENsetqualtype
|
||||
*/
|
||||
int DLLEXPORT ENgetqualtype(int *qualcode, int *tracenode);
|
||||
|
||||
/**
|
||||
@brief Get the text of an error code.
|
||||
@param errcode The error code
|
||||
@param[out] errmsg The error string represented by the code
|
||||
@param maxLen The maximum number of characters to copy into the char pointer errmsg
|
||||
@return Error code
|
||||
*/
|
||||
int DLLEXPORT ENgeterror(int errcode, char *errmsg, int maxLen);
|
||||
|
||||
/**
|
||||
@brief Get hydraulic simulation statistic
|
||||
@param code The type of statistic to get
|
||||
@param[out] value The value of the statistic
|
||||
@return Error code
|
||||
*/
|
||||
int DLLEXPORT ENgetstatistic(int code, EN_API_FLOAT_TYPE* value);
|
||||
|
||||
/**
|
||||
@brief Get index of node with specified ID
|
||||
@param id The string ID of the node
|
||||
@param[out] index The node's index (first node is index 1)
|
||||
@return Error code
|
||||
@see ENgetnodeid
|
||||
*/
|
||||
int DLLEXPORT ENgetnodeindex(char *id, int *index);
|
||||
|
||||
/**
|
||||
@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.
|
||||
@return Error code
|
||||
@see ENgetnodeindex
|
||||
*/
|
||||
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.
|
||||
@return Error code
|
||||
*/
|
||||
int DLLEXPORT ENgetnodetype(int index, int *code);
|
||||
|
||||
/**
|
||||
@brief Get a property value for specified node
|
||||
@param index The index of a node (first node is index 1).
|
||||
@param code The property type code
|
||||
@param[out] value The value of the node's property.
|
||||
@return Error code
|
||||
@see EN_NodeProperty
|
||||
*/
|
||||
int DLLEXPORT ENgetnodevalue(int index, int code, EN_API_FLOAT_TYPE *value);
|
||||
|
||||
/**
|
||||
@brief Get coordinates (x,y) for a node.
|
||||
@param index The index of a node (first node is index 1).
|
||||
@param[out] x X-value of node's coordinate
|
||||
@param[out] y Y-value of node's coordinate
|
||||
@return Error code
|
||||
@see ENsetcoord
|
||||
*/
|
||||
int DLLEXPORT ENgetcoord(int index, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y);
|
||||
|
||||
/**
|
||||
@brief Set coordinates (x,y) for a node.
|
||||
@param index The index of a node (first node is index 1)
|
||||
@param x X-value of node's coordinate
|
||||
@param y Y-value of node's coordinate
|
||||
@return Error code
|
||||
@see ENgetcoord
|
||||
*/
|
||||
int DLLEXPORT ENsetcoord(int index, EN_API_FLOAT_TYPE x, EN_API_FLOAT_TYPE y);
|
||||
|
||||
/**
|
||||
@brief Get the number of demand categories for a node.
|
||||
@param nodeIndex The index of a node (first node is index 1)
|
||||
@param[out] numDemands The number of demand categories
|
||||
@return Error code
|
||||
*/
|
||||
int DLLEXPORT ENgetnumdemands(int nodeIndex, int *numDemands);
|
||||
int DLLEXPORT ENgetbasedemand(int nodeIndex, int demandIdx, EN_API_FLOAT_TYPE *baseDemand);
|
||||
int DLLEXPORT ENgetdemandpattern(int nodeIndex, int demandIdx, int *pattIdx);
|
||||
|
||||
/**
|
||||
@brief Get a node's base demand for a specified category.
|
||||
@param nodeIndex The index of a node (first node is index 1)
|
||||
@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);
|
||||
|
||||
/**
|
||||
@brief Get 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[out] pattIndex The index of the pattern for this node and category.
|
||||
@return Error code
|
||||
*/
|
||||
int DLLEXPORT ENgetdemandpattern(int nodeIndex, int demandIndex, int *pattIndex);
|
||||
|
||||
/**
|
||||
@brief Get the index of a Link with specified ID.
|
||||
@param id The string ID of a link.
|
||||
@param[out] index The index of the named link (first link is index 1)
|
||||
@return Error code
|
||||
@see ENgetlinkid
|
||||
*/
|
||||
int DLLEXPORT ENgetlinkindex(char *id, int *index);
|
||||
|
||||
/**
|
||||
@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.
|
||||
@return Error code
|
||||
@see ENgetlinkindex
|
||||
*/
|
||||
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.
|
||||
@return Error code
|
||||
@see EN_LinkType
|
||||
*/
|
||||
int DLLEXPORT ENgetlinktype(int index, int *code);
|
||||
|
||||
/**
|
||||
@brief Get the indexes of a link's start- and end-nodes.
|
||||
@param index The index of a link (first link is index 1)
|
||||
@param[out] node1 The index of the link's start node (first node is index 1).
|
||||
@param[out] node2 The index of the link's end node (first node is index 1).
|
||||
@return Error code
|
||||
@see ENgetnodeid, ENgetlinkid
|
||||
*/
|
||||
int DLLEXPORT ENgetlinknodes(int index, int *node1, int *node2);
|
||||
|
||||
/**
|
||||
@brief Get a property value for specified link.
|
||||
@param index The index of a node (first node is index 1).
|
||||
@param code The parameter desired.
|
||||
@param[out] value The value of the link's specified property.
|
||||
@return Error code
|
||||
@see ENgetnodevalue, EN_LinkProperty
|
||||
*/
|
||||
int DLLEXPORT ENgetlinkvalue(int index, int code, EN_API_FLOAT_TYPE *value);
|
||||
|
||||
/**
|
||||
@brief Get a curve's properties.
|
||||
@param curveIndex The index of a curve (first curve is index 1).
|
||||
@param[out] id The curve's string ID. Client code must preallocate at least MAXID characters.
|
||||
@param[out] nValues The number of values in the curve's (x,y) list.
|
||||
@param[out] xValues The curve's x-values. Must be freed by client.
|
||||
@param[out] yValues The curve's y-values. 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 ENgetheadcurveindex(int index, int *curveindex);
|
||||
int DLLEXPORT ENgetpumptype(int index, int *type);
|
||||
|
||||
/**
|
||||
@brief Retrieves the curve index for a specified pump index.
|
||||
@param pumpIndex The index of a pump
|
||||
@param[out] curveIndex The index of the curve used by the pump.
|
||||
@return Error code.
|
||||
*/
|
||||
int DLLEXPORT ENgetheadcurveindex(int pumpIndex, int *curveIndex);
|
||||
|
||||
/**
|
||||
@brief Get the type of pump
|
||||
@param linkIndex The index of the pump element
|
||||
@param[out] outType The integer-typed pump curve type signifier (output parameter)
|
||||
@return Error code
|
||||
@see EN_CurveType
|
||||
*/
|
||||
int DLLEXPORT ENgetpumptype(int linkIndex, int *outType);
|
||||
|
||||
/**
|
||||
@brief Get the version number. This number is to be interpreted with implied decimals, i.e., "20100" == "2(.)01(.)00"
|
||||
@param[out] version The version of EPANET
|
||||
@return Error code.
|
||||
*/
|
||||
int DLLEXPORT ENgetversion(int *version);
|
||||
|
||||
/**
|
||||
@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.
|
||||
@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);
|
||||
|
||||
/**
|
||||
@brief Set a property value for a node.
|
||||
@param index The index of a node. First node is index 1.
|
||||
@param code The code for the proprty to set.
|
||||
@param v The value to set for this node and property.
|
||||
@return Error code.
|
||||
@see EN_NodeProperty
|
||||
*/
|
||||
int DLLEXPORT ENsetnodevalue(int index, int code, EN_API_FLOAT_TYPE v);
|
||||
|
||||
/**
|
||||
@brief Set a proprty value for a link.
|
||||
@param index The index of a link. First link is index 1.
|
||||
@param code The code for the property to set.
|
||||
@param v The value to set for this link and property.
|
||||
@return Error code.
|
||||
@see EN_LinkProperty
|
||||
*/
|
||||
int DLLEXPORT ENsetlinkvalue(int index, int code, EN_API_FLOAT_TYPE v);
|
||||
|
||||
/**
|
||||
@brief Add a new time pattern.
|
||||
@param id The string ID of the pattern to add.
|
||||
@return Error code.
|
||||
@see ENgetpatternindex
|
||||
*/
|
||||
int DLLEXPORT ENaddpattern(char *id);
|
||||
|
||||
/**
|
||||
@brief Set multipliers for a specific pattern
|
||||
@param index The index of a pattern. First pattern is index 1.
|
||||
@param f An array of multipliers
|
||||
@param len The length of array f.
|
||||
@return Error code.
|
||||
@see ENgetpatternindex
|
||||
*/
|
||||
int DLLEXPORT ENsetpattern(int index, EN_API_FLOAT_TYPE *f, int len);
|
||||
|
||||
/**
|
||||
@brief Set the multiplier for a specific pattern at a specific period.
|
||||
@param index The index of a pattern. First pattern is index 1.
|
||||
@param period The period of the pattern to set.
|
||||
@param value The value of the multiplier to set.
|
||||
@return Error code.
|
||||
*/
|
||||
int DLLEXPORT ENsetpatternvalue(int index, int period, EN_API_FLOAT_TYPE value);
|
||||
|
||||
/**
|
||||
@brief Set the value for a time parameter.
|
||||
@param code The code for the parameter to set.
|
||||
@param value The desired value of the parameter.
|
||||
@return Error code.
|
||||
@see EN_TimeProperty
|
||||
*/
|
||||
int DLLEXPORT ENsettimeparam(int code, long value);
|
||||
|
||||
/**
|
||||
@brief Set a value for an anlysis option.
|
||||
@param code The code for the desired option.
|
||||
@param v The desired value for the option specified.
|
||||
@return Error code.
|
||||
@see EN_Option
|
||||
*/
|
||||
int DLLEXPORT ENsetoption(int code, EN_API_FLOAT_TYPE v);
|
||||
|
||||
/**
|
||||
@brief Sets the level of hydraulic status reporting.
|
||||
@param code Status reporting code.
|
||||
@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)
|
||||
@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.
|
||||
*/
|
||||
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.
|
||||
@return Error code.
|
||||
@see EN_QualityType
|
||||
*/
|
||||
int DLLEXPORT ENgetqualinfo(int *qualcode, char *chemname, char *chemunits, int *tracenode);
|
||||
|
||||
/**
|
||||
@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.
|
||||
@return Error code.
|
||||
@see ENgetbasedemand
|
||||
*/
|
||||
int DLLEXPORT ENsetbasedemand(int nodeIndex, int demandIdx, EN_API_FLOAT_TYPE baseDemand);
|
||||
|
||||
|
||||
/**
|
||||
@brief Retrieves index of curve with specific ID.
|
||||
@param id The ID 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.
|
||||
@param index The index of a curve.
|
||||
@param[out] id The ID of the curve specified.
|
||||
@return Error code.
|
||||
@see ENsetcurveindex
|
||||
|
||||
NOTE: 'id' must be able to hold MAXID characters
|
||||
*/
|
||||
int DLLEXPORT ENgetcurveid(int index, char *id);
|
||||
|
||||
/**
|
||||
@brief Retrieves number of points in a curve
|
||||
@param index The index of a curve.
|
||||
@param[out] len The length of the curve coordinate list
|
||||
@return Error code.
|
||||
@see ENgetcurvevalue
|
||||
*/
|
||||
int DLLEXPORT ENgetcurvelen(int index, int *len);
|
||||
int DLLEXPORT ENgetcurvevalue(int index, int pnt, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y);
|
||||
int DLLEXPORT ENsetcurvevalue(int index, int pnt, EN_API_FLOAT_TYPE x, EN_API_FLOAT_TYPE y);
|
||||
|
||||
/**
|
||||
@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
|
||||
@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);
|
||||
|
||||
/**
|
||||
@brief Sets x,y point for a specific point and curve.
|
||||
@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);
|
||||
|
||||
/**
|
||||
@brief Sets x,y values for a specified 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.
|
||||
@return Error code.
|
||||
*/
|
||||
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.
|
||||
@param id The name of the curve to be added.
|
||||
@return Error code.
|
||||
@see ENgetcurveindex ENsetcurve
|
||||
*/
|
||||
int DLLEXPORT ENaddcurve(char *id);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
||||
539
src/epanet.c
539
src/epanet.c
@@ -473,17 +473,6 @@ int DLLEXPORT ENinitH(int flag)
|
||||
|
||||
|
||||
int DLLEXPORT ENrunH(long *t)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: none (no need to supply a value for *t)
|
||||
** Output: *t = current simulation time (seconds)
|
||||
** Returns: error/warning code
|
||||
** Purpose: solves hydraulics for conditions at time t.
|
||||
**
|
||||
** This function is used in a loop with ENnextH() to run
|
||||
** an extended period hydraulic simulation.
|
||||
** See ENsolveH() for an example.
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
int errcode;
|
||||
*t = 0;
|
||||
@@ -495,18 +484,6 @@ int DLLEXPORT ENrunH(long *t)
|
||||
|
||||
|
||||
int DLLEXPORT ENnextH(long *tstep)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: none (no need to supply a value for *tstep)
|
||||
** Output: *tstep = time (seconds) until next hydraulic event
|
||||
** (0 marks end of simulation period)
|
||||
** Returns: error code
|
||||
** Purpose: determines time until next hydraulic event.
|
||||
**
|
||||
** This function is used in a loop with ENrunH() to run
|
||||
** an extended period hydraulic simulation.
|
||||
** See ENsolveH() for an example.
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
int errcode;
|
||||
*tstep = 0;
|
||||
@@ -519,13 +496,7 @@ int DLLEXPORT ENnextH(long *tstep)
|
||||
|
||||
|
||||
int DLLEXPORT ENcloseH()
|
||||
/*----------------------------------------------------------------
|
||||
** Input: none
|
||||
** Output: none
|
||||
** Returns: error code
|
||||
** Purpose: frees data allocated by hydraulics solver
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
|
||||
{
|
||||
if (!Openflag) return(102);
|
||||
closehyd();
|
||||
@@ -535,13 +506,6 @@ int DLLEXPORT ENcloseH()
|
||||
|
||||
|
||||
int DLLEXPORT ENsavehydfile(char *filename)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: filename = name of file
|
||||
** Output: none
|
||||
** Returns: error code
|
||||
** Purpose: copies binary hydraulics file to disk
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
FILE *f;
|
||||
int c;
|
||||
@@ -561,13 +525,6 @@ int DLLEXPORT ENsavehydfile(char *filename)
|
||||
|
||||
|
||||
int DLLEXPORT ENusehydfile(char *filename)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: filename = name of file
|
||||
** Output: none
|
||||
** Returns: error code
|
||||
** Purpose: opens previously saved binary hydraulics file
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
int errcode;
|
||||
|
||||
@@ -600,13 +557,6 @@ int DLLEXPORT ENusehydfile(char *filename)
|
||||
|
||||
|
||||
int DLLEXPORT ENsolveQ()
|
||||
/*----------------------------------------------------------------
|
||||
** Input: none
|
||||
** Output: none
|
||||
** Returns: error code
|
||||
** Purpose: solves for network water quality in all time periods
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
int errcode;
|
||||
long t, tstep;
|
||||
@@ -662,13 +612,6 @@ int DLLEXPORT ENsolveQ()
|
||||
|
||||
|
||||
int DLLEXPORT ENopenQ()
|
||||
/*----------------------------------------------------------------
|
||||
** Input: none
|
||||
** Output: none
|
||||
** Returns: error code
|
||||
** Purpose: sets up data structures for WQ analysis
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
int errcode = 0;
|
||||
|
||||
@@ -688,14 +631,6 @@ int DLLEXPORT ENopenQ()
|
||||
|
||||
|
||||
int DLLEXPORT ENinitQ(int saveflag)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: saveflag = EN_SAVE (1) if results saved to file,
|
||||
** EN_NOSAVE (0) if not
|
||||
** Output: none
|
||||
** Returns: error code
|
||||
** Purpose: initializes WQ analysis
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
int errcode = 0;
|
||||
if (!OpenQflag) return(105);
|
||||
@@ -712,17 +647,6 @@ int DLLEXPORT ENinitQ(int saveflag)
|
||||
|
||||
|
||||
int DLLEXPORT ENrunQ(long *t)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: none (no need to supply a value for *t)
|
||||
** Output: *t = current simulation time (seconds)
|
||||
** Returns: error code
|
||||
** Purpose: retrieves hydraulic & WQ results at time t.
|
||||
**
|
||||
** This function is used in a loop with ENnextQ() to run
|
||||
** an extended period WQ simulation. See ENsolveQ() for
|
||||
** an example.
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
int errcode;
|
||||
*t = 0;
|
||||
@@ -734,18 +658,6 @@ int DLLEXPORT ENrunQ(long *t)
|
||||
|
||||
|
||||
int DLLEXPORT ENnextQ(long *tstep)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: none (no need to supply a value for *tstep)
|
||||
** Output: *tstep = time (seconds) until next hydraulic event
|
||||
** (0 marks end of simulation period)
|
||||
** Returns: error code
|
||||
** Purpose: advances WQ simulation to next hydraulic event.
|
||||
**
|
||||
** This function is used in a loop with ENrunQ() to run
|
||||
** an extended period WQ simulation. See ENsolveQ() for
|
||||
** an example.
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
int errcode;
|
||||
*tstep = 0;
|
||||
@@ -758,16 +670,6 @@ int DLLEXPORT ENnextQ(long *tstep)
|
||||
|
||||
|
||||
int DLLEXPORT ENstepQ(long *tleft)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: none
|
||||
** Output: *tleft = time left in overall simulation (seconds)
|
||||
** Returns: error code
|
||||
** Purpose: advances WQ simulation by a single WQ time step
|
||||
**
|
||||
** This function is used in a loop with ENrunQ() to run
|
||||
** an extended period WQ simulation.
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
int errcode;
|
||||
*tleft = 0;
|
||||
@@ -780,13 +682,7 @@ int DLLEXPORT ENstepQ(long *tleft)
|
||||
|
||||
|
||||
int DLLEXPORT ENcloseQ()
|
||||
/*----------------------------------------------------------------
|
||||
** Input: none
|
||||
** Output: none
|
||||
** Returns: error code
|
||||
** Purpose: frees data allocated by WQ solver
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
|
||||
{
|
||||
if (!Openflag) return(102);
|
||||
closequal();
|
||||
@@ -803,13 +699,6 @@ int DLLEXPORT ENcloseQ()
|
||||
|
||||
|
||||
int DLLEXPORT ENwriteline(char *line)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: line = text string
|
||||
** Output: none
|
||||
** Returns: error code
|
||||
** Purpose: writes line of text to report file
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
if (!Openflag) return(102);
|
||||
writeline(line);
|
||||
@@ -818,13 +707,6 @@ int DLLEXPORT ENwriteline(char *line)
|
||||
|
||||
|
||||
int DLLEXPORT ENreport()
|
||||
/*----------------------------------------------------------------
|
||||
** Input: none
|
||||
** Output: none
|
||||
** Returns: error code
|
||||
** Purpose: writes report to report file
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
int errcode;
|
||||
|
||||
@@ -837,13 +719,6 @@ int DLLEXPORT ENreport()
|
||||
|
||||
|
||||
int DLLEXPORT ENresetreport()
|
||||
/*----------------------------------------------------------------
|
||||
** Input: none
|
||||
** Output: none
|
||||
** Returns: error code
|
||||
** Purpose: resets report options to default values
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
int i;
|
||||
if (!Openflag) return(102);
|
||||
@@ -855,13 +730,6 @@ int DLLEXPORT ENresetreport()
|
||||
|
||||
|
||||
int DLLEXPORT ENsetreport(char *s)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: s = report format command
|
||||
** Output: none
|
||||
** Returns: error code
|
||||
** Purpose: processes a reporting format command
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
char s1[MAXLINE+1];
|
||||
if (!Openflag) return(102);
|
||||
@@ -897,20 +765,6 @@ int DLLEXPORT ENgetversion(int *v)
|
||||
|
||||
|
||||
int DLLEXPORT ENgetcontrol(int cindex, int *ctype, int *lindex, EN_API_FLOAT_TYPE *setting, int *nindex, EN_API_FLOAT_TYPE *level)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: cindex = control index (position of control statement
|
||||
** in the input file, starting from 1)
|
||||
** Output: *ctype = control type code (see EPANET2.H)
|
||||
** *lindex = index of controlled link
|
||||
** *setting = control setting on link
|
||||
** *nindex = index of controlling node (0 for TIMER
|
||||
** or TIMEOFDAY control)
|
||||
** *level = control level (tank level, junction
|
||||
** pressure, or time (seconds))
|
||||
** Returns: error code
|
||||
** Purpose: retrieves parameters that define a simple control
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
double s, lvl;
|
||||
|
||||
@@ -950,14 +804,6 @@ int DLLEXPORT ENgetcontrol(int cindex, int *ctype, int *lindex, EN_API_FLOAT_TYP
|
||||
|
||||
|
||||
int DLLEXPORT ENgetcount(int code, int *count)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: code = component code (see EPANET2.H)
|
||||
** Output: *count = number of components in network
|
||||
** Returns: error code
|
||||
** Purpose: retrieves the number of components of a
|
||||
** given type in the network
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
*count = 0;
|
||||
if (!Openflag) return(102);
|
||||
@@ -976,13 +822,6 @@ int DLLEXPORT ENgetcount(int code, int *count)
|
||||
|
||||
|
||||
int DLLEXPORT ENgetoption(int code, EN_API_FLOAT_TYPE *value)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: code = option code (see EPANET2.H)
|
||||
** Output: *value = option value
|
||||
** Returns: error code
|
||||
** Purpose: gets value for an analysis option
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
double v = 0.0;
|
||||
*value = 0.0;
|
||||
@@ -1007,13 +846,6 @@ int DLLEXPORT ENgetoption(int code, EN_API_FLOAT_TYPE *value)
|
||||
|
||||
|
||||
int DLLEXPORT ENgettimeparam(int code, long *value)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: code = time parameter code (see EPANET2.H)
|
||||
** Output: *value = value of time parameter
|
||||
** Returns: error code
|
||||
** Purpose: retrieves value of specific time parameter
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
*value = 0;
|
||||
if (!Openflag) return(102);
|
||||
@@ -1042,14 +874,6 @@ int DLLEXPORT ENgettimeparam(int code, long *value)
|
||||
|
||||
|
||||
int DLLEXPORT ENgetflowunits(int *code)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: none
|
||||
** Output: *code = code of flow units in use
|
||||
** (see EPANET2.H or TYPES.H)
|
||||
** Returns: error code
|
||||
** Purpose: retrieves flow units code
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
*code = -1;
|
||||
if (!Openflag) return(102);
|
||||
@@ -1059,13 +883,6 @@ int DLLEXPORT ENgetflowunits(int *code)
|
||||
|
||||
|
||||
int DLLEXPORT ENgetpatternindex(char *id, int *index)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: id = time pattern ID
|
||||
** Output: *index = index of time pattern in list of patterns
|
||||
** Returns: error code
|
||||
** Purpose: retrieves index of time pattern with specific ID
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
int i;
|
||||
*index = 0;
|
||||
@@ -1084,15 +901,6 @@ int DLLEXPORT ENgetpatternindex(char *id, int *index)
|
||||
|
||||
|
||||
int DLLEXPORT ENgetpatternid(int index, char *id)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = index of time pattern
|
||||
** Output: id = pattern ID
|
||||
** Returns: error code
|
||||
** Purpose: retrieves ID of a time pattern with specific index
|
||||
**
|
||||
** NOTE: 'id' must be able to hold MAXID characters
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
strcpy(id,"");
|
||||
if (!Openflag) return(102);
|
||||
@@ -1103,13 +911,6 @@ int DLLEXPORT ENgetpatternid(int index, char *id)
|
||||
|
||||
|
||||
int DLLEXPORT ENgetpatternlen(int index, int *len)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = index of time pattern
|
||||
** Output: *len = pattern length (number of multipliers)
|
||||
** Returns: error code
|
||||
** Purpose: retrieves number of multipliers in a time pattern
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
if (!Openflag) return(102);
|
||||
if (index < 1 || index > Npats) return(205);
|
||||
@@ -1119,15 +920,6 @@ int DLLEXPORT ENgetpatternlen(int index, int *len)
|
||||
|
||||
|
||||
int DLLEXPORT ENgetpatternvalue(int index, int period, EN_API_FLOAT_TYPE *value)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = index of time pattern
|
||||
** period = pattern time period
|
||||
** Output: *value = pattern multiplier
|
||||
** Returns: error code
|
||||
** Purpose: retrieves multiplier for a specific time period
|
||||
** and pattern
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{ *value = 0.0;
|
||||
if (!Openflag) return(102);
|
||||
if (index < 1 || index > Npats) return(205);
|
||||
@@ -1138,13 +930,6 @@ int DLLEXPORT ENgetpatternvalue(int index, int period, EN_API_FLOAT_TYPE *value)
|
||||
|
||||
|
||||
int DLLEXPORT ENgetcurveindex(char *id, int *index)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: id = curve ID
|
||||
** Output: *index = index of curve in list of curves
|
||||
** Returns: error code
|
||||
** Purpose: retrieves index of curve with specific ID
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
int i;
|
||||
*index = 0;
|
||||
@@ -1163,15 +948,6 @@ int DLLEXPORT ENgetcurveindex(char *id, int *index)
|
||||
|
||||
|
||||
int DLLEXPORT ENgetcurveid(int index, char *id)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = index of curve
|
||||
** Output: id = curve ID
|
||||
** Returns: error code
|
||||
** Purpose: retrieves ID of a curve with specific index
|
||||
**
|
||||
** NOTE: 'id' must be able to hold MAXID characters
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
strcpy(id,"");
|
||||
if (!Openflag) return(102);
|
||||
@@ -1182,13 +958,6 @@ int DLLEXPORT ENgetcurveid(int index, char *id)
|
||||
|
||||
|
||||
int DLLEXPORT ENgetcurvelen(int index, int *len)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = index of curve
|
||||
** Output: *len = curve length (number of points in curve)
|
||||
** Returns: error code
|
||||
** Purpose: retrieves number of points in a curve
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
if (!Openflag) return(102);
|
||||
if (index < 1 || index > Ncurves) return(206);
|
||||
@@ -1198,17 +967,7 @@ int DLLEXPORT ENgetcurvelen(int index, int *len)
|
||||
|
||||
|
||||
int DLLEXPORT ENgetcurvevalue(int index, int pnt, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = index of curve
|
||||
** pnt = curve's point number
|
||||
** Output: *x = curve x value
|
||||
** curve y value
|
||||
** Returns: error code
|
||||
** Purpose: retrieves x,y point for a specific point number
|
||||
** and curve
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
{
|
||||
*x = 0.0;
|
||||
*y = 0.0;
|
||||
if (!Openflag) return(102);
|
||||
@@ -1221,15 +980,6 @@ int DLLEXPORT ENgetcurvevalue(int index, int pnt, EN_API_FLOAT_TYPE *x, EN_API_F
|
||||
|
||||
|
||||
int DLLEXPORT ENgetqualtype(int *qualcode, int *tracenode)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: none
|
||||
** Output: *qualcode = WQ analysis code number (see EPANET2.H)
|
||||
** *tracenode = index of node being traced (if
|
||||
** qualocode = WQ tracing)
|
||||
** Returns: error code
|
||||
** Purpose: retrieves type of quality analysis called for
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
*tracenode = 0;
|
||||
if (!Openflag) return(102);
|
||||
@@ -1253,14 +1003,6 @@ int DLLEXPORT ENgetqualinfo(int *qualcode, char *chemname, char *chemunits, int
|
||||
}
|
||||
|
||||
int DLLEXPORT ENgeterror(int errcode, char *errmsg, int n)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: errcode = error/warning code number
|
||||
** n = maximum length of string errmsg
|
||||
** Output: errmsg = text of error/warning message
|
||||
** Returns: error code
|
||||
** Purpose: retrieves text of error/warning message
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
switch (errcode)
|
||||
{
|
||||
@@ -1277,13 +1019,6 @@ int DLLEXPORT ENgeterror(int errcode, char *errmsg, int n)
|
||||
}
|
||||
|
||||
int DLLEXPORT ENgetstatistic(int code, EN_API_FLOAT_TYPE* value)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: code = type of simulation statistic to retrieve
|
||||
** Output: value = value of requested statistic
|
||||
** Returns: error code
|
||||
** Purpose: retrieves hydraulic simulation statistic
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
switch (code) {
|
||||
case EN_ITERATIONS:
|
||||
@@ -1306,13 +1041,6 @@ int DLLEXPORT ENgetstatistic(int code, EN_API_FLOAT_TYPE* value)
|
||||
|
||||
|
||||
int DLLEXPORT ENgetnodeindex(char *id, int *index)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: id = node ID
|
||||
** Output: *index = index of node in list of nodes
|
||||
** Returns: error code
|
||||
** Purpose: retrieves index of a node with specific ID
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
*index = 0;
|
||||
if (!Openflag) return(102);
|
||||
@@ -1323,15 +1051,6 @@ int DLLEXPORT ENgetnodeindex(char *id, int *index)
|
||||
|
||||
|
||||
int DLLEXPORT ENgetnodeid(int index, char *id)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = index of node in list of nodes
|
||||
** Output: id = node ID
|
||||
** Returns: error code
|
||||
** Purpose: retrieves ID of a node with specific index
|
||||
**
|
||||
** NOTE: 'id' must be able to hold MAXID characters
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
strcpy(id,"");
|
||||
if (!Openflag) return(102);
|
||||
@@ -1342,13 +1061,6 @@ int DLLEXPORT ENgetnodeid(int index, char *id)
|
||||
|
||||
|
||||
int DLLEXPORT ENgetnodetype(int index, int *code)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = node index
|
||||
** Output: *code = node type code number (see EPANET2.H)
|
||||
** Returns: error code
|
||||
** Purpose: retrieves node type of specific node
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
*code = -1;
|
||||
if (!Openflag) return(102);
|
||||
@@ -1364,14 +1076,6 @@ int DLLEXPORT ENgetnodetype(int index, int *code)
|
||||
|
||||
|
||||
int DLLEXPORT ENgetcoord(int index, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = node index
|
||||
** Output: *x = value of node's coordinate
|
||||
** *y = value of node's coordinate
|
||||
** Returns: error code
|
||||
** Purpose: retrieves coordinate x, y for a node
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
if (!Openflag) return(102);
|
||||
if (index < 1 || index > Nnodes) return(203);
|
||||
@@ -1387,15 +1091,6 @@ int DLLEXPORT ENgetcoord(int index, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y)
|
||||
|
||||
|
||||
int DLLEXPORT ENsetcoord(int index, EN_API_FLOAT_TYPE x, EN_API_FLOAT_TYPE y)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = node index
|
||||
** *x = value of node's coordinate
|
||||
** *y = value of node's coordinate
|
||||
** Output: None
|
||||
** Returns: error code
|
||||
** Purpose: sets coordinate x, y for a node
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
if (!Openflag) return(102);
|
||||
if (index < 1 || index > Nnodes) return(203);
|
||||
@@ -1409,14 +1104,6 @@ int DLLEXPORT ENsetcoord(int index, EN_API_FLOAT_TYPE x, EN_API_FLOAT_TYPE y)
|
||||
|
||||
|
||||
int DLLEXPORT ENgetnodevalue(int index, int code, EN_API_FLOAT_TYPE *value)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = node index
|
||||
** code = node parameter code (see EPANET2.H)
|
||||
** Output: *value = value of node's parameter
|
||||
** Returns: error code
|
||||
** Purpose: retrieves parameter value for a node
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
double v = 0.0;
|
||||
Pdemand demand;
|
||||
@@ -1594,13 +1281,6 @@ int DLLEXPORT ENgetnodevalue(int index, int code, EN_API_FLOAT_TYPE *value)
|
||||
|
||||
|
||||
int DLLEXPORT ENgetlinkindex(char *id, int *index)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: id = link ID
|
||||
** Output: *index = index of link in list of links
|
||||
** Returns: error code
|
||||
** Purpose: retrieves index of a link with specific ID
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
*index = 0;
|
||||
if (!Openflag) return(102);
|
||||
@@ -1611,15 +1291,6 @@ int DLLEXPORT ENgetlinkindex(char *id, int *index)
|
||||
|
||||
|
||||
int DLLEXPORT ENgetlinkid(int index, char *id)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = index of link in list of links
|
||||
** Output: id = link ID
|
||||
** Returns: error code
|
||||
** Purpose: retrieves ID of a link with specific index
|
||||
**
|
||||
** NOTE: 'id' must be able to hold MAXID characters
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
strcpy(id,"");
|
||||
if (!Openflag) return(102);
|
||||
@@ -1630,13 +1301,6 @@ int DLLEXPORT ENgetlinkid(int index, char *id)
|
||||
|
||||
|
||||
int DLLEXPORT ENgetlinktype(int index, int *code)
|
||||
/*------------------------------------------------------------------
|
||||
** Input: index = link index
|
||||
** Output: *code = link type code number (see EPANET2.H)
|
||||
** Returns: error code
|
||||
** Purpose: retrieves link type of specific link
|
||||
**------------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
*code = -1;
|
||||
if (!Openflag) return(102);
|
||||
@@ -1647,14 +1311,6 @@ int DLLEXPORT ENgetlinktype(int index, int *code)
|
||||
|
||||
|
||||
int DLLEXPORT ENgetlinknodes(int index, int *node1, int *node2)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = link index
|
||||
** Output: *node1 = index of link's starting node
|
||||
** *node2 = index of link's ending node
|
||||
** Returns: error code
|
||||
** Purpose: retrieves end nodes of a specific link
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
*node1 = 0;
|
||||
*node2 = 0;
|
||||
@@ -1667,14 +1323,6 @@ int DLLEXPORT ENgetlinknodes(int index, int *node1, int *node2)
|
||||
|
||||
|
||||
int DLLEXPORT ENgetlinkvalue(int index, int code, EN_API_FLOAT_TYPE *value)
|
||||
/*------------------------------------------------------------------
|
||||
** Input: index = link index
|
||||
** code = link parameter code (see EPANET2.H)
|
||||
** Output: *value = value of link's parameter
|
||||
** Returns: error code
|
||||
** Purpose: retrieves parameter value for a link
|
||||
**------------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
double a,h,q, v = 0.0;
|
||||
|
||||
@@ -1819,18 +1467,6 @@ int DLLEXPORT ENgetlinkvalue(int index, int code, EN_API_FLOAT_TYPE *value)
|
||||
|
||||
|
||||
int DLLEXPORT ENgetcurve(int curveIndex, char* id, int *nValues, EN_API_FLOAT_TYPE **xValues, EN_API_FLOAT_TYPE **yValues)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: curveIndex = curve index
|
||||
** Output: *nValues = number of points on curve
|
||||
** id = curve ID
|
||||
** *xValues = values for x
|
||||
** *yValues = values for y
|
||||
** Returns: error code
|
||||
** Purpose: retrieves curve id, number of values and (x,y) values
|
||||
**
|
||||
** NOTE: 'id' must be able to hold MAXID characters
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
int iPoint, nPoints;
|
||||
Scurve curve;
|
||||
@@ -1871,21 +1507,6 @@ int DLLEXPORT ENgetcurve(int curveIndex, char* id, int *nValues, EN_API_FLOAT_T
|
||||
|
||||
int DLLEXPORT ENsetcontrol(int cindex, int ctype, int lindex,
|
||||
EN_API_FLOAT_TYPE setting, int nindex, EN_API_FLOAT_TYPE level)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: cindex = control index (position of control statement
|
||||
** in the input file, starting from 1)
|
||||
** ctype = control type code (see EPANET2.H)
|
||||
** lindex = index of controlled link
|
||||
** setting = control setting applied to link
|
||||
** nindex = index of controlling node (0 for TIMER
|
||||
** or TIMEOFDAY control)
|
||||
** level = control level (tank level, junction pressure,
|
||||
** or time (seconds))
|
||||
** Output: none
|
||||
** Returns: error code
|
||||
** Purpose: specifies parameters that define a simple control
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
char status = ACTIVE;
|
||||
long t = 0;
|
||||
@@ -2327,14 +1948,6 @@ int DLLEXPORT ENsetlinkvalue(int index, int code, EN_API_FLOAT_TYPE v)
|
||||
|
||||
|
||||
int DLLEXPORT ENaddpattern(char *id)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: id = ID name of the new pattern
|
||||
** Output: none
|
||||
** Returns: error code
|
||||
** Purpose: adds a new time pattern appended to the end of the
|
||||
** existing patterns.
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
int i, j, n, err = 0;
|
||||
Spattern *tmpPat;
|
||||
@@ -2395,15 +2008,6 @@ int DLLEXPORT ENaddpattern(char *id)
|
||||
|
||||
|
||||
int DLLEXPORT ENsetpattern(int index, EN_API_FLOAT_TYPE *f, int n)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = time pattern index
|
||||
** *f = array of pattern multipliers
|
||||
** n = number of time periods in pattern
|
||||
** Output: none
|
||||
** Returns: error code
|
||||
** Purpose: sets multipliers for a specific time pattern
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
int j;
|
||||
|
||||
@@ -2424,15 +2028,6 @@ int DLLEXPORT ENsetpattern(int index, EN_API_FLOAT_TYPE *f, int n)
|
||||
|
||||
|
||||
int DLLEXPORT ENsetpatternvalue(int index, int period, EN_API_FLOAT_TYPE value)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = time pattern index
|
||||
** period = time pattern period
|
||||
** value = pattern multiplier
|
||||
** Output: none
|
||||
** Returns: error code
|
||||
** Purpose: sets multiplier for a specific time period and pattern
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
if (!Openflag) return(102);
|
||||
if (index <= 0 || index > Npats) return(205);
|
||||
@@ -2443,14 +2038,6 @@ int DLLEXPORT ENsetpatternvalue(int index, int period, EN_API_FLOAT_TYPE value
|
||||
|
||||
|
||||
int DLLEXPORT ENaddcurve(char *id)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: id = ID name of the new curve
|
||||
** Output: none
|
||||
** Returns: error code
|
||||
** Purpose: adds a new curve appended to the end of the
|
||||
** existing curves.
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
int i, j, n, err = 0;
|
||||
Scurve *tmpCur;
|
||||
@@ -2530,16 +2117,6 @@ int DLLEXPORT ENaddcurve(char *id)
|
||||
|
||||
|
||||
int DLLEXPORT ENsetcurve(int index, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y, int n)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = curve index
|
||||
** *x = array of x points
|
||||
** *y = array of y points
|
||||
** n = number of points in curve
|
||||
** Output: none
|
||||
** Returns: error code
|
||||
** Purpose: sets x,y values for a specific curve
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
int j;
|
||||
|
||||
@@ -2566,16 +2143,6 @@ int DLLEXPORT ENsetcurve(int index, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y
|
||||
|
||||
|
||||
int DLLEXPORT ENsetcurvevalue(int index, int pnt, EN_API_FLOAT_TYPE x, EN_API_FLOAT_TYPE y)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = curve index
|
||||
** pnt = curve's point number
|
||||
** x = curve x value
|
||||
** y = curve y value
|
||||
** Output: none
|
||||
** Returns: error code
|
||||
** Purpose: sets x,y point for a specific point and curve
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
if (!Openflag) return(102);
|
||||
if (index <= 0 || index > Ncurves) return(206);
|
||||
@@ -2587,14 +2154,7 @@ int DLLEXPORT ENsetcurvevalue(int index, int pnt, EN_API_FLOAT_TYPE x, EN_API_
|
||||
|
||||
|
||||
int DLLEXPORT ENsettimeparam(int code, long value)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: code = time parameter code (see EPANET2.H)
|
||||
** value = time parameter value
|
||||
** Output: none
|
||||
** Returns: error code
|
||||
** Purpose: sets value for time parameter
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
|
||||
{
|
||||
if (!Openflag) return(102);
|
||||
if (OpenHflag || OpenQflag) {
|
||||
@@ -2723,13 +2283,6 @@ int DLLEXPORT ENsetoption(int code, EN_API_FLOAT_TYPE v)
|
||||
|
||||
|
||||
int DLLEXPORT ENsetstatusreport(int code)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: code = status reporting code (0, 1, or 2)
|
||||
** Output: none
|
||||
** Returns: error code
|
||||
** Purpose: sets level of hydraulic status reporting
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
int errcode = 0;
|
||||
if (code >= 0 && code <= 2) Statflag = (char)code;
|
||||
@@ -2738,22 +2291,7 @@ int DLLEXPORT ENsetstatusreport(int code)
|
||||
}
|
||||
|
||||
|
||||
int DLLEXPORT ENsetqualtype(int qualcode, char *chemname,
|
||||
char *chemunits, char *tracenode)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: qualcode = WQ parameter code (see EPANET2.H)
|
||||
** chemname = name of WQ constituent
|
||||
** chemunits = concentration units of WQ constituent
|
||||
** tracenode = ID of node being traced
|
||||
** Output: none
|
||||
** Returns: error code
|
||||
** Purpose: sets type of quality analysis called for
|
||||
**
|
||||
** NOTE: chemname and chemunits only apply when WQ analysis
|
||||
** is for chemical. tracenode only applies when WQ
|
||||
** analysis is source tracing.
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
int DLLEXPORT ENsetqualtype(int qualcode, char *chemname, char *chemunits, char *tracenode)
|
||||
{
|
||||
/*** Updated 3/1/01 ***/
|
||||
double ccf = 1.0;
|
||||
@@ -2801,14 +2339,6 @@ int DLLEXPORT ENsetqualtype(int qualcode, char *chemname,
|
||||
}
|
||||
|
||||
int DLLEXPORT ENgetheadcurveindex(int index, int *curveindex)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = index of pump in list of links
|
||||
** Output: curveindex = head curve index
|
||||
** Returns: error code
|
||||
** Purpose: retrieves index of a head curve for specific link index
|
||||
**
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
if (!Openflag) return(102);
|
||||
if (index < 1 || index > Nlinks || PUMP != Link[index].Type) return(204);
|
||||
@@ -2817,14 +2347,6 @@ int DLLEXPORT ENgetheadcurveindex(int index, int *curveindex)
|
||||
}
|
||||
|
||||
int DLLEXPORT ENgetpumptype(int index, int *type)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = index of pump in list of links
|
||||
** Output: type = Pump type
|
||||
** Returns: error code
|
||||
** Purpose: retrieves type of a pump for specific link index
|
||||
**
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
*type=-1;
|
||||
if (!Openflag) return(102);
|
||||
@@ -3561,13 +3083,6 @@ void writewin(char *s)
|
||||
|
||||
|
||||
int DLLEXPORT ENgetnumdemands(int nodeIndex, int *numDemands)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: nodeIndex = index of node
|
||||
** Output: *numDemands = number of demand categories
|
||||
** Returns: error code
|
||||
** Purpose: retrieves the number of a demand categories for a node
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
Pdemand d;
|
||||
int n=0;
|
||||
@@ -3581,14 +3096,6 @@ int DLLEXPORT ENgetnumdemands(int nodeIndex, int *numDemands)
|
||||
|
||||
|
||||
int DLLEXPORT ENgetbasedemand(int nodeIndex, int demandIdx, EN_API_FLOAT_TYPE *baseDemand)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: nodeIndex = index of node
|
||||
** demandIdx = index of demand category
|
||||
** Output: *baseDemand = base demand for selected category
|
||||
** Returns: error code
|
||||
** Purpose: retrieves the node's base demand for a category
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
Pdemand d;
|
||||
int n=1;
|
||||
@@ -3596,9 +3103,13 @@ int DLLEXPORT ENgetbasedemand(int nodeIndex, int demandIdx, EN_API_FLOAT_TYPE *
|
||||
if (!Openflag) return(102);
|
||||
if (nodeIndex <= 0 || nodeIndex > Nnodes) return(203);
|
||||
if (nodeIndex <= Njuncs) {
|
||||
for(d=Node[nodeIndex].D; n<demandIdx && d != NULL; d=d->next) n++;
|
||||
if(n!=demandIdx) return(253);
|
||||
*baseDemand=(EN_API_FLOAT_TYPE)(d->Base*Ucf[FLOW]);
|
||||
for(d=Node[nodeIndex].D; n<demandIdx && d != NULL; d=d->next) {
|
||||
n++;
|
||||
}
|
||||
if(n != demandIdx) {
|
||||
return(253);
|
||||
}
|
||||
*baseDemand=(EN_API_FLOAT_TYPE)(d->Base*Ucf[FLOW]);
|
||||
}
|
||||
else {
|
||||
*baseDemand=(EN_API_FLOAT_TYPE)(0.0);
|
||||
@@ -3608,14 +3119,6 @@ int DLLEXPORT ENgetbasedemand(int nodeIndex, int demandIdx, EN_API_FLOAT_TYPE *
|
||||
|
||||
|
||||
int DLLEXPORT ENsetbasedemand(int nodeIndex, int demandIdx, EN_API_FLOAT_TYPE baseDemand)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: nodeIndex = index of node
|
||||
** demandIdx = index of demand category
|
||||
** baseDemand = base demand for selected category
|
||||
** Returns: error code
|
||||
** Purpose: sets the node's base demand for a category
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
Pdemand d;
|
||||
int n=1;
|
||||
@@ -3632,15 +3135,6 @@ int DLLEXPORT ENsetbasedemand(int nodeIndex, int demandIdx, EN_API_FLOAT_TYPE b
|
||||
|
||||
|
||||
int DLLEXPORT ENgetdemandpattern(int nodeIndex, int demandIdx, int *pattIdx)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: nodeIndex = index of node
|
||||
** demandIdx = index of demand category
|
||||
** Output: *pattIdx = demand pattern index
|
||||
** Returns: error code
|
||||
** Purpose: retrieves the index of a demand pattern for a specific
|
||||
** demand category of a node
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
Pdemand d;
|
||||
int n=1;
|
||||
@@ -3655,14 +3149,7 @@ int DLLEXPORT ENgetdemandpattern(int nodeIndex, int demandIdx, int *pattIdx)
|
||||
|
||||
|
||||
int DLLEXPORT ENgetaveragepatternvalue(int index, EN_API_FLOAT_TYPE *value)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = index of time pattern
|
||||
** Output: *value = pattern average value
|
||||
** Returns: error code
|
||||
** Purpose: retrieves the average value of a pattern
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
{
|
||||
int i;
|
||||
*value = 0.0;
|
||||
if (!Openflag) return(102);
|
||||
|
||||
Reference in New Issue
Block a user