Merge remote-tracking branch 'refs/remotes/upstream/dev' into dev-swig
This commit is contained in:
@@ -26,30 +26,48 @@
|
|||||||
# cmake -G "Visual Studio 10 2010" ..
|
# cmake -G "Visual Studio 10 2010" ..
|
||||||
# msbuild /p:Configuration=Release ALL_BUILD.vcxproj
|
# msbuild /p:Configuration=Release ALL_BUILD.vcxproj
|
||||||
#
|
#
|
||||||
|
# Generic Invocation:
|
||||||
|
# cmake -E make_directory buildprod
|
||||||
|
# cd build
|
||||||
|
# cmake -G GENERATOR -DCMAKE_BUILD_TYPE=Release ..
|
||||||
|
# cmake --build . --target SOME_TARGET --config Release
|
||||||
|
#
|
||||||
# More information:
|
# More information:
|
||||||
# cmake --help
|
# cmake --help
|
||||||
#
|
#
|
||||||
# CMake is available at https://cmake.org/download/
|
# CMake is available at https://cmake.org/download/
|
||||||
#
|
#
|
||||||
|
|
||||||
cmake_minimum_required (VERSION 2.6)
|
cmake_minimum_required (VERSION 2.8.8)
|
||||||
|
|
||||||
SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
|
|
||||||
SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
|
|
||||||
|
|
||||||
project(EPANET)
|
project(EPANET)
|
||||||
|
|
||||||
IF(APPLE)
|
SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
|
||||||
|
SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
|
||||||
|
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
|
|
||||||
|
IF (APPLE)
|
||||||
SET(CMAKE_INSTALL_NAME_DIR @executable_path)
|
SET(CMAKE_INSTALL_NAME_DIR @executable_path)
|
||||||
SET(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
|
SET(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
|
||||||
ENDIF(APPLE)
|
ENDIF (APPLE)
|
||||||
|
|
||||||
# the library
|
IF (MSVC)
|
||||||
include_directories(include)
|
set(CMAKE_C_FLAGS_RELEASE "/GL")
|
||||||
|
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
||||||
|
ENDIF (MSVC)
|
||||||
|
|
||||||
|
set(EPANET_API_HEADER "include/epanet2.h")
|
||||||
|
|
||||||
|
# create object library for reuse in other targets
|
||||||
|
include_directories(include; src)
|
||||||
file(GLOB EPANET_SOURCES src/*.c)
|
file(GLOB EPANET_SOURCES src/*.c)
|
||||||
add_library(epanet STATIC ${EPANET_SOURCES})
|
add_library(epanet_objs OBJECT ${EPANET_SOURCES})
|
||||||
|
|
||||||
|
# the shared library
|
||||||
|
add_library(epanet SHARED $<TARGET_OBJECTS:epanet_objs> ${EPANET_API_HEADER})
|
||||||
|
|
||||||
# the standalone executable
|
# the standalone executable
|
||||||
include_directories(src)
|
add_executable(runepanet run/main.c $<TARGET_OBJECTS:epanet_objs>)
|
||||||
add_executable(runepanet run/main.c)
|
if (NOT MSVC)
|
||||||
target_link_libraries (runepanet LINK_PUBLIC epanet m)
|
target_link_libraries (runepanet m)
|
||||||
|
endif (NOT MSVC)
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
EPANET {#epanet-readme}
|
EPANET {#epanet-readme}
|
||||||
======
|
======
|
||||||
|
|
||||||
|
## Build Status
|
||||||
|
[](https://ci.appveyor.com/project/OpenWaterAnalytics/epanet)
|
||||||
[](https://travis-ci.org/OpenWaterAnalytics/EPANET)
|
[](https://travis-ci.org/OpenWaterAnalytics/EPANET)
|
||||||
|
|
||||||
The EPANET Library is a pressurized pipe network hydraulic and water quality analysis toolkit written in C.
|
The EPANET Library is a pressurized pipe network hydraulic and water quality analysis toolkit written in C.
|
||||||
@@ -13,4 +15,4 @@ A step-by-step tutorial on how to contribute to EPANET using GitHub is also [ava
|
|||||||
|
|
||||||
__Note:__ This repository is not affiliated with, or endorsed by, the USEPA. For the last "official" release of EPANET (2.00.12 UI and Toolkit) please go to the [EPA's GitHub repo](https://github.com/USEPA/Water-Distribution-Network-Model) or [the USEPA website](http://www2.epa.gov/water-research/epanet). It is also not the graphical user interface version. This is the hydraulic and water quality solver engine.
|
__Note:__ This repository is not affiliated with, or endorsed by, the USEPA. For the last "official" release of EPANET (2.00.12 UI and Toolkit) please go to the [EPA's GitHub repo](https://github.com/USEPA/Water-Distribution-Network-Model) or [the USEPA website](http://www2.epa.gov/water-research/epanet). It is also not the graphical user interface version. This is the hydraulic and water quality solver engine.
|
||||||
|
|
||||||
However, if you are interested in extending EPANET for academic, personal, or commercial use, then you've come to the right place. For community discussion, FAQ, and roadmapping of the project, go to the [Community Forum](http://community.wateranalytics.org/category/epanet).
|
However, if you are interested in extending EPANET for academic, personal, or commercial use, then you've come to the right place. For community discussion, FAQ, and roadmapping of the project, go to the [Community Forum](http://community.wateranalytics.org/category/epanet).
|
||||||
48
appveyor.yml
Normal file
48
appveyor.yml
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
#
|
||||||
|
# appveyor.yml - Appveyor CI configuration for OWA EPANET
|
||||||
|
#
|
||||||
|
# Date created: 01/09/2018
|
||||||
|
#
|
||||||
|
# Author: Michael E. Tryby
|
||||||
|
# US EPA - ORD/NRMRL
|
||||||
|
#
|
||||||
|
|
||||||
|
version: 2.0.{build}
|
||||||
|
|
||||||
|
image:
|
||||||
|
- Visual Studio 2013
|
||||||
|
|
||||||
|
# called before repo cloning
|
||||||
|
init:
|
||||||
|
- set EPANET_HOME=%APPVEYOR_BUILD_FOLDER%
|
||||||
|
- set BUILD_HOME=buildprod
|
||||||
|
- set TEST_HOME=tests\epanet-nrtestsuite
|
||||||
|
- set NRTEST_SCRIPT=%EPANET_HOME%\%BUILD_HOME%\packages\nrtest\scripts
|
||||||
|
- set GENERATOR="Visual Studio 10 2010"
|
||||||
|
|
||||||
|
cache:
|
||||||
|
- C:\ProgramData\chocolatey\bin -> appveyor.yml
|
||||||
|
- C:\ProgramData\chocolatey\lib -> appveyor.yml
|
||||||
|
- '%BUILD_HOME% -> CMakeLists.txt'
|
||||||
|
|
||||||
|
# called after repo clone
|
||||||
|
install:
|
||||||
|
- choco install swig
|
||||||
|
- python -m pip install --src %BUILD_HOME%\packages -r tools\requirements.txt
|
||||||
|
|
||||||
|
# called before build
|
||||||
|
before_build:
|
||||||
|
- cd %BUILD_HOME%
|
||||||
|
- cmake -G %GENERATOR% -DCMAKE_BUILD_TYPE=Release ..
|
||||||
|
|
||||||
|
# run custom build script
|
||||||
|
build_script:
|
||||||
|
- cmake --build . --target runepanet --config Release
|
||||||
|
|
||||||
|
before_test:
|
||||||
|
- cd %EPANET_HOME%
|
||||||
|
- tools\gen-config.cmd %EPANET_HOME%\%BUILD_HOME%\bin\Release > %TEST_HOME%\apps\epanet-%APPVEYOR_REPO_COMMIT%.json
|
||||||
|
|
||||||
|
# run custom test script
|
||||||
|
test_script:
|
||||||
|
- tools\run-nrtest.cmd %NRTEST_SCRIPT% %TEST_HOME% %APPVEYOR_REPO_COMMIT%
|
||||||
@@ -8,150 +8,150 @@ Attribute VB_Name = "Module1"
|
|||||||
'Last updated on 4/3/07
|
'Last updated on 4/3/07
|
||||||
|
|
||||||
' These are codes used by the DLL functions
|
' These are codes used by the DLL functions
|
||||||
Global Const EN_ELEVATION = 0 ' Node parameters
|
Public Const EN_ELEVATION = 0 ' Node parameters
|
||||||
Global Const EN_BASEDEMAND = 1
|
Public Const EN_BASEDEMAND = 1
|
||||||
Global Const EN_PATTERN = 2
|
Public Const EN_PATTERN = 2
|
||||||
Global Const EN_EMITTER = 3
|
Public Const EN_EMITTER = 3
|
||||||
Global Const EN_INITQUAL = 4
|
Public Const EN_INITQUAL = 4
|
||||||
Global Const EN_SOURCEQUAL = 5
|
Public Const EN_SOURCEQUAL = 5
|
||||||
Global Const EN_SOURCEPAT = 6
|
Public Const EN_SOURCEPAT = 6
|
||||||
Global Const EN_SOURCETYPE = 7
|
Public Const EN_SOURCETYPE = 7
|
||||||
Global Const EN_TANKLEVEL = 8
|
Public Const EN_TANKLEVEL = 8
|
||||||
Global Const EN_DEMAND = 9
|
Public Const EN_DEMAND = 9
|
||||||
Global Const EN_HEAD = 10
|
Public Const EN_HEAD = 10
|
||||||
Global Const EN_PRESSURE = 11
|
Public Const EN_PRESSURE = 11
|
||||||
Global Const EN_QUALITY = 12
|
Public Const EN_QUALITY = 12
|
||||||
Global Const EN_SOURCEMASS = 13
|
Public Const EN_SOURCEMASS = 13
|
||||||
Global Const EN_INITVOLUME = 14
|
Public Const EN_INITVOLUME = 14
|
||||||
Global Const EN_MIXMODEL = 15
|
Public Const EN_MIXMODEL = 15
|
||||||
Global Const EN_MIXZONEVOL = 16
|
Public Const EN_MIXZONEVOL = 16
|
||||||
|
|
||||||
Global Const EN_TANKDIAM = 17
|
Public Const EN_TANKDIAM = 17
|
||||||
Global Const EN_MINVOLUME = 18
|
Public Const EN_MINVOLUME = 18
|
||||||
Global Const EN_VOLCURVE = 19
|
Public Const EN_VOLCURVE = 19
|
||||||
Global Const EN_MINLEVEL = 20
|
Public Const EN_MINLEVEL = 20
|
||||||
Global Const EN_MAXLEVEL = 21
|
Public Const EN_MAXLEVEL = 21
|
||||||
Global Const EN_MIXFRACTION = 22
|
Public Const EN_MIXFRACTION = 22
|
||||||
Global Const EN_TANK_KBULK = 23
|
Public Const EN_TANK_KBULK = 23
|
||||||
Global Const EN_TANKVOLUME = 24
|
Public Const EN_TANKVOLUME = 24
|
||||||
Global Const EN_MAXVOLUME = 25
|
Public Const EN_MAXVOLUME = 25
|
||||||
|
|
||||||
Global Const EN_DIAMETER = 0 ' Link parameters
|
Public Const EN_DIAMETER = 0 ' Link parameters
|
||||||
Global Const EN_LENGTH = 1
|
Public Const EN_LENGTH = 1
|
||||||
Global Const EN_ROUGHNESS = 2
|
Public Const EN_ROUGHNESS = 2
|
||||||
Global Const EN_MINORLOSS = 3
|
Public Const EN_MINORLOSS = 3
|
||||||
Global Const EN_INITSTATUS = 4
|
Public Const EN_INITSTATUS = 4
|
||||||
Global Const EN_INITSETTING = 5
|
Public Const EN_INITSETTING = 5
|
||||||
Global Const EN_KBULK = 6
|
Public Const EN_KBULK = 6
|
||||||
Global Const EN_KWALL = 7
|
Public Const EN_KWALL = 7
|
||||||
Global Const EN_FLOW = 8
|
Public Const EN_FLOW = 8
|
||||||
Global Const EN_VELOCITY = 9
|
Public Const EN_VELOCITY = 9
|
||||||
Global Const EN_HEADLOSS = 10
|
Public Const EN_HEADLOSS = 10
|
||||||
Global Const EN_STATUS = 11
|
Public Const EN_STATUS = 11
|
||||||
Global Const EN_SETTING = 12
|
Public Const EN_SETTING = 12
|
||||||
Global Const EN_ENERGY = 13
|
Public Const EN_ENERGY = 13
|
||||||
Global Const EN_LINKQUAL = 14 'ES
|
Public Const EN_LINKQUAL = 14 'ES
|
||||||
Global Const EN_LINKPATTERN = 15
|
Public Const EN_LINKPATTERN = 15
|
||||||
Global Const EN_EFFICIENCY = 16
|
Public Const EN_EFFICIENCY = 16
|
||||||
Global Const EN_HEADCURVE = 17
|
Public Const EN_HEADCURVE = 17
|
||||||
Global Const EN_EFFICIENCYCURVE = 18
|
Public Const EN_EFFICIENCYCURVE = 18
|
||||||
Global Const EN_PRICEPATTERN = 19
|
Public Const EN_PRICEPATTERN = 19
|
||||||
|
|
||||||
Global Const EN_DURATION = 0 ' Time parameters
|
Public Const EN_DURATION = 0 ' Time parameters
|
||||||
Global Const EN_HYDSTEP = 1
|
Public Const EN_HYDSTEP = 1
|
||||||
Global Const EN_QUALSTEP = 2
|
Public Const EN_QUALSTEP = 2
|
||||||
Global Const EN_PATTERNSTEP = 3
|
Public Const EN_PATTERNSTEP = 3
|
||||||
Global Const EN_PATTERNSTART = 4
|
Public Const EN_PATTERNSTART = 4
|
||||||
Global Const EN_REPORTSTEP = 5
|
Public Const EN_REPORTSTEP = 5
|
||||||
Global Const EN_REPORTSTART = 6
|
Public Const EN_REPORTSTART = 6
|
||||||
Global Const EN_RULESTEP = 7
|
Public Const EN_RULESTEP = 7
|
||||||
Global Const EN_STATISTIC = 8
|
Public Const EN_STATISTIC = 8
|
||||||
Global Const EN_PERIODS = 9
|
Public Const EN_PERIODS = 9
|
||||||
Global Const EN_STARTTIME = 10
|
Public Const EN_STARTTIME = 10
|
||||||
Global Const EN_HTIME = 11
|
Public Const EN_HTIME = 11
|
||||||
Global Const EN_QTIME = 12
|
Public Const EN_QTIME = 12
|
||||||
Global Const EN_HALTFLAG = 13
|
Public Const EN_HALTFLAG = 13
|
||||||
Global Const EN_NEXTEVENT = 14
|
Public Const EN_NEXTEVENT = 14
|
||||||
|
|
||||||
Global Const EN_ITERATIONS = 0
|
Public Const EN_ITERATIONS = 0
|
||||||
Global Const EN_RELATIVEERROR = 1
|
Public Const EN_RELATIVEERROR = 1
|
||||||
|
|
||||||
Global Const EN_NODECOUNT = 0 'Component counts
|
Public Const EN_NODECOUNT = 0 'Component counts
|
||||||
Global Const EN_TANKCOUNT = 1
|
Public Const EN_TANKCOUNT = 1
|
||||||
Global Const EN_LINKCOUNT = 2
|
Public Const EN_LINKCOUNT = 2
|
||||||
Global Const EN_PATCOUNT = 3
|
Public Const EN_PATCOUNT = 3
|
||||||
Global Const EN_CURVECOUNT = 4
|
Public Const EN_CURVECOUNT = 4
|
||||||
Global Const EN_CONTROLCOUNT = 5
|
Public Const EN_CONTROLCOUNT = 5
|
||||||
Global Const EN_RULECOUNT = 6
|
Public Const EN_RULECOUNT = 6
|
||||||
|
|
||||||
Global Const EN_JUNCTION = 0 ' Node types
|
Public Const EN_JUNCTION = 0 ' Node types
|
||||||
Global Const EN_RESERVOIR = 1
|
Public Const EN_RESERVOIR = 1
|
||||||
Global Const EN_TANK = 2
|
Public Const EN_TANK = 2
|
||||||
|
|
||||||
Global Const EN_CVPIPE = 0 ' Link types
|
Public Const EN_CVPIPE = 0 ' Link types
|
||||||
Global Const EN_PIPE = 1
|
Public Const EN_PIPE = 1
|
||||||
Global Const EN_PUMP = 2
|
Public Const EN_PUMP = 2
|
||||||
Global Const EN_PRV = 3
|
Public Const EN_PRV = 3
|
||||||
Global Const EN_PSV = 4
|
Public Const EN_PSV = 4
|
||||||
Global Const EN_PBV = 5
|
Public Const EN_PBV = 5
|
||||||
Global Const EN_FCV = 6
|
Public Const EN_FCV = 6
|
||||||
Global Const EN_TCV = 7
|
Public Const EN_TCV = 7
|
||||||
Global Const EN_GPV = 8
|
Public Const EN_GPV = 8
|
||||||
|
|
||||||
Global Const EN_NONE = 0 ' Quality analysis types
|
Public Const EN_NONE = 0 ' Quality analysis types
|
||||||
Global Const EN_CHEM = 1
|
Public Const EN_CHEM = 1
|
||||||
Global Const EN_AGE = 2
|
Public Const EN_AGE = 2
|
||||||
Global Const EN_TRACE = 3
|
Public Const EN_TRACE = 3
|
||||||
|
|
||||||
Global Const EN_CONCEN = 0 ' Source quality types
|
Public Const EN_CONCEN = 0 ' Source quality types
|
||||||
Global Const EN_MASS = 1
|
Public Const EN_MASS = 1
|
||||||
Global Const EN_SETPOINT = 2
|
Public Const EN_SETPOINT = 2
|
||||||
Global Const EN_FLOWPACED = 3
|
Public Const EN_FLOWPACED = 3
|
||||||
|
|
||||||
Global Const EN_HW = 0 ' Head loss formula
|
Public Const EN_HW = 0 ' Head loss formula
|
||||||
Global Const EN_DW = 1
|
Public Const EN_DW = 1
|
||||||
Global Const EN_CM = 2
|
Public Const EN_CM = 2
|
||||||
|
|
||||||
Global Const EN_CFS = 0 ' Flow units types
|
Public Const EN_CFS = 0 ' Flow units types
|
||||||
Global Const EN_GPM = 1
|
Public Const EN_GPM = 1
|
||||||
Global Const EN_MGD = 2
|
Public Const EN_MGD = 2
|
||||||
Global Const EN_IMGD = 3
|
Public Const EN_IMGD = 3
|
||||||
Global Const EN_AFD = 4
|
Public Const EN_AFD = 4
|
||||||
Global Const EN_LPS = 5
|
Public Const EN_LPS = 5
|
||||||
Global Const EN_LPM = 6
|
Public Const EN_LPM = 6
|
||||||
Global Const EN_MLD = 7
|
Public Const EN_MLD = 7
|
||||||
Global Const EN_CMH = 8
|
Public Const EN_CMH = 8
|
||||||
Global Const EN_CMD = 9
|
Public Const EN_CMD = 9
|
||||||
|
|
||||||
Global Const EN_TRIALS = 0 ' Misc. options
|
Public Const EN_TRIALS = 0 ' Misc. options
|
||||||
Global Const EN_ACCURACY = 1
|
Public Const EN_ACCURACY = 1
|
||||||
Global Const EN_TOLERANCE = 2
|
Public Const EN_TOLERANCE = 2
|
||||||
Global Const EN_EMITEXPON = 3
|
Public Const EN_EMITEXPON = 3
|
||||||
Global Const EN_DEMANDMULT = 4
|
Public Const EN_DEMANDMULT = 4
|
||||||
|
|
||||||
Global Const EN_LOWLEVEL = 0 ' Control types
|
Public Const EN_LOWLEVEL = 0 ' Control types
|
||||||
Global Const EN_HILEVEL = 1
|
Public Const EN_HILEVEL = 1
|
||||||
Global Const EN_TIMER = 2
|
Public Const EN_TIMER = 2
|
||||||
Global Const EN_TIMEOFDAY = 3
|
Public Const EN_TIMEOFDAY = 3
|
||||||
|
|
||||||
Global Const EN_AVERAGE = 1 'Time statistic types
|
Public Const EN_AVERAGE = 1 'Time statistic types
|
||||||
Global Const EN_MINIMUM = 2
|
Public Const EN_MINIMUM = 2
|
||||||
Global Const EN_MAXIMUM = 3
|
Public Const EN_MAXIMUM = 3
|
||||||
Global Const EN_RANGE = 4
|
Public Const EN_RANGE = 4
|
||||||
|
|
||||||
Global Const EN_MIX1 = 0 'Tank mixing models
|
Public Const EN_MIX1 = 0 'Tank mixing models
|
||||||
Global Const EN_MIX2 = 1
|
Public Const EN_MIX2 = 1
|
||||||
Global Const EN_FIFO = 2
|
Public Const EN_FIFO = 2
|
||||||
Global Const EN_LIFO = 3
|
Public Const EN_LIFO = 3
|
||||||
|
|
||||||
Global Const EN_NOSAVE = 0 ' Save-results-to-file flag
|
Public Const EN_NOSAVE = 0 ' Save-results-to-file flag
|
||||||
Global Const EN_SAVE = 1
|
Public Const EN_SAVE = 1
|
||||||
|
|
||||||
Global Const EN_INITFLOW = 10 ' Re-initialize flow flag
|
Public Const EN_INITFLOW = 10 ' Re-initialize flow flag
|
||||||
|
|
||||||
Global Const EN_CONST_HP = 0 ' constant horsepower
|
Public Const EN_CONST_HP = 0 ' constant horsepower
|
||||||
Global Const EN_POWER_FUNC = 1 ' power function
|
Public Const EN_POWER_FUNC = 1 ' power function
|
||||||
Global Const EN_CUSTOM = 2 ' user-defined custom curve
|
Public Const EN_CUSTOM = 2 ' user-defined custom curve
|
||||||
|
|
||||||
'These are the external functions that comprise the DLL
|
'These are the external functions that comprise the DLL
|
||||||
|
|
||||||
@@ -183,65 +183,66 @@ Global Const EN_CUSTOM = 2 ' user-defined custom curve
|
|||||||
Declare Function ENresetreport 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 S As String) 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 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 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 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 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 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 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 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 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 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 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 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 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
|
Declare Function ENgetstatistic Lib "epanet2.dll" (ByVal code As Long, value As Single) As Long
|
||||||
|
|
||||||
Declare Function ENgetnodeindex Lib "epanet2.dll" (ByVal ID As String, Index 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 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 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 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 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
|
Declare Function ENsetcoord Lib "epanet2.dll" (ByVal index As Long, ByVal X As Single, ByVal Y As Single) As Long
|
||||||
|
|
||||||
Declare Function ENgetnumdemands Lib "epanet2.dll" (ByVal Index As Long, numDemands As Long) 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 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
|
Declare Function ENgetdemandpattern Lib "epanet2.dll" (ByVal index As Long, ByVal DemandIndex As Long, PatIndex As Long) As Long
|
||||||
|
|
||||||
Declare Function ENgetlinkindex Lib "epanet2.dll" (ByVal ID As String, Index 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 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 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 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
|
Declare Function ENgetlinkvalue Lib "epanet2.dll" (ByVal index As Long, ByVal code As Long, value As Single) 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 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 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
|
Declare Function ENgetpumptype Lib "epanet2.dll" (ByVal index As Long, PumpType As Long) As Long
|
||||||
|
|
||||||
Declare Function ENgetversion Lib "epanet2.dll" (Value As Long) As Long
|
Declare Function ENgetversion Lib "epanet2.dll" (value 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 ENsetflowunits Lib "epanet2.dll" (ByVal code As Long) As Long
|
||||||
Declare Function ENsetnodevalue Lib "epanet2.dll" (ByVal Index As Long, ByVal Code As Long, ByVal Value As Single) 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 ENsetlinkvalue Lib "epanet2.dll" (ByVal Index As Long, ByVal Code As Long, ByVal Value 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 ENaddpattern Lib "epanet2.dll" (ByVal ID As String) As Long
|
Declare Function ENsetlinkvalue Lib "epanet2.dll" (ByVal index As Long, ByVal code As Long, ByVal value As Single) As Long
|
||||||
Declare Function ENsetpattern Lib "epanet2.dll" (ByVal Index As Long, F As Any, ByVal N As Long) As Long
|
Declare Function ENaddpattern Lib "epanet2.dll" (ByVal id As String) As Long
|
||||||
Declare Function ENsetpatternvalue Lib "epanet2.dll" (ByVal Index As Long, ByVal Period As Long, ByVal Value As Single) As Long
|
Declare Function ENsetpattern Lib "epanet2.dll" (ByVal index As Long, F As Any, ByVal N As Long) As Long
|
||||||
Declare Function ENsettimeparam Lib "epanet2.dll" (ByVal Code As Long, ByVal Value 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 ENsetoption Lib "epanet2.dll" (ByVal Code 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 ENsetstatusreport Lib "epanet2.dll" (ByVal Code 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 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 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
|
Declare Function ENsetbasedemand Lib "epanet2.dll" (ByVal nodeIndex As Long, ByVal DemandIndex As Long, ByVal BaseDemand As Single) As Long
|
||||||
|
|
||||||
Declare Function ENgetcurveindex Lib "epanet2.dll" (ByVal ID As String, 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 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 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 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 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 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
|
Declare Function ENaddcurve Lib "epanet2.dll" (ByVal id As String) As Long
|
||||||
|
|
||||||
Declare Function ENgetrule Lib "epanet2.dll" (ByVal index As Long, nPremises As Long, nTrueActions As Long, nFalseActions As Long, priority As Single) As Long
|
Declare Function ENgetrule Lib "epanet2.dll" (ByVal index As Long, nPremises As Long, nTrueActions As Long, nFalseActions As Long, priority As Single) As Long
|
||||||
Declare Function ENsetrulepriority Lib "epanet2.dll" (ByVal index As Long, ByVal priority As Single) 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 indexRule As Long, ByVal indexPremise As Long, logop As Long, object As Long, indexObj As Long, variable As Long, relop As Long, status As Long, value As Single) As Long
|
Declare Function ENgetpremise Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexPremise As Long, logop As Long, object As Long, indexObj As Long, variable As Long, relop As Long, status As Long, value As Single) As Long
|
||||||
Declare Function ENsetpremise Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexPremise As Long, ByVal logop As Long, ByVal object As Long, ByVal indexObj As Long, ByVal variable As Long, ByVal relop As Long, ByVal status As Long, ByVal value As Single) As Long
|
Declare Function ENsetpremise Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexPremise As Long, ByVal logop As Long, ByVal object As Long, ByVal indexObj As Long, ByVal variable As Long, ByVal relop As Long, ByVal status As Long, ByVal value As Single) As Long
|
||||||
@@ -250,7 +251,7 @@ Global Const EN_CUSTOM = 2 ' user-defined custom curve
|
|||||||
Declare Function ENsetpremisevalue Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexPremise As Long, ByVal value As Single) As Long
|
Declare Function ENsetpremisevalue Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexPremise As Long, ByVal value As Single) As Long
|
||||||
Declare Function ENgettrueaction Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexAction As Long, indexLink As Long, status As Long, setting As Single) As Long
|
Declare Function ENgettrueaction Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexAction As Long, indexLink As Long, status As Long, setting As Single) As Long
|
||||||
Declare Function ENsettrueaction Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexAction As Long, ByVal indexLink As Long, ByVal status As Long, ByVal setting As Single) As Long
|
Declare Function ENsettrueaction Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexAction As Long, ByVal indexLink As Long, ByVal status As Long, ByVal setting As Single) As Long
|
||||||
Declare FUnction ENgetfalseaction Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexAction As Long, indexLink As Long, status As Long, setting As Single) As Long
|
Declare Function ENgetfalseaction Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexAction As Long, indexLink As Long, status As Long, setting As Single) As Long
|
||||||
Declare Function ENsetfalseaction Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexAction As Long, ByVal indexLink As Long, ByVal status As Long, ByVal setting As Single) As Long
|
Declare Function ENsetfalseaction Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexAction As Long, ByVal indexLink As Long, ByVal status As Long, ByVal setting As Single) As Long
|
||||||
Declare Function ENgetruleID Lib "epanet2.dll" (ByVal indexRule As Long, ByVal id As String) As Long
|
Declare Function ENgetruleID Lib "epanet2.dll" (ByVal indexRule As Long, ByVal id As String) As Long
|
||||||
|
|
||||||
|
|||||||
@@ -514,6 +514,13 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
int DLLEXPORT ENgetflowunits(int *code);
|
int DLLEXPORT ENgetflowunits(int *code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Sets the flow units
|
||||||
|
@param code Code of flow units to use
|
||||||
|
@return Error code
|
||||||
|
*/
|
||||||
|
int DLLEXPORT ENsetflowunits(int code);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Retrieves the index of the time pattern with specified ID
|
@brief Retrieves the index of the time pattern with specified ID
|
||||||
@param id String ID of the time pattern
|
@param id String ID of the time pattern
|
||||||
@@ -1162,6 +1169,7 @@ extern "C" {
|
|||||||
int DLLEXPORT EN_getoption(EN_Project *p, EN_Option opt, EN_API_FLOAT_TYPE *value);
|
int DLLEXPORT EN_getoption(EN_Project *p, EN_Option opt, EN_API_FLOAT_TYPE *value);
|
||||||
int DLLEXPORT EN_gettimeparam(EN_Project *p, int code, long *value);
|
int DLLEXPORT EN_gettimeparam(EN_Project *p, int code, long *value);
|
||||||
int DLLEXPORT EN_getflowunits(EN_Project *p, int *code);
|
int DLLEXPORT EN_getflowunits(EN_Project *p, int *code);
|
||||||
|
int DLLEXPORT EN_setflowunits(EN_Project *p, int code);
|
||||||
int DLLEXPORT EN_getpatternindex(EN_Project *p, char *id, int *index);
|
int DLLEXPORT EN_getpatternindex(EN_Project *p, char *id, int *index);
|
||||||
int DLLEXPORT EN_getpatternid(EN_Project *p, int index, char *id);
|
int DLLEXPORT EN_getpatternid(EN_Project *p, int index, char *id);
|
||||||
int DLLEXPORT EN_getpatternlen(EN_Project *p, int index, int *len);
|
int DLLEXPORT EN_getpatternlen(EN_Project *p, int index, int *len);
|
||||||
|
|||||||
83
src/epanet.c
83
src/epanet.c
@@ -233,6 +233,9 @@ int DLLEXPORT ENgettimeparam(int code, long *value) {
|
|||||||
int DLLEXPORT ENgetflowunits(int *code) {
|
int DLLEXPORT ENgetflowunits(int *code) {
|
||||||
return EN_getflowunits(_defaultModel, code);
|
return EN_getflowunits(_defaultModel, code);
|
||||||
}
|
}
|
||||||
|
int DLLEXPORT ENsetflowunits(int code) {
|
||||||
|
return EN_setflowunits(_defaultModel, code);
|
||||||
|
}
|
||||||
int DLLEXPORT ENgetpatternindex(char *id, int *index) {
|
int DLLEXPORT ENgetpatternindex(char *id, int *index) {
|
||||||
return EN_getpatternindex(_defaultModel, id, index);
|
return EN_getpatternindex(_defaultModel, id, index);
|
||||||
}
|
}
|
||||||
@@ -1358,6 +1361,80 @@ int DLLEXPORT EN_getflowunits(EN_Project *p, int *code) {
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int DLLEXPORT EN_setflowunits(EN_Project *p, int code) {
|
||||||
|
int i, j;
|
||||||
|
double qfactor, vfactor, hfactor, efactor, xfactor, yfactor;
|
||||||
|
double *Ucf = p->Ucf;
|
||||||
|
EN_Network *net = &p->network;
|
||||||
|
|
||||||
|
if (!p->Openflag) {
|
||||||
|
return(102);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Determine unit system based on flow units */
|
||||||
|
qfactor = Ucf[FLOW];
|
||||||
|
vfactor = Ucf[VOLUME];
|
||||||
|
hfactor = Ucf[HEAD];
|
||||||
|
efactor = Ucf[ELEV];
|
||||||
|
|
||||||
|
p->parser.Flowflag = code;
|
||||||
|
switch (code)
|
||||||
|
{
|
||||||
|
case LPS: /* Liters/sec */
|
||||||
|
case LPM: /* Liters/min */
|
||||||
|
case MLD: /* megaliters/day */
|
||||||
|
case CMH: /* cubic meters/hr */
|
||||||
|
case CMD: /* cubic meters/day */
|
||||||
|
p->parser.Unitsflag = SI;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
p->parser.Unitsflag = US;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Revise pressure units depending on flow units */
|
||||||
|
if (p->parser.Unitsflag != SI) {
|
||||||
|
p->parser.Pressflag = PSI;
|
||||||
|
}
|
||||||
|
else if (p->parser.Pressflag == PSI) {
|
||||||
|
p->parser.Pressflag = METERS;
|
||||||
|
}
|
||||||
|
|
||||||
|
initunits(p);
|
||||||
|
|
||||||
|
//update curves
|
||||||
|
for (i=1; i <= net->Ncurves; i++)
|
||||||
|
{
|
||||||
|
switch (net->Curve[i].Type)
|
||||||
|
{
|
||||||
|
case V_CURVE:
|
||||||
|
xfactor = efactor/Ucf[ELEV];
|
||||||
|
yfactor = vfactor/Ucf[VOLUME];
|
||||||
|
break;
|
||||||
|
case H_CURVE:
|
||||||
|
case P_CURVE:
|
||||||
|
xfactor = qfactor/Ucf[FLOW];
|
||||||
|
yfactor = hfactor/Ucf[HEAD];
|
||||||
|
break;
|
||||||
|
case E_CURVE:
|
||||||
|
xfactor = qfactor/Ucf[FLOW];
|
||||||
|
yfactor = 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
xfactor = 1;
|
||||||
|
yfactor = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (j=0; j < net->Curve[i].Npts; j++)
|
||||||
|
{
|
||||||
|
net->Curve[i].X[j] = net->Curve[i].X[j]/xfactor;
|
||||||
|
net->Curve[i].Y[j] = net->Curve[i].Y[j]/yfactor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
int DLLEXPORT EN_getpatternindex(EN_Project *p, char *id, int *index) {
|
int DLLEXPORT EN_getpatternindex(EN_Project *p, char *id, int *index) {
|
||||||
int i;
|
int i;
|
||||||
*index = 0;
|
*index = 0;
|
||||||
@@ -2018,6 +2095,11 @@ int DLLEXPORT EN_getlinkvalue(EN_Project *p, int index, EN_LinkProperty code, EN
|
|||||||
getenergy(p, index, &a, &v);
|
getenergy(p, index, &a, &v);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case EN_PRICEPATTERN:
|
||||||
|
if (Link[index].Type == EN_PUMP)
|
||||||
|
v = (double)Pump[findpump(&p->network, index)].Epat;
|
||||||
|
break;
|
||||||
|
|
||||||
case EN_HEADCURVE:
|
case EN_HEADCURVE:
|
||||||
if (Link[index].Type == EN_PUMP) {
|
if (Link[index].Type == EN_PUMP) {
|
||||||
v = (double)Pump[findpump(&p->network, index)].Hcurve;
|
v = (double)Pump[findpump(&p->network, index)].Hcurve;
|
||||||
@@ -2782,6 +2864,7 @@ int DLLEXPORT EN_addcurve(EN_Project *p, char *id) {
|
|||||||
|
|
||||||
strcpy(tmpCur[n].ID, id);
|
strcpy(tmpCur[n].ID, id);
|
||||||
tmpCur[n].Npts = 1;
|
tmpCur[n].Npts = 1;
|
||||||
|
tmpCur[n].Type = -1;
|
||||||
tmpCur[n].X = (double *)calloc(tmpCur[n].Npts, sizeof(double));
|
tmpCur[n].X = (double *)calloc(tmpCur[n].Npts, sizeof(double));
|
||||||
tmpCur[n].Y = (double *)calloc(tmpCur[n].Npts, sizeof(double));
|
tmpCur[n].Y = (double *)calloc(tmpCur[n].Npts, sizeof(double));
|
||||||
if (tmpCur[n].X == NULL)
|
if (tmpCur[n].X == NULL)
|
||||||
|
|||||||
@@ -400,6 +400,7 @@ int getpumpparams(EN_Project *pr)
|
|||||||
return (200);
|
return (200);
|
||||||
}
|
}
|
||||||
curve = &net->Curve[j];
|
curve = &net->Curve[j];
|
||||||
|
curve->Type = P_CURVE;
|
||||||
n = curve->Npts;
|
n = curve->Npts;
|
||||||
if (n == 1) { /* Only a single h-q point supplied so use generic */
|
if (n == 1) { /* Only a single h-q point supplied so use generic */
|
||||||
pump->Ptype = POWER_FUNC; /* power function curve. */
|
pump->Ptype = POWER_FUNC; /* power function curve. */
|
||||||
|
|||||||
13
src/input3.c
13
src/input3.c
@@ -198,9 +198,11 @@ int tankdata(EN_Project *pr)
|
|||||||
/* If volume curve supplied check it exists */
|
/* If volume curve supplied check it exists */
|
||||||
if (n == 8) {
|
if (n == 8) {
|
||||||
t = findID(par->Tok[7], par->Curvelist);
|
t = findID(par->Tok[7], par->Curvelist);
|
||||||
if (t == NULL)
|
if (t == NULL) {
|
||||||
return (202);
|
return (202);
|
||||||
|
}
|
||||||
vcurve = t->i;
|
vcurve = t->i;
|
||||||
|
net->Curve[t->i].Type = V_CURVE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -529,16 +531,16 @@ int valvedata(EN_Project *pr)
|
|||||||
return (202);
|
return (202);
|
||||||
if (diam <= 0.0)
|
if (diam <= 0.0)
|
||||||
return (202); /* Illegal diameter.*/
|
return (202); /* Illegal diameter.*/
|
||||||
if (type == EN_GPV) /* Headloss curve for GPV */
|
if (type == EN_GPV) { /* Headloss curve for GPV */
|
||||||
{
|
|
||||||
t = findID(par->Tok[5], par->Curvelist);
|
t = findID(par->Tok[5], par->Curvelist);
|
||||||
if (t == NULL)
|
if (t == NULL) {
|
||||||
return (206);
|
return (206);
|
||||||
|
}
|
||||||
setting = t->i;
|
setting = t->i;
|
||||||
|
net->Curve[t->i].Type = H_CURVE;
|
||||||
|
|
||||||
/*** Updated 9/7/00 ***/
|
/*** Updated 9/7/00 ***/
|
||||||
status = OPEN;
|
status = OPEN;
|
||||||
|
|
||||||
} else if (!getfloat(par->Tok[5], &setting))
|
} else if (!getfloat(par->Tok[5], &setting))
|
||||||
return (202);
|
return (202);
|
||||||
if (n >= 7 && !getfloat(par->Tok[6], &lcoeff))
|
if (n >= 7 && !getfloat(par->Tok[6], &lcoeff))
|
||||||
@@ -1436,6 +1438,7 @@ int energydata(EN_Project *pr)
|
|||||||
if (t == NULL)
|
if (t == NULL)
|
||||||
return (217);
|
return (217);
|
||||||
Pump[j].Ecurve = t->i;
|
Pump[j].Ecurve = t->i;
|
||||||
|
net->Curve[t->i].Type = E_CURVE;
|
||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|||||||
29
tools/gen-config.cmd
Normal file
29
tools/gen-config.cmd
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
::
|
||||||
|
:: gen-config.cmd - Generated nrtest app configuration file for test executable
|
||||||
|
::
|
||||||
|
:: Date Created: 1/8/2018
|
||||||
|
::
|
||||||
|
:: Author: Michael E. Tryby
|
||||||
|
:: US EPA - ORD/NRMRL
|
||||||
|
::
|
||||||
|
:: Arguments:
|
||||||
|
:: 1 - absolute path to test executable (valid path seperator for nrtest is "/")
|
||||||
|
::
|
||||||
|
|
||||||
|
@echo off
|
||||||
|
setlocal
|
||||||
|
|
||||||
|
:: process path to remove quotes and convert backward to forward slash
|
||||||
|
set ABS_BUILD_PATH=%~1
|
||||||
|
set ABS_BUILD_PATH=%ABS_BUILD_PATH:\=/%
|
||||||
|
|
||||||
|
:: this is the target created by the cmake build script
|
||||||
|
set TEST_CMD=runepanet.exe
|
||||||
|
|
||||||
|
echo {
|
||||||
|
echo "name" : "epanet",
|
||||||
|
echo "version" : "",
|
||||||
|
echo "description" : "",
|
||||||
|
echo "setup_script" : "",
|
||||||
|
echo "exe" : "%ABS_BUILD_PATH%/%TEST_CMD%"
|
||||||
|
echo }
|
||||||
46
tools/run-nrtest.cmd
Normal file
46
tools/run-nrtest.cmd
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
::
|
||||||
|
:: run_nrtest.cmd - Runs numerical regression test
|
||||||
|
::
|
||||||
|
:: Date Created: 1/8/2018
|
||||||
|
::
|
||||||
|
:: Author: Michael E. Tryby
|
||||||
|
:: US EPA - ORD/NRMRL
|
||||||
|
::
|
||||||
|
:: Arguments:
|
||||||
|
:: 1 - nrtest script path
|
||||||
|
:: 2 - test suite path
|
||||||
|
:: 3 - version/build identifier
|
||||||
|
::
|
||||||
|
|
||||||
|
@echo off
|
||||||
|
setlocal
|
||||||
|
|
||||||
|
set NRTEST_SCRIPT_PATH=%~1
|
||||||
|
set TEST_SUITE_PATH=%~2
|
||||||
|
|
||||||
|
set NRTEST_EXECUTE_CMD=python %NRTEST_SCRIPT_PATH%\nrtest execute
|
||||||
|
set TEST_APP_PATH=apps\epanet-%3.json
|
||||||
|
set TESTS=tests\examples
|
||||||
|
set TEST_OUTPUT_PATH=benchmark\epanet-%3
|
||||||
|
|
||||||
|
set NRTEST_COMPARE_CMD=python %NRTEST_SCRIPT_PATH%\nrtest compare
|
||||||
|
set REF_OUTPUT_PATH=benchmark\epanet-2012
|
||||||
|
set RTOL_VALUE=0.1
|
||||||
|
set ATOL_VALUE=0.0
|
||||||
|
|
||||||
|
:: change current directory to test suite
|
||||||
|
cd %TEST_SUITE_PATH%
|
||||||
|
|
||||||
|
:: if present clean test benchmark results
|
||||||
|
if exist %TEST_OUTPUT_PATH% (
|
||||||
|
rmdir /s /q %TEST_OUTPUT_PATH%
|
||||||
|
)
|
||||||
|
|
||||||
|
echo INFO: Creating test benchmark
|
||||||
|
set NRTEST_COMMAND=%NRTEST_EXECUTE_CMD% %TEST_APP_PATH% %TESTS% -o %TEST_OUTPUT_PATH%
|
||||||
|
:: if there is an error exit the script with error value 1
|
||||||
|
%NRTEST_COMMAND% || exit /B 1
|
||||||
|
|
||||||
|
echo INFO: Comparing test and ref benchmark
|
||||||
|
set NRTEST_COMMAND=%NRTEST_COMPARE_CMD% %TEST_OUTPUT_PATH% %REF_OUTPUT_PATH% --rtol %RTOL_VALUE% --atol %ATOL_VALUE%
|
||||||
|
%NRTEST_COMMAND%
|
||||||
@@ -27,7 +27,7 @@ If %ERRORLEVEL% == 1 (
|
|||||||
md "%Build_PATH%"\64bit
|
md "%Build_PATH%"\64bit
|
||||||
move /y "%SRC_PATH%"\*.dll "%Build_PATH%"\64bit
|
move /y "%SRC_PATH%"\*.dll "%Build_PATH%"\64bit
|
||||||
move /y "%SRC_PATH%"\*.exe "%Build_PATH%"\64bit
|
move /y "%SRC_PATH%"\*.exe "%Build_PATH%"\64bit
|
||||||
copy "%H_PATH%"\*.h "%Build_PATH%"\64bit
|
rem copy "%H_PATH%"\*.h "%Build_PATH%"\64bit
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ rem : 32 bit with DEF
|
|||||||
CALL "%SDK_PATH%bin\"SetEnv.cmd /x86 /release
|
CALL "%SDK_PATH%bin\"SetEnv.cmd /x86 /release
|
||||||
echo "32 bit with epanet2.def mapping"
|
echo "32 bit with epanet2.def mapping"
|
||||||
rem : create EPANET2.DLL
|
rem : create EPANET2.DLL
|
||||||
cl -o epanet2.dll epanet.c hash.c hydraul.c inpfile.c input1.c input2.c input3.c mempool.c output.c quality.c report.c rules.c smatrix.c /I ..\include /I ..\run /link /DLL /def:..\build\WinSDK\epanet2.def /MAP
|
cl -o epanet2.dll epanet.c hash.c hydraul.c inpfile.c input1.c input2.c input3.c mempool.c output.c quality.c report.c rules.c smatrix.c /I ..\include /I ..\run /link /DLL /def:..\win_build\WinSDK\epanet2.def /MAP
|
||||||
rem : create EPANET2.EXE
|
rem : create EPANET2.EXE
|
||||||
cl -o epanet2.exe epanet.c ..\run\main.c hash.c hydraul.c inpfile.c input1.c input2.c input3.c mempool.c output.c quality.c report.c rules.c smatrix.c /I ..\include /I ..\run /I ..\src /link
|
cl -o epanet2.exe epanet.c ..\run\main.c hash.c hydraul.c inpfile.c input1.c input2.c input3.c mempool.c output.c quality.c report.c rules.c smatrix.c /I ..\include /I ..\run /I ..\src /link
|
||||||
md "%Build_PATH%"\32bit
|
md "%Build_PATH%"\32bit
|
||||||
@@ -86,4 +86,5 @@ EXPORTS
|
|||||||
ENsettrueaction = _ENsettrueaction@20
|
ENsettrueaction = _ENsettrueaction@20
|
||||||
ENgetfalseaction = _ENgetfalseaction@20
|
ENgetfalseaction = _ENgetfalseaction@20
|
||||||
ENsetfalseaction = _ENsetfalseaction@20
|
ENsetfalseaction = _ENsetfalseaction@20
|
||||||
ENgetruleID = _ENgetruleID@8
|
ENgetruleID = _ENgetruleID@8
|
||||||
|
ENsetflowunits = _ENsetflowunits@4
|
||||||
Reference in New Issue
Block a user