diff --git a/.gitignore b/.gitignore
index 1bf6273..3ffd691 100755
--- a/.gitignore
+++ b/.gitignore
@@ -2,9 +2,14 @@
*.slo
*.lo
*.o
+*.map
+*.exp
+*.lib
-# Compiled Dynamic libraries
+# Compiled Dynamic libraries and executables
*.so
+*.dll
+*.exe
# Compiled Static libraries
*.lai
@@ -101,6 +106,7 @@ ipch/
*.psess
*.vsp
*.vspx
+*.idb
# Guidance Automation Toolkit
*.gpState
diff --git a/build/CMake/CMakeLists.txt b/build/CMake/CMakeLists.txt
new file mode 100644
index 0000000..2edaf20
--- /dev/null
+++ b/build/CMake/CMakeLists.txt
@@ -0,0 +1,18 @@
+## cmake .
+## make
+
+cmake_minimum_required (VERSION 2.6)
+
+SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
+SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
+
+project (EPANET)
+
+# the library
+include_directories(../../include)
+add_library(epanet STATIC ../../src/epanet.c ../../src/hydraul.c ../../src/hash.c ../../src/inpfile.c ../../src/input1.c ../../src/input2.c ../../src/input3.c ../../src/mempool.c ../../src/output.c ../../src/quality.c ../../src/report.c ../../src/rules.c ../../src/smatrix.c)
+
+# the standalone executable
+include_directories(../../src)
+add_executable(runepanet ../../run/main.c)
+target_link_libraries (runepanet LINK_PUBLIC epanet m)
diff --git a/build/MSVS/LemonTigerJ.sln b/build/MSVS/LemonTigerJ.sln
deleted file mode 100755
index f61001a..0000000
--- a/build/MSVS/LemonTigerJ.sln
+++ /dev/null
@@ -1,20 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2012
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LemonTigerJ", "LemonTigerJ.vcxproj", "{4B66D9F0-407B-4995-B625-1CA1B72662C6}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {4B66D9F0-407B-4995-B625-1CA1B72662C6}.Debug|Win32.ActiveCfg = Debug|Win32
- {4B66D9F0-407B-4995-B625-1CA1B72662C6}.Debug|Win32.Build.0 = Debug|Win32
- {4B66D9F0-407B-4995-B625-1CA1B72662C6}.Release|Win32.ActiveCfg = Release|Win32
- {4B66D9F0-407B-4995-B625-1CA1B72662C6}.Release|Win32.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/build/MSVS/LemonTigerJ.vcxproj b/build/MSVS/LemonTigerJ.vcxproj
deleted file mode 100755
index 7ffa87b..0000000
--- a/build/MSVS/LemonTigerJ.vcxproj
+++ /dev/null
@@ -1,105 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Release
- Win32
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {4B66D9F0-407B-4995-B625-1CA1B72662C6}
- Win32Proj
-
-
-
- DynamicLibrary
- true
- v110
-
-
- Application
- false
- v110
-
-
-
-
-
-
-
-
-
-
-
-
- true
-
-
- true
-
-
-
- WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS
- MultiThreadedDebugDLL
- Level3
- ProgramDatabase
- Disabled
- .\include
-
-
- MachineX86
- true
- Console
-
-
-
-
- WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
- MultiThreadedDLL
- Level3
- ProgramDatabase
-
-
- MachineX86
- true
- Console
- true
- true
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/epanet2.def b/build/WinSDK/epanet2.def
similarity index 91%
rename from src/epanet2.def
rename to build/WinSDK/epanet2.def
index a914dfc..ec3bee9 100644
--- a/src/epanet2.def
+++ b/build/WinSDK/epanet2.def
@@ -59,6 +59,12 @@ EXPORTS
ENgetnumdemands = _ENgetnumdemands@8
ENgetbasedemand = _ENgetbasedemand@12
ENgetdemandpattern = _ENgetdemandpattern@12
- ENgetcurve = _ENgetcurve@16
+ ENgetcurve = _ENgetcurve@20
+ ENgetstatistic = _ENgetstatistic@8
+ ENgetcoord = _ENgetcoord@12
+ ENsetcoord = _ENsetcoord@12
+ ENgetqualinfo = _ENgetqualinfo@16
+ ENsetbasedemand = _ENsetbasedemand@12
+ ENgetaveragepatternvalue = _ENgetaveragepatternvalue@8
ENgetheadcurve = _ENgetheadcurve@8
ENgetpumptype = _ENgetpumptype@8
\ No newline at end of file
diff --git a/build/WinSDK/makeWINx64.bat b/build/WinSDK/makeWINx64.bat
new file mode 100644
index 0000000..49acc49
--- /dev/null
+++ b/build/WinSDK/makeWINx64.bat
@@ -0,0 +1,28 @@
+rem : set path to Windows SDK
+Set Reg.Key=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows
+Set Reg.Val=CurrentInstallFolder
+
+For /F "Tokens=2*" %%A In ('Reg Query "%Reg.Key%" /v "%Reg.Val%" ^| Find /I "%Reg.Val%"' ) Do Call Set SDK_PATH=%%B
+echo %SDK_PATH%
+
+
+CALL "%SDK_PATH%bin\"SetEnv.cmd /x64 /release
+
+rem : set path for source EPANET files
+cd ..\..\src
+set SRC_PATH=%CD%
+
+del %SRC_PATH%\*.dll
+del %SRC_PATH%\*.exe
+
+rem : do the magic ...
+ 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
+ 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
+
+rem : a bit of housekeeping and cleaning
+del %SRC_PATH%\*.obj
+del %SRC_PATH%\*.exp
+del %SRC_PATH%\*.lib
+del %SRC_PATH%\*.map
\ No newline at end of file
diff --git a/build/WinSDK/makeWINx86.bat b/build/WinSDK/makeWINx86.bat
new file mode 100644
index 0000000..9382c47
--- /dev/null
+++ b/build/WinSDK/makeWINx86.bat
@@ -0,0 +1,29 @@
+rem : set path to Windows SDK
+Set Reg.Key=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows
+Set Reg.Val=CurrentInstallFolder
+
+For /F "Tokens=2*" %%A In ('Reg Query "%Reg.Key%" /v "%Reg.Val%" ^| Find /I "%Reg.Val%"' ) Do Call Set SDK_PATH=%%B
+echo %SDK_PATH%
+
+
+CALL "%SDK_PATH%bin\"SetEnv.cmd /x86 /release
+
+rem : set path for source EPANET files
+SET SRC_PATH="D:\Projects\EPANET\Open Source\Code\owa\EPANET\src"
+cd ..\..\src
+set SRC_PATH=%CD%
+
+del %SRC_PATH%\*.dll
+del %SRC_PATH%\*.exe
+
+rem : do the magic ...
+ 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
+ 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
+
+rem : a bit of housekeeping and cleaning
+del %SRC_PATH%\*.obj
+del %SRC_PATH%\*.exp
+del %SRC_PATH%\*.lib
+del %SRC_PATH%\*.map
\ No newline at end of file
diff --git a/build/WinSDK/win_make.bat b/build/WinSDK/win_make.bat
new file mode 100644
index 0000000..cdfd45b
--- /dev/null
+++ b/build/WinSDK/win_make.bat
@@ -0,0 +1,22 @@
+rem : set path to Windows SDK
+SET SDK_PATH="C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\"
+
+rem : set path for source EPANET files
+SET SRC_PATH="D:\Projects\EPANET\Open Source\Code\owa\EPANET\src"
+
+CALL %SDK_PATH%SetEnv.cmd /x86 /release
+CHDIR /D %SRC_PATH%
+del %SRC_PATH%\*.dll
+del %SRC_PATH%\*.exe
+
+rem : do the magic ...
+ rem : creat 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
+ rem : creat 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
+
+rem : a bit of housekeeping and cleaning
+del %SRC_PATH%\*.obj
+del %SRC_PATH%\*.exp
+del %SRC_PATH%\*.lib
+del %SRC_PATH%\*.map
\ No newline at end of file
diff --git a/build/Xcode/epanet.xcodeproj/project.pbxproj b/build/Xcode/epanet.xcodeproj/project.pbxproj
new file mode 100755
index 0000000..a2c8b20
--- /dev/null
+++ b/build/Xcode/epanet.xcodeproj/project.pbxproj
@@ -0,0 +1,520 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 22322F851068369500641384 /* enumstxt.h in Headers */ = {isa = PBXBuildFile; fileRef = 22322F701068369500641384 /* enumstxt.h */; };
+ 22322F861068369500641384 /* epanet.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F711068369500641384 /* epanet.c */; };
+ 22322F871068369500641384 /* funcs.h in Headers */ = {isa = PBXBuildFile; fileRef = 22322F721068369500641384 /* funcs.h */; };
+ 22322F881068369500641384 /* hash.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F731068369500641384 /* hash.c */; };
+ 22322F891068369500641384 /* hash.h in Headers */ = {isa = PBXBuildFile; fileRef = 22322F741068369500641384 /* hash.h */; };
+ 22322F8A1068369500641384 /* hydraul.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F751068369500641384 /* hydraul.c */; };
+ 22322F8B1068369500641384 /* inpfile.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F761068369500641384 /* inpfile.c */; };
+ 22322F8C1068369500641384 /* input1.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F771068369500641384 /* input1.c */; };
+ 22322F8D1068369500641384 /* input2.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F781068369500641384 /* input2.c */; };
+ 22322F8E1068369500641384 /* input3.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F791068369500641384 /* input3.c */; };
+ 22322F8F1068369500641384 /* mempool.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F7A1068369500641384 /* mempool.c */; };
+ 22322F901068369500641384 /* mempool.h in Headers */ = {isa = PBXBuildFile; fileRef = 22322F7B1068369500641384 /* mempool.h */; };
+ 22322F911068369500641384 /* output.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F7C1068369500641384 /* output.c */; };
+ 22322F921068369500641384 /* quality.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F7D1068369500641384 /* quality.c */; };
+ 22322F931068369500641384 /* report.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F7E1068369500641384 /* report.c */; };
+ 22322F941068369500641384 /* rules.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F7F1068369500641384 /* rules.c */; };
+ 22322F951068369500641384 /* smatrix.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F801068369500641384 /* smatrix.c */; };
+ 22322F961068369500641384 /* text.h in Headers */ = {isa = PBXBuildFile; fileRef = 22322F811068369500641384 /* text.h */; };
+ 22322F981068369500641384 /* types.h in Headers */ = {isa = PBXBuildFile; fileRef = 22322F831068369500641384 /* types.h */; };
+ 22322F991068369500641384 /* vars.h in Headers */ = {isa = PBXBuildFile; fileRef = 22322F841068369500641384 /* vars.h */; };
+ 22322FAA106836BC00641384 /* epanet2.h in Headers */ = {isa = PBXBuildFile; fileRef = 22322FA9106836B000641384 /* epanet2.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 2255753F17551234009946B1 /* epanet.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F711068369500641384 /* epanet.c */; };
+ 2255754017551234009946B1 /* hash.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F731068369500641384 /* hash.c */; };
+ 2255754117551234009946B1 /* hydraul.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F751068369500641384 /* hydraul.c */; };
+ 2255754217551234009946B1 /* inpfile.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F761068369500641384 /* inpfile.c */; };
+ 2255754317551234009946B1 /* input1.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F771068369500641384 /* input1.c */; };
+ 2255754417551234009946B1 /* input2.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F781068369500641384 /* input2.c */; };
+ 2255754517551234009946B1 /* input3.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F791068369500641384 /* input3.c */; };
+ 2255754617551234009946B1 /* mempool.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F7A1068369500641384 /* mempool.c */; };
+ 2255754717551234009946B1 /* output.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F7C1068369500641384 /* output.c */; };
+ 2255754817551234009946B1 /* quality.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F7D1068369500641384 /* quality.c */; };
+ 2255754917551234009946B1 /* report.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F7E1068369500641384 /* report.c */; };
+ 2255754A17551234009946B1 /* rules.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F7F1068369500641384 /* rules.c */; };
+ 2255754B17551234009946B1 /* smatrix.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F801068369500641384 /* smatrix.c */; };
+ 226537E0179EDEEB00258C60 /* epanet2.h in Headers */ = {isa = PBXBuildFile; fileRef = 22322FA9106836B000641384 /* epanet2.h */; };
+ 22CD9A5E1B27898E00B65E83 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 22CD9A5D1B27898E00B65E83 /* main.c */; };
+ 22CD9A611B278BB900B65E83 /* libepanet-static.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2255753B17551217009946B1 /* libepanet-static.a */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ 22CD9A5F1B278B0400B65E83 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 2255753A17551217009946B1;
+ remoteInfo = "epanet-static";
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXFileReference section */
+ 22322F66106833BB00641384 /* runepanet */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = runepanet; sourceTree = BUILT_PRODUCTS_DIR; };
+ 22322F701068369500641384 /* enumstxt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = enumstxt.h; path = ../../src/enumstxt.h; sourceTree = SOURCE_ROOT; };
+ 22322F711068369500641384 /* epanet.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; lineEnding = 2; name = epanet.c; path = ../../src/epanet.c; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.c; };
+ 22322F721068369500641384 /* funcs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = funcs.h; path = ../../src/funcs.h; sourceTree = SOURCE_ROOT; };
+ 22322F731068369500641384 /* hash.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = hash.c; path = ../../src/hash.c; sourceTree = SOURCE_ROOT; };
+ 22322F741068369500641384 /* hash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = hash.h; path = ../../src/hash.h; sourceTree = SOURCE_ROOT; };
+ 22322F751068369500641384 /* hydraul.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = hydraul.c; path = ../../src/hydraul.c; sourceTree = SOURCE_ROOT; };
+ 22322F761068369500641384 /* inpfile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = inpfile.c; path = ../../src/inpfile.c; sourceTree = SOURCE_ROOT; };
+ 22322F771068369500641384 /* input1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = input1.c; path = ../../src/input1.c; sourceTree = SOURCE_ROOT; };
+ 22322F781068369500641384 /* input2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = input2.c; path = ../../src/input2.c; sourceTree = SOURCE_ROOT; };
+ 22322F791068369500641384 /* input3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = input3.c; path = ../../src/input3.c; sourceTree = SOURCE_ROOT; };
+ 22322F7A1068369500641384 /* mempool.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mempool.c; path = ../../src/mempool.c; sourceTree = SOURCE_ROOT; };
+ 22322F7B1068369500641384 /* mempool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mempool.h; path = ../../src/mempool.h; sourceTree = SOURCE_ROOT; };
+ 22322F7C1068369500641384 /* output.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = output.c; path = ../../src/output.c; sourceTree = SOURCE_ROOT; };
+ 22322F7D1068369500641384 /* quality.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; lineEnding = 2; name = quality.c; path = ../../src/quality.c; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.c; };
+ 22322F7E1068369500641384 /* report.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = report.c; path = ../../src/report.c; sourceTree = SOURCE_ROOT; };
+ 22322F7F1068369500641384 /* rules.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = rules.c; path = ../../src/rules.c; sourceTree = SOURCE_ROOT; };
+ 22322F801068369500641384 /* smatrix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = smatrix.c; path = ../../src/smatrix.c; sourceTree = SOURCE_ROOT; };
+ 22322F811068369500641384 /* text.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = text.h; path = ../../src/text.h; sourceTree = SOURCE_ROOT; };
+ 22322F831068369500641384 /* types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = types.h; path = ../../src/types.h; sourceTree = SOURCE_ROOT; };
+ 22322F841068369500641384 /* vars.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = vars.h; path = ../../src/vars.h; sourceTree = SOURCE_ROOT; };
+ 22322FA9106836B000641384 /* epanet2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 2; name = epanet2.h; path = ../../include/epanet2.h; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
+ 2255753B17551217009946B1 /* libepanet-static.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libepanet-static.a"; sourceTree = BUILT_PRODUCTS_DIR; };
+ 22CD9A5D1B27898E00B65E83 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = main.c; path = ../../run/main.c; sourceTree = ""; };
+ D2AAC0630554660B00DB518D /* libepanet.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libepanet.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 22322F64106833BB00641384 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 22CD9A611B278BB900B65E83 /* libepanet-static.a in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 2255753817551217009946B1 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ D289988505E68E00004EDB86 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 08FB7794FE84155DC02AAC07 /* epanet */ = {
+ isa = PBXGroup;
+ children = (
+ 22CD9A5C1B27896200B65E83 /* run epanet */,
+ 22322FA8106836A000641384 /* Include */,
+ 08FB7795FE84155DC02AAC07 /* Source */,
+ 1AB674ADFE9D54B511CA2CBB /* Products */,
+ );
+ name = epanet;
+ sourceTree = "";
+ };
+ 08FB7795FE84155DC02AAC07 /* Source */ = {
+ isa = PBXGroup;
+ children = (
+ 22322F711068369500641384 /* epanet.c */,
+ 22322F751068369500641384 /* hydraul.c */,
+ 22322F701068369500641384 /* enumstxt.h */,
+ 22322F721068369500641384 /* funcs.h */,
+ 22322F731068369500641384 /* hash.c */,
+ 22322F741068369500641384 /* hash.h */,
+ 22322F761068369500641384 /* inpfile.c */,
+ 22322F771068369500641384 /* input1.c */,
+ 22322F781068369500641384 /* input2.c */,
+ 22322F791068369500641384 /* input3.c */,
+ 22322F7A1068369500641384 /* mempool.c */,
+ 22322F7B1068369500641384 /* mempool.h */,
+ 22322F7C1068369500641384 /* output.c */,
+ 22322F7D1068369500641384 /* quality.c */,
+ 22322F7E1068369500641384 /* report.c */,
+ 22322F7F1068369500641384 /* rules.c */,
+ 22322F801068369500641384 /* smatrix.c */,
+ 22322F811068369500641384 /* text.h */,
+ 22322F831068369500641384 /* types.h */,
+ 22322F841068369500641384 /* vars.h */,
+ );
+ name = Source;
+ sourceTree = "";
+ };
+ 1AB674ADFE9D54B511CA2CBB /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ D2AAC0630554660B00DB518D /* libepanet.dylib */,
+ 22322F66106833BB00641384 /* runepanet */,
+ 2255753B17551217009946B1 /* libepanet-static.a */,
+ );
+ name = Products;
+ sourceTree = "";
+ };
+ 22322FA8106836A000641384 /* Include */ = {
+ isa = PBXGroup;
+ children = (
+ 22322FA9106836B000641384 /* epanet2.h */,
+ );
+ name = Include;
+ sourceTree = "";
+ };
+ 22CD9A5C1B27896200B65E83 /* run epanet */ = {
+ isa = PBXGroup;
+ children = (
+ 22CD9A5D1B27898E00B65E83 /* main.c */,
+ );
+ name = "run epanet";
+ sourceTree = "";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+ 2255753917551217009946B1 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 226537E0179EDEEB00258C60 /* epanet2.h in Headers */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ D2AAC0600554660B00DB518D /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 22322FAA106836BC00641384 /* epanet2.h in Headers */,
+ 22322F851068369500641384 /* enumstxt.h in Headers */,
+ 22322F871068369500641384 /* funcs.h in Headers */,
+ 22322F891068369500641384 /* hash.h in Headers */,
+ 22322F901068369500641384 /* mempool.h in Headers */,
+ 22322F961068369500641384 /* text.h in Headers */,
+ 22322F981068369500641384 /* types.h in Headers */,
+ 22322F991068369500641384 /* vars.h in Headers */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+ 22322F65106833BB00641384 /* runepanet */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 22322F6A106833E600641384 /* Build configuration list for PBXNativeTarget "runepanet" */;
+ buildPhases = (
+ 22322F63106833BB00641384 /* Sources */,
+ 22322F64106833BB00641384 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 22CD9A601B278B0400B65E83 /* PBXTargetDependency */,
+ );
+ name = runepanet;
+ productName = runepanet;
+ productReference = 22322F66106833BB00641384 /* runepanet */;
+ productType = "com.apple.product-type.tool";
+ };
+ 2255753A17551217009946B1 /* epanet-static */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 2255753E17551217009946B1 /* Build configuration list for PBXNativeTarget "epanet-static" */;
+ buildPhases = (
+ 2255753717551217009946B1 /* Sources */,
+ 2255753817551217009946B1 /* Frameworks */,
+ 2255753917551217009946B1 /* Headers */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = "epanet-static";
+ productName = "epanet-static";
+ productReference = 2255753B17551217009946B1 /* libepanet-static.a */;
+ productType = "com.apple.product-type.library.static";
+ };
+ D2AAC0620554660B00DB518D /* epanet */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 1DEB914A08733D8E0010E9CD /* Build configuration list for PBXNativeTarget "epanet" */;
+ buildPhases = (
+ D2AAC0600554660B00DB518D /* Headers */,
+ D2AAC0610554660B00DB518D /* Sources */,
+ D289988505E68E00004EDB86 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = epanet;
+ productName = epanet;
+ productReference = D2AAC0630554660B00DB518D /* libepanet.dylib */;
+ productType = "com.apple.product-type.library.dynamic";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 08FB7793FE84155DC02AAC07 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0630;
+ };
+ buildConfigurationList = 1DEB914E08733D8E0010E9CD /* Build configuration list for PBXProject "epanet" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 1;
+ knownRegions = (
+ English,
+ Japanese,
+ French,
+ German,
+ );
+ mainGroup = 08FB7794FE84155DC02AAC07 /* epanet */;
+ projectDirPath = "";
+ projectRoot = ../../..;
+ targets = (
+ D2AAC0620554660B00DB518D /* epanet */,
+ 22322F65106833BB00641384 /* runepanet */,
+ 2255753A17551217009946B1 /* epanet-static */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 22322F63106833BB00641384 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 22CD9A5E1B27898E00B65E83 /* main.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 2255753717551217009946B1 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 2255753F17551234009946B1 /* epanet.c in Sources */,
+ 2255754017551234009946B1 /* hash.c in Sources */,
+ 2255754117551234009946B1 /* hydraul.c in Sources */,
+ 2255754217551234009946B1 /* inpfile.c in Sources */,
+ 2255754317551234009946B1 /* input1.c in Sources */,
+ 2255754417551234009946B1 /* input2.c in Sources */,
+ 2255754517551234009946B1 /* input3.c in Sources */,
+ 2255754617551234009946B1 /* mempool.c in Sources */,
+ 2255754717551234009946B1 /* output.c in Sources */,
+ 2255754817551234009946B1 /* quality.c in Sources */,
+ 2255754917551234009946B1 /* report.c in Sources */,
+ 2255754A17551234009946B1 /* rules.c in Sources */,
+ 2255754B17551234009946B1 /* smatrix.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ D2AAC0610554660B00DB518D /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 22322F861068369500641384 /* epanet.c in Sources */,
+ 22322F881068369500641384 /* hash.c in Sources */,
+ 22322F8A1068369500641384 /* hydraul.c in Sources */,
+ 22322F8B1068369500641384 /* inpfile.c in Sources */,
+ 22322F8C1068369500641384 /* input1.c in Sources */,
+ 22322F8D1068369500641384 /* input2.c in Sources */,
+ 22322F8E1068369500641384 /* input3.c in Sources */,
+ 22322F8F1068369500641384 /* mempool.c in Sources */,
+ 22322F911068369500641384 /* output.c in Sources */,
+ 22322F921068369500641384 /* quality.c in Sources */,
+ 22322F931068369500641384 /* report.c in Sources */,
+ 22322F941068369500641384 /* rules.c in Sources */,
+ 22322F951068369500641384 /* smatrix.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+ 22CD9A601B278B0400B65E83 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 2255753A17551217009946B1 /* epanet-static */;
+ targetProxy = 22CD9A5F1B278B0400B65E83 /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
+/* Begin XCBuildConfiguration section */
+ 1DEB914B08733D8E0010E9CD /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ EXECUTABLE_PREFIX = lib;
+ GCC_MODEL_TUNING = G5;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = "EN_API_FLOAT_TYPE=double";
+ PRODUCT_NAME = epanet;
+ };
+ name = Debug;
+ };
+ 1DEB914C08733D8E0010E9CD /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ EXECUTABLE_PREFIX = lib;
+ GCC_MODEL_TUNING = G5;
+ GCC_PREPROCESSOR_DEFINITIONS = "EN_API_FLOAT_TYPE=double";
+ PRODUCT_NAME = epanet;
+ };
+ name = Release;
+ };
+ 1DEB914F08733D8E0010E9CD /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ COPY_PHASE_STRIP = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = c89;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = "";
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = "";
+ };
+ name = Debug;
+ };
+ 1DEB915008733D8E0010E9CD /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = c89;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = "";
+ SDKROOT = "";
+ };
+ name = Release;
+ };
+ 22322F68106833BC00641384 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ GCC_MODEL_TUNING = G5;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = "";
+ INFOPLIST_PREPROCESSOR_DEFINITIONS = "";
+ PRODUCT_NAME = runepanet;
+ };
+ name = Debug;
+ };
+ 22322F69106833BC00641384 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ GCC_MODEL_TUNING = G5;
+ GCC_PREPROCESSOR_DEFINITIONS = "";
+ INFOPLIST_PREPROCESSOR_DEFINITIONS = "";
+ PRODUCT_NAME = runepanet;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 2255753C17551217009946B1 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_WARN_EMPTY_BODY = YES;
+ COMBINE_HIDPI_IMAGES = YES;
+ EXECUTABLE_PREFIX = lib;
+ GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+ GCC_PREPROCESSOR_DEFINITIONS = "EN_API_FLOAT_TYPE=double";
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ 2255753D17551217009946B1 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_WARN_EMPTY_BODY = YES;
+ COMBINE_HIDPI_IMAGES = YES;
+ EXECUTABLE_PREFIX = lib;
+ GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+ GCC_PREPROCESSOR_DEFINITIONS = "EN_API_FLOAT_TYPE=double";
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 1DEB914A08733D8E0010E9CD /* Build configuration list for PBXNativeTarget "epanet" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 1DEB914B08733D8E0010E9CD /* Debug */,
+ 1DEB914C08733D8E0010E9CD /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 1DEB914E08733D8E0010E9CD /* Build configuration list for PBXProject "epanet" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 1DEB914F08733D8E0010E9CD /* Debug */,
+ 1DEB915008733D8E0010E9CD /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 22322F6A106833E600641384 /* Build configuration list for PBXNativeTarget "runepanet" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 22322F68106833BC00641384 /* Debug */,
+ 22322F69106833BC00641384 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 2255753E17551217009946B1 /* Build configuration list for PBXNativeTarget "epanet-static" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 2255753C17551217009946B1 /* Debug */,
+ 2255753D17551217009946B1 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
+}
diff --git a/test/Net3.inp b/example-networks/Net3.inp
similarity index 100%
rename from test/Net3.inp
rename to example-networks/Net3.inp
diff --git a/test/sampletown.inp b/example-networks/sampletown.inp
similarity index 100%
rename from test/sampletown.inp
rename to example-networks/sampletown.inp
diff --git a/test/simplenet.inp b/example-networks/simplenet.inp
similarity index 100%
rename from test/simplenet.inp
rename to example-networks/simplenet.inp
diff --git a/include/epanet2.bas b/include/epanet2.bas
index 74d0b83..4260cfb 100644
--- a/include/epanet2.bas
+++ b/include/epanet2.bas
@@ -33,8 +33,8 @@ 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 'ES
+Global Const EN_TANKVOLUME = 24
+Global Const EN_MAXVOLUME = 25
Global Const EN_DIAMETER = 0 ' Link parameters
Global Const EN_LENGTH = 1
@@ -51,6 +51,7 @@ 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
Global Const EN_DURATION = 0 ' Time parameters
Global Const EN_HYDSTEP = 1
@@ -62,7 +63,14 @@ 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 'ES
+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
+
+Global Const EN_ITERATIONS = 0
+Global Const EN_RELATIVEERROR = 1
Global Const EN_NODECOUNT = 0 'Component counts
Global Const EN_TANKCOUNT = 1
@@ -132,10 +140,6 @@ Global Const EN_SAVE = 1
Global Const EN_INITFLOW = 10 ' Re-initialize flow flag
-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
-
'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
@@ -175,17 +179,21 @@ Global Const EN_CUSTOM = 2 ' user-defined custom curve
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)
+ 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 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
- Declare Function ENgetnumdemands Lib "epanet2.dll" (ByVal Index As Long, numDemands As Long) As Long 'ES
- Declare Function ENgetbasedemand Lib "epanet2.dll" (ByVal Index As Long, ByVal DemandIndex As Long, Value As Single) As Long 'ES
- Declare Function ENgetdemandpattern Lib "epanet2.dll" (ByVal Index As Long, ByVal DemandIndex As Long, PatIndex As Long) As Long 'ES
+ 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
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
@@ -193,9 +201,9 @@ Global Const EN_CUSTOM = 2 ' user-defined custom curve
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 ENgetcurve Lib "epanet2.dll" (ByVal CurveIndex As Long, nValues As Long, xValues As Any, yValues As Any) As Long 'ES
- Declare Function ENgetheadcurve Lib "epanet2.dll" (ByVal Index As Long, ID As String) As Long 'ES
- Declare Function ENgetpumptype Lib "epanet2.dll" (ByVal Index As Long, PumpType As Long) As Long 'ES
+ 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 ENgetheadcurve Lib "epanet2.dll" (ByVal Index As Long, ByVal ID As String) 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
@@ -209,4 +217,5 @@ Global Const EN_CUSTOM = 2 ' user-defined custom curve
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, ChemName As String, 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
diff --git a/include/epanet2.h b/include/epanet2.h
index 9b013a1..e447d85 100755
--- a/include/epanet2.h
+++ b/include/epanet2.h
@@ -19,26 +19,39 @@
#define EPANET2_H
#ifndef EN_API_FLOAT_TYPE
-#define EN_API_FLOAT_TYPE float
+ #define EN_API_FLOAT_TYPE float
#endif
+// --- define WINDOWS
+#undef WINDOWS
+#ifdef _WIN32
+ #define WINDOWS
+#endif
+#ifdef __WIN32__
+ #define WINDOWS
+#endif
+
+// --- define DLLEXPORT
#ifndef DLLEXPORT
-#ifdef DLL
-#ifdef __cplusplus
-#define DLLEXPORT extern "C" __declspec(dllexport)
-#else
-#define DLLEXPORT __declspec(dllexport)
-#endif
-#elif defined(CYGWIN)
-#define DLLEXPORT __stdcall
-#else
-#ifdef __cplusplus
-#define DLLEXPORT
-#else
-#define DLLEXPORT
-#endif
-#endif
+ #ifdef WINDOWS
+ #ifdef __cplusplus
+ #define DLLEXPORT extern "C" __declspec(dllexport)
+ #else
+ #define DLLEXPORT __declspec(dllexport) __stdcall
+ #endif // __cplusplus
+ #elif defined(CYGWIN)
+ #define DLLEXPORT __stdcall
+ #elif defined(__APPLE__)
+ #ifdef __cplusplus
+ #define DLLEXPORT
+ #else
+ #define DLLEXPORT
+ #endif
+ #else
+ #define DLLEXPORT
+ #endif
#endif
+
// --- Define the EPANET toolkit constants
#define EN_ELEVATION 0 /* Node parameters */
@@ -83,7 +96,7 @@
#define EN_STATUS 11
#define EN_SETTING 12
#define EN_ENERGY 13
-#define EN_LINKQUAL 14 /* TNT */
+#define EN_LINKQUAL 14
#define EN_LINKPATTERN 15
#define EN_DURATION 0 /* Time parameters */
@@ -226,6 +239,7 @@ extern "C" {
int DLLEXPORT ENgetnodetype(int index, int *code);
int DLLEXPORT ENgetnodevalue(int index, int code, EN_API_FLOAT_TYPE *value);
int DLLEXPORT ENgetcoord(int index, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y);
+ int DLLEXPORT ENsetcoord(int index, EN_API_FLOAT_TYPE x, EN_API_FLOAT_TYPE y);
int DLLEXPORT ENgetnumdemands(int nodeIndex, int *numDemands);
int DLLEXPORT ENgetbasedemand(int nodeIndex, int demandIdx, EN_API_FLOAT_TYPE *baseDemand);
@@ -238,7 +252,8 @@ extern "C" {
int DLLEXPORT ENgetlinkvalue(int index, int code, EN_API_FLOAT_TYPE *value);
int DLLEXPORT ENgetcurve(int curveIndex, char* id, int *nValues, EN_API_FLOAT_TYPE **xValues, EN_API_FLOAT_TYPE **yValues);
-
+ int DLLEXPORT ENgetheadcurve(int, char *);
+ int DLLEXPORT ENgetpumptype(int, int *);
int DLLEXPORT ENgetversion(int *version);
@@ -259,4 +274,8 @@ extern "C" {
}
#endif
+<<<<<<< HEAD
#endif //TOOLKIT_H
+=======
+#endif //EPANET2_H
+>>>>>>> coordinates-getter
diff --git a/include/epanet2.vb b/include/epanet2.vb
new file mode 100644
index 0000000..62da5fc
--- /dev/null
+++ b/include/epanet2.vb
@@ -0,0 +1,220 @@
+
+'EPANET2.VB
+'
+'Declarations of functions in the EPANET PROGRAMMERs TOOLKIT
+'(EPANET2.DLL) for use with VB.Net.
+
+'Last updated on 7/19/15 - LR
+
+Imports System.Runtime.InteropServices
+Imports System.Text
+
+Module Epanet2
+
+' These are codes used by the DLL functions
+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
+
+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 'ES
+
+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 'ES
+Public Const EN_LINKPATTERN 15
+
+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 'ES
+
+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_JUNCTION = 0 ' Node types
+Public Const EN_RESERVOIR = 1
+Public Const EN_TANK = 2
+
+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
+
+Public Const EN_NONE = 0 ' Quality analysis types
+Public Const EN_CHEM = 1
+Public Const EN_AGE = 2
+Public Const EN_TRACE = 3
+
+Public Const EN_CONCEN = 0 ' Source quality types
+Public Const EN_MASS = 1
+Public Const EN_SETPOINT = 2
+Public Const EN_FLOWPACED = 3
+
+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
+
+Public Const EN_TRIALS = 0 ' Misc. options
+Public Const EN_ACCURACY = 1
+Public Const EN_TOLERANCE = 2
+Public Const EN_EMITEXPON = 3
+Public Const EN_DEMANDMULT = 4
+
+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_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_CONST_HP = 0 ' constant horsepower
+Public Const EN_POWER_FUNC = 1 ' power function
+Public Const EN_CUSTOM = 2 ' user-defined custom curve
+
+'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
+ Declare Function ENclose Lib "epanet2.dll" () As Int32
+
+ 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 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 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 ENcloseQ Lib "epanet2.dll" () As Int32
+
+ Declare Function ENwriteline Lib "epanet2.dll" (ByVal S As String) As Int32
+ Declare Function ENreport 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 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)
+
+ 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
+
+ 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
+
+ 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
+
+ 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 ENgetheadcurve Lib "epanet2.dll" (ByVal Index As Int32, ByVal ID As StringBuilder) As Int32 'ES
+ Declare Function ENgetpumptype Lib "epanet2.dll" (ByVal Index As Int32, ByRef PumpType As Int32) As Int32 'ES
+
+ Declare Function ENgetversion Lib "epanet2.dll" (ByRef Value As Int32) 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
+
+End Module
diff --git a/run/main.c b/run/main.c
new file mode 100644
index 0000000..83949a7
--- /dev/null
+++ b/run/main.c
@@ -0,0 +1,75 @@
+#include
+#include "epanet2.h"
+#include "text.h"
+
+void writeConsole(char *s);
+
+extern char Warnflag;
+
+/*
+----------------------------------------------------------------
+ Entry point used to compile a stand-alone executable.
+----------------------------------------------------------------
+*/
+
+
+int main(int argc, char *argv[])
+/*--------------------------------------------------------------
+ ** Input: argc = number of command line arguments
+ ** *argv[] = array of command line arguments
+ ** Output: none
+ ** Purpose: main program segment
+ **
+ ** Command line for stand-alone operation is:
+ ** progname f1 f2 f3
+ ** where progname = name of executable this code was compiled to,
+ ** f1 = name of input file, f2 = name of report file, and
+ ** f3 = name of binary output file (optional).
+ **--------------------------------------------------------------
+ */
+{
+ char *f1,*f2,*f3;
+ char blank[] = "";
+ int errcode;
+
+ /* Check for proper number of command line arguments */
+ if (argc < 3) {
+ writeConsole(FMT03);
+ }
+ else {
+ /* Call the main control function */
+ f1 = argv[1];
+ f2 = argv[2];
+ if (argc > 3) {
+ f3 = argv[3];
+ }
+ else {
+ f3 = blank;
+ }
+ writeConsole(FMT01);
+ errcode = ENepanet(f1,f2,f3,NULL);
+ if (errcode > 0) {
+ writeConsole(FMT11);
+ }
+ else if (Warnflag > 0) {
+ writeConsole(FMT10);
+ }
+ else {
+ writeConsole(FMT09);
+ }
+ }
+ return(0);
+} /* End of main */
+
+
+void writeConsole(char *s)
+/*----------------------------------------------------------------
+ ** Input: text string
+ ** Output: none
+ ** Purpose: writes string of characters to console
+ **----------------------------------------------------------------
+ */
+{
+ fprintf(stdout,"%s",s);
+ fflush(stdout);
+}
diff --git a/src/epanet.c b/src/epanet.c
index a4aae2b..c27e231 100755
--- a/src/epanet.c
+++ b/src/epanet.c
@@ -12,8 +12,8 @@ DATE: 5/30/00
6/24/02
8/15/07 (2.00.11)
2/14/08 (2.00.12)
-AUTHOR: L. Rossman
- US EPA - NRMRL
+ AUTHORS: L. Rossman - US EPA - NRMRL
+ OpenWaterAnalytics members: see git stats for contributors
EPANET performs extended period hydraulic and water quality analysis of
looped, pressurized piping networks. The program consists of the
@@ -37,7 +37,7 @@ The program can be compiled as either a stand-alone console application
or as a dynamic link library (DLL) of function calls depending on whether
the macro identifier 'DLL' is defined or not.
-See TOOLKIT.H for function prototypes of exported DLL functions
+See EPANET2.H for function prototypes of exported DLL functions
See FUNCS.H for prototypes of all other functions
See TYPES.H for declaration of global constants and data structures
See VARS.H for declaration of global variables
@@ -144,64 +144,6 @@ void (* viewprog) (char *); /* Pointer to progress viewing function */
----------------------------------------------------------------
*/
-/*** This code is no longer required ***** //(2.00.11 - LR)
-#ifdef DLL
-int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* reserved)
-{
- viewprog = NULL;
- return 1;
-}
-#endif
-*****************************************/
-
-
-/*
-----------------------------------------------------------------
- Entry point used to compile a stand-alone executable.
-----------------------------------------------------------------
-*/
-
-#ifdef CLE //(2.00.11 - LR)
-
-int main(int argc, char *argv[])
-/*--------------------------------------------------------------
-** Input: argc = number of command line arguments
-** *argv[] = array of command line arguments
-** Output: none
-** Purpose: main program segment
-**
-** Command line for stand-alone operation is:
-** progname f1 f2 f3
-** where progname = name of executable this code was compiled to,
-** f1 = name of input file, f2 = name of report file, and
-** f3 = name of binary output file (optional).
-**--------------------------------------------------------------
-*/
-{
- char *f1,*f2,*f3;
- char blank[] = "";
- int errcode;
-
-/* Check for proper number of command line arguments */
- if (argc < 3) writecon(FMT03);
- else
- {
-
- /* Call the main control function */
- f1 = argv[1];
- f2 = argv[2];
- if (argc > 3) f3 = argv[3];
- else f3 = blank;
- writecon(FMT01);
- errcode = ENepanet(f1,f2,f3,NULL);
- if (errcode > 0) writecon(FMT11);
- else if (Warnflag > 0) writecon(FMT10);
- else writecon(FMT09);
- }
- return(0);
-} /* End of main */
-#endif
-
/*
----------------------------------------------------------------
@@ -268,19 +210,10 @@ int DLLEXPORT ENopen(char *f1, char *f2, char *f3)
SaveHflag = FALSE;
SaveQflag = FALSE;
Warnflag = FALSE;
-
+ Coordflag = TRUE;
+
/*** Updated 9/7/00 ***/
Messageflag = TRUE;
-
-/* If binary output file being used, then */
-/* do not write full results to Report file */
-/* (use it only for status reports). */
- Rptflag = 0;
- if (strlen(f3) == 0) Rptflag = 1;
-
-/*** Updated 9/7/00 ***/
-/*** Previous code segment ignored. ***/
-/*** Rptflag now always set to 1. ***/
Rptflag = 1;
/* Initialize global pointers to NULL. */
@@ -307,7 +240,6 @@ int DLLEXPORT ENopen(char *f1, char *f2, char *f3)
/* Free temporary linked lists used for Patterns & Curves */
freeTmplist(Patlist);
freeTmplist(Curvelist);
- freeTmplist(Coordlist);
/* If using previously saved hydraulics then open its file */
if (Hydflag == USE) ERRCODE(openhydfile());
@@ -964,12 +896,11 @@ int DLLEXPORT ENgetversion(int *v)
}
-int DLLEXPORT ENgetcontrol(int cindex, int *ctype, int *lindex,
- EN_API_FLOAT_TYPE *setting, int *nindex, EN_API_FLOAT_TYPE *level)
+int DLLEXPORT ENgetcontrol(int cindex, int *ctype, int *lindex, EN_API_FLOAT_TYPE *setting, int *nindex, EN_API_FLOAT_TYPE *level)
/*----------------------------------------------------------------
** Input: cindex = control index (position of control statement
** in the input file, starting from 1)
-** Output: *ctype = control type code (see TOOLKIT.H)
+** Output: *ctype = control type code (see EPANET2.H)
** *lindex = index of controlled link
** *setting = control setting on link
** *nindex = index of controlling node (0 for TIMER
@@ -1020,7 +951,7 @@ int DLLEXPORT ENgetcontrol(int cindex, int *ctype, int *lindex,
int DLLEXPORT ENgetcount(int code, int *count)
/*----------------------------------------------------------------
-** Input: code = component code (see TOOLKIT.H)
+** Input: code = component code (see EPANET2.H)
** Output: *count = number of components in network
** Returns: error code
** Purpose: retrieves the number of components of a
@@ -1046,7 +977,7 @@ int DLLEXPORT ENgetcount(int code, int *count)
int DLLEXPORT ENgetoption(int code, EN_API_FLOAT_TYPE *value)
/*----------------------------------------------------------------
-** Input: code = option code (see TOOLKIT.H)
+** Input: code = option code (see EPANET2.H)
** Output: *value = option value
** Returns: error code
** Purpose: gets value for an analysis option
@@ -1077,7 +1008,7 @@ int DLLEXPORT ENgetoption(int code, EN_API_FLOAT_TYPE *value)
int DLLEXPORT ENgettimeparam(int code, long *value)
/*----------------------------------------------------------------
-** Input: code = time parameter code (see TOOLKIT.H)
+** Input: code = time parameter code (see EPANET2.H)
** Output: *value = value of time parameter
** Returns: error code
** Purpose: retrieves value of specific time parameter
@@ -1114,7 +1045,7 @@ int DLLEXPORT ENgetflowunits(int *code)
/*----------------------------------------------------------------
** Input: none
** Output: *code = code of flow units in use
-** (see TOOLKIT.H or TYPES.H)
+** (see EPANET2.H or TYPES.H)
** Returns: error code
** Purpose: retrieves flow units code
**----------------------------------------------------------------
@@ -1206,10 +1137,10 @@ int DLLEXPORT ENgetpatternvalue(int index, int period, EN_API_FLOAT_TYPE *value)
}
-int DLLEXPORT ENgetqualtype(int *qualcode, int *tracenode)
+int DLLEXPORT ENgetqualtype(int *qualcode, int *tracenode)
/*----------------------------------------------------------------
** Input: none
-** Output: *qualcode = WQ analysis code number (see TOOLKIT.H)
+** Output: *qualcode = WQ analysis code number (see EPANET2.H)
** *tracenode = index of node being traced (if
** qualocode = WQ tracing)
** Returns: error code
@@ -1330,7 +1261,7 @@ int DLLEXPORT ENgetnodeid(int index, char *id)
int DLLEXPORT ENgetnodetype(int index, int *code)
/*----------------------------------------------------------------
** Input: index = node index
-** Output: *code = node type code number (see TOOLKIT.H)
+** Output: *code = node type code number (see EPANET2.H)
** Returns: error code
** Purpose: retrieves node type of specific node
**----------------------------------------------------------------
@@ -1353,21 +1284,51 @@ int DLLEXPORT ENgetcoord(int index, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y)
/*----------------------------------------------------------------
** Input: index = node index
** Output: *x = value of node's coordinate
- ** *x = value of node's coordinate
+ ** *y = value of node's coordinate
** Returns: error code
** Purpose: retrieves coordinate x, y for a node
**----------------------------------------------------------------
*/
{
- *x = Coord[index].X[0];
- *y = Coord[index].Y[0];
- return 0;
+ if (!Openflag) return(102);
+ if (index < 1 || index > Nnodes) return(203);
+ if (!Coordflag) return(255);
+
+ // check if node have coords
+ if (Coord[index].HaveCoords == FALSE) return(254);
+
+ *x = Coord[index].X;
+ *y = Coord[index].Y;
+ return 0;
}
+
+int DLLEXPORT ENsetcoord(int index, EN_API_FLOAT_TYPE x, EN_API_FLOAT_TYPE y)
+/*----------------------------------------------------------------
+ ** Input: index = node index
+ ** *x = value of node's coordinate
+ ** *y = value of node's coordinate
+ ** Output: None
+ ** Returns: error code
+ ** Purpose: sets coordinate x, y for a node
+ **----------------------------------------------------------------
+ */
+{
+ if (!Openflag) return(102);
+ if (index < 1 || index > Nnodes) return(203);
+ if (!Coordflag) return(255);
+
+ Coord[index].X = x;
+ Coord[index].Y = y;
+ Coord[index].HaveCoords = TRUE;
+ return 0;
+}
+
+
int DLLEXPORT ENgetnodevalue(int index, int code, EN_API_FLOAT_TYPE *value)
/*----------------------------------------------------------------
** Input: index = node index
-** code = node parameter code (see TOOLKIT.H)
+** code = node parameter code (see EPANET2.H)
** Output: *value = value of node's parameter
** Returns: error code
** Purpose: retrieves parameter value for a node
@@ -1588,7 +1549,7 @@ int DLLEXPORT ENgetlinkid(int index, char *id)
int DLLEXPORT ENgetlinktype(int index, int *code)
/*------------------------------------------------------------------
** Input: index = link index
-** Output: *code = link type code number (see TOOLKIT.H)
+** Output: *code = link type code number (see EPANET2.H)
** Returns: error code
** Purpose: retrieves link type of specific link
**------------------------------------------------------------------
@@ -1625,7 +1586,7 @@ int DLLEXPORT ENgetlinknodes(int index, int *node1, int *node2)
int DLLEXPORT ENgetlinkvalue(int index, int code, EN_API_FLOAT_TYPE *value)
/*------------------------------------------------------------------
** Input: index = link index
-** code = link parameter code (see TOOLKIT.H)
+** code = link parameter code (see EPANET2.H)
** Output: *value = value of link's parameter
** Returns: error code
** Purpose: retrieves parameter value for a link
@@ -1778,21 +1739,29 @@ int DLLEXPORT ENgetcurve(int curveIndex, char* id, int *nValues, EN_API_FLOAT_T
/*----------------------------------------------------------------
** Input: curveIndex = curve index
** Output: *nValues = number of points on curve
+ ** id = curve ID
** *xValues = values for x
** *yValues = values for y
** Returns: error code
- ** Purpose: retrieves end nodes of a specific link
+ ** Purpose: retrieves curve id, number of values and (x,y) values
+ **
+ ** NOTE: 'id' must be able to hold MAXID characters
**----------------------------------------------------------------
*/
{
- int err = 0;
+ int iPoint, nPoints;
+ Scurve curve;
+ EN_API_FLOAT_TYPE *pointX, *pointY;
- Scurve curve = Curve[curveIndex];
- int nPoints = curve.Npts;
+/* Check that input file opened */
+ if (!Openflag) return(102);
+
+ curve = Curve[curveIndex];
+ nPoints = curve.Npts;
+
+ pointX = calloc(nPoints, sizeof(EN_API_FLOAT_TYPE));
+ pointY = calloc(nPoints, sizeof(EN_API_FLOAT_TYPE));
- EN_API_FLOAT_TYPE *pointX = calloc(nPoints, sizeof(EN_API_FLOAT_TYPE));
- EN_API_FLOAT_TYPE *pointY = calloc(nPoints, sizeof(EN_API_FLOAT_TYPE));
- int iPoint;
for (iPoint = 0; iPoint < nPoints; iPoint++) {
double x = curve.X[iPoint] * Ucf[LENGTH];
double y = curve.Y[iPoint] * Ucf[VOLUME];
@@ -1800,12 +1769,13 @@ int DLLEXPORT ENgetcurve(int curveIndex, char* id, int *nValues, EN_API_FLOAT_T
pointY[iPoint] = (EN_API_FLOAT_TYPE)y;
}
+ strncpy(id,"", MAXID);
strncpy(id, curve.ID, MAXID);
*nValues = nPoints;
*xValues = pointX;
*yValues = pointY;
- return err;
+ return(0);
}
@@ -1821,7 +1791,7 @@ int DLLEXPORT ENsetcontrol(int cindex, int ctype, int lindex,
/*----------------------------------------------------------------
** Input: cindex = control index (position of control statement
** in the input file, starting from 1)
-** ctype = control type code (see TOOLKIT.H)
+** ctype = control type code (see EPANET2.H)
** lindex = index of controlled link
** setting = control setting applied to link
** nindex = index of controlling node (0 for TIMER
@@ -1908,7 +1878,7 @@ int DLLEXPORT ENsetcontrol(int cindex, int ctype, int lindex,
int DLLEXPORT ENsetnodevalue(int index, int code, EN_API_FLOAT_TYPE v)
/*----------------------------------------------------------------
** Input: index = node index
-** code = node parameter code (see TOOLKIT.H)
+** code = node parameter code (see EPANET2.H)
** value = parameter value
** Output: none
** Returns: error code
@@ -2121,7 +2091,7 @@ int DLLEXPORT ENsetnodevalue(int index, int code, EN_API_FLOAT_TYPE v)
int DLLEXPORT ENsetlinkvalue(int index, int code, EN_API_FLOAT_TYPE v)
/*----------------------------------------------------------------
** Input: index = link index
-** code = link parameter code (see TOOLKIT.H)
+** code = link parameter code (see EPANET2.H)
** v = parameter value
** Output: none
** Returns: error code
@@ -2355,7 +2325,7 @@ int DLLEXPORT ENsetpatternvalue(int index, int period, EN_API_FLOAT_TYPE value
int DLLEXPORT ENsettimeparam(int code, long value)
/*----------------------------------------------------------------
-** Input: code = time parameter code (see TOOLKIT.H)
+** Input: code = time parameter code (see EPANET2.H)
** value = time parameter value
** Output: none
** Returns: error code
@@ -2447,7 +2417,7 @@ int DLLEXPORT ENsettimeparam(int code, long value)
int DLLEXPORT ENsetoption(int code, EN_API_FLOAT_TYPE v)
/*----------------------------------------------------------------
-** Input: code = option code (see TOOLKIT.H)
+** Input: code = option code (see EPANET2.H)
** v = option value
** Output: none
** Returns: error code
@@ -2508,7 +2478,7 @@ int DLLEXPORT ENsetstatusreport(int code)
int DLLEXPORT ENsetqualtype(int qualcode, char *chemname,
char *chemunits, char *tracenode)
/*----------------------------------------------------------------
-** Input: qualcode = WQ parameter code (see TOOLKIT.H)
+** Input: qualcode = WQ parameter code (see EPANET2.H)
** chemname = name of WQ constituent
** chemunits = concentration units of WQ constituent
** tracenode = ID of node being traced
@@ -2830,12 +2800,11 @@ void initpointers()
Pattern = NULL;
Curve = NULL;
Control = NULL;
- Coord = NULL;
+ Coord = NULL;
X = NULL;
Patlist = NULL;
Curvelist = NULL;
- Coordlist = NULL;
Adjlist = NULL;
Aii = NULL;
Aij = NULL;
@@ -2915,14 +2884,17 @@ int allocdata()
Control = (Scontrol *) calloc(MaxControls+1,sizeof(Scontrol));
Pattern = (Spattern *) calloc(MaxPats+1, sizeof(Spattern));
Curve = (Scurve *) calloc(MaxCurves+1, sizeof(Scurve));
- Coord = (Scoord *) calloc(MaxNodes+1, sizeof(Scoord));
+ if (Coordflag == TRUE)
+ {
+ Coord = (Scoord *) calloc(MaxNodes+1, sizeof(Scoord));
+ }
ERRCODE(MEMCHECK(Tank));
ERRCODE(MEMCHECK(Pump));
ERRCODE(MEMCHECK(Valve));
ERRCODE(MEMCHECK(Control));
ERRCODE(MEMCHECK(Pattern));
ERRCODE(MEMCHECK(Curve));
- ERRCODE(MEMCHECK(Coord));
+ if (Coordflag == TRUE) ERRCODE(MEMCHECK(Coord));
}
/* Initialize pointers used in patterns, curves, and demand category lists */
@@ -2945,12 +2917,13 @@ int allocdata()
{
// node demand
Node[n].D = NULL;
- /* Allocate memory for coord data */
- Coord[n].X = (double *) calloc(1, sizeof(double));
- Coord[n].Y = (double *) calloc(1, sizeof(double));
- if (Coord[n].X == NULL || Coord[n].Y == NULL) return(101);
- Coord[n].X[0] = 0;
- Coord[n].Y[0] = 0;
+ /* ini coord data */
+ if (Coordflag == TRUE)
+ {
+ Coord[n].X = 0;
+ Coord[n].Y = 0;
+ Coord[n].HaveCoords = FALSE;
+ }
}
}
@@ -3248,7 +3221,10 @@ char *geterrmsg(int errcode)
case 241: sprintf(Msg,ERR241,t_FUNCCALL,""); break;
case 250: sprintf(Msg,ERR250); break;
case 251: sprintf(Msg,ERR251); break;
-
+ case 253: sprintf(Msg,ERR253); break;
+ case 254: sprintf(Msg,ERR254); break;
+ case 255: sprintf(Msg,ERR255); break;
+
/* File Errors */
case 301: strcpy(Msg,ERR301); break;
case 302: strcpy(Msg,ERR302); break;
@@ -3295,10 +3271,10 @@ void writecon(char *s)
**----------------------------------------------------------------
*/
{
-#ifdef CLE //(2.00.11 - LR)
+ //(2.00.11 - LR)
fprintf(stdout,s);
fflush(stdout);
-#endif
+
}
@@ -3320,7 +3296,16 @@ void writewin(char *s)
}
#endif
}
+
+
int DLLEXPORT ENgetnumdemands(int nodeIndex, int *numDemands)
+/*----------------------------------------------------------------
+ ** Input: nodeIndex = index of node
+ ** Output: *numDemands = number of demand categories
+ ** Returns: error code
+ ** Purpose: retrieves the number of a demand categories for a node
+ **----------------------------------------------------------------
+ */
{
Pdemand d;
int n=0;
@@ -3331,7 +3316,17 @@ int DLLEXPORT ENgetnumdemands(int nodeIndex, int *numDemands)
*numDemands=n;
return 0;
}
+
+
int DLLEXPORT ENgetbasedemand(int nodeIndex, int demandIdx, EN_API_FLOAT_TYPE *baseDemand)
+/*----------------------------------------------------------------
+ ** Input: nodeIndex = index of node
+ ** demandIdx = index of demand category
+ ** Output: *baseDemand = base demand for selected category
+ ** Returns: error code
+ ** Purpose: retrieves the node's base demand for a category
+ **----------------------------------------------------------------
+ */
{
Pdemand d;
int n=1;
@@ -3349,7 +3344,16 @@ int DLLEXPORT ENgetbasedemand(int nodeIndex, int demandIdx, EN_API_FLOAT_TYPE *
return 0;
}
+
int DLLEXPORT ENsetbasedemand(int nodeIndex, int demandIdx, EN_API_FLOAT_TYPE baseDemand)
+/*----------------------------------------------------------------
+ ** Input: nodeIndex = index of node
+ ** demandIdx = index of demand category
+ ** baseDemand = base demand for selected category
+ ** Returns: error code
+ ** Purpose: sets the node's base demand for a category
+ **----------------------------------------------------------------
+ */
{
Pdemand d;
int n=1;
@@ -3364,7 +3368,17 @@ int DLLEXPORT ENsetbasedemand(int nodeIndex, int demandIdx, EN_API_FLOAT_TYPE b
return 0;
}
+
int DLLEXPORT ENgetdemandpattern(int nodeIndex, int demandIdx, int *pattIdx)
+/*----------------------------------------------------------------
+ ** Input: nodeIndex = index of node
+ ** demandIdx = index of demand category
+ ** Output: *pattIdx = demand pattern index
+ ** Returns: error code
+ ** Purpose: retrieves the index of a demand pattern for a specific
+ ** demand category of a node
+ **----------------------------------------------------------------
+ */
{
Pdemand d;
int n=1;
@@ -3377,21 +3391,21 @@ int DLLEXPORT ENgetdemandpattern(int nodeIndex, int demandIdx, int *pattIdx)
return 0;
}
+
int DLLEXPORT ENgetaveragepatternvalue(int index, EN_API_FLOAT_TYPE *value)
/*----------------------------------------------------------------
** Input: index = index of time pattern
- ** period = pattern time period
- ** Output: *value = pattern multiplier
+ ** Output: *value = pattern average value
** Returns: error code
- ** Purpose: retrieves multiplier for a specific time period
- ** and pattern
+ ** Purpose: retrieves the average value of a pattern
**----------------------------------------------------------------
*/
-{ *value = 0.0;
+{
+ int i;
+ *value = 0.0;
if (!Openflag) return(102);
if (index < 1 || index > Npats) return(205);
//if (period < 1 || period > Pattern[index].Length) return(251);
- int i;
for (i=0; i 0)
+ fprintf(f, "\n FILE %s", Rpt2Fname);
switch (Nodeflag)
{
case 0:
@@ -610,7 +621,22 @@ int saveinpfile(char *fname)
}
else fprintf(f, "\n %-20sNO", Field[i].Name);
}
- fprintf(f, "\n");
+ fprintf(f, "\n\n");
+
+/* Write [COORDINATES] section */
+
+ if (Coordflag == TRUE)
+ {
+ fprintf(f, "\n\n[COORDINATES]");
+ for (i=1; i<=Nnodes; i++)
+ {
+ if (Coord[i].HaveCoords == TRUE)
+ {
+ fprintf(f,"\n %-31s %14.6f %14.6f",Node[i].ID,Coord[i].X,Coord[i].Y);
+ }
+ }
+ fprintf(f, "\n\n");
+ }
/* Save auxilary data to new input file */
diff --git a/src/input2.c b/src/input2.c
index b372867..6ac3202 100755
--- a/src/input2.c
+++ b/src/input2.c
@@ -48,7 +48,6 @@ char *Tok[MAXTOKS]; /* Array of token strings */
/* Used in INPUT3.C: */
STmplist *PrevPat; /* Pointer to pattern list element */
STmplist *PrevCurve; /* Pointer to curve list element */
-STmplist *PrevCoord; /* Pointer to coordinate list element */
/* Defined in enumstxt.h in EPANET.C */
extern char *SectTxt[]; /* Input section keywords */
@@ -79,7 +78,6 @@ int netsize()
MaxRules = 0;
MaxCurves = 0;
sect = -1;
- MaxCoords = 0;
/* Add a default pattern 0 */
MaxPats = -1;
@@ -121,8 +119,6 @@ int netsize()
break;
case _CURVES: errcode = addcurve(tok);
break;
-// case _COORDS: errcode = addcoord(tok); //06.02.2010-woohn
-// break;
}
if (errcode) break;
}
@@ -176,7 +172,6 @@ int readdata()
Npats = MaxPats;
PrevPat = NULL;
PrevCurve = NULL;
- PrevCoord = NULL;
sect = -1;
errsum = 0;
@@ -245,7 +240,6 @@ int readdata()
/* Get pattern & curve data from temp. lists */
if (!errcode) errcode = getpatterns();
if (!errcode) errcode = getcurves();
- //if (!errcode) errcode = getcoords();
if (!errcode) errcode = getpumpparams();
/* Free input buffer */
@@ -300,7 +294,11 @@ int newline(int sect, char *line)
case _OPTIONS: return(optiondata());
/* Data in these sections are not used for any computations */
- case _COORDS: return (0); //return(coordata());
+ case _COORDS: if (Coordflag == TRUE)
+ {
+ return(coordata());
+ }
+ else return(0);
case _LABELS: return(0);
case _TAGS: return(0);
case _VERTICES: return(0);
@@ -520,43 +518,6 @@ int addcurve(char *id)
return(0);
}
-int addcoord(char *id)
-/*
- **-------------------------------------------------------------
- ** Input: id = curve ID label
- ** Output: returns error code
- ** Purpose: adds a new curve to the database
- **--------------------------------------------------------------
- */
-{
- STmplist *c;
-
- /* Check if ID is same as last one processed */
- if (Coordlist != NULL && strcmp(id,Coordlist->ID) == 0) return(0);
-
- /* Check that coordinate was not already created */
- if (findID(id,Coordlist) == NULL)
- {
-
- /* Update coordinate count & create new list element */
- (MaxCoords)++;
- c = (STmplist *) malloc(sizeof(STmplist));
- if (c == NULL) {
- return(101);
- }
- else {
- /* Initialize list element properties */
- // c->i = MaxCoords; // bug! if coordinates are not in the same order as junctions, then this is a BAD assumption
- // do this later: c->i = findnode(id);
- strncpy(c->ID,id,MAXID);
- c->x = NULL;
- c->y = NULL;
- c->next = Coordlist;
- Coordlist = c;
- }
- }
- return(0);
-}
STmplist *findID(char *id, STmplist *list)
/*
@@ -749,65 +710,6 @@ int getcurves(void)
return(0);
}
-int getcoords(void)
-/*
- **-----------------------------------------------------------
- ** Input: none
- ** Output: returns error code
- ** Purpose: retrieves curve data from temporary linked list
- **-----------------------------------------------------------
- */
-{
- int i,j,n;
- double x;
- SFloatlist *xFloatList, *yFloatList;
- STmplist *coordinateList;
-
- /* Start at head of coordinate list */
- coordinateList = Coordlist;
-
- /* Traverse list of coordinates */
- while (coordinateList != NULL)
- {
- // BAD! ---> i = coordinateList->i;
- i = findnode(coordinateList->ID);
- if (i >= 1 && i <= MaxNodes)
- {
- /* Save coordinate ID */
- strcpy(Coord[i].ID, coordinateList->ID);
-
- n = 1; //Coord[i].Npts
-
- /* Traverse list of x,y data */
- x = BIG;
- xFloatList = coordinateList->x;
- yFloatList = coordinateList->y;
- j = n - 1;
- while (xFloatList != NULL && yFloatList != NULL && j >= 0)
- {
-
- /* Check that x data is in ascending order */
- if (xFloatList->value >= x)
- {
- sprintf(Msg,ERR230,coordinateList->ID);
- writeline(Msg);
- return(200);
- }
- x = xFloatList->value;
-
- /* Save x,y data in Curve structure */
- Coord[i].X[j] = xFloatList->value;
- xFloatList = xFloatList->next;
- Coord[i].Y[j] = yFloatList->value;
- yFloatList = yFloatList->next;
- j--;
- }
- }
- coordinateList = coordinateList->next;
- }
- return(0);
-}
-
int findmatch(char *line, char *keyword[])
/*
diff --git a/src/input3.c b/src/input3.c
index d0922f6..4ab3487 100755
--- a/src/input3.c
+++ b/src/input3.c
@@ -42,8 +42,6 @@ extern char *Fldname[];
extern char *Tok[MAXTOKS];
extern STmplist *PrevPat;
extern STmplist *PrevCurve;
-
-extern STmplist *PrevCoord;
extern int Ntokens;
@@ -591,46 +589,24 @@ int coordata()
**--------------------------------------------------------------
*/
{
- double x,y;
- SFloatlist *fx, *fy;
- STmplist *c;
+ double x, y;
+ int j;
- /* Check for valid curve ID */
+ /* Check for valid node ID */
if (Ntokens < 3) return(201);
- if (
- PrevCoord != NULL &&
- strcmp(Tok[0],PrevCoord->ID) == 0
- ) c = PrevCoord;
- else c = findID(Tok[0],Coordlist);
-
- // c = findID(Tok[0],Coordlist);
- if (c == NULL) return(205);
-
- /* Check for valid data */
+ /* Check for valid data */
+ if ((j = findnode(Tok[0])) == 0) return(203);
if (!getfloat(Tok[1],&x)) return(202);
if (!getfloat(Tok[2],&y)) return(202);
-
- /* Add new data point to curve's linked list */
- fx = (SFloatlist *) malloc(sizeof(SFloatlist));
- fy = (SFloatlist *) malloc(sizeof(SFloatlist));
- if (fx == NULL || fy == NULL) return(101);
- fx->value = x;
- fx->next = c->x;
- c->x = fx;
- fy->value = y;
- fy->next = c->y;
- c->y = fy;
- //Curve[c->i].Npts++;
-
- /* Save the pointer to this curve */
- PrevCoord = c;
- return(0);
-
- /* Save coordn data */
- //Coord[Njuncs].X = x;
- //Coord[Njuncs].Y = y;
-
+
+ /* Save coord data */
+ strncpy(Coord[j].ID, Node[j].ID, MAXID);
+ Coord[j].X = x;
+ Coord[j].Y = y;
+ Coord[j].HaveCoords = TRUE;
+
+ return(0);
} /* end of coordata */
int demanddata()
@@ -1370,7 +1346,7 @@ int reportdata()
/* Check if input is a reporting criterion. */
/*** Special case needed to distinguish "HEAD" from "HEADLOSS" ***/ //(2.00.11 - LR)
- if (strcomp(Tok[0], w_HEADLOSS)) i = HEADLOSS; //(2.00.11 - LR)
+ if (strcomp(Tok[0], t_HEADLOSS)) i = HEADLOSS;
else i = findmatch(Tok[0],Fldname); //(2.00.11 - LR)
if (i >= 0) //(2.00.11 - LR)
/*****************************************************************/ //(2.00.11 - LR)
diff --git a/src/quality.c b/src/quality.c
index be9193d..ac11d3d 100755
--- a/src/quality.c
+++ b/src/quality.c
@@ -222,7 +222,8 @@ int runqual(long *t)
long hydtime; /* Hydraulic solution time */
long hydstep; /* Hydraulic time step */
int errcode = 0;
-
+ int i;
+
/* Update reported simulation time */
*t = Qtime;
@@ -236,11 +237,11 @@ int runqual(long *t)
}
else {
// stepwise calculation - hydraulic results are already in memory
- for (int i=1; i<= Ntanks; ++i) {
+ for (i=1; i<= Ntanks; ++i) {
QTankVolumes[i-1] = Tank[i].V;
}
- for (int i=1; i<= Nlinks; ++i)
+ for (i=1; i<= Nlinks; ++i)
{
if (LinkStatus[i] <= CLOSED) {
QLinkFlow[i-1] = Q[i];
@@ -251,11 +252,11 @@ int runqual(long *t)
}
else {
// stepwise calculation
- for (int i=1; i<= Ntanks; ++i) {
+ for (i=1; i<= Ntanks; ++i) {
QTankVolumes[i-1] = Tank[i].V;
}
- for (int i=1; i<= Nlinks; ++i)
+ for (i=1; i<= Nlinks; ++i)
{
if (LinkStatus[i] <= CLOSED) {
QLinkFlow[i-1] = Q[i];
@@ -281,7 +282,9 @@ int nextqual(long *tstep)
{
long hydstep; /* Hydraulic solution time step */
int errcode = 0;
-
+ double *tankVolumes;
+ int i;
+
/* Determine time step */
*tstep = 0;
@@ -290,19 +293,17 @@ int nextqual(long *tstep)
if (Htime <= Dur) hydstep = Htime - Qtime;
else hydstep = 0;
- double *tankVolumes;
-
// if we're operating in stepwise mode, capture the tank levels so we can restore them later.
if (OpenHflag) {
tankVolumes = calloc(Ntanks, sizeof(double));
- for (int i=1; i<=Ntanks; ++i) {
+ for (i=1; i<=Ntanks; ++i) {
if (Tank[i].A != 0) { // skip reservoirs
tankVolumes[i-1] = Tank[i].V;
}
}
// restore the previous step's tank volumes
- for (int i=1; i<=Ntanks; i++) {
+ for (i=1; i<=Ntanks; i++) {
if (Tank[i].A != 0) { // skip reservoirs again
int n = Tank[i].Node;
Tank[i].V = QTankVolumes[i-1];
@@ -311,7 +312,7 @@ int nextqual(long *tstep)
}
// restore the previous step's pipe link flows
- for (int i=1; i<=Nlinks; i++) {
+ for (i=1; i<=Nlinks; i++) {
if (LinkStatus[i] <= CLOSED) {
Q[i] = 0.0;
}
@@ -332,7 +333,7 @@ int nextqual(long *tstep)
// restore tank levels to post-runH state, if needed.
if (OpenHflag) {
- for (int i=1; i<=Ntanks; i++) {
+ for (i=1; i<=Ntanks; i++) {
if (Tank[i].A != 0) { // skip reservoirs again
int n = Tank[i].Node;
Tank[i].V = tankVolumes[i-1];
@@ -340,7 +341,7 @@ int nextqual(long *tstep)
}
}
- for (int i=1; i<=Nlinks; ++i) {
+ for (i=1; i<=Nlinks; ++i) {
if (LinkStatus[i] <= CLOSED) {
Q[i] = QLinkFlow[i-1];
}
diff --git a/src/testLemonTiger.cpp b/src/testLemonTiger.cpp
deleted file mode 100755
index 0863e9a..0000000
--- a/src/testLemonTiger.cpp
+++ /dev/null
@@ -1,332 +0,0 @@
-#include