* removing reference to strncpy

* Fixing memory problems with test_toolkit

Fixes memory leaks and some minor refactoring.

* Update test_toolkit.hpp

removing crtdbg.h from header

* Update CMakeLists.txt

Restoring test_net_builder to test_toolkit.exe

* Cleaning up include statements adding crtdbg.h

* Fixing index error in test

* Add more analysis options to the API (issue #425)

* Fixed epanet2_enums.h

* Eliminates use of temporary linked lists to process Patterns & Curves (issue #449)

* Update input2.c

* Bug fix for 2Comp and LIFO tank mixing models (issue #448)

* Triggering build to update benchmarks

* Added new reg tests

Updating reference build id

* Initial commit list

generic linked list

* Update test_list.cpp

Tests are passing

* Update list.h

Adding documentation

* Fix typo

* Fixing bug in head_list

* Fixing indentation

* Fixed memory leak

Fixed memory leak in test_head_list

* Clean up and inline comments

* Updating file headers

* Update list.c

Updating in line comments.

* Update test_list.cpp

* Fixing indent

Spaces not tabs

* Update list.c

Fixing indent

* Update test_list.cpp

Updating file header to reflect proper attribution

* Expanding test

Added test where data is a struct

* Fixing indent

* Work in progress

* Reorganized to contain list abstraction

* Update list.c

* Refactoring head_list and tail_list

Simplifying head and tail list. Adding delete_node() to list API.

* Update test_list.cpp

* Update test_list.cpp

Fixing bug on gcc

* Fixing bug

* Fixing bug on gcc

* Update CMakeLists.txt

Adding test_list to ctest

* Fixes memory leak in EN_addnode() (#455)


* Fixing memory leak in EN_addnode()

* Separating test_net_builder from test_toolkit

Making test_net_builder a standalone test

* Removing BOOST_TEST_MAIN

* Work in progress

* Updating unit tests

* Fixing compilation bug on gcc

* Work in progress

compiles with warnings, definitely not working

* Update demand.h

* Work in progress

Implementing demand_list

* Work in progress

Creating function for validateing element ID strings

* Work in progress

Refactoring cstr_copy and adding test

* Update cstr_helper.c

fixing indentation

* Update cstr_helper.c

Fixing indentation

* Update test_cstrhelper.cpp

Fixed mem leak

* Adding element id validity checks

* Adding element id validity check

Adding checks for element set id functions

* Fixing build warnings on gcc

* Update errror code from 250 to 252

* Work in progress

Implementing generic demand pattern lists. Compiles but does not run.

* Update demand.c

Work in progress

* Return object index from EN_addnode and EN_addlink (issue #432)

Adds an output argument to EN_addnode and EN_addlink that returns the index of the newly added object.
Also refactors the validity check on object ID names.

* Fixed compilation errors

* Update test_node.cpp

* Create test_demand_data.cpp

* test demand data passing

* Work in progress

Fixing problems when demand lists are null

* Passing open and close test

* get/set demand name are passing

* Updated criteria for valid object ID name

* Work in progress

* Work in progress

Working on demand lists

* Work in progress

Fixing memory leaks
Unit tests passing

* Cleaning up build on gcc

* Cleaning up gcc build

* Fixing bug

* Working on gcc bug

Tests are passing on Appveyor

* Update inpfile.c

Trying to isolate bug

* GCC Bug

* Refactored xstrcpy function

* Update inpfile.c

Testing linux build

* Update epanet.c

Trying to isolate bug

* updating get demand name and write demands

Everything passing locally

* Update test_project.cpp

Isolating bug on gcc

* Isolating bug

Not writing demand section of input file should eliminate it

* Update demand.c

Fixing bug in get_category_name when category_name is NULL

* Restoring write_demands section in saveinpfile

* Update test_demand_data.cpp

Adding index to addnode calls. Fixing indent

* Update demand.c

* Reverted handling of default pattern

When creating demands, no pattern is marked with a zero. Then when data is adjusted it gets updated to default.

* Update epanet.c

Updating EN_getnodevalue() and EN_setnodevalue() to process the primary demand located at the head of the demand list

* Update demand.c

* Work in progress

code cleanup, addressed issue raised in review, and implemented EN_adddemand()

* Adding key and search to list

* Adding remove node method to generic list

* Adding remove demand method to toolkit

* Fix bug and test remove demand

* Fix problems with setting tank parameters (issue #464 )

* Fixed NULL pointer error, if no label is provided after the rule keyword.

* Create Makefile2.bat

Co-Authored-By: Demetrios G. Eliades <eldemet@users.noreply.github.com>
Co-Authored-By: Elad Salomons <selad@optiwater.com>

* Create LICENSE

* Fixed NULL pointer error, if no label is provided after the rule keyword.
Add NULL guard in freerules function. Use strncat and strncpy to ensure
the buffer lengths are adhered to.

* For "conditional" do delete a node connected to a link

For "conditional" deletion the node is deleted only if all of its links have been explicitly deleted beforehand #473

Co-Authored-By: Lew Rossman <lrossman@outlook.com>

* Create CODE_OF_CONDUCT.md

* Refactors the API's demand editing functions

* Update test_demand.cpp

* Update CODE_OF_CONDUCT.md

* Update rules.c

Fix broken win build script

* Updates to doc files

* Documentation edits

* Update Makefile.bat

Updates on the Microsoft SDK 7.1 compilation script to generate runepanet.exe and to use the \include\epanet2.def

* Update Makefile2.bat

Modified epanet2.exe to runepanet.exe, for consistency.

* Delete epanet2.def

Deleted the redundant `epanet2.def` file in the WindSDK folder

* Minor format change to status report

* Removing status reports from CI testing

* rm WinSDK folder and update Makefiles

Co-Authored-By: Demetrios G. Eliades <eldemet@users.noreply.github.com>

* Restored CI testing of status reports

* Removes _DEBUG directives from all source files

This commit removes the #ifdef _DEBUG statements at the top of all source code files per issue #482. It also updates the doc files to stress that the speedup observed for hydraulic analysis with the MMD node re-ordering method only applies to single period runs.

* Fix refactor of types.h

* updates authors

* updates AUTHORS and generator script

* Update run\CMakeLists.txt

* add help file win_build.md

Co-Authored-By: Elad Salomons <selad@optiwater.com>

* move win_build.md to root dir and renaiming to BUILDING.md

* Move BuildAndTest.md to the tools directory

* Update BUILDING.md

* Update BUILDING.md

* Update BUILDING.md

* Fixes problem with findpattern() function (issue #498)

* Change default properties for new pipe created with EN_addlink (issue #500)

* Numerous updates to project documentation

* Adds tank overflow feature

* Updating docs for tank overflow feature

* Updating VB include files

* Update input3.c

* Identifies overflowing tank in Status Report

* Update Makefile.bat

* Update Makefile2.bat

#508

* rethinking the python wrapper (#511)

* renames certain function parameter declarations and removes double pointer call from the deleteproject function

* deprecates conditonal compilation, removes python-specific headers and function renaming

* fixes tests and docs

* fixes test

* PDA fixes

* Minor update to force new CI test

* Another minor change to force another CI test

* Fixes Overflow and PDA tests not being run

* Fix EN_getElseaction and EN_setelseaction

Co-Authored-By: Andreas Ashikkis <andreasashikkis@users.noreply.github.com>

* Add -MT switch for CMake Windows build

* Updates to the docs

* Update BUILDING.md

* Build script updates

* Fixes EN_setlinkvalue bug

* fix in EN_deleteLink

when pipes are deleted via deletelink it also deletes comment of last link

Co-Authored-By: Pavlos Pavlou <pavlou.v.pavlos@ucy.ac.cy>

* rm set to null in functions EN_deletenode, EN_deletelink

* trial actions config

* Update ccpp.yml

* welcome to the Actions beta

* fixes mkstemp file handle-leaking behavior (#529)

* reverts posix include (#533)

... because it is not needed

* Fixes bugs in pump and demand head loss gradients

* Removed dependence on unistd.h in project.c

Travis CI failed because system could not find unistd.h.

* getTmpName() and xstrcpy() made safer

* Fixed use of strncpy in xstrcpy()

* Refactor of hydcoeffs.c

Simplifies and unifies how limit on head gradient at low flow is handled.

* Update ReleaseNotes2_2.md

* Return error if node/link name is too long (#535)

* co-authored with @ehsan-shafiee

* removes errant slashes

* Throws correct error for ID name too long

* Revert "Throws correct error for ID name too long"

This reverts commit 57b4873f5882cb9fd983f7e1e5a703b9e442cd74.

* fixes #534 by bubbling error codes up from add node/link internal functions

* fixes tests on Mac at least

* fixes improper success code

* Error 252 (not 250) returned for ID name too long.

From errors.dat: DAT(252,"invalid ID name")

* Fixes problems with EN_addnode() (#543)

See issue #542 . Also modifies unit test test_node to check that fixup works.

* Adds EN_getresultindex function to the API

See issue #546 . Also fixes a small bug in project.c.

* Adds link vertex get/set functions to the API

* Fixes to EN_addlink and EN_deletelink

* Updates the docs

* Bug fix for EN_setcurve

Adjusts params of any pump that uses the curve whose data is modified by EN_setcurve or EN_setcurvevalue (issue #550 ).

* Bug fix for EN_getrule

Fixes possible seg fault condition in EN_getrule. Also defines EN_MISSING as an API constant since it can be assigned internally to several variables that are retrievable by the API.

* Updating the docs

* Adds error check to EN_setheadcurveindex

See issue #556 .

* Update epanet2.pas

* Incorrect characterd

There was a character ’ instead of ' which created an error when compiling LaTeX.

* fixes a crashing issue in freedata (#559)

The freedata function used cached values for sizes of certain arrays found in the parser struct. However, now that the network is mutable, those values can become invalid. Relying instead on the actual array lengths prevents freeing unallocated memory, or ignoring cleanup on newly created elements.

* Bug fix for valvecheck function

See issue #561

* Restored prior update to project.c that got overwritten

* Fixed editing errors made to project.c

* PDF Guide

PDF users' guide for EPANET, and some minor corrections to readme.md to fix some formatting issues.

* HTML Users Guide

* Fixes a "copy over" bug in input3.c

The copying of one input line token over another was causing a compilation error under Clang. With v2.2 this copying is no longer needed so the line of code in question was simply deleted.

This commit also deletes the HTML and Latex output generated by running Doxygen that got added from the previous update to dev since they don't really belong in a source code repo.

* Correction made to doc files

The output-format.dox file was deprecated and not included in the doxyfile so it was deleted. The description of the format of of the Energy Usage section of the binary output in toolkit-files.dox was corrected.

* Update ReleaseNotes2_2.md

I added the v2.2 contributing authors to the notes. I checked PR's from 2017 and beyond and these were the only names I could find. Please append any one I might have missed.

* Fixes problem with re-opening const. HP pumps

See latest comments in issue #528. Also, the setlinkflow() function was deleted as it was never called anywhere.

* Update README.md (#539)

* Update README.md

* Update README.md

Some section titles were re-named to conform to GitHub guidelines and the OWA info was moved to a CREDITS section.

* Update README.md

Added link to the Community Forum page.

* Replaced OWA copyright with "(see AUTHORS)".

* Update AUTHORS

Copied format used by the OWA-SWMM project.

* Update README.md

The Disclaimer section was edited to reflect that there actually is a "collaborative" connection between USEPA and OWA.

* updates CI badges

* cleanup of readme links and unused files

* possessive vs contraction

* adding contributor to notes
This commit is contained in:
Sam Hatchett
2019-12-10 10:19:36 -05:00
committed by GitHub
parent 36381129e6
commit 4d8d82ddc2
166 changed files with 77192 additions and 21553 deletions

View File

@@ -5,229 +5,391 @@ Attribute VB_Name = "Module1"
'Declarations of functions in the EPANET PROGRAMMERs TOOLKIT
'(EPANET2.DLL)
'Last updated on 4/3/07
'Last updated on 11/04/2019
' These are codes used by the DLL functions
Global Const EN_ELEVATION = 0 ' Node parameters
Global Const EN_BASEDEMAND = 1
Global Const EN_PATTERN = 2
Global Const EN_EMITTER = 3
Global Const EN_INITQUAL = 4
Global Const EN_SOURCEQUAL = 5
Global Const EN_SOURCEPAT = 6
Global Const EN_SOURCETYPE = 7
Global Const EN_TANKLEVEL = 8
Global Const EN_DEMAND = 9
Global Const EN_HEAD = 10
Global Const EN_PRESSURE = 11
Global Const EN_QUALITY = 12
Global Const EN_SOURCEMASS = 13
Global Const EN_INITVOLUME = 14
Global Const EN_MIXMODEL = 15
Global Const EN_MIXZONEVOL = 16
Public Const EN_ELEVATION = 0 ' Node parameters
Public Const EN_BASEDEMAND = 1
Public Const EN_PATTERN = 2
Public Const EN_EMITTER = 3
Public Const EN_INITQUAL = 4
Public Const EN_SOURCEQUAL = 5
Public Const EN_SOURCEPAT = 6
Public Const EN_SOURCETYPE = 7
Public Const EN_TANKLEVEL = 8
Public Const EN_DEMAND = 9
Public Const EN_HEAD = 10
Public Const EN_PRESSURE = 11
Public Const EN_QUALITY = 12
Public Const EN_SOURCEMASS = 13
Public Const EN_INITVOLUME = 14
Public Const EN_MIXMODEL = 15
Public Const EN_MIXZONEVOL = 16
Global Const EN_TANKDIAM = 17
Global Const EN_MINVOLUME = 18
Global Const EN_VOLCURVE = 19
Global Const EN_MINLEVEL = 20
Global Const EN_MAXLEVEL = 21
Global Const EN_MIXFRACTION = 22
Global Const EN_TANK_KBULK = 23
Global Const EN_TANKVOLUME = 24
Global Const EN_MAXVOLUME = 25
Public Const EN_TANKDIAM = 17
Public Const EN_MINVOLUME = 18
Public Const EN_VOLCURVE = 19
Public Const EN_MINLEVEL = 20
Public Const EN_MAXLEVEL = 21
Public Const EN_MIXFRACTION = 22
Public Const EN_TANK_KBULK = 23
Public Const EN_TANKVOLUME = 24
Public Const EN_MAXVOLUME = 25
Public Const EN_CANOVERFLOW = 26
Public Const EN_DEMANDDEFICIT = 27
Global Const EN_DIAMETER = 0 ' Link parameters
Global Const EN_LENGTH = 1
Global Const EN_ROUGHNESS = 2
Global Const EN_MINORLOSS = 3
Global Const EN_INITSTATUS = 4
Global Const EN_INITSETTING = 5
Global Const EN_KBULK = 6
Global Const EN_KWALL = 7
Global Const EN_FLOW = 8
Global Const EN_VELOCITY = 9
Global Const EN_HEADLOSS = 10
Global Const EN_STATUS = 11
Global Const EN_SETTING = 12
Global Const EN_ENERGY = 13
Global Const EN_LINKQUAL = 14 'ES
Global Const EN_LINKPATTERN = 15
Public Const EN_DIAMETER = 0 ' Link parameters
Public Const EN_LENGTH = 1
Public Const EN_ROUGHNESS = 2
Public Const EN_MINORLOSS = 3
Public Const EN_INITSTATUS = 4
Public Const EN_INITSETTING = 5
Public Const EN_KBULK = 6
Public Const EN_KWALL = 7
Public Const EN_FLOW = 8
Public Const EN_VELOCITY = 9
Public Const EN_HEADLOSS = 10
Public Const EN_STATUS = 11
Public Const EN_SETTING = 12
Public Const EN_ENERGY = 13
Public Const EN_LINKQUAL = 14
Public Const EN_LINKPATTERN = 15
Global Const EN_DURATION = 0 ' Time parameters
Global Const EN_HYDSTEP = 1
Global Const EN_QUALSTEP = 2
Global Const EN_PATTERNSTEP = 3
Global Const EN_PATTERNSTART = 4
Global Const EN_REPORTSTEP = 5
Global Const EN_REPORTSTART = 6
Global Const EN_RULESTEP = 7
Global Const EN_STATISTIC = 8
Global Const EN_PERIODS = 9
Global Const EN_STARTTIME = 10
Global Const EN_HTIME = 11
Global Const EN_QTIME = 12
Global Const EN_HALTFLAG = 13
Global Const EN_NEXTEVENT = 14
Public Const EN_PUMP_STATE = 16
Public Const EN_PUMP_EFFIC = 17
Public Const EN_PUMP_POWER = 18
Public Const EN_PUMP_HCURVE = 19
Public Const EN_PUMP_ECURVE = 20
Public Const EN_PUMP_ECOST = 21
Public Const EN_PUMP_EPAT = 22
Global Const EN_ITERATIONS = 0
Global Const EN_RELATIVEERROR = 1
Public Const EN_DURATION = 0 ' Time parameters
Public Const EN_HYDSTEP = 1
Public Const EN_QUALSTEP = 2
Public Const EN_PATTERNSTEP = 3
Public Const EN_PATTERNSTART = 4
Public Const EN_REPORTSTEP = 5
Public Const EN_REPORTSTART = 6
Public Const EN_RULESTEP = 7
Public Const EN_STATISTIC = 8
Public Const EN_PERIODS = 9
Public Const EN_STARTTIME = 10
Public Const EN_HTIME = 11
Public Const EN_QTIME = 12
Public Const EN_HALTFLAG = 13
Public Const EN_NEXTEVENT = 14
Global Const EN_NODECOUNT = 0 'Component counts
Global Const EN_TANKCOUNT = 1
Global Const EN_LINKCOUNT = 2
Global Const EN_PATCOUNT = 3
Global Const EN_CURVECOUNT = 4
Global Const EN_CONTROLCOUNT = 5
Public Const EN_ITERATIONS = 0 ' Run statistics
Public Const EN_RELATIVEERROR = 1
Public Const EN_MAXHEADERROR = 2
Public Const EN_MAXFLOWCHANGE = 3
Public Const EN_MASSBALANCE = 4
Public Const EN_DEFICIENTNODES = 5
Public Const EN_DEMANDREDUCTION = 6
Global Const EN_JUNCTION = 0 ' Node types
Global Const EN_RESERVOIR = 1
Global Const EN_TANK = 2
Public Const EN_NODE = 0 ' Component types
Public Const EN_LINK = 1
Public Const EN_TIMEPAT = 2
Public Const EN_CURVE = 3
Public Const EN_CONTROL = 4
Public Const EN_RULE = 5
Global Const EN_CVPIPE = 0 ' Link types
Global Const EN_PIPE = 1
Global Const EN_PUMP = 2
Global Const EN_PRV = 3
Global Const EN_PSV = 4
Global Const EN_PBV = 5
Global Const EN_FCV = 6
Global Const EN_TCV = 7
Global Const EN_GPV = 8
Public Const EN_NODECOUNT = 0 ' Component counts
Public Const EN_TANKCOUNT = 1
Public Const EN_LINKCOUNT = 2
Public Const EN_PATCOUNT = 3
Public Const EN_CURVECOUNT = 4
Public Const EN_CONTROLCOUNT = 5
Public Const EN_RULECOUNT = 6
Global Const EN_NONE = 0 ' Quality analysis types
Global Const EN_CHEM = 1
Global Const EN_AGE = 2
Global Const EN_TRACE = 3
Public Const EN_JUNCTION = 0 ' Node types
Public Const EN_RESERVOIR = 1
Public Const EN_TANK = 2
Global Const EN_CONCEN = 0 ' Source quality types
Global Const EN_MASS = 1
Global Const EN_SETPOINT = 2
Global Const EN_FLOWPACED = 3
Public Const EN_CVPIPE = 0 ' Link types
Public Const EN_PIPE = 1
Public Const EN_PUMP = 2
Public Const EN_PRV = 3
Public Const EN_PSV = 4
Public Const EN_PBV = 5
Public Const EN_FCV = 6
Public Const EN_TCV = 7
Public Const EN_GPV = 8
Global Const EN_CFS = 0 ' Flow units types
Global Const EN_GPM = 1
Global Const EN_MGD = 2
Global Const EN_IMGD = 3
Global Const EN_AFD = 4
Global Const EN_LPS = 5
Global Const EN_LPM = 6
Global Const EN_MLD = 7
Global Const EN_CMH = 8
Global Const EN_CMD = 9
Public Const EN_NONE = 0 ' Quality analysis types
Public Const EN_CHEM = 1
Public Const EN_AGE = 2
Public Const EN_TRACE = 3
Global Const EN_TRIALS = 0 ' Misc. options
Global Const EN_ACCURACY = 1
Global Const EN_TOLERANCE = 2
Global Const EN_EMITEXPON = 3
Global Const EN_DEMANDMULT = 4
Public Const EN_CONCEN = 0 ' Source quality types
Public Const EN_MASS = 1
Public Const EN_SETPOINT = 2
Public Const EN_FLOWPACED = 3
Global Const EN_LOWLEVEL = 0 ' Control types
Global Const EN_HILEVEL = 1
Global Const EN_TIMER = 2
Global Const EN_TIMEOFDAY = 3
Public Const EN_HW = 0 ' Head loss formulas
Public Const EN_DW = 1
Public Const EN_CM = 2
Global Const EN_AVERAGE = 1 'Time statistic types
Global Const EN_MINIMUM = 2
Global Const EN_MAXIMUM = 3
Global Const EN_RANGE = 4
Public Const EN_CFS = 0 ' Flow units types
Public Const EN_GPM = 1
Public Const EN_MGD = 2
Public Const EN_IMGD = 3
Public Const EN_AFD = 4
Public Const EN_LPS = 5
Public Const EN_LPM = 6
Public Const EN_MLD = 7
Public Const EN_CMH = 8
Public Const EN_CMD = 9
Global Const EN_MIX1 = 0 'Tank mixing models
Global Const EN_MIX2 = 1
Global Const EN_FIFO = 2
Global Const EN_LIFO = 3
Public Const EN_DDA = 0 ' Demand driven analysis
Public Const EN_PDA = 1 ' Pressure driven analysis
Global Const EN_NOSAVE = 0 ' Save-results-to-file flag
Global Const EN_SAVE = 1
Public Const EN_TRIALS = 0 ' Simulation options
Public Const EN_ACCURACY = 1
Public Const EN_TOLERANCE = 2
Public Const EN_EMITEXPON = 3
Public Const EN_DEMANDMULT = 4
Public Const EN_HEADERROR = 5
Public Const EN_FLOWCHANGE = 6
Public Const EN_HEADLOSSFORM = 7
Public Const EN_GLOBALEFFIC = 8
Public Const EN_GLOBALPRICE = 9
Public Const EN_GLOBALPATTERN = 10
Public Const EN_DEMANDCHARGE = 11
Public Const EN_SP_GRAVITY = 12
Public Const EN_SP_VISCOS = 13
Public Const EN_UNBALANCED = 14
Public Const EN_CHECKFREQ = 15
Public Const EN_MAXCHECK = 16
Public Const EN_DAMPLIMIT = 17
Public Const EN_SP_DIFFUS = 18
Public Const EN_BULKORDER = 19
Public Const EN_WALLORDER = 20
Public Const EN_TANKORDER = 21
Public Const EN_CONCENLIMIT = 22
Global Const EN_INITFLOW = 10 ' Re-initialize flow flag
Public Const EN_LOWLEVEL = 0 ' Control types
Public Const EN_HILEVEL = 1
Public Const EN_TIMER = 2
Public Const EN_TIMEOFDAY = 3
Global Const EN_CONST_HP = 0 ' constant horsepower
Global Const EN_POWER_FUNC = 1 ' power function
Global Const EN_CUSTOM = 2 ' user-defined custom curve
Public Const EN_AVERAGE = 1 ' Time statistic types
Public Const EN_MINIMUM = 2
Public Const EN_MAXIMUM = 3
Public Const EN_RANGE = 4
Public Const EN_MIX1 = 0 ' Tank mixing models
Public Const EN_MIX2 = 1
Public Const EN_FIFO = 2
Public Const EN_LIFO = 3
Public Const EN_NOSAVE = 0 ' Save-results-to-file flag
Public Const EN_SAVE = 1
Public Const EN_INITFLOW = 10 ' Re-initialize flow flag
Public Const EN_SAVE_AND_INIT = 11
Public Const EN_CONST_HP = 0 ' Constant horsepower pump curve
Public Const EN_POWER_FUNC = 1 ' Power function pump cuve
Public Const EN_CUSTOM = 2 ' User-defined custom pump curve
Public Const EN_NOCURVE = 3 ' No pump curve
Public Const EN_VOLUME_CURVE = 0 ' Volume curve
Public Const EN_PUMP_CURVE = 1 ' Pump curve
Public Const EN_EFFIC_CURVE = 2 ' Efficiency curve
Public Const EN_HLOSS_CURVE = 3 ' Head loss curve
Public Const EN_GENERIC_CURVE = 4 ' Generic curve
Public Const EN_UNCONDITIONAL = 0 ' Unconditional object deletion
Public Const EN_CONDITIONAL = 1 ' Conditional object deletion
Public Const EN_NO_REPORT = 0 ' No status report
Public Const EN_NORMAL_REPORT = 1 ' Normal status report
Public Const EN_FULL_REPORT = 2 ' Full status report
Public Const EN_R_NODE = 6 ' Rule objects
Public Const EN_R_LINK = 7
Public Const EN_R_SYSTEM = 8
Public Const EN_R_DEMAND = 0 ' Rule variables
Public Const EN_R_HEAD = 1
Public Const EN_R_GRADE = 2
Public Const EN_R_LEVEL = 3
Public Const EN_R_PRESSURE = 4
Public Const EN_R_FLOW = 5
Public Const EN_R_STATUS = 6
Public Const EN_R_SETTING = 7
Public Const EN_R_POWER = 8
Public Const EN_R_TIME = 9
Public Const EN_R_CLOCKTIME = 10
Public Const EN_R_FILLTIME = 11
Public Const EN_R_DRAINTIME = 12
Public Const EN_R_EQ = 0 ' Rule operators
Public Const EN_R_NE = 1
Public Const EN_R_LE = 2
Public Const EN_R_GE = 3
Public Const EN_R_LT = 4
Public Const EN_R_GT = 5
Public Const EN_R_IS = 6
Public Const EN_R_NOT = 7
Public Const EN_R_BELOW = 8
Public Const EN_R_ABOVE = 9
Public Const EN_R_IS_OPEN = 1 ' Rule status types
Public Const EN_R_IS_CLOSED = 2
Public Const EN_R_IS_ACTIVE = 3
Public Const EN_MISSING As Double = -1.0E10
'These are the external functions that comprise the DLL
Declare Function ENepanet Lib "epanet2.dll" (ByVal F1 As String, ByVal F2 As String, ByVal F3 As String, ByVal F4 As Any) As Long
Declare Function ENopen Lib "epanet2.dll" (ByVal F1 As String, ByVal F2 As String, ByVal F3 As String) As Long
Declare Function ENsaveinpfile Lib "epanet2.dll" (ByVal F As String) As Long
'Project Functions
Declare Function ENgetversion Lib "epanet2.dll" (value As Long) As Long
Declare Function ENepanet Lib "epanet2.dll" (ByVal inpFile As String, ByVal rptFile As String, ByVal outFile As String, ByVal pviewprog As Any) As Long
Declare Function ENinit Lib "epanet2.dll" (ByVal rptFile As String, ByVal outFile As String, ByVal unitsType As Long, ByVal headlossType As Long) As Long
Declare Function ENopen Lib "epanet2.dll" (ByVal inpFile As String, ByVal rptFile As String, ByVal outFile As String) As Long
Declare Function ENgettitle Lib "epanet2.dll" (ByVal line1 As String, ByVal line2 As String, ByVal line3 As String) As Long
Declare Function ENsettitle Lib "epanet2.dll" (ByVal titleline1 As String, ByVal titleline2 As String, ByVal titleline3 As String) As Long
Declare Function ENsaveinpfile Lib "epanet2.dll" (ByVal filename As String) As Long
Declare Function ENclose Lib "epanet2.dll" () As Long
'Hydraulic Analysis Functions
Declare Function ENsolveH Lib "epanet2.dll" () As Long
Declare Function ENsaveH Lib "epanet2.dll" () As Long
Declare Function ENopenH Lib "epanet2.dll" () As Long
Declare Function ENinitH Lib "epanet2.dll" (ByVal SaveFlag As Long) As Long
Declare Function ENrunH Lib "epanet2.dll" (T As Long) As Long
Declare Function ENnextH Lib "epanet2.dll" (Tstep As Long) As Long
Declare Function ENinitH Lib "epanet2.dll" (ByVal initFlag As Long) As Long
Declare Function ENrunH Lib "epanet2.dll" (currentTime As Long) As Long
Declare Function ENnextH Lib "epanet2.dll" (tStep As Long) As Long
Declare Function ENcloseH Lib "epanet2.dll" () As Long
Declare Function ENsavehydfile Lib "epanet2.dll" (ByVal F As String) As Long
Declare Function ENusehydfile Lib "epanet2.dll" (ByVal F As String) As Long
Declare Function ENsavehydfile Lib "epanet2.dll" (ByVal filename As String) As Long
Declare Function ENusehydfile Lib "epanet2.dll" (ByVal filename As String) As Long
'Water Quality Analysis Functions
Declare Function ENsolveQ Lib "epanet2.dll" () As Long
Declare Function ENopenQ Lib "epanet2.dll" () As Long
Declare Function ENinitQ Lib "epanet2.dll" (ByVal SaveFlag As Long) As Long
Declare Function ENrunQ Lib "epanet2.dll" (T As Long) As Long
Declare Function ENnextQ Lib "epanet2.dll" (Tstep As Long) As Long
Declare Function ENstepQ Lib "epanet2.dll" (Tleft As Long) As Long
Declare Function ENinitQ Lib "epanet2.dll" (ByVal saveFlag As Long) As Long
Declare Function ENrunQ Lib "epanet2.dll" (currentTime As Long) As Long
Declare Function ENnextQ Lib "epanet2.dll" (tStep As Long) As Long
Declare Function ENstepQ Lib "epanet2.dll" (timeLeft As Long) As Long
Declare Function ENcloseQ Lib "epanet2.dll" () As Long
Declare Function ENwriteline Lib "epanet2.dll" (ByVal S As String) As Long
'Reporting Functions
Declare Function ENwriteline Lib "epanet2.dll" (ByVal line As String) As Long
Declare Function ENreport Lib "epanet2.dll" () As Long
Declare Function ENcopyreport Lib "epanet2.dll" (ByVal filename As String) As Long
Declare Function ENclearreport Lib "epanet2.dll" () As Long
Declare Function ENresetreport Lib "epanet2.dll" () As Long
Declare Function ENsetreport Lib "epanet2.dll" (ByVal S As String) As Long
Declare Function ENsetreport Lib "epanet2.dll" (ByVal format As String) As Long
Declare Function ENsetstatusreport Lib "epanet2.dll" (ByVal level As Long) As Long
Declare Function ENgetcount Lib "epanet2.dll" (ByVal object As Long, count As Long) As Long
Declare Function ENgeterror Lib "epanet2.dll" (ByVal errcode As Long, ByVal errmsg As String, ByVal maxLen As Long) As Long
Declare Function ENgetstatistic Lib "epanet2.dll" (ByVal type_ As Long, ByRef value As Single) As Long
Declare Function ENgetresultindex Lib "epanet2.dll" (ByVal type_ As Long, ByVal index As Long, ByRef value As Long) As Long
Declare Function ENgetcontrol Lib "epanet2.dll" (ByVal Cindex As Long, Ctype As Long, Lindex As Long, Setting As Single, Nindex As Long, Level As Single) As Long
Declare Function ENgetcount Lib "epanet2.dll" (ByVal Code As Long, Value As Long) As Long
Declare Function ENgetoption Lib "epanet2.dll" (ByVal Code As Long, Value As Single) As Long
Declare Function ENgettimeparam Lib "epanet2.dll" (ByVal Code As Long, Value As Long) As Long
Declare Function ENgetflowunits Lib "epanet2.dll" (Code As Long) As Long
Declare Function ENgetpatternindex Lib "epanet2.dll" (ByVal ID As String, Index As Long) As Long
Declare Function ENgetpatternid Lib "epanet2.dll" (ByVal Index As Long, ByVal ID As String) As Long
Declare Function ENgetpatternlen Lib "epanet2.dll" (ByVal Index As Long, L As Long) As Long
Declare Function ENgetpatternvalue Lib "epanet2.dll" (ByVal Index As Long, ByVal Period As Long, Value As Single) As Long
Declare Function ENgetaveragepatternvalue Lib "epanet2.dll" (ByVal Index As Long, Value As Single) As Long
Declare Function ENgetqualtype Lib "epanet2.dll" (QualCode As Long, TraceNode As Long) As Long
Declare Function ENgeterror Lib "epanet2.dll" (ByVal ErrCode As Long, ByVal ErrMsg As String, ByVal N As Long) As Long
Declare Function ENgetstatistic Lib "epanet2.dll" (ByVal Code As Long, Value As Single) As Long
'Analysis Options Functions
Declare Function ENgetoption Lib "epanet2.dll" (ByVal option_ As Long, value As Single) As Long
Declare Function ENsetoption Lib "epanet2.dll" (ByVal option_ As Long, ByVal value As Single) As Long
Declare Function ENgetflowunits Lib "epanet2.dll" (units As Long) As Long
Declare Function ENsetflowunits Lib "epanet2.dll" (ByVal units As Long) As Long
Declare Function ENgettimeparam Lib "epanet2.dll" (ByVal param As Long, value As Long) As Long
Declare Function ENsettimeparam Lib "epanet2.dll" (ByVal param As Long, ByVal value As Long) As Long
Declare Function ENgetqualinfo Lib "epanet2.dll" (qualType As Long, ByVal chemName As String, ByVal chemUnits As String, traceNode As Long) As Long
Declare Function ENgetqualtype Lib "epanet2.dll" (qualType As Long, traceNode As Long) As Long
Declare Function ENsetqualtype Lib "epanet2.dll" (ByVal qualType As Long, ByVal chemName As String, ByVal chemUnits As String, ByVal traceNode As String) As Long
Declare Function ENgetnodeindex Lib "epanet2.dll" (ByVal ID As String, Index As Long) As Long
Declare Function ENgetnodeid Lib "epanet2.dll" (ByVal Index As Long, ByVal ID As String) As Long
Declare Function ENgetnodetype Lib "epanet2.dll" (ByVal Index As Long, Code As Long) As Long
Declare Function ENgetnodevalue Lib "epanet2.dll" (ByVal Index As Long, ByVal Code As Long, Value As Single) As Long
Declare Function ENgetcoord Lib "epanet2.dll" (ByVal Index As Long, X As Single, Y As Single) As Long
Declare Function ENsetcoord Lib "epanet2.dll" (ByVal Index As Long, ByVal X As Single, ByVal Y As Single) As Long
'Node Functions
Declare Function ENaddnode Lib "epanet2.dll" (ByVal id As String, ByVal nodeType As Long, index As Long) As Long
Declare Function ENdeletenode Lib "epanet2.dll" (ByVal index As Long, ByVal actionCode As Long) As Long
Declare Function ENgetnodeindex Lib "epanet2.dll" (ByVal id As String, index As Long) As Long
Declare Function ENgetnodeid Lib "epanet2.dll" (ByVal index As Long, ByVal id As String) As Long
Declare Function ENsetnodeid Lib "epanet2.dll" (ByVal index As Long, ByVal newid As String) As Long
Declare Function ENgetnodetype Lib "epanet2.dll" (ByVal index As Long, nodeType As Long) As Long
Declare Function ENgetnodevalue Lib "epanet2.dll" (ByVal index As Long, ByVal property As Long, value As Single) As Long
Declare Function ENsetnodevalue Lib "epanet2.dll" (ByVal index As Long, ByVal property As Long, ByVal value As Single) As Long
Declare Function ENsetjuncdata Lib "epanet2.dll" (ByVal index As Long, ByVal elev As Single, ByVal dmnd As Single, ByVal dmndpat As String) As Long
Declare Function ENsettankdata Lib "epanet2.dll" (ByVal index As Long, ByVal elev As Single, ByVal initlvl As Single, ByVal minlvl As Single, ByVal maxlvl As Single, ByVal diam As Single, ByVal minvol As Single, ByVal volcurve As String) As Long
Declare Function ENgetcoord Lib "epanet2.dll" (ByVal index As Long, x As Double, y As Double) As Long
Declare Function ENsetcoord Lib "epanet2.dll" (ByVal index As Long, ByVal x As Double, ByVal y As Double) As Long
'Nodal Demand Functions
Declare Function ENgetdemandmodel Lib "epanet2.dll" (type_ As Long, pmin As Single, preq As Single, pexp As Single) As Long
Declare Function ENsetdemandmodel Lib "epanet2.dll" (ByVal type_ As Long, ByVal pmin As Single, ByVal preq As Single, ByVal pexp As Single) As Long
Declare Function ENadddemand Lib "epanet2.dll" (ByVal nodeIndex As Long, ByVal baseDemand As Single, ByVal patternName As String, ByVal demandName As String) As Long
Declare Function ENdeletedemand Lib "epanet2.dll" (ByVal nodeIndex As Long, ByVal demandIndex As Long) As Long
Declare Function ENgetdemandindex Lib "epanet2.dll" (ByVal nodeIndex As Long, ByVal demandName As String, demandIndex As Long) As Long
Declare Function ENgetnumdemands Lib "epanet2.dll" (ByVal nodeIndex As Long, numDemands As Long) As Long
Declare Function ENgetbasedemand Lib "epanet2.dll" (ByVal nodeIndex As Long, ByVal demandIndex As Long, value As Single) As Long
Declare Function ENsetbasedemand Lib "epanet2.dll" (ByVal nodeIndex As Long, ByVal demandIndex As Long, ByVal BaseDemand As Single) As Long
Declare Function ENgetdemandpattern Lib "epanet2.dll" (ByVal nodeIndex As Long, ByVal demandIndex As Long, patIndex As Long) As Long
Declare Function ENsetdemandpattern Lib "epanet2.dll" (ByVal nodeIndex As Long, ByVal demandIndex As Long, ByVal patIndex As Long) As Long
Declare Function ENgetdemandname Lib "epanet2.dll" (ByVal nodeIndex As Long, ByVal demandIndex As Long, ByVal demandName As String) As Long
Declare Function ENsetdemandname Lib "epanet2.dll" (ByVal nodeIndex As Long, ByVal demandIndex As Long, ByVal demandName As String) As Long
Declare Function ENgetnumdemands Lib "epanet2.dll" (ByVal Index As Long, numDemands As Long) As Long
Declare Function ENgetbasedemand Lib "epanet2.dll" (ByVal Index As Long, ByVal DemandIndex As Long, Value As Single) As Long
Declare Function ENgetdemandpattern Lib "epanet2.dll" (ByVal Index As Long, ByVal DemandIndex As Long, PatIndex As Long) As Long
'Link Functions
Declare Function ENaddlink Lib "epanet2.dll" (ByVal id As String, ByVal linkType As Long, ByVal fromNode As String, ByVal toNode As String, index As Long) As Long
Declare Function ENdeletelink Lib "epanet2.dll" (ByVal index As Long, ByVal actionCode As Long) As Long
Declare Function ENgetlinkindex Lib "epanet2.dll" (ByVal id As String, index As Long) As Long
Declare Function ENgetlinkid Lib "epanet2.dll" (ByVal index As Long, ByVal id As String) As Long
Declare Function ENsetlinkid Lib "epanet2.dll" (ByVal index As Long, ByVal newid As String) As Long
Declare Function ENgetlinktype Lib "epanet2.dll" (ByVal index As Long, linkType As Long) As Long
Declare Function ENsetlinktype Lib "epanet2.dll" (index As Long, ByVal linkType As Long, ByVal actionCode As Long) As Long
Declare Function ENgetlinknodes Lib "epanet2.dll" (ByVal index As Long, node1 As Long, node2 As Long) As Long
Declare Function ENsetlinknodes Lib "epanet2.dll" (ByVal index As Long, ByVal node1 As Long, ByVal node2 As Long) As Long
Declare Function ENgetlinkvalue Lib "epanet2.dll" (ByVal index As Long, ByVal property As Long, value As Single) As Long
Declare Function ENsetlinkvalue Lib "epanet2.dll" (ByVal index As Long, ByVal property As Long, ByVal value As Single) As Long
Declare Function ENsetpipedata Lib "epanet2.dll" (ByVal index As Long, ByVal length As Single, ByVal diam As Single, ByVal rough As Single, ByVal mloss As Single) As Long
Declare Function ENgetvertexcount Lib "epanet2.dll" (ByVal index As Long, count As Long) As Long
Declare Function ENgetvertex Lib "epanet2.dll" (ByVal index As Long, ByVal vertex As Long, x As Double, y As Double) As Long
Declare Function ENsetvertices Lib "epanet2.dll" (ByVal index As Long, xCoords As Any, yCoords As Any, ByVal count As Long) As Long
Declare Function ENgetlinkindex Lib "epanet2.dll" (ByVal ID As String, Index As Long) As Long
Declare Function ENgetlinkid Lib "epanet2.dll" (ByVal Index As Long, ByVal ID As String) As Long
Declare Function ENgetlinktype Lib "epanet2.dll" (ByVal Index As Long, Code As Long) As Long
Declare Function ENgetlinknodes Lib "epanet2.dll" (ByVal Index As Long, Node1 As Long, Node2 As Long) As Long
Declare Function ENgetlinkvalue Lib "epanet2.dll" (ByVal Index As Long, ByVal Code As Long, Value As Single) As Long
'Pump Functions
Declare Function ENgetheadcurveindex Lib "epanet2.dll" (ByVal linkIndex As Long, curveIndex As Long) As Long
Declare Function ENsetheadcurveindex Lib "epanet2.dll" (ByVal linkIndex As Long, ByVal curveIndex As Long) As Long
Declare Function ENgetpumptype Lib "epanet2.dll" (ByVal linkIndex As Long, pumpType As Long) As Long
Declare Function ENgetcurve Lib "epanet2.dll" (ByVal CurveIndex As Long, ByVal CurveID As String, nValues As Long, xValues As Any, yValues As Any) As Long
Declare Function ENgetheadcurveindex Lib "epanet2.dll" (ByVal PumpIndex As Long, CurveIndex As Long) As Long
Declare Function ENgetpumptype Lib "epanet2.dll" (ByVal Index As Long, PumpType As Long) As Long
'Time Pattern Functions
Declare Function ENaddpattern Lib "epanet2.dll" (ByVal id As String) As Long
Declare Function ENdeletepattern Lib "epanet2.dll" (ByVal index As Long) As Long
Declare Function ENgetpatternindex Lib "epanet2.dll" (ByVal id As String, index As Long) As Long
Declare Function ENgetpatternid Lib "epanet2.dll" (ByVal index As Long, ByVal id As String) As Long
Declare Function ENsetpatternid Lib "epanet2.dll" (ByVal index As Long, ByVal newid As String) As Long
Declare Function ENgetpatternlen Lib "epanet2.dll" (ByVal index As Long, len_ As Long) As Long
Declare Function ENgetpatternvalue Lib "epanet2.dll" (ByVal index As Long, ByVal period As Long, value As Single) As Long
Declare Function ENsetpatternvalue Lib "epanet2.dll" (ByVal index As Long, ByVal period As Long, ByVal value As Single) As Long
Declare Function ENgetaveragepatternvalue Lib "epanet2.dll" (ByVal index As Long, value As Single) As Long
Declare Function ENsetpattern Lib "epanet2.dll" (ByVal index As Long, values As Any, ByVal len_ As Long) As Long
Declare Function ENgetversion Lib "epanet2.dll" (Value As Long) As Long
'Data Curve Functions
Declare Function ENaddcurve Lib "epanet2.dll" (ByVal id As String) As Long
Declare Function ENdeletecurve Lib "epanet2.dll" (ByVal index As Long) As Long
Declare Function ENgetcurveindex Lib "epanet2.dll" (ByVal id As String, index As Long) As Long
Declare Function ENgetcurveid Lib "epanet2.dll" (ByVal index As Long, ByVal id As String) As Long
Declare Function ENsetcurveid Lib "epanet2.dll" (ByVal index As Long, ByVal newid As String) As Long
Declare Function ENgetcurvelen Lib "epanet2.dll" (ByVal index As Long, len_ As Long) As Long
Declare Function ENgetcurvetype Lib "epanet2.dll" (ByVal index As Long, type_ As Long) As Long
Declare Function ENgetcurvevalue Lib "epanet2.dll" (ByVal curveIndex As Long, ByVal pointIndex As Long, x As Single, y As Single) As Long
Declare Function ENsetcurvevalue Lib "epanet2.dll" (ByVal curveIndex As Long, ByVal pointIndex As Long, ByVal x As Single, ByVal y As Single) As Long
Declare Function ENgetcurve Lib "epanet2.dll" (ByVal index As Long, ByVal id As String, nPoints As Long, xValues As Any, yValues As Any) As Long
Declare Function ENsetcurve Lib "epanet2.dll" (ByVal index As Long, xValues As Any, yValues As Any, ByVal nPoints As Long) As Long
Declare Function ENsetcontrol Lib "epanet2.dll" (ByVal Cindex As Long, ByVal Ctype As Long, ByVal Lindex As Long, ByVal Setting As Single, ByVal Nindex As Long, ByVal Level As Single) As Long
Declare Function ENsetnodevalue Lib "epanet2.dll" (ByVal Index As Long, ByVal Code As Long, ByVal Value As Single) As Long
Declare Function ENsetlinkvalue Lib "epanet2.dll" (ByVal Index As Long, ByVal Code As Long, ByVal Value As Single) As Long
Declare Function ENaddpattern Lib "epanet2.dll" (ByVal ID As String) As Long
Declare Function ENsetpattern Lib "epanet2.dll" (ByVal Index As Long, F As Any, ByVal N As Long) As Long
Declare Function ENsetpatternvalue Lib "epanet2.dll" (ByVal Index As Long, ByVal Period As Long, ByVal Value As Single) As Long
Declare Function ENsettimeparam Lib "epanet2.dll" (ByVal Code As Long, ByVal Value As Long) As Long
Declare Function ENsetoption Lib "epanet2.dll" (ByVal Code As Long, ByVal Value As Single) As Long
Declare Function ENsetstatusreport Lib "epanet2.dll" (ByVal Code As Long) As Long
Declare Function ENsetqualtype Lib "epanet2.dll" (ByVal QualCode As Long, ByVal ChemName As String, ByVal ChemUnits As String, ByVal TraceNode As String) As Long
Declare Function ENgetqualinfo Lib "epanet2.dll" (QualCode As Long, ByVal ChemName As String, ByVal ChemUnits As String, TraceNode As Long) As Long
Declare Function ENsetbasedemand Lib "epanet2.dll" (ByVal NodeIndex As Long, ByVal DemandIndex As Long, ByVal BaseDemand As Single) As Long
'Simple Control Functions
Declare Function ENaddcontrol Lib "epanet2.dll" (ByVal type_ As Long, ByVal linkIndex As Long, ByVal setting As Single, ByVal nodeIndex As Long, ByVal level As Single, index As Long) As Long
Declare Function ENdeletecontrol Lib "epanet2.dll" (ByVal index As Long) As Long
Declare Function ENgetcontrol Lib "epanet2.dll" (ByVal index As Long, type_ As Long, linkIndex As Long, setting As Single, nodeIndex As Long, level As Single) As Long
Declare Function ENsetcontrol Lib "epanet2.dll" (ByVal index As Long, ByVal type_ As Long, ByVal linkIndex As Long, ByVal setting As Single, ByVal nodeIndex As Long, ByVal level As Single) As Long
Declare Function ENgetcurveindex Lib "epanet2.dll" (ByVal ID As String, Index As Long) As Long
Declare Function ENgetcurveid Lib "epanet2.dll" (ByVal Index As Long, ByVal ID As String) As Long
Declare Function ENgetcurvelen Lib "epanet2.dll" (ByVal Index As Long, L As Long) As Long
Declare Function ENgetcurvevalue Lib "epanet2.dll" (ByVal Index As Long, ByVal Ptn As Long, X As Single, Y As Single) As Long
Declare Function ENsetcurvevalue Lib "epanet2.dll" (ByVal Index As Long, ByVal Ptn As Long, ByVal X As Single, ByVal Y As Single) As Long
Declare Function ENsetcurve Lib "epanet2.dll" (ByVal Index As Long, X As Any, Y As Any, ByVal N As Long) As Long
Declare Function ENaddcurve Lib "epanet2.dll" (ByVal ID As String) As Long
'Rule-Based Control Functions
Declare Function ENaddrule Lib "epanet2.dll" (ByVal rule As String) As Long
Declare Function ENdeleterule Lib "epanet2.dll" (ByVal index As Long) As Long
Declare Function ENgetrule Lib "epanet2.dll" (ByVal index As Long, nPremises As Long, nThenActions As Long, nElseActions As Long, priority As Single) As Long
Declare Function ENgetruleID Lib "epanet2.dll" (ByVal index As Long, ByVal id As String) As Long
Declare Function ENsetrulepriority Lib "epanet2.dll" (ByVal index As Long, ByVal priority As Single) As Long
Declare Function ENgetpremise Lib "epanet2.dll" (ByVal ruleIndex As Long, ByVal premiseIndex As Long, logop As Long, object As Long, objIndex As Long, variable As Long, relop As Long, status As Long, value As Single) As Long
Declare Function ENsetpremise Lib "epanet2.dll" (ByVal ruleIndex As Long, ByVal premiseIndex As Long, ByVal logop As Long, ByVal object As Long, ByVal objIndex As Long, ByVal variable As Long, ByVal relop As Long, ByVal status As Long, ByVal value As Single) As Long
Declare Function ENsetpremiseindex Lib "epanet2.dll" (ByVal ruleIndex As Long, ByVal premiseIndex As Long, ByVal objIndex As Long) As Long
Declare Function ENsetpremisestatus Lib "epanet2.dll" (ByVal ruleIndex As Long, ByVal premiseIndex As Long, ByVal status As Long) As Long
Declare Function ENsetpremisevalue Lib "epanet2.dll" (ByVal ruleIndex As Long, ByVal premiseIndex As Long, ByVal value As Single) As Long
Declare Function ENgetthenaction Lib "epanet2.dll" (ByVal ruleIndex As Long, ByVal actionIndex As Long, linkIndex As Long, status As Long, setting As Single) As Long
Declare Function ENsetthenaction Lib "epanet2.dll" (ByVal ruleIndex As Long, ByVal actionIndex As Long, ByVal linkIndex As Long, ByVal status As Long, ByVal setting As Single) As Long
Declare Function ENgetelseaction Lib "epanet2.dll" (ByVal ruleIndex As Long, ByVal actionIndex As Long, linkIndex As Long, status As Long, setting As Single) As Long
Declare Function ENsetelseaction Lib "epanet2.dll" (ByVal ruleIndex As Long, ByVal actionIndex As Long, ByVal linkIndex As Long, ByVal status As Long, ByVal setting As Single) As Long

131
include/epanet2.def Normal file
View File

@@ -0,0 +1,131 @@
LIBRARY EPANET2.DLL
EXPORTS
ENaddcontrol = _ENaddcontrol@24
ENaddcurve = _ENaddcurve@4
ENaddlink = _ENaddlink@20
ENaddnode = _ENaddnode@12
ENadddemand = _ENadddemand@16
ENaddpattern = _ENaddpattern@4
ENaddrule = _ENaddrule@4
ENclearreport = _ENclearreport@0
ENclose = _ENclose@0
ENcloseH = _ENcloseH@0
ENcloseQ = _ENcloseQ@0
ENcopyreport = _ENcopyreport@4
ENdeletecontrol = _ENdeletecontrol@4
ENdeletecurve = _ENdeletecurve@4
ENdeletedemand = _ENdeletedemand@8
ENdeletelink = _ENdeletelink@8
ENdeletenode = _ENdeletenode@8
ENdeletepattern = _ENdeletepattern@4
ENdeleterule = _ENdeleterule@4
ENepanet = _ENepanet@16
ENgetaveragepatternvalue = _ENgetaveragepatternvalue@8
ENgetbasedemand = _ENgetbasedemand@12
ENgetcomment = _ENgetcomment@12
ENgetcontrol = _ENgetcontrol@24
ENgetcoord = _ENgetcoord@12
ENgetcount = _ENgetcount@8
ENgetcurve = _ENgetcurve@20
ENgetcurveid = _ENgetcurveid@8
ENgetcurveindex = _ENgetcurveindex@8
ENgetcurvelen = _ENgetcurvelen@8
ENgetcurvetype = _ENgetcurvetype@8
ENgetcurvevalue = _ENgetcurvevalue@16
ENgetdemandindex = _ENgetdemandindex@12
ENgetdemandmodel = _ENgetdemandmodel@16
ENgetdemandname = _ENgetdemandname@12
ENgetdemandpattern = _ENgetdemandpattern@12
ENgetelseaction = _ENgetelseaction@20
ENgeterror = _ENgeterror@12
ENgetflowunits = _ENgetflowunits@4
ENgetheadcurveindex = _ENgetheadcurveindex@8
ENgetlinkid = _ENgetlinkid@8
ENgetlinkindex = _ENgetlinkindex@8
ENgetlinknodes = _ENgetlinknodes@12
ENsetlinknodes = _ENsetlinknodes@12
ENgetlinktype = _ENgetlinktype@8
ENgetlinkvalue = _ENgetlinkvalue@12
ENgetnodeid = _ENgetnodeid@8
ENgetnodeindex = _ENgetnodeindex@8
ENgetnodetype = _ENgetnodetype@8
ENgetnodevalue = _ENgetnodevalue@12
ENgetnumdemands = _ENgetnumdemands@8
ENgetoption = _ENgetoption@8
ENgetpatternid = _ENgetpatternid@8
ENgetpatternindex = _ENgetpatternindex@8
ENgetpatternlen = _ENgetpatternlen@8
ENgetpatternvalue = _ENgetpatternvalue@12
ENgetpremise = _ENgetpremise@36
ENgetpumptype = _ENgetpumptype@8
ENgetqualinfo = _ENgetqualinfo@16
ENgetqualtype = _ENgetqualtype@8
ENgetresultindex = _ENgetresultindex@12
ENgetrule = _ENgetrule@20
ENgetruleID = _ENgetruleID@8
ENgetstatistic = _ENgetstatistic@8
ENgetthenaction = _ENgetthenaction@20
ENgettimeparam = _ENgettimeparam@8
ENgettitle = _ENgettitle@12
ENgetversion = _ENgetversion@4
ENgetvertex = _ENgetvertex@16
ENgetvertexcount = _ENgetvertexcount@8
ENinit = _ENinit@16
ENinitH = _ENinitH@4
ENinitQ = _ENinitQ@4
ENnextH = _ENnextH@4
ENnextQ = _ENnextQ@4
ENopen = _ENopen@12
ENopenH = _ENopenH@0
ENopenQ = _ENopenQ@0
ENreport = _ENreport@0
ENresetreport = _ENresetreport@0
ENrunH = _ENrunH@4
ENrunQ = _ENrunQ@4
ENsaveH = _ENsaveH@0
ENsavehydfile = _ENsavehydfile@4
ENsaveinpfile = _ENsaveinpfile@4
ENsetbasedemand = _ENsetbasedemand@12
ENsetcomment = _ENsetcomment@12
ENsetcontrol = _ENsetcontrol@24
ENsetcoord = _ENsetcoord@20
ENsetcurve = _ENsetcurve@16
ENsetcurveid = _ENsetcurveid@8
ENsetcurvevalue = _ENsetcurvevalue@16
ENsetdemandmodel = _ENsetdemandmodel@16
ENsetdemandname = _ENsetdemandname@12
ENsetdemandpattern = _ENsetdemandpattern@12
ENsetelseaction = _ENsetelseaction@20
ENsetflowunits = _ENsetflowunits@4
ENsetheadcurveindex = _ENsetheadcurveindex@8
ENsetjuncdata = _ENsetjuncdata@16
ENsetlinkid = _ENsetlinkid@8
ENsetlinknodes = _ENsetlinknodes@12
ENsetlinktype = _ENsetlinktype@12
ENsetlinkvalue = _ENsetlinkvalue@12
ENsetnodeid = _ENsetnodeid@8
ENsetnodevalue = _ENsetnodevalue@12
ENsetoption = _ENsetoption@8
ENsetpattern = _ENsetpattern@12
ENsetpatternid = _ENsetpatternid@8
ENsetpatternvalue = _ENsetpatternvalue@12
ENsetpipedata = _ENsetpipedata@20
ENsetpremise = _ENsetpremise@36
ENsetpremiseindex = _ENsetpremiseindex@12
ENsetpremisestatus = _ENsetpremisestatus@12
ENsetpremisevalue = _ENsetpremisevalue@12
ENsetqualtype = _ENsetqualtype@16
ENsetreport = _ENsetreport@4
ENsetrulepriority = _ENsetrulepriority@8
ENsetstatusreport = _ENsetstatusreport@4
ENsettankdata = _ENsettankdata@32
ENsetthenaction = _ENsetthenaction@20
ENsettimeparam = _ENsettimeparam@8
ENsettitle = _ENsettitle@12
ENsetvertices = _ENsetvertices@16
ENsolveH = _ENsolveH@0
ENsolveQ = _ENsolveQ@0
ENstepQ = _ENstepQ@4
ENusehydfile = _ENusehydfile@4
ENwriteline = _ENwriteline@4

1341
include/epanet2.h Executable file → Normal file

File diff suppressed because it is too large Load Diff

423
include/epanet2.pas Normal file
View File

@@ -0,0 +1,423 @@
unit epanet2;
{ Declarations of imported procedures from the EPANET PROGRAMMERs TOOLKIT }
{ (EPANET2.DLL) }
{Last updated on 11/12/19}
interface
const
{ These are codes used by the DLL functions }
EN_MAXID = 31; { Max. # characters in ID name }
EN_MAXMSG = 255; { Max. # characters in strings }
EN_MISSING = -1.E10;
EN_ELEVATION = 0; { Node parameters }
EN_BASEDEMAND = 1;
EN_PATTERN = 2;
EN_EMITTER = 3;
EN_INITQUAL = 4;
EN_SOURCEQUAL = 5;
EN_SOURCEPAT = 6;
EN_SOURCETYPE = 7;
EN_TANKLEVEL = 8;
EN_DEMAND = 9;
EN_HEAD = 10;
EN_PRESSURE = 11;
EN_QUALITY = 12;
EN_SOURCEMASS = 13;
EN_INITVOLUME = 14;
EN_MIXMODEL = 15;
EN_MIXZONEVOL = 16;
EN_TANKDIAM = 17;
EN_MINVOLUME = 18;
EN_VOLCURVE = 19;
EN_MINLEVEL = 20;
EN_MAXLEVEL = 21;
EN_MIXFRACTION = 22;
EN_TANK_KBULK = 23;
EN_TANKVOLUME = 24;
EN_MAXVOLUME = 25;
EN_CANOVERFLOW = 26;
EN_DEMANDDEFICIT = 27;
EN_DIAMETER = 0; { Link parameters }
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_PUMP_STATE = 16;
EN_PUMP_EFFIC = 17;
EN_PUMP_POWER = 18;
EN_PUMP_HCURVE = 19;
EN_PUMP_ECURVE = 20;
EN_PUMP_ECOST = 21;
EN_PUMP_EPAT = 22;
EN_DURATION = 0; { Time parameters }
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_NEXTEVENTTANK = 15;
EN_ITERATIONS = 0; { Analysis statistics }
EN_RELATIVEERROR = 1;
EN_MAXHEADERROR = 2;
EN_MAXFLOWCHANGE = 3;
EN_MASSBALANCE = 4;
EN_DEFICIENTNODES = 5;
EN_DEMANDREDUCTION = 6;
EN_NODE = 0; { Component Types }
EN_LINK = 1;
EN_TIMEPAT = 2;
EN_CURVE = 3;
EN_CONTROL = 4;
EN_RULE = 5;
EN_NODECOUNT = 0; { Component counts }
EN_TANKCOUNT = 1;
EN_LINKCOUNT = 2;
EN_PATCOUNT = 3;
EN_CURVECOUNT = 4;
EN_CONTROLCOUNT = 5;
EN_RULECOUNT = 6;
EN_JUNCTION = 0; { Node types }
EN_RESERVOIR = 1;
EN_TANK = 2;
EN_CVPIPE = 0; { Link types }
EN_PIPE = 1;
EN_PUMP = 2;
EN_PRV = 3;
EN_PSV = 4;
EN_PBV = 5;
EN_FCV = 6;
EN_TCV = 7;
EN_GPV = 8;
EN_CLOSED = 0; { Link status types }
EN_OPEN = 1;
EN_PUMP_XHEAD = 0; { Pump state types }
EN_PUMP_CLOSED = 2;
EN_PUMP_OPEN = 3;
EN_PUMP_XFLOW = 5;
EN_NONE = 0; { Quality analysis types }
EN_CHEM = 1;
EN_AGE = 2;
EN_TRACE = 3;
EN_CONCEN = 0; { Source quality types }
EN_MASS = 1;
EN_SETPOINT = 2;
EN_FLOWPACED = 3;
EN_HW = 0; { Head loss formulas }
EN_DW = 1;
EN_CM = 2;
EN_CFS = 0; { Flow units types }
EN_GPM = 1;
EN_MGD = 2;
EN_IMGD = 3;
EN_AFD = 4;
EN_LPS = 5;
EN_LPM = 6;
EN_MLD = 7;
EN_CMH = 8;
EN_CMD = 9;
EN_DDA = 0; { Demand model types }
EN_PDA = 1;
EN_TRIALS = 0; { Option types }
EN_ACCURACY = 1;
EN_TOLERANCE = 2;
EN_EMITEXPON = 3;
EN_DEMANDMULT = 4;
EN_HEADERROR = 5;
EN_FLOWCHANGE = 6;
EN_HEADLOSSFORM = 7;
EN_GLOBALEFFIC = 8;
EN_GLOBALPRICE = 9;
EN_GLOBALPATTERN = 10;
EN_DEMANDCHARGE = 11;
EN_SP_GRAVITY = 12;
EN_SP_VISCOS = 13;
EN_EXTRA_ITER = 14;
EN_CHECKFREQ = 15;
EN_MAXCHECK = 16;
EN_DAMPLIMIT = 17;
EN_SP_DIFFUS = 18;
EN_BULKORDER = 19;
EN_WALLORDER = 20;
EN_TANKORDER = 21;
EN_CONCENLIMIT = 22;
EN_LOWLEVEL = 0; { Control types }
EN_HILEVEL = 1;
EN_TIMER = 2;
EN_TIMEOFDAY = 3;
EN_SERIES = 0; { Report statistic types }
EN_AVERAGE = 1;
EN_MINIMUM = 2;
EN_MAXIMUM = 3;
EN_RANGE = 4;
EN_MIX1 = 0; { Tank mixing models }
EN_MIX2 = 1;
EN_FIFO = 2;
EN_LIFO = 3;
EN_NOSAVE = 0; { Hydraulics flags }
EN_SAVE = 1;
EN_INITFLOW = 10;
EN_SAVE_AND_INIT = 11;
EN_CONST_HP = 0; { Pump curve types }
EN_POWER_FUNC = 1;
EN_CUSTOM = 2;
EN_NOCURVE = 3;
EN_VOLUME_CURVE = 0; { Curve types }
EN_PUMP_CURVE = 1;
EN_EFFIC_CURVE = 2;
EN_HLOSS_CURVE = 3;
EN_GENERIC_CURVE = 4;
EN_UNCONDITIONAL = 0; { Deletion action codes }
EN_CONDITIONAL = 1;
EN_NO_REPORT = 0; { Status reporting levels }
EN_NORMAL_REPORT = 1;
EN_FULL_REPORT = 2;
EN_R_NODE = 6; { Rule-based control objects }
EN_R_LINK = 7;
EN_R_SYSTEM = 8;
EN_R_DEMAND = 0; { Rule-based control variables }
EN_R_HEAD = 1;
EN_R_GRADE = 2;
EN_R_LEVEL = 3;
EN_R_PRESSURE = 4;
EN_R_FLOW = 5;
EN_R_STATUS = 6;
EN_R_SETTING = 7;
EN_R_POWER = 8;
EN_R_TIME = 9;
EN_R_CLOCKTIME = 10;
EN_R_FILLTIME = 11;
EN_R_DRAINTIME = 12;
EN_R_EQ = 0; { Rule-based control operators }
EN_R_NE = 1;
EN_R_LE = 2;
EN_R_GE = 3;
EN_R_LT = 4;
EN_R_GT = 5;
EN_R_IS = 6;
EN_R_NOT = 7;
EN_R_BELOW = 8;
EN_R_ABOVE = 9;
EN_R_IS_OPEN = 1; { Rule-based control link status }
EN_R_IS_CLOSED = 2;
EN_R_IS_ACTIVE = 3;
EpanetLib = 'epanet2.dll';
{Project Functions}
function ENepanet(F1: PAnsiChar; F2: PAnsiChar; F3: PAnsiChar; F4: Pointer): Integer; stdcall; external EpanetLib;
function ENinit(F2: PAnsiChar; F3: PAnsiChar; UnitsType: Integer; HeadlossType: Integer): Integer; stdcall; external EpanetLib;
function ENopen(F1: PAnsiChar; F2: PAnsiChar; F3: PAnsiChar): Integer; stdcall; external EpanetLib;
function ENgetcount(Code: Integer; var Count: Integer): Integer; stdcall; external EpanetLib;
function ENgettitle(Line1: PAnsiChar; Line2: PAnsiChar; Line3: PAnsiChar): Integer; stdcall; external EpanetLib;
function ENsettitle(Line1: PAnsiChar; Line2: PAnsiChar; Line3: PAnsiChar): Integer; stdcall; external EpanetLib;
function ENgetcomment(ObjType: Integer; Index: Integer; Comment: PAnsiChar): Integer; stdcall; external EpanetLib;
function ENsetcomment(ObjType: Integer; Index: Integer; Comment: PAnsiChar): Integer; stdcall; external EpanetLib;
function ENsaveinpfile(F: PAnsiChar): Integer; stdcall; external EpanetLib;
function ENclose: Integer; stdcall; external EpanetLib;
{Hydraulic Functions}
function ENsolveH: Integer; stdcall; external EpanetLib;
function ENsaveH: Integer; stdcall; external EpanetLib;
function ENopenH: Integer; stdcall; external EpanetLib;
function ENinitH(SaveFlag: Integer): Integer; stdcall; external EpanetLib;
function ENrunH(var T: LongInt): Integer; stdcall; external EpanetLib;
function ENnextH(var Tstep: LongInt): Integer; stdcall; external EpanetLib;
function ENcloseH: Integer; stdcall; external EpanetLib;
function ENsavehydfile(F: PAnsiChar): Integer; stdcall; external EpanetLib;
function ENusehydfile(F: PAnsiChar): Integer; stdcall; external EpanetLib;
{Quality Functions}
function ENsolveQ: Integer; stdcall; external EpanetLib;
function ENopenQ: Integer; stdcall; external EpanetLib;
function ENinitQ(SaveFlag: Integer): Integer; stdcall; external EpanetLib;
function ENrunQ(var T: LongInt): Integer; stdcall; external EpanetLib;
function ENnextQ(var Tstep: LongInt): Integer; stdcall; external EpanetLib;
function ENstepQ(var Tleft: LongInt): Integer; stdcall; external EpanetLib;
function ENcloseQ: Integer; stdcall; external EpanetLib;
{Reporting Functions}
function ENwriteline(S: PAnsiChar): Integer; stdcall; external EpanetLib;
function ENreport: Integer; stdcall; external EpanetLib;
function ENcopyreport(F: PAnsiChar): Integer; stdcall; external EpanetLib;
function ENclearreport: Integer; stdcall; external EpanetLib;
function ENresetreport: Integer; stdcall; external EpanetLib;
function ENsetreport(S: PAnsiChar): Integer; stdcall; external EpanetLib;
function ENsetstatusreport(Code: Integer): Integer; stdcall; external EpanetLib;
function ENgetversion(var Version: Integer): Integer; stdcall; external EpanetLib;
function ENgeterror(Errcode: Integer; Errmsg: PAnsiChar; MaxLen: Integer): Integer; stdcall; external EpanetLib;
function ENgetstatistic(StatType: Integer; var Value: Single): Integer; stdcall; external EpanetLib;
function ENgetresultindex(Code: Integer; Index: Integer; var Value: Integer): Integer; stdcall; external EpanetLib;
{Analysis Options Functions}
function ENgetoption(Code: Integer; var Value: Single): Integer; stdcall; external EpanetLib;
function ENsetoption(Code: Integer; Value: Single): Integer; stdcall; external EpanetLib;
function ENgetflowunits(var Code: Integer): Integer; stdcall; external EpanetLib;
function ENsetflowunits(Code: Integer): Integer; stdcall; external EpanetLib;
function ENgettimeparam(Code: Integer; var Value: LongInt): Integer; stdcall; external EpanetLib;
function ENsettimeparam(Code: Integer; Value: LongInt): Integer; stdcall; external EpanetLib;
function ENgetqualinfo(var QualType: Integer; ChemName: PAnsiChar; ChemUnits: PAnsiChar; var TraceNode: Integer): Integer; stdcall; external EpanetLib;
function ENgetqualtype(var QualCode: Integer; var TraceNode: Integer): Integer; stdcall; external EpanetLib;
function ENsetqualtype(QualCode: Integer; ChemName: PAnsiChar; ChemUnits: PAnsiChar; TraceNodeID: PAnsiChar): Integer; stdcall; external EpanetLib;
{Node Functions}
function ENaddnode(ID: PAnsiChar; NodeType: Integer; var Index: Integer): Integer; stdcall; external EpanetLib;
function ENdeletenode(Index: Integer; ActionCode: Integer): Integer; stdcall; external EpanetLib;
function ENgetnodeindex(ID: PAnsiChar; var Index: Integer): Integer; stdcall; external EpanetLib;
function ENgetnodeid(Index: Integer; ID: PAnsiChar): Integer; stdcall; external EpanetLib;
function ENsetnodeid(Index: Integer; NewID: PAnsiChar): Integer; stdcall; external EpanetLib;
function ENgetnodetype(Index: Integer; var Code: Integer): Integer; stdcall; external EpanetLib;
function ENgetnodevalue(Index: Integer; Code: Integer; var Value: Single): Integer; stdcall; external EpanetLib;
function ENsetnodevalue(Index: Integer; Code: Integer; Value: Single): Integer; stdcall; external EpanetLib;
function ENsetjuncdata(Index: Integer; Elev: Single; Dmnd: Single; DmndPat: PAnsiChar): Integer; stdcall; external EpanetLib;
function ENsettankdata(Index: Integer; Elev, InitLvl, MinLvl, MaxLvl, Diam, MinVol: Single; VolCurve: PAnsiChar): Integer; stdcall; external EpanetLib;
function ENgetcoord(Index: Integer; var X: Double; var Y: Double): Integer; stdcall; external EpanetLib;
function ENsetcoord(Index: Integer; X: Double; Y: Double): Integer; stdcall; external EpanetLib;
{Demand Functions}
function ENgetdemandmodel(var Model: Integer; var Pmin: Single; var Preq: Single; var Pexp: Single): Integer; stdcall; external EpanetLib;
function ENsetdemandmodel(Model: Integer; Pmin: Single; Preq: Single; Pexp: Single): Integer; stdcall; external EpanetLib;
function ENgetnumdemands(NodeIndex: Integer; var NumDemands: Integer): Integer; stdcall; external EpanetLib;
function ENadddemand(NodeIndex: Integer; BaseDemand: Single; PatName: PAnsiChar; DemandName: PAnsiChar): Integer; stdcall; external EpanetLib;
function ENdeletedemand(NodeIndex: Integer; DemandIndex: Integer): Integer; stdcall; external EpanetLib;
function ENgetdemandindex(NodeIndex: Integer; DemandName: PAnsiChar; var DemandIndex: Integer): Integer; stdcall; external EpanetLib;
function ENgetbasedemand(NodeIndex: Integer; DemandIndex: Integer; var BaseDemand: Single): Integer; stdcall; external EpanetLib;
function ENsetbasedemand(NodeIndex: Integer; DemandIndex: Integer; BaseDemand: Single): Integer; stdcall; external EpanetLib;
function ENgetdemandpattern(NodeIndex: Integer; DemandIndex: Integer; var PatIndex: Integer): Integer; stdcall; external EpanetLib;
function ENsetdemandpattern(NodeIndex: Integer; DemandIndex: Integer; PatIndex: Integer): Integer; stdcall; external EpanetLib;
function ENgetdemandname(NodeIndex: Integer; DemandIndex: Integer; DemandName: PAnsiChar): Integer; stdcall; external EpanetLib;
function ENsetdemandname(NodeIndex: Integer; DemandIndex: Integer; DemandName: PAnsiChar): Integer; stdcall; external EpanetLib;
{Link Functions}
function ENaddlink(ID: PAnsiChar; LinkType: Integer; FromNode: PAnsiChar; ToNode: PAnsiChar; var Index: Integer): Integer; stdcall; external EpanetLib;
function ENdeletelink(Index: Integer; ActionCode: Integer): Integer; stdcall; external EpanetLib;
function ENgetlinkindex(ID: PAnsiChar; var Index: Integer): Integer; stdcall; external EpanetLib;
function ENgetlinkid(Index: Integer; ID: PAnsiChar): Integer; stdcall; external EpanetLib;
function ENsetlinkid(Index: Integer; ID: PAnsiChar): Integer; stdcall; external EpanetLib;
function ENgetlinktype(Index: Integer; var Code: Integer): Integer; stdcall; external EpanetLib;
function ENsetlinktype(var Index: Integer; LinkType: Integer; ActionCode: Integer): Integer; stdcall; external EpanetLib;
function ENgetlinknodes(Index: Integer; var Node1: Integer; var Node2: Integer): Integer; stdcall; external EpanetLib;
function ENsetlinknodes(Index: Integer; Node1: Integer; Node2: Integer): Integer; stdcall; external EpanetLib;
function ENgetlinkvalue(Index: Integer; Code: Integer; var Value: Single): Integer; stdcall; external EpanetLib;
function ENsetlinkvalue(Index: Integer; Code: Integer; Value: Single): Integer; stdcall; external EpanetLib;
function ENsetpipedata(Index: Integer; Length: Single; Diam: Single; Rough: Single; Mloss:Single): Integer; stdcall; external EpanetLib;
function ENgetvertexcount(Index: Integer; var Count: Integer): Integer; stdcall; external EpanetLib;
function ENgetvertex(Index: Integer; Vertex: Integer; var X: Double; var Y: Double): Integer; stdcall; external EpanetLib;
function ENsetvertices(Index: Integer; var X: Double; var Y: Double; Count: Integer): Integer; stdcall; external EpanetLib;
{Pump Functions}
function ENgetpumptype(LinkIndex: Integer; var PumpType: Integer): Integer; stdcall; external EpanetLib;
function ENgetheadcurveindex(LinkIndex: Integer; var CurveIndex: Integer): Integer; stdcall; external EpanetLib;
function ENsetheadcurveindex(LinkIndex: Integer; CurveIndex: Integer): Integer; stdcall; external EpanetLib;
{Pattern Functions}
function ENaddpattern(ID: PAnsiChar): Integer; stdcall; external EpanetLib;
function ENdeletepattern(Index: Integer): Integer; stdcall; external EpanetLib;
function ENgetpatternindex(ID: PAnsiChar; var Index: Integer): Integer; stdcall; external EpanetLib;
function ENgetpatternid(Index: Integer; ID: PAnsiChar): Integer; stdcall; external EpanetLib;
function ENsetpatternid(Index: Integer; ID: PAnsiChar): Integer; stdcall; external EpanetLib;
function ENgetpatternlen(Index: Integer; var Len: Integer): Integer; stdcall; external EpanetLib;
function ENgetpatternvalue(Index: Integer; Period: Integer; var Value: Single): Integer; stdcall; external EpanetLib;
function ENsetpatternvalue(Index: Integer; Period: Integer; Value: Single): Integer; stdcall; external EpanetLib;
function ENgetaveragepatternvalue(Index: Integer; var Value: Single): Integer; stdcall; external EpanetLib;
function ENsetpattern(Index: Integer; var F: Single; N: Integer): Integer; stdcall; external EpanetLib;
{Curve Functions}
function ENaddcurve(ID: PAnsiChar): Integer; stdcall; external EpanetLib;
function ENdeletecurve(Index: Integer): Integer; stdcall; external EpanetLib;
function ENgetcurveindex(ID: PAnsiChar; var Index: Integer): Integer; stdcall; external EpanetLib;
function ENgetcurveid(Index: Integer; ID: PAnsiChar): Integer; stdcall; external EpanetLib;
function ENsetcurveid(Index: Integer; ID: PAnsiChar): Integer; stdcall; external EpanetLib;
function ENgetcurvelen(Index: Integer; var Len: Integer): Integer; stdcall; external EpanetLib;
function ENgetcurvetype(Index: Integer; var CurveType: Integer): Integer; stdcall; external EpanetLib;
function ENgetcurvevalue(CurveIndex: Integer; PointIndex: Integer; var X: Single; var Y: Single): Integer; stdcall; external EpanetLib;
function ENsetcurvevalue(CurveIndex: Integer; PointIndex: Integer; X: Single; Y: Single): Integer; stdcall; external EpanetLib;
function ENgetcurve(Index: Integer; ID: PAnsiChar; var N: Integer; var X: Single; var Y: Single): Integer; stdcall; external EpanetLib;
function ENsetcurve(Index: Integer; var X: Single; var Y: Single; N: Integer): Integer; stdcall; external EpanetLib;
{Control Functions}
function ENaddcontrol(Ctype: Integer; Link: Integer; Setting: Single; Node: Integer; Level: Single; var Index: Integer): Integer; stdcall; external EpanetLib;
function ENdeletecontrol(Index: Integer): Integer; stdcall; external EpanetLib;
function ENgetcontrol(Index: Integer; var Ctype: Integer; var Link: Integer; var Setting: Single; var Node: Integer; var Level: Single): Integer; stdcall; external EpanetLib;
function ENsetcontrol(Index: Integer; Ctype: Integer; Link: Integer; Setting: Single; Node: Integer; Level: Single): Integer; stdcall; external EpanetLib;
{Rule-Based Control Functions}
function ENaddrule(Rule: PAnsiChar): Integer; stdcall; external EpanetLib;
function ENdeleterule(Index: Integer): Integer; stdcall; external EpanetLib;
function ENgetrule(Index: Integer; var Npremises: Integer; var NthenActions: Integer;
var NelseActions: Integer; var Priority: Single): Integer; stdcall; external EpanetLib;
function ENgetruleID(Index: Integer; ID: PAnsiChar): Integer; stdcall; external EpanetLib;
function ENsetrulepriority(Index: Integer; Priority: Single): Integer; stdcall; external EpanetLib;
function ENgetpremise(RuleIndex: Integer; PremiseIndex: Integer; var LogOp: Integer;
var ObjType: Integer; var ObjIndex: Integer; var Param: Integer; var RelOp: Integer;
var Status: Integer; var Value: Single): Integer; stdcall; external EpanetLib;
function ENsetpremise(RuleIndex: Integer; PremiseIndex: Integer; LogOp: Integer; ObjType: Integer;
ObjIndex: Integer; Param: Integer; RelOp: Integer; Status: Integer; Value: Single): Integer; stdcall; external EpanetLib;
function ENsetpremiseindex(RuleIndex: Integer; PremiseIndex: Integer; ObjIndex: Integer): Integer; stdcall; external EpanetLib;
function ENsetpremisestatus(RuleIndex: Integer; PremiseIndex: Integer; Status: Integer): Integer; stdcall; external EpanetLib;
function ENsetpremisevalue(RuleIndex: Integer; PremiseIndex: Integer; Value: Single): Integer; stdcall; external EpanetLib;
function ENgetthenaction(RuleIndex: Integer; ActionIndex: Integer; var LinkIndex: Integer;
var Status: Integer; var Setting: Single): Integer; stdcall; external EpanetLib;
function ENsetthenaction(RuleIndex: Integer; ActionIndex: Integer; LinkIndex: Integer;
Status: Integer; Setting: Single): Integer; stdcall; external EpanetLib;
function ENgetelseaction(RuleIndex: Integer; ActionIndex: Integer; var LinkIndex: Integer;
var Status: Integer; var Setting: Single): Integer; stdcall; external EpanetLib;
function ENsetelseaction(RuleIndex: Integer; ActionIndex: Integer; LinkIndex: Integer;
Status: Integer; Setting: Single): Integer; stdcall; external EpanetLib;
implementation
end.

View File

@@ -4,7 +4,7 @@
'Declarations of functions in the EPANET PROGRAMMERs TOOLKIT
'(EPANET2.DLL) for use with VB.Net.
'Last updated on 7/19/15 - LR
'Last updated on 11/04/2019
Imports System.Runtime.InteropServices
Imports System.Text
@@ -38,7 +38,10 @@ Public Const EN_MAXLEVEL = 21
Public Const EN_MIXFRACTION = 22
Public Const EN_TANK_KBULK = 23
Public Const EN_TANKVOLUME = 24 'ES
Public Const EN_TANKVOLUME = 24
Public Const EN_MAXVOLUME = 25
Public Const EN_CANOVERFLOW = 26
Public Const EN_DEMANDDEFICIT = 27
Public Const EN_DIAMETER = 0 ' Link parameters
Public Const EN_LENGTH = 1
@@ -54,9 +57,17 @@ Public Const EN_HEADLOSS = 10
Public Const EN_STATUS = 11
Public Const EN_SETTING = 12
Public Const EN_ENERGY = 13
Public Const EN_LINKQUAL = 14 'ES
Public Const EN_LINKQUAL = 14
Public Const EN_LINKPATTERN = 15
Public Const EN_PUMP_STATE = 16
Public Const EN_PUMP_EFFIC = 17
Public Const EN_PUMP_POWER = 18
Public Const EN_PUMP_HCURVE = 19
Public Const EN_PUMP_ECURVE = 20
Public Const EN_PUMP_ECOST = 21
Public Const EN_PUMP_EPAT = 22
Public Const EN_DURATION = 0 ' Time parameters
Public Const EN_HYDSTEP = 1
Public Const EN_QUALSTEP = 2
@@ -67,7 +78,26 @@ Public Const EN_REPORTSTART = 6
Public Const EN_RULESTEP = 7
Public Const EN_STATISTIC = 8
Public Const EN_PERIODS = 9
Public Const EN_STARTTIME = 10 'ES
Public Const EN_STARTTIME = 10
Public Const EN_HTIME = 11
Public Const EN_QTIME = 12
Public Const EN_HALTFLAG = 13
Public Const EN_NEXTEVENT = 14
Public Const EN_ITERATIONS = 0
Public Const EN_RELATIVEERROR = 1
Public Const EN_MAXHEADERROR = 2
Public Const EN_MAXFLOWCHANGE = 3
Public Const EN_MASSBALANCE = 4
Public Const EN_DEFICIENTNODES = 5
Public Const EN_DEMANDREDUCTION = 6
Public Const EN_NODE = 0 ' Component types
Public Const EN_LINK = 1
Public Const EN_TIMEPAT = 2
Public Const EN_CURVE = 3
Public Const EN_CONTROL = 4
Public Const EN_RULE = 5
Public Const EN_NODECOUNT = 0 'Component counts
Public Const EN_TANKCOUNT = 1
@@ -75,6 +105,7 @@ Public Const EN_LINKCOUNT = 2
Public Const EN_PATCOUNT = 3
Public Const EN_CURVECOUNT = 4
Public Const EN_CONTROLCOUNT = 5
Public Const EN_RULECOUNT = 6
Public Const EN_JUNCTION = 0 ' Node types
Public Const EN_RESERVOIR = 1
@@ -100,6 +131,10 @@ Public Const EN_MASS = 1
Public Const EN_SETPOINT = 2
Public Const EN_FLOWPACED = 3
Public Const EN_HW = 0 ' Head loss formulas
Public Const EN_DW = 1
Public Const EN_CM = 2
Public Const EN_CFS = 0 ' Flow units types
Public Const EN_GPM = 1
Public Const EN_MGD = 2
@@ -111,118 +146,257 @@ Public Const EN_MLD = 7
Public Const EN_CMH = 8
Public Const EN_CMD = 9
Public Const EN_TRIALS = 0 ' Misc. options
Public Const EN_DDA = 0 ' Demand driven analysis
Public Const EN_PDA = 1 ' Pressure driven analysis
Public Const EN_TRIALS = 0 ' Simulation options
Public Const EN_ACCURACY = 1
Public Const EN_TOLERANCE = 2
Public Const EN_EMITEXPON = 3
Public Const EN_DEMANDMULT = 4
Public Const EN_HEADERROR = 5
Public Const EN_FLOWCHANGE = 6
Public Const EN_HEADLOSSFORM = 7
Public Const EN_GLOBALEFFIC = 8
Public Const EN_GLOBALPRICE = 9
Public Const EN_GLOBALPATTERN = 10
Public Const EN_DEMANDCHARGE = 11
Public Const EN_SP_GRAVITY = 12
Public Const EN_SP_VISCOS = 13
Public Const EN_UNBALANCED = 14
Public Const EN_CHECKFREQ = 15
Public Const EN_MAXCHECK = 16
Public Const EN_DAMPLIMIT = 17
Public Const EN_SP_DIFFUS = 18
Public Const EN_BULKORDER = 19
Public Const EN_WALLORDER = 20
Public Const EN_TANKORDER = 21
Public Const EN_CONCENLIMIT = 22
Public Const EN_LOWLEVEL = 0 ' Control types
Public Const EN_LOWLEVEL = 0 ' Control types
Public Const EN_HILEVEL = 1
Public Const EN_TIMER = 2
Public Const EN_TIMEOFDAY = 3
Public Const EN_AVERAGE = 1 'Time statistic types
Public Const EN_AVERAGE = 1 ' Time statistic types
Public Const EN_MINIMUM = 2
Public Const EN_MAXIMUM = 3
Public Const EN_RANGE = 4
Public Const EN_MIX1 = 0 'Tank mixing models
Public Const EN_MIX1 = 0 ' Tank mixing models
Public Const EN_MIX2 = 1
Public Const EN_FIFO = 2
Public Const EN_LIFO = 3
Public Const EN_NOSAVE = 0 ' Save-results-to-file flag
Public Const EN_NOSAVE = 0 ' Save-results-to-file flag
Public Const EN_SAVE = 1
Public Const EN_INITFLOW = 10 ' Re-initialize flow flag
Public Const EN_INITFLOW = 10 ' Re-initialize flow flag
Public Const EN_SAVE_AND_INIT = 11
Public Const EN_CONST_HP = 0 ' constant horsepower
Public Const EN_POWER_FUNC = 1 ' power function
Public Const EN_CUSTOM = 2 ' user-defined custom curve
Public Const EN_CONST_HP = 0 ' Constant horsepower pump curve
Public Const EN_POWER_FUNC = 1 ' Power function pump curve
Public Const EN_CUSTOM = 2 ' User-defined custom pump curve
Public Const EN_NOCURVE = 3 ' No pump curve
Public Const EN_VOLUME_CURVE = 0 ' Volume curve
Public Const EN_PUMP_CURVE = 1 ' Pump curve
Public Const EN_EFFIC_CURVE = 2 ' Efficiency curve
Public Const EN_HLOSS_CURVE = 3 ' Head loss curve
Public Const EN_GENERIC_CURVE = 4 ' Generic curve
Public Const EN_UNCONDITIONAL = 0 ' Unconditional object deletion
Public Const EN_CONDITIONAL = 1 ' Conditional object deletion
Public Const EN_NO_REPORT = 0 ' No status report
Public Const EN_NORMAL_REPORT = 1 ' Normal status report
Public Const EN_FULL_REPORT = 2 ' Full status report
Public Const EN_R_NODE = 6 ' Rule objects
Public Const EN_R_LINK = 7
Public Const EN_R_SYSTEM = 8
Public Const EN_R_DEMAND = 0 ' Rule variables
Public Const EN_R_HEAD = 1
Public Const EN_R_GRADE = 2
Public Const EN_R_LEVEL = 3
Public Const EN_R_PRESSURE = 4
Public Const EN_R_FLOW = 5
Public Const EN_R_STATUS = 6
Public Const EN_R_SETTING = 7
Public Const EN_R_POWER = 8
Public Const EN_R_TIME = 9
Public Const EN_R_CLOCKTIME = 10
Public Const EN_R_FILLTIME = 11
Public Const EN_R_DRAINTIME = 12
Public Const EN_R_EQ = 0 ' Rule operators
Public Const EN_R_NE = 1
Public Const EN_R_LE = 2
Public Const EN_R_GE = 3
Public Const EN_R_LT = 4
Public Const EN_R_GT = 5
Public Const EN_R_IS = 6
Public Const EN_R_NOT = 7
Public Const EN_R_BELOW = 8
Public Const EN_R_ABOVE = 9
Public Const EN_R_IS_OPEN = 1 ' Rule status types
Public Const EN_R_IS_CLOSED = 2
Public Const EN_R_IS_ACTIVE = 3
Public Const EN_MISSING As Double = -1.0E10
'These are the external functions that comprise the DLL
Declare Function ENepanet Lib "epanet2.dll" (ByVal F1 As String, ByVal F2 As String, ByVal F3 As String, ByVal F4 As String) As Int32
Declare Function ENopen Lib "epanet2.dll" (ByVal F1 As String, ByVal F2 As String, ByVal F3 As String) As Int32
Declare Function ENsaveinpfile Lib "epanet2.dll" (ByVal F As String) As Int32
'Project Functions
Declare Function ENgetversion Lib "epanet2.dll" (value As Int32) As Int32
Declare Function ENepanet Lib "epanet2.dll" (ByVal inpFile As String, ByVal rptFile As String, ByVal outFile As String, ByVal pviewprog As Any) As Int32
Declare Function ENinit Lib "epanet2.dll" (ByVal rptFile As String, ByVal outFile As String, ByVal unitsType As Int32, ByVal headlossType As Int32) As Int32
Declare Function ENopen Lib "epanet2.dll" (ByVal inpFile As String, ByVal rptFile As String, ByVal outFile As String) As Int32
Declare Function ENgettitle Lib "epanet2.dll" (ByVal titleline1 As String, ByVal titleline2 As String, ByVal titleline3 As String) As Int32
Declare Function ENsettitle Lib "epanet2.dll" (ByVal titleline1 As String, ByVal titleline2 As String, ByVal titleline3 As String) As Int32
Declare Function ENsaveinpfile Lib "epanet2.dll" (ByVal filename As String) As Int32
Declare Function ENclose Lib "epanet2.dll" () As Int32
'Hydraulic Analysis Functions
Declare Function ENsolveH Lib "epanet2.dll" () As Int32
Declare Function ENsaveH Lib "epanet2.dll" () As Int32
Declare Function ENopenH Lib "epanet2.dll" () As Int32
Declare Function ENinitH Lib "epanet2.dll" (ByVal SaveFlag As Int32) As Int32
Declare Function ENrunH Lib "epanet2.dll" (ByRef T As Int32) As Int32
Declare Function ENnextH Lib "epanet2.dll" (ByRef Tstep As Int32) As Int32
Declare Function ENinitH Lib "epanet2.dll" (ByVal initFlag As Int32) As Int32
Declare Function ENrunH Lib "epanet2.dll" (currentTime As Int32) As Int32
Declare Function ENnextH Lib "epanet2.dll" (tStep As Int32) As Int32
Declare Function ENcloseH Lib "epanet2.dll" () As Int32
Declare Function ENsavehydfile Lib "epanet2.dll" (ByVal F As String) As Int32
Declare Function ENusehydfile Lib "epanet2.dll" (ByVal F As String) As Int32
Declare Function ENsavehydfile Lib "epanet2.dll" (ByVal filename As String) As Int32
Declare Function ENusehydfile Lib "epanet2.dll" (ByVal filename As String) As Int32
'Water Quality Analysis Functions
Declare Function ENsolveQ Lib "epanet2.dll" () As Int32
Declare Function ENopenQ Lib "epanet2.dll" () As Int32
Declare Function ENinitQ Lib "epanet2.dll" (ByVal SaveFlag As Int32) As Int32
Declare Function ENrunQ Lib "epanet2.dll" (ByRef T As Int32) As Int32
Declare Function ENnextQ Lib "epanet2.dll" (ByRef Tstep As Int32) As Int32
Declare Function ENstepQ Lib "epanet2.dll" (ByRef Tleft As Int32) As Int32
Declare Function ENinitQ Lib "epanet2.dll" (ByVal saveFlag As Int32) As Int32
Declare Function ENrunQ Lib "epanet2.dll" (currentTime As Int32) As Int32
Declare Function ENnextQ Lib "epanet2.dll" (tStep As Int32) As Int32
Declare Function ENstepQ Lib "epanet2.dll" (timeLeft As Int32) As Int32
Declare Function ENcloseQ Lib "epanet2.dll" () As Int32
Declare Function ENwriteline Lib "epanet2.dll" (ByVal S As String) As Int32
'Reporting Functions
Declare Function ENwriteline Lib "epanet2.dll" (ByVal line As String) As Int32
Declare Function ENreport Lib "epanet2.dll" () As Int32
Declare Function ENcopyreport Lib "epanet2.dll" (ByVal filename As String) As Int32
Declare Function ENclearreport Lib "epanet2.dll" () As Int32
Declare Function ENresetreport Lib "epanet2.dll" () As Int32
Declare Function ENsetreport Lib "epanet2.dll" (ByVal S As String) As Int32
Declare Function ENsetreport Lib "epanet2.dll" (ByVal format As String) As Int32
Declare Function ENsetstatusreport Lib "epanet2.dll" (ByVal level As Int32) As Int32
Declare Function ENgetcount Lib "epanet2.dll" (ByVal object As Int32, count As Int32) As Int32
Declare Function ENgeterror Lib "epanet2.dll" (ByVal errcode As Int32, ByVal errmsg As String, ByVal maxLen As Int32) As Int32
Declare Function ENgetstatistic Lib "epanet2.dll" (ByVal type_ As Int32, ByRef value As Single) As Int32
Declare Function ENgetresultindex Lib "epanet2.dll" (ByVal type_ As Int32, ByVal index As Int32, ByRef value As Int32) As Int32
'Analysis Options Functions
Declare Function ENgetoption Lib "epanet2.dll" (ByVal option As Int32, value As Single) As Int32
Declare Function ENsetoption Lib "epanet2.dll" (ByVal option As Int32, ByVal value As Single) As Int32
Declare Function ENgetflowunits Lib "epanet2.dll" (units As Int32) As Int32
Declare Function ENsetflowunits Lib "epanet2.dll" (ByVal units As Int32) As Int32
Declare Function ENgettimeparam Lib "epanet2.dll" (ByVal param As Int32, value As Int32) As Int32
Declare Function ENsettimeparam Lib "epanet2.dll" (ByVal param As Int32, ByVal value As Int32) As Int32
Declare Function ENgetqualinfo Lib "epanet2.dll" (qualType As Int32, ByVal chemName As String, ByVal chemUnits As String, traceNode As Int32) As Int32
Declare Function ENgetqualtype Lib "epanet2.dll" (qualType As Int32, traceNode As Int32) As Int32
Declare Function ENsetqualtype Lib "epanet2.dll" (ByVal qualType As Int32, ByVal chemName As String, ByVal chemUnits As String, ByVal traceNode As String) As Int32
'Node Functions
Declare Function ENaddnode Lib "epanet2.dll" (ByVal id As String, ByVal nodeType As Int32, Index As Int32) As Int32
Declare Function ENdeletenode Lib "epanet2.dll" (ByVal index As Int32, ByVal actionCode As Int32) As Int32
Declare Function ENgetnodeindex Lib "epanet2.dll" (ByVal id As String, index As Int32) As Int32
Declare Function ENgetnodeid Lib "epanet2.dll" (ByVal index As Int32, ByVal id As String) As Int32
Declare Function ENsetnodeid Lib "epanet2.dll" (ByVal index As Int32, ByVal newid As String) As Int32
Declare Function ENgetnodetype Lib "epanet2.dll" (ByVal index As Int32, nodeType As Int32) As Int32
Declare Function ENgetnodevalue Lib "epanet2.dll" (ByVal index As Int32, ByVal property As Int32, value As Single) As Int32
Declare Function ENsetnodevalue Lib "epanet2.dll" (ByVal index As Int32, ByVal property As Int32, ByVal value As Single) As Int32
Declare Function ENsetjuncdata Lib "epanet2.dll" (ByVal index As Int32, ByVal elev As Single, ByVal dmnd As Single, ByVal dmndpat As String) As Int32
Declare Function ENsettankdata Lib "epanet2.dll" (ByVal index As Int32, ByVal elev As Single, ByVal initlvl As Single, ByVal minlvl As Single, ByVal maxlvl As Single, ByVal diam As Single, ByVal minvol As Single, ByVal volcurve As String) As Int32
Declare Function ENgetcoord Lib "epanet2.dll" (ByVal index As Int32, x As Double, y As Double) As Int32
Declare Function ENsetcoord Lib "epanet2.dll" (ByVal index As Int32, ByVal x As Double, ByVal y As Double) As Int32
Declare Function ENgetcontrol Lib "epanet2.dll" (ByVal Cindex As Int32, ByRef CtlType As Int32, ByRef Lindex As Int32, ByRef Setting As Single, ByRef Nindex As Int32, ByRef Level As Single) As Int32
Declare Function ENgetcount Lib "epanet2.dll" (ByVal Code As Int32, ByRef Value As Int32) As Int32
Declare Function ENgetoption Lib "epanet2.dll" (ByVal Code As Int32, ByRef Value As Single) As Int32
Declare Function ENgettimeparam Lib "epanet2.dll" (ByVal Code As Int32, ByRef Value As Int32) As Int32
Declare Function ENgetflowunits Lib "epanet2.dll" (ByRef Code As Int32) As Int32
Declare Function ENgetpatternindex Lib "epanet2.dll" (ByVal ID As String, ByRef Index As Int32) As Int32
Declare Function ENgetpatternid Lib "epanet2.dll" (ByVal Index As Int32, ByVal ID As StringBuilder) As Int32
Declare Function ENgetpatternlen Lib "epanet2.dll" (ByVal Index As Int32, ByRef L As Int32) As Int32
Declare Function ENgetpatternvalue Lib "epanet2.dll" (ByVal Index As Int32, ByVal Period As Int32, ByRef Value As Single) As Int32
Declare Function ENgetqualtype Lib "epanet2.dll" (ByRef QualCode As Int32, ByRef TraceNode As Int32) As Int32
Declare Function ENgeterror Lib "epanet2.dll" (ByVal ErrCode As Int32, ByVal ErrMsg As StringBuilder, ByVal N As Int32)
'Nodal Demand Functions
Declare Function ENgetdemandmodel Lib "epanet2.dll" (type_ As Int32, pmin As Single, preq As Single, pexp As Single) As Int32
Declare Function ENsetdemandmodel Lib "epanet2.dll" (ByVal type_ As Int32, ByVal pmin As Single, ByVal preq As Single, ByVal pexp As Single) As Int32
Declare Function ENadddemand Lib "epanet2.dll" (ByVal nodeIndex As Int32, ByVal baseDemand As Single, ByVal patternName As String, ByVal demandName As String) As Int32
Declare Function ENdeletedemand Lib "epanet2.dll" (ByVal nodeIndex As Int32, ByVal demandIndex As Int32) As Int32
Declare Function ENgetdemandindex Lib "epanet2.dll" (ByVal nodeIndex As Int32, ByVal demandName As String, demandIndex As Int32) As Int32
Declare Function ENgetnumdemands Lib "epanet2.dll" (ByVal nodeIndex As Int32, numDemands As Int32) As Int32
Declare Function ENgetbasedemand Lib "epanet2.dll" (ByVal nodeIndex As Int32, ByVal demandIndex As Int32, value As Single) As Int32
Declare Function ENsetbasedemand Lib "epanet2.dll" (ByVal nodeIndex As Int32, ByVal demandIndex As Int32, ByVal BaseDemand As Single) As Int32
Declare Function ENgetdemandpattern Lib "epanet2.dll" (ByVal nodeIndex As Int32, ByVal demandIndex As Int32, patIndex As Int32) As Int32
Declare Function ENsetdemandpattern Lib "epanet2.dll" (ByVal nodeIndex As Int32, ByVal demandIndex As Int32, ByVal patIndex As Int32) As Int32
Declare Function ENgetdemandname Lib "epanet2.dll" (ByVal nodeIndex As Int32, ByVal demandIndex As Int32, ByVal demandName As String) As Int32
Declare Function ENsetdemandname Lib "epanet2.dll" (ByVal nodeIndex As Int32, ByVal demandIndex As Int32, ByVal demandName As String) As Int32
Declare Function ENgetnodeindex Lib "epanet2.dll" (ByVal ID As String, ByRef Index As Int32) As Int32
Declare Function ENgetnodeid Lib "epanet2.dll" (ByVal Index As Int32, ByVal ID As StringBuilder) As Int32
Declare Function ENgetnodetype Lib "epanet2.dll" (ByVal Index As Int32, ByRef Code As Int32) As Int32
Declare Function ENgetnodevalue Lib "epanet2.dll" (ByVal Index As Int32, ByVal Code As Int32, ByRef Value As Single) As Int32
Declare Function ENgetcoord Lib "epanet2.dll" (ByVal Index As Int32, ByRef X As Single, ByRef Y As Single) As Int32
Declare Function ENsetcoord Lib "epanet2.dll" (ByVal Index As Int32, ByVal X As Single, ByVal Y As Single) As Int32
'Link Functions
Declare Function ENaddlink Lib "epanet2.dll" (ByVal id As String, ByVal linkType As Int32, ByVal fromNode As String, ByVal toNode As String, Index As Int32) As Int32
Declare Function ENdeletelink Lib "epanet2.dll" (ByVal index As Int32, ByVal actionCode As Int32) As Int32
Declare Function ENgetlinkindex Lib "epanet2.dll" (ByVal id As String, index As Int32) As Int32
Declare Function ENgetlinkid Lib "epanet2.dll" (ByVal index As Int32, ByVal id As String) As Int32
Declare Function ENsetlinkid Lib "epanet2.dll" (ByVal index As Int32, ByVal newid As String) As Int32
Declare Function ENgetlinktype Lib "epanet2.dll" (ByVal index As Int32, linkType As Int32) As Int32
Declare Function ENsetlinktype Lib "epanet2.dll" (index As Int32, ByVal linkType As Int32, ByVal actionCode As Int32) As Int32
Declare Function ENgetlinknodes Lib "epanet2.dll" (ByVal index As Int32, node1 As Int32, node2 As Int32) As Int32
Declare Function ENsetlinknodes Lib "epanet2.dll" (ByVal index As Int32, ByVal node1 As Int32, ByVal node2 As Int32) As Int32
Declare Function ENgetlinkvalue Lib "epanet2.dll" (ByVal index As Int32, ByVal property As Int32, value As Single) As Int32
Declare Function ENsetlinkvalue Lib "epanet2.dll" (ByVal index As Int32, ByVal property As Int32, ByVal value As Single) As Int32
Declare Function ENsetpipedata Lib "epanet2.dll" (ByVal index As Int32, ByVal length As Single, ByVal diam As Single, ByVal rough As Single, ByVal mloss As Single) As Int32
Declare Function ENgetvertexcount Lib "epanet2.dll" (ByVal index As Int32, count As Int32) As Int32
Declare Function ENgetvertex Lib "epanet2.dll" (ByVal index As Int32, ByVal vertex As Int32, x As Double, y As Double) As Int32
Declare Function ENsetvertices Lib "epanet2.dll" (ByVal index As Int32, xCoords As Any, yCoords As Any, ByVal count As Int32) As Int32
Declare Function ENgetnumdemands Lib "epanet2.dll" (ByVal Index As Int32, ByRef numDemands As Int32) As Int32 'ES
Declare Function ENgetbasedemand Lib "epanet2.dll" (ByVal Index As Int32, ByVal DemandIndex As Int32, ByRef Value As Single) As Int32 'ES
Declare Function ENgetdemandpattern Lib "epanet2.dll" (ByVal Index As Int32, ByVal DemandIndex As Int32, ByRef PatIndex As Int32) As Int32 'ES
'Pump Functions
Declare Function ENgetheadcurveindex Lib "epanet2.dll" (ByVal linkIndex As Int32, curveIndex As Int32) As Int32
Declare Function ENsetheadcurveindex Lib "epanet2.dll" (ByVal linkIndex As Int32, ByVal curveIndex As Int32) As Int32
Declare Function ENgetpumptype Lib "epanet2.dll" (ByVal linkIndex As Int32, pumpType As Int32) As Int32
Declare Function ENgetlinkindex Lib "epanet2.dll" (ByVal ID As String, ByRef Index As Int32) As Int32
Declare Function ENgetlinkid Lib "epanet2.dll" (ByVal Index As Int32, ByVal ID As StringBuilder) As Int32
Declare Function ENgetlinktype Lib "epanet2.dll" (ByVal Index As Int32, ByRef Code As Int32) As Int32
Declare Function ENgetlinknodes Lib "epanet2.dll" (ByVal Index As Int32, ByRef Node1 As Int32, ByRef Node2 As Int32) As Int32
Declare Function ENgetlinkvalue Lib "epanet2.dll" (ByVal Index As Int32, ByVal Code As Int32, ByRef Value As Single) As Int32
'Time Pattern Functions
Declare Function ENaddpattern Lib "epanet2.dll" (ByVal id As String) As Int32
Declare Function ENdeletepattern Lib "epanet2.dll" (ByVal index As Int32) As Int32
Declare Function ENgetpatternindex Lib "epanet2.dll" (ByVal id As String, index As Int32) As Int32
Declare Function ENgetpatternid Lib "epanet2.dll" (ByVal index As Int32, ByVal id As String) As Int32
Declare Function ENsetpatternid Lib "epanet2.dll" (ByVal index As Int32, ByVal newid As String) As Int32
Declare Function ENgetpatternlen Lib "epanet2.dll" (ByVal index As Int32, len_ As Int32) As Int32
Declare Function ENgetpatternvalue Lib "epanet2.dll" (ByVal index As Int32, ByVal period As Int32, value As Single) As Int32
Declare Function ENsetpatternvalue Lib "epanet2.dll" (ByVal index As Int32, ByVal period As Int32, ByVal value As Single) As Int32
Declare Function ENgetaveragepatternvalue Lib "epanet2.dll" (ByVal index As Int32, value As Single) As Int32
Declare Function ENsetpattern Lib "epanet2.dll" (ByVal index As Int32, values As Any, ByVal len_ As Int32) As Int32
Declare Function ENgetcurve Lib "epanet2.dll" (ByVal CurveIndex As Int32, ByRef nValues As Int32, ByRef xValues As Single, ByRef yValues As Single) As Int32 'ES
Declare Function ENgetheadcurveindex Lib "epanet2.dll" (ByVal Index As Int32, ByVal CurveIndex As int32) As Int32 'ES
Declare Function ENgetpumptype Lib "epanet2.dll" (ByVal Index As Int32, ByRef PumpType As Int32) As Int32 'ES
'Data Curve Functions
Declare Function ENaddcurve Lib "epanet2.dll" (ByVal id As String) As Int32
Declare Function ENdeletecurve Lib "epanet2.dll" (ByVal index As Int32) As Int32
Declare Function ENgetcurveindex Lib "epanet2.dll" (ByVal id As String, index As Int32) As Int32
Declare Function ENgetcurveid Lib "epanet2.dll" (ByVal index As Int32, ByVal id As String) As Int32
Declare Function ENsetcurveid Lib "epanet2.dll" (ByVal index As Int32, ByVal newid As String) As Int32
Declare Function ENgetcurvelen Lib "epanet2.dll" (ByVal index As Int32, len_ As Int32) As Int32
Declare Function ENgetcurvetype Lib "epanet2.dll" (ByVal index As Int32, type_ As Int32) As Int32
Declare Function ENgetcurvevalue Lib "epanet2.dll" (ByVal curveIndex As Int32, ByVal pointIndex As Int32, x As Single, y As Single) As Int32
Declare Function ENsetcurvevalue Lib "epanet2.dll" (ByVal curveIndex As Int32, ByVal pointIndex As Int32, ByVal x As Single, ByVal y As Single) As Int32
Declare Function ENgetcurve Lib "epanet2.dll" (ByVal index As Int32, ByVal id As String, nPoints As Int32, xValues As Any, yValues As Any) As Int32
Declare Function ENsetcurve Lib "epanet2.dll" (ByVal index As Int32, xValues As Any, yValues As Any, ByVal nPoints As Int32) As Int32
Declare Function ENgetversion Lib "epanet2.dll" (ByRef Value As Int32) As Int32
'Simple Control Functions
Declare Function ENaddcontrol Lib "epanet2.dll" (ByVal type_ As Int32, ByVal linkIndex As Int32, ByVal setting As Single, ByVal nodeIndex As Int32, ByVal level As Single, index As Int32) As Int32
Declare Function ENdeletecontrol Lib "epanet2.dll" (ByVal index As Int32) As Int32
Declare Function ENgetcontrol Lib "epanet2.dll" (ByVal index As Int32, type_ As Int32, linkIndex As Int32, setting As Single, nodeIndex As Int32, level As Single) As Int32
Declare Function ENsetcontrol Lib "epanet2.dll" (ByVal index As Int32, ByVal type_ As Int32, ByVal linkIndex As Int32, ByVal setting As Single, ByVal nodeIndex As Int32, ByVal level As Single) As Int32
Declare Function ENsetcontrol Lib "epanet2.dll" (ByVal Cindex As Int32, ByVal CtlType As Int32, ByVal Lindex As Int32, ByVal Setting As Single, ByVal Nindex As Int32, ByVal Level As Single) As Int32
Declare Function ENsetnodevalue Lib "epanet2.dll" (ByVal Index As Int32, ByVal Code As Int32, ByVal Value As Single) As Int32
Declare Function ENsetlinkvalue Lib "epanet2.dll" (ByVal Index As Int32, ByVal Code As Int32, ByVal Value As Single) As Int32
Declare Function ENsetpattern Lib "epanet2.dll" (ByVal Index as Int32, ByRef F as Single, ByVal N as Int32) as Int32
Declare Function ENsetpatternvalue Lib "epanet2.dll" (ByVal Index As Int32, ByVal Period As Int32, ByVal Value As Single) As Int32
Declare Function ENsettimeparam Lib "epanet2.dll" (ByVal Code As Int32, ByVal Value As Int32) As Int32
Declare Function ENsetoption Lib "epanet2.dll" (ByVal Code As Int32, ByVal Value As Single) As Int32
Declare Function ENsetstatusreport Lib "epanet2.dll" (ByVal Code As Int32) As Int32
Declare Function ENsetqualtype Lib "epanet2.dll" (ByVal QualCode As Int32, ByVal ChemName As String, ByVal ChemUnits As String, ByVal TraceNode As String) As Int32
Declare Function ENaddpattern Lib "epanet2.dll" (ByVal ID As String) As Int32
'Rule-Based Control Functions
Declare Function ENaddrule Lib "epanet2.dll" (ByVal rule As String) As Int32
Declare Function ENdeleterule Lib "epanet2.dll" (ByVal index As Int32) As Int32
Declare Function ENgetrule Lib "epanet2.dll" (ByVal index As Int32, nPremises As Int32, nThenActions As Int32, nElseActions As Int32, priority As Single) As Int32
Declare Function ENgetruleID Lib "epanet2.dll" (ByVal index As Int32, ByVal id As String) As Int32
Declare Function ENsetrulepriority Lib "epanet2.dll" (ByVal index As Int32, ByVal priority As Single) As Int32
Declare Function ENgetpremise Lib "epanet2.dll" (ByVal ruleIndex As Int32, ByVal premiseIndex As Int32, logop As Int32, object As Int32, objIndex As Int32, variable As Int32, relop As Int32, status As Int32, value As Single) As Int32
Declare Function ENsetpremise Lib "epanet2.dll" (ByVal ruleIndex As Int32, ByVal premiseIndex As Int32, ByVal logop As Int32, ByVal object As Int32, ByVal objIndex As Int32, ByVal variable As Int32, ByVal relop As Int32, ByVal status As Int32, ByVal value As Single) As Int32
Declare Function ENsetpremiseindex Lib "epanet2.dll" (ByVal ruleIndex As Int32, ByVal premiseIndex As Int32, ByVal objIndex As Int32) As Int32
Declare Function ENsetpremisestatus Lib "epanet2.dll" (ByVal ruleIndex As Int32, ByVal premiseIndex As Int32, ByVal status As Int32) As Int32
Declare Function ENsetpremisevalue Lib "epanet2.dll" (ByVal ruleIndex As Int32, ByVal premiseIndex As Int32, ByVal value As Single) As Int32
Declare Function ENgetthenaction Lib "epanet2.dll" (ByVal ruleIndex As Int32, ByVal actionIndex As Int32, linkIndex As Int32, status As Int32, setting As Single) As Int32
Declare Function ENsetthenaction Lib "epanet2.dll" (ByVal ruleIndex As Int32, ByVal actionIndex As Int32, ByVal linkIndex As Int32, ByVal status As Int32, ByVal setting As Single) As Int32
Declare Function ENgetelseaction Lib "epanet2.dll" (ByVal ruleIndex As Int32, ByVal actionIndex As Int32, linkIndex As Int32, status As Int32, setting As Single) As Int32
Declare Function ENsetelseaction Lib "epanet2.dll" (ByVal ruleIndex As Int32, ByVal actionIndex As Int32, ByVal linkIndex As Int32, ByVal status As Int32, ByVal setting As Single) As Int32
Declare Function ENgetcurveindex Lib "epanet2.dll" (ByVal ID As String, ByRef Index As Int32) As Int32
Declare Function ENgetcurveid Lib "epanet2.dll" (ByVal Index As Int32, ByVal ID As StringBuilder) As Int32
Declare Function ENgetcurvelen Lib "epanet2.dll" (ByVal Index As Int32, ByRef L As Int32) As Int32
Declare Function ENgetcurvevalue Lib "epanet2.dll" (ByVal Index As Int32, ByVal Pnt As Int32, ByRef X As Single, ByRef Y As Single) As Int32
Declare Function ENsetcurvevalue Lib "epanet2.dll" (ByVal Index As Int32, ByVal Pnt As Int32, ByVal X As Single, ByVal Y As Single) As Int32
Declare Function ENsetcurve Lib "epanet2.dll" (ByVal Index as Int32, ByRef X as Single, ByRef Y as Single, ByVal N as Int32) as Int32
Declare Function ENaddcurve Lib "epanet2.dll" (ByVal ID As String) As Int32
End Module

1786
include/epanet2_2.h Normal file

File diff suppressed because it is too large Load Diff

468
include/epanet2_enums.h Normal file
View File

@@ -0,0 +1,468 @@
/** @file epanet2_enums.h
*/
/*
******************************************************************************
Project: OWA EPANET
Version: 2.2
Module: epanet2_enums.h
Description: enumerations of symbolic constants used by the API functions
Authors: see AUTHORS
Copyright: see AUTHORS
License: see LICENSE
Last Updated: 11/06/2019
******************************************************************************
*/
#ifndef EPANET2_ENUMS_H
#define EPANET2_ENUMS_H
// --- Define the EPANET toolkit constants
/// Size Limts
/**
Limits on the size of character arrays used to store ID names
and text messages.
*/
typedef enum {
EN_MAXID = 31, //!< Max. # characters in ID name
EN_MAXMSG = 255 //!< Max. # characters in message text
} EN_SizeLimits;
/// Node properties
/**
These node properties are used with @ref EN_getnodevalue and @ref EN_setnodevalue.
Those marked as read only are computed values that can only be retrieved.
*/
typedef enum {
EN_ELEVATION = 0, //!< Elevation
EN_BASEDEMAND = 1, //!< Primary demand baseline value
EN_PATTERN = 2, //!< Primary demand time pattern index
EN_EMITTER = 3, //!< Emitter flow coefficient
EN_INITQUAL = 4, //!< Initial quality
EN_SOURCEQUAL = 5, //!< Quality source strength
EN_SOURCEPAT = 6, //!< Quality source pattern index
EN_SOURCETYPE = 7, //!< Quality source type (see @ref EN_SourceType)
EN_TANKLEVEL = 8, //!< Current computed tank water level (read only)
EN_DEMAND = 9, //!< Current computed demand (read only)
EN_HEAD = 10, //!< Current computed hydraulic head (read only)
EN_PRESSURE = 11, //!< Current computed pressure (read only)
EN_QUALITY = 12, //!< Current computed quality (read only)
EN_SOURCEMASS = 13, //!< Current computed quality source mass inflow (read only)
EN_INITVOLUME = 14, //!< Tank initial volume (read only)
EN_MIXMODEL = 15, //!< Tank mixing model (see @ref EN_MixingModel)
EN_MIXZONEVOL = 16, //!< Tank mixing zone volume (read only)
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, //!< Current computed tank volume (read only)
EN_MAXVOLUME = 25, //!< Tank maximum volume (read only)
EN_CANOVERFLOW = 26, //!< Tank can overflow (= 1) or not (= 0)
EN_DEMANDDEFICIT = 27 //!< Amount that full demand is reduced under PDA (read only)
} EN_NodeProperty;
/// Link properties
/**
These link properties are used with @ref EN_getlinkvalue and @ref EN_setlinkvalue.
Those marked as read only are computed values that can only be retrieved.
*/
typedef enum {
EN_DIAMETER = 0, //!< Pipe/valve diameter
EN_LENGTH = 1, //!< Pipe length
EN_ROUGHNESS = 2, //!< Pipe roughness coefficient
EN_MINORLOSS = 3, //!< Pipe/valve minor loss coefficient
EN_INITSTATUS = 4, //!< Initial status (see @ref EN_LinkStatusType)
EN_INITSETTING = 5, //!< Initial pump speed or valve setting
EN_KBULK = 6, //!< Bulk chemical reaction coefficient
EN_KWALL = 7, //!< Pipe wall chemical reaction coefficient
EN_FLOW = 8, //!< Current computed flow rate (read only)
EN_VELOCITY = 9, //!< Current computed flow velocity (read only)
EN_HEADLOSS = 10, //!< Current computed head loss (read only)
EN_STATUS = 11, //!< Current link status (see @ref EN_LinkStatusType)
EN_SETTING = 12, //!< Current link setting
EN_ENERGY = 13, //!< Current computed pump energy usage (read only)
EN_LINKQUAL = 14, //!< Current computed link quality (read only)
EN_LINKPATTERN = 15, //!< Pump speed time pattern index
EN_PUMP_STATE = 16, //!< Current computed pump state (read only) (see @ref EN_PumpStateType)
EN_PUMP_EFFIC = 17, //!< Current computed pump efficiency (read only)
EN_PUMP_POWER = 18, //!< Pump constant power rating
EN_PUMP_HCURVE = 19, //!< Pump head v. flow curve index
EN_PUMP_ECURVE = 20, //!< Pump efficiency v. flow curve index
EN_PUMP_ECOST = 21, //!< Pump average energy price
EN_PUMP_EPAT = 22 //!< Pump energy price time pattern index
} EN_LinkProperty;
/// Time parameters
/**
These time-related options are used with @ref EN_gettimeparam and@ref EN_settimeparam.
All times are expressed in seconds The parameters marked as read only are
computed values that can only be retrieved.
*/
typedef enum {
EN_DURATION = 0, //!< Total simulation duration
EN_HYDSTEP = 1, //!< Hydraulic time step
EN_QUALSTEP = 2, //!< Water quality time step
EN_PATTERNSTEP = 3, //!< Time pattern period
EN_PATTERNSTART = 4, //!< Time when time patterns begin
EN_REPORTSTEP = 5, //!< Reporting time step
EN_REPORTSTART = 6, //!< Time when reporting starts
EN_RULESTEP = 7, //!< Rule-based control evaluation time step
EN_STATISTIC = 8, //!< Reporting statistic code (see @ref EN_StatisticType)
EN_PERIODS = 9, //!< Number of reporting time periods (read only)
EN_STARTTIME = 10, //!< Simulation starting time of day
EN_HTIME = 11, //!< Elapsed time of current hydraulic solution (read only)
EN_QTIME = 12, //!< Elapsed time of current quality solution (read only)
EN_HALTFLAG = 13, //!< Flag indicating if the simulation was halted (read only)
EN_NEXTEVENT = 14, //!< Shortest time until a tank becomes empty or full (read only)
EN_NEXTEVENTTANK = 15 //!< Index of tank with shortest time to become empty or full (read only)
} EN_TimeParameter;
/// Analysis convergence statistics
/**
These statistics report the convergence criteria for the most current hydraulic analysis
and the cumulative water quality mass balance error at the current simulation time. They
can be retrieved with @ref EN_getstatistic.
*/
typedef enum {
EN_ITERATIONS = 0, //!< Number of hydraulic iterations taken
EN_RELATIVEERROR = 1, //!< Sum of link flow changes / sum of link flows
EN_MAXHEADERROR = 2, //!< Largest head loss error for links
EN_MAXFLOWCHANGE = 3, //!< Largest flow change in links
EN_MASSBALANCE = 4, //!< Cumulative water quality mass balance ratio
EN_DEFICIENTNODES = 5, //!< Number of pressure deficient nodes
EN_DEMANDREDUCTION = 6 //!< % demand reduction at pressure deficient nodes
} EN_AnalysisStatistic;
/// Types of network objects
/**
The types of objects that comprise a network model.
*/
typedef enum {
EN_NODE = 0, //!< Nodes
EN_LINK = 1, //!< Links
EN_TIMEPAT = 2, //!< Time patterns
EN_CURVE = 3, //!< Data curves
EN_CONTROL = 4, //!< Simple controls
EN_RULE = 5 //!< Control rules
} EN_ObjectType;
/// Types of objects to count
/**
These options tell @ref EN_getcount which type of object to count.
*/
typedef enum {
EN_NODECOUNT = 0, //!< Number of nodes (junctions + tanks + reservoirs)
EN_TANKCOUNT = 1, //!< Number of tanks and reservoirs
EN_LINKCOUNT = 2, //!< Number of links (pipes + pumps + valves)
EN_PATCOUNT = 3, //!< Number of time patterns
EN_CURVECOUNT = 4, //!< Number of data curves
EN_CONTROLCOUNT = 5, //!< Number of simple controls
EN_RULECOUNT = 6 //!< Number of rule-based controls
} EN_CountType;
/// Node Types
/**
These are the different types of nodes that can be returned by calling @ref EN_getnodetype.
*/
typedef enum {
EN_JUNCTION = 0, //!< Junction node
EN_RESERVOIR = 1, //!< Reservoir node
EN_TANK = 2 //!< Storage tank node
} EN_NodeType;
/// Link types
/**
These are the different types of links that can be returned by calling @ref EN_getlinktype.
*/
typedef enum {
EN_CVPIPE = 0, //!< Pipe with check valve
EN_PIPE = 1, //!< Pipe
EN_PUMP = 2, //!< Pump
EN_PRV = 3, //!< Pressure reducing valve
EN_PSV = 4, //!< Pressure sustaining valve
EN_PBV = 5, //!< Pressure breaker valve
EN_FCV = 6, //!< Flow control valve
EN_TCV = 7, //!< Throttle control valve
EN_GPV = 8 //!< General purpose valve
} EN_LinkType;
/// Link status
/**
One of these values is returned when @ref EN_getlinkvalue is used to retrieve a link's
initial status ( \b EN_INITSTATUS ) or its current status ( \b EN_STATUS ). These options are
also used with @ref EN_setlinkvalue to set values for these same properties.
*/
typedef enum {
EN_CLOSED = 0,
EN_OPEN = 1
} EN_LinkStatusType;
/// Pump states
/**
One of these codes is returned when @ref EN_getlinkvalue is used to retrieve a pump's
current operating state ( \b EN_PUMP_STATE ). \b EN_PUMP_XHEAD indicates that the pump has been
shut down because it is being asked to deliver more than its shutoff head. \b EN_PUMP_XFLOW
indicates that the pump is being asked to deliver more than its maximum flow.
*/
typedef enum {
EN_PUMP_XHEAD = 0, //!< Pump closed - cannot supply head
EN_PUMP_CLOSED = 2, //!< Pump closed
EN_PUMP_OPEN = 3, //!< Pump open
EN_PUMP_XFLOW = 5 //!< Pump open - cannot supply flow
} EN_PumpStateType;
/// Types of water quality analyses
/**
These are the different types of water quality analyses that EPANET can run. They
are used with @ref EN_getqualinfo, @ref EN_getqualtype, and @ref EN_setqualtype.
*/
typedef enum {
EN_NONE = 0, //!< No quality analysis
EN_CHEM = 1, //!< Chemical fate and transport
EN_AGE = 2, //!< Water age analysis
EN_TRACE = 3 //!< Source tracing analysis
} EN_QualityType;
/// Water quality source types
/**
These are the different types of external water quality sources that can be assigned
to a node's \b EN_SOURCETYPE property as used by @ref EN_getnodevalue and @ref EN_setnodevalue.
*/
typedef enum {
EN_CONCEN = 0, //!< Sets the concentration of external inflow entering a node
EN_MASS = 1, //!< Injects a given mass/minute into a node
EN_SETPOINT = 2, //!< Sets the concentration leaving a node to a given value
EN_FLOWPACED = 3 //!< Adds a given value to the concentration leaving a node
} EN_SourceType;
/// Head loss formulas
/**
The available choices for the \b EN_HEADLOSSFORM option in @ref EN_getoption and
@ref EN_setoption. They are also used for the head loss type argument in @ref EN_init.
Each head loss formula uses a different type of roughness coefficient ( \b EN_ROUGHNESS )
that can be set with @ref EN_setlinkvalue.
*/
typedef enum {
EN_HW = 0, //!< Hazen-Williams
EN_DW = 1, //!< Darcy-Weisbach
EN_CM = 2 //!< Chezy-Manning
} EN_HeadLossType;
/// Flow units
/**
These choices for flow units are used with @ref EN_getflowunits and @ref EN_setflowunits.
They are also used for the flow units type argument in @ref EN_init. If flow units are
expressed in US Customary units ( \b EN_CFS through \b EN_AFD ) then all other quantities are
in US Customary units. Otherwise they are in metric units.
*/
typedef enum {
EN_CFS = 0, //!< Cubic feet per second
EN_GPM = 1, //!< Gallons per minute
EN_MGD = 2, //!< Million gallons per day
EN_IMGD = 3, //!< Imperial million gallons per day
EN_AFD = 4, //!< Acre-feet per day
EN_LPS = 5, //!< Liters per second
EN_LPM = 6, //!< Liters per minute
EN_MLD = 7, //!< Million liters per day
EN_CMH = 8, //!< Cubic meters per hour
EN_CMD = 9 //!< Cubic meters per day
} EN_FlowUnits;
/// Demand models
/**
These choices for modeling consumer demands are used with @ref EN_getdemandmodel
and @ref EN_setdemandmodel.
A demand driven analysis requires that a junction's full demand be supplied
in each time period independent of how much pressure is available. A pressure
driven analysis makes demand be a power function of pressure, up to the point
where the full demand is met.
*/
typedef enum {
EN_DDA = 0, //!< Demand driven analysis
EN_PDA = 1 //!< Pressure driven analysis
} EN_DemandModel;
/// Simulation options
/**
These constants identify the hydraulic and water quality simulation options
that are applied on a network-wide basis. They are accessed using the
@ref EN_getoption and @ref EN_setoption functions.
*/
typedef enum {
EN_TRIALS = 0, //!< Maximum trials allowed for hydraulic convergence
EN_ACCURACY = 1, //!< Total normalized flow change for hydraulic convergence
EN_TOLERANCE = 2, //!< Water quality tolerance
EN_EMITEXPON = 3, //!< Exponent in emitter discharge formula
EN_DEMANDMULT = 4, //!< Global demand multiplier
EN_HEADERROR = 5, //!< Maximum head loss error for hydraulic convergence
EN_FLOWCHANGE = 6, //!< Maximum flow change for hydraulic convergence
EN_HEADLOSSFORM = 7, //!< Head loss formula (see @ref EN_HeadLossType)
EN_GLOBALEFFIC = 8, //!< Global pump efficiency (percent)
EN_GLOBALPRICE = 9, //!< Global energy price per KWH
EN_GLOBALPATTERN = 10, //!< Index of a global energy price pattern
EN_DEMANDCHARGE = 11, //!< Energy charge per max. KW usage
EN_SP_GRAVITY = 12, //!< Specific gravity
EN_SP_VISCOS = 13, //!< Specific viscosity (relative to water at 20 deg C)
EN_UNBALANCED = 14, //!< Extra trials allowed if hydraulics don't converge
EN_CHECKFREQ = 15, //!< Frequency of hydraulic status checks
EN_MAXCHECK = 16, //!< Maximum trials for status checking
EN_DAMPLIMIT = 17, //!< Accuracy level where solution damping begins
EN_SP_DIFFUS = 18, //!< Specific diffusivity (relative to chlorine at 20 deg C)
EN_BULKORDER = 19, //!< Bulk water reaction order for pipes
EN_WALLORDER = 20, //!< Wall reaction order for pipes (either 0 or 1)
EN_TANKORDER = 21, //!< Bulk water reaction order for tanks
EN_CONCENLIMIT = 22 //!< Limiting concentration for growth reactions
} EN_Option;
/// Simple control types
/**
These are the different types of simple (single statement) controls that can be applied
to network links. They are used as an argument to @ref EN_addcontrol,@ref EN_getcontrol,
and @ref EN_setcontrol.
*/
typedef enum {
EN_LOWLEVEL = 0, //!< Act when pressure or tank level drops below a setpoint
EN_HILEVEL = 1, //!< Act when pressure or tank level rises above a setpoint
EN_TIMER = 2, //!< Act at a prescribed elapsed amount of time
EN_TIMEOFDAY = 3 //!< Act at a particular time of day
} EN_ControlType;
/// Reporting statistic choices
/**
These options determine what kind of statistical post-processing should be done on
the time series of simulation results generated before they are reported using
@ref EN_report. An option can be chosen by using \b STATISTIC _option_ as the argument
to @ref EN_setreport.
*/
typedef enum {
EN_SERIES = 0, //!< Report all time series points
EN_AVERAGE = 1, //!< Report average value over simulation period
EN_MINIMUM = 2, //!< Report minimum value over simulation period
EN_MAXIMUM = 3, //!< Report maximum value over simulation period
EN_RANGE = 4 //!< Report maximum - minimum over simulation period
} EN_StatisticType;
/// Tank mixing models
/**
These are the different types of models that describe water quality mixing in storage tanks.
The choice of model is accessed with the \b EN_MIXMODEL property of a Tank node using
@ref EN_getnodevalue and @ref EN_setnodevalue.
*/
typedef enum {
EN_MIX1 = 0, //!< Complete mix model
EN_MIX2 = 1, //!< 2-compartment model
EN_FIFO = 2, //!< First in, first out model
EN_LIFO = 3 //!< Last in, first out model
} EN_MixingModel;
/// Hydraulic initialization options
/**
These options are used to initialize a new hydraulic analysis when @ref EN_initH is called.
*/
typedef enum {
EN_NOSAVE = 0, //!< Don't save hydraulics; don't re-initialize flows
EN_SAVE = 1, //!< Save hydraulics to file, don't re-initialize flows
EN_INITFLOW = 10, //!< Don't save hydraulics; re-initialize flows
EN_SAVE_AND_INIT = 11 //!< Save hydraulics; re-initialize flows
} EN_InitHydOption;
/// Types of pump curves
/**
@ref EN_getpumptype returns one of these values when it is called.
*/
typedef enum {
EN_CONST_HP = 0, //!< Constant horsepower
EN_POWER_FUNC = 1, //!< Power function
EN_CUSTOM = 2, //!< User-defined custom curve
EN_NOCURVE = 3 //!< No curve
} EN_PumpType;
/// Types of data curves
/**
These are the different types of physical relationships that a data curve can
represent as returned by calling @ref EN_getcurvetype.
*/
typedef enum {
EN_VOLUME_CURVE = 0, //!< Tank volume v. depth curve
EN_PUMP_CURVE = 1, //!< Pump head v. flow curve
EN_EFFIC_CURVE = 2, //!< Pump efficiency v. flow curve
EN_HLOSS_CURVE = 3, //!< Valve head loss v. flow curve
EN_GENERIC_CURVE = 4 //!< Generic curve
} EN_CurveType;
/// Deletion action codes
/**
These codes are used in @ref EN_deletenode and @ref EN_deletelink to indicate what action
should be taken if the node or link being deleted appears in any simple or rule-based
controls or if a deleted node has any links connected to it.
*/
typedef enum {
EN_UNCONDITIONAL = 0, //!< Delete all controls and connecing links
EN_CONDITIONAL = 1 //!< Cancel object deletion if it appears in controls or has connecting links
} EN_ActionCodeType;
/// Status reporting levels
/**
These choices specify the level of status reporting written to a project's report
file during a hydraulic analysis. The level is set using the @ref EN_setstatusreport function.
*/
typedef enum {
EN_NO_REPORT = 0, //!< No status reporting
EN_NORMAL_REPORT = 1, //!< Normal level of status reporting
EN_FULL_REPORT = 2 //!< Full level of status reporting
} EN_StatusReport;
/// Network objects used in rule-based controls
typedef enum {
EN_R_NODE = 6, //!< Clause refers to a node
EN_R_LINK = 7, //!< Clause refers to a link
EN_R_SYSTEM = 8 //!< Clause refers to a system parameter (e.g., time)
} EN_RuleObject;
/// Object variables used in rule-based controls
typedef enum {
EN_R_DEMAND = 0, //!< Nodal demand
EN_R_HEAD = 1, //!< Nodal hydraulic head
EN_R_GRADE = 2, //!< Nodal hydraulic grade
EN_R_LEVEL = 3, //!< Tank water level
EN_R_PRESSURE = 4, //!< Nodal pressure
EN_R_FLOW = 5, //!< Link flow rate
EN_R_STATUS = 6, //!< Link status
EN_R_SETTING = 7, //!< Link setting
EN_R_POWER = 8, //!< Pump power output
EN_R_TIME = 9, //!< Elapsed simulation time
EN_R_CLOCKTIME = 10, //!< Time of day
EN_R_FILLTIME = 11, //!< Time to fill a tank
EN_R_DRAINTIME = 12 //!< Time to drain a tank
} EN_RuleVariable;
/// Comparison operators used in rule-based controls
typedef enum {
EN_R_EQ = 0, //!< Equal to
EN_R_NE = 1, //!< Not equal
EN_R_LE = 2, //!< Less than or equal to
EN_R_GE = 3, //!< Greater than or equal to
EN_R_LT = 4, //!< Less than
EN_R_GT = 5, //!< Greater than
EN_R_IS = 6, //!< Is equal to
EN_R_NOT = 7, //!< Is not equal to
EN_R_BELOW = 8, //!< Is below
EN_R_ABOVE = 9 //!< Is above
} EN_RuleOperator;
/// Link status codes used in rule-based controls
typedef enum {
EN_R_IS_OPEN = 1, //!< Link is open
EN_R_IS_CLOSED = 2, //!< Link is closed
EN_R_IS_ACTIVE = 3 //!< Control valve is active
} EN_RuleStatus;
#define EN_MISSING -1.E10 //!< Missing value indicator
#endif //EPANET2_ENUMS_H