Merge branch 'dev-2.1'
This commit is contained in:
23
.gitignore
vendored
23
.gitignore
vendored
@@ -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
|
||||
@@ -39,6 +44,11 @@ xcuserdata
|
||||
*.dat
|
||||
*.dep
|
||||
|
||||
*.xcodeproj/
|
||||
!*.xcodeproj/project.pbxproj
|
||||
|
||||
|
||||
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
@@ -52,6 +62,7 @@ xcuserdata
|
||||
[Dd]ebug/
|
||||
[Rr]elease/
|
||||
x64/
|
||||
build/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
|
||||
@@ -95,6 +106,7 @@ ipch/
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.idb
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
@@ -184,6 +196,9 @@ Desktop.ini
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# CMake temp files
|
||||
build/CMake/*
|
||||
!build/CMake/CMakeLists.txt
|
||||
|
||||
*.xcuserstate
|
||||
|
||||
# WindSDK compiled folders
|
||||
build/WinSDK/32bit/
|
||||
build/WinSDK/64bit/
|
||||
|
||||
9
.mailmap
Normal file
9
.mailmap
Normal file
@@ -0,0 +1,9 @@
|
||||
Sam Hatchett <samhatchett@gmail.com>
|
||||
James Uber <jim@citilogics.com>
|
||||
Demetrios Eliades <eldemet@gmail.com>
|
||||
Hyoungmin Woo <hyoungmin.woo@gmail.com>
|
||||
Hyoungmin Woo <hyoungmin.woo@gmail.com> <woohn@mail.uc.edu>
|
||||
Yunier Soad <yunier.soad@gmail.com>
|
||||
Jinduan Chen <jinduan.uc@gmail.com>
|
||||
Maurizio Cingi <mrzcng2@gmail.com>
|
||||
Elad Salomons <selad@optiwater.com> <elad.salomons@gmail.com>
|
||||
12
.travis.yml
Normal file
12
.travis.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
language: c
|
||||
|
||||
before_script:
|
||||
- cd build/CMake
|
||||
- mkdir buildproducts
|
||||
- cd buildproducts
|
||||
- cmake ..
|
||||
|
||||
script:
|
||||
- make
|
||||
- cd ../../../tests
|
||||
- ./test_networks.sh
|
||||
20
AUTHORS
Normal file
20
AUTHORS
Normal file
@@ -0,0 +1,20 @@
|
||||
# Authors ordered by first contribution.
|
||||
# Generated by tools/update-authors.sh
|
||||
|
||||
Lew Rossman <LRossman@cinci.rr.com>
|
||||
Michael Tryby <tryby.michael@epa.gov>
|
||||
Sam Hatchett <samhatchett@gmail.com>
|
||||
Feng Shang <fshang>
|
||||
James Uber <jim@citilogics.com>
|
||||
Tom Taxon <tntaxon@anl.gov>
|
||||
Hyoungmin Woo <hyoungmin.woo@gmail.com>
|
||||
Jinduan Chen <jinduan.uc@gmail.com>
|
||||
Yunier Soad <yunier.soad@gmail.com>
|
||||
Mike Kane <muke195@gmail.com>
|
||||
Demetrios Eliades <eldemet@gmail.com>
|
||||
Will Furnass <will@thearete.co.uk>
|
||||
Steffen Macke <sdteffen@sdteffen.de>
|
||||
Mariosmsk <mariosmsk@gmail.com>
|
||||
Elad Salomons <selad@optiwater.com>
|
||||
Maurizio Cingi <mrzcng2@gmail.com>
|
||||
Bryant McDonnell <bemcdonnell@gmail.com>
|
||||
@@ -1,12 +1,16 @@
|
||||
EPANET
|
||||
EPANET {#epanet-readme}
|
||||
======
|
||||
|
||||
[](https://travis-ci.org/OpenWaterAnalytics/EPANET)
|
||||
|
||||
The EPANET Library is a pressurized pipe network hydraulic and water quality analysis toolkit written in C.
|
||||
|
||||
If you are interested in using/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).
|
||||
|
||||
Please see the [`version 2.1` Roadmap](https://github.com/OpenWaterAnalytics/EPANET/milestones/v2.1) for ongoing areas of development. If you would like to contribute by addressing any of the outstanding [Issues](https://github.com/OpenWaterAnalytics/EPANET/issues), then please comment on the Issue, then Fork this repo to your own account and base your commits on the [`dev-2.1` branch](https://github.com/OpenWaterAnalytics/EPANET/tree/dev-2.1). Once you are finished, you can open a Pull Request to test the code and discuss merging your changes back into the community respository.
|
||||
|
||||
|
||||
__Note:__ This repository is not affiliated with, or endorsed by, the USEPA. For the "official" release of EPANET (2.00.12 UI and Toolkit) please go to the [EPA's GitHub repo](https://github.com/USEPA/Water-Distribution-Network-Model) or [the USEPA website](http://www2.epa.gov/water-research/epanet). It is also not the graphical user interface version. This is the hydraulic and water quality solver engine.
|
||||
|
||||
However, if you are interested in extending EPANET for academic, personal, or commercial use, then you've come to the right place. For community discussion, FAQ, and roadmapping of the project, go to the [Community Forum](http://community.wateranalytics.org/category/epanet).
|
||||
|
||||
Please see the [`version 2.1` Roadmap](https://github.com/OpenWaterAnalytics/EPANET/milestones/v2.1) for ongoing areas of development. If you would like to contribute by addressing any of the outstanding [Issues](https://github.com/OpenWaterAnalytics/EPANET/issues), then please comment on the Issue, then Fork this repo to your own account and base your commits on the [`dev-2.1` branch](https://github.com/OpenWaterAnalytics/EPANET/tree/dev-2.1). Once you are finished, you can open a Pull Request to test the code and discuss merging your changes back into the community respository.
|
||||
|
||||
103
ReleaseNotes2_1.md
Normal file
103
ReleaseNotes2_1.md
Normal file
@@ -0,0 +1,103 @@
|
||||
Release Notes for EPANET 2.1 {#release_2_1}
|
||||
============================
|
||||
|
||||
The last update to the EPANET engine was "Build 2.00.12" in February of 2008. Since that time, a community effort to update and extend the open-source code has emerged. This group has made a number of bug-fixes and API additions that help to improve the EPANET engine for everyone. Version 2.1 is now released after 8.5 years.
|
||||
|
||||
Contributors to this version (listed in order of first contribution):
|
||||
|
||||
- Lew Rossman
|
||||
- Michael Tryby
|
||||
- Feng Shang
|
||||
- James Uber
|
||||
- Tom Taxon
|
||||
- Sam Hatchett
|
||||
- Hyoungmin Woo
|
||||
- Jinduan Chen
|
||||
- Yunier Soad
|
||||
- Mike Kane
|
||||
- Demetrios Eliades
|
||||
- Will Furnass
|
||||
- Steffen Macke
|
||||
- Mariosmsk
|
||||
- Elad Salomons
|
||||
- Maurizio Cingi
|
||||
- Bryant McDonnell
|
||||
|
||||
##API Additions (new functions):
|
||||
- `ENgetaveragepatternvalue`
|
||||
- `ENgetstatistic`
|
||||
- `ENgetcoord / ENsetcoord`
|
||||
- `ENgetpumptype`
|
||||
- `ENgetqualinfo`
|
||||
|
||||
###Demands
|
||||
- `ENgetnumdemands`
|
||||
- `ENgetbasedemand / ENsetbasedemand`
|
||||
- `ENgetdemandpattern`
|
||||
|
||||
###Curves
|
||||
- `ENgetcurve`
|
||||
- `ENgetcurveid`
|
||||
- `ENgetcurvelen`
|
||||
- `ENgetcurvevalue`
|
||||
- `ENsetcurvevalue`
|
||||
- `ENsetcurve`
|
||||
- `ENaddcurve`
|
||||
- `ENgetheadcurveindex`
|
||||
- `ENgetcurveindex`
|
||||
|
||||
|
||||
##API Extensions (additional parameters)
|
||||
###node value types:
|
||||
- `EN_TANKVOLUME`
|
||||
- `EN_MAXVOLUME`
|
||||
|
||||
###link value types:
|
||||
- `EN_LINKQUAL`
|
||||
- `EN_LINKPATTERN`
|
||||
|
||||
###time parameters:
|
||||
- `EN_STARTTIME`
|
||||
- `EN_HTIME`
|
||||
- `EN_QTIME`
|
||||
- `EN_HALTFLAG`
|
||||
- `EN_NEXTEVENT`
|
||||
|
||||
###(new) statistic values:
|
||||
- `EN_ITERATIONS`
|
||||
- `EN_RELATIVEERROR`
|
||||
|
||||
###pump types
|
||||
- `EN_CONST_HP`
|
||||
- `EN_POWER_FUNC`
|
||||
- `EN_CUSTOM`
|
||||
|
||||
##Notable Performance Improvements, Bug Fixes, Usage Features, and other notes
|
||||
- API float type is a compile-time option with the `EN_API_FLOAT_TYPE` definition. Use either `float` or `double` - default if left undefined is `float` to maintain compatibility with 2.0.x
|
||||
- updated hash table algorithm
|
||||
- fixed memory leak when saving output
|
||||
- enables interleaved hydraulic and water quality analysis steps:
|
||||
|
||||
```
|
||||
ENopenH();
|
||||
ENinitH(0);
|
||||
ENinitQ(EN_NOSAVE);
|
||||
do {
|
||||
ENrunH(&t);
|
||||
ENrunQ(&qt);
|
||||
ENnextQ(&qstep);
|
||||
// collect results
|
||||
ENnextH(&tstep);
|
||||
} while (tstep > 0);
|
||||
ENcloseQ();
|
||||
ENcloseH();
|
||||
```
|
||||
|
||||
- engine code and command-line executable are now in separate implementation files
|
||||
- parameter `#define` directives are now enumerated values
|
||||
- main header now contains doxygen-compatible comment blocks for auto-generated documentation
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
28
build/CMake/CMakeLists.txt
Normal file
28
build/CMake/CMakeLists.txt
Normal file
@@ -0,0 +1,28 @@
|
||||
## 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)
|
||||
|
||||
IF(APPLE)
|
||||
SET(CMAKE_INSTALL_NAME_DIR @executable_path)
|
||||
SET(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
|
||||
ENDIF(APPLE)
|
||||
|
||||
# the library
|
||||
include_directories(../../include)
|
||||
file(GLOB EPANET_SOURCES ../../src/*.c)
|
||||
add_library(epanet STATIC ${EPANET_SOURCES})
|
||||
|
||||
# the standalone executable
|
||||
include_directories(../../src)
|
||||
add_executable(runepanet ../../run/main.c)
|
||||
target_link_libraries (runepanet LINK_PUBLIC epanet m)
|
||||
|
||||
# the binary hydraulics file API
|
||||
include_directories(../../tools/outputapi)
|
||||
add_library(ENBinaryOut SHARED ../../tools/outputapi/outputapi.c)
|
||||
@@ -41,10 +41,13 @@ runcmdname = runepanet2.sh
|
||||
epanetincludedir = ../../include
|
||||
# Search path for sources
|
||||
epanetsrcdir = ../../src
|
||||
VPATH = $(epanetsrcdir):$(epanetincludedir)
|
||||
epanetrundir = ../../run
|
||||
VPATH = $(epanetsrcdir):$(epanetincludedir):$(epanetrundir)
|
||||
|
||||
# Install directories
|
||||
#prefix = /usr/local # GNU standard -- requires superuser rights
|
||||
prefix =~
|
||||
#
|
||||
exec_prefix = $(prefix)
|
||||
libdir = $(exec_prefix)/lib
|
||||
bindir = $(exec_prefix)/bin
|
||||
@@ -66,11 +69,11 @@ INSTALL_DATA = $(INSTALL) -m 644
|
||||
# Files for the shared object library
|
||||
epanet_objs=hash.o hydraul.o inpfile.o input1.o input2.o \
|
||||
input3.o mempool.o output.o quality.o report.o \
|
||||
rules.o smatrix.o
|
||||
rules.o smatrix.o epanet.o
|
||||
# Epanet header files
|
||||
epanet_heads=enumstxt.h funcs.h hash.h mempool.h text.h toolkit.h types.h vars.h
|
||||
epanet_heads=enumstxt.h funcs.h hash.h mempool.h text.h types.h vars.h
|
||||
# Epanet main program
|
||||
epanet_main=epanet
|
||||
epanet_main=main
|
||||
# Epanet main program header files
|
||||
epanet_main_heads=epanet2.h
|
||||
|
||||
@@ -78,11 +81,9 @@ epanet_main_heads=epanet2.h
|
||||
all: $(libname) $(exename)
|
||||
|
||||
$(libname): $(epanet_objs)
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -D SOL -c $(epanetsrcdir)/$(epanet_main).c
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $(epanet_main).o $^
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^
|
||||
|
||||
$(exename): $(libname) $(epanet_main_heads)
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -D CLE -c $(epanetsrcdir)/$(epanet_main).c
|
||||
$(exename): $(epanet_main).o $(epanet_main_heads)
|
||||
$(CC) $(CFLAGS) -o $@ $(epanet_main).o -l$(epanetrootname) $(LDFLAGS)
|
||||
|
||||
$(epanet_objs): $(epanet_heads)
|
||||
@@ -95,7 +96,7 @@ install:
|
||||
$(INSTALL_PROGRAM) -D $(exename) $(bindir)/$(exename)
|
||||
$(INSTALL_PROGRAM) -D $(libname) $(libdir)/$(libname)
|
||||
$(INSTALL_DATA) -D $(epanetincludedir)/epanet2.h $(includedir)/epanet2.h
|
||||
$(INSTALL_PROGRAM) -D $(runcmdname) $(bindir)/$(runcmdname)
|
||||
$(INSTALL_PROGRAM) -D $(runcmdname) ~/$(runcmdname)
|
||||
|
||||
.PHONY: uninstall
|
||||
uninstall:
|
||||
|
||||
3
build/Linux/runepanet.sh.template
Normal file
3
build/Linux/runepanet.sh.template
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
export LD_LIBRARY_PATH=libdir:$LD_LIBRARY_PATH
|
||||
exec exename $*
|
||||
@@ -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
|
||||
@@ -1,105 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\enumstxt.h" />
|
||||
<ClInclude Include="src\funcs.h" />
|
||||
<ClInclude Include="src\hash.h" />
|
||||
<ClInclude Include="src\lemontiger.h" />
|
||||
<ClInclude Include="src\mempool.h" />
|
||||
<ClInclude Include="src\text.h" />
|
||||
<ClInclude Include="src\toolkit.h" />
|
||||
<ClInclude Include="src\types.h" />
|
||||
<ClInclude Include="src\vars.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\epanet.c" />
|
||||
<ClCompile Include="src\hash.c" />
|
||||
<ClCompile Include="src\hydraul.c" />
|
||||
<ClCompile Include="src\inpfile.c" />
|
||||
<ClCompile Include="src\input1.c" />
|
||||
<ClCompile Include="src\input2.c" />
|
||||
<ClCompile Include="src\input3.c" />
|
||||
<ClCompile Include="src\lemontiger.c" />
|
||||
<ClCompile Include="src\mempool.c" />
|
||||
<ClCompile Include="src\output.c" />
|
||||
<ClCompile Include="src\quality.c" />
|
||||
<ClCompile Include="src\report.c" />
|
||||
<ClCompile Include="src\rules.c" />
|
||||
<ClCompile Include="src\smatrix.c" />
|
||||
<ClCompile Include="src\testLT.c" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{4B66D9F0-407B-4995-B625-1CA1B72662C6}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>.\include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
78
build/MinGW/Makefile
Normal file
78
build/MinGW/Makefile
Normal file
@@ -0,0 +1,78 @@
|
||||
# MINGW32 Makefile for EPANET
|
||||
|
||||
# This will build EPANET as DLL
|
||||
# (epanet2.dll) under MINGW32 GCC, and a standalone
|
||||
# executable (epanet2d.exe).
|
||||
|
||||
# The following targets are defined:
|
||||
# make
|
||||
# -Builds epanet2.dll, epanet2d.exe
|
||||
# make install
|
||||
# -Copy epanet2.dll, epanet2d.exe, epanet2.def to $(prefix)
|
||||
# make clean
|
||||
# -Removes object and library files, returning the build directory
|
||||
# to its pristine state.
|
||||
|
||||
# You may wish to change the install path 'prefix',
|
||||
# or the compiler flags, but these defaults should be fine.
|
||||
|
||||
|
||||
# Target filenames
|
||||
epanetrootname := epanet2
|
||||
libname := $(epanetrootname).dll
|
||||
exename := $(epanetrootname)d.exe
|
||||
|
||||
# Location of EPANET toolkit includes
|
||||
epanetincludedir = ../../include
|
||||
# Search path for sources
|
||||
epanetsrcdir = ../../src
|
||||
# Search path for sources
|
||||
epanetmainsrcdir = ../../run
|
||||
VPATH = $(epanetsrcdir):$(epanetincludedir):$(epanetmainsrcdir)
|
||||
|
||||
# Install directories
|
||||
prefix = C:\discoD\EPA\EPAnet_util
|
||||
execdir = $(prefix)
|
||||
libdir = $(prefix)
|
||||
|
||||
|
||||
# Compiler and flags
|
||||
CC = gcc
|
||||
CFLAGS = -g -O3 -std=c99 -Wno-implicit-function-declaration -D DLL
|
||||
CPPFLAGS = -I $(epanetincludedir) -I $(epanetsrcdir)
|
||||
LDFLAGS = -L . -Wl,--kill-at,--enable-stdcall-fixup,-rpath,$(libdir) -lm
|
||||
|
||||
|
||||
# Files for the shared object library
|
||||
epanet_objs=hash.o hydraul.o inpfile.o input1.o input2.o \
|
||||
input3.o mempool.o output.o quality.o report.o \
|
||||
rules.o smatrix.o epanet.o
|
||||
# Epanet header files
|
||||
epanet_heads=enumstxt.h funcs.h hash.h mempool.h text.h types.h vars.h epanet2.h
|
||||
# Epanet main program
|
||||
epanet_main=main
|
||||
# Epanet main program header files
|
||||
epanet_main_heads=epanet2.h
|
||||
|
||||
.PHONY: all
|
||||
all: $(libname) $(exename)
|
||||
|
||||
$(libname): $(epanet_objs)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -Wl,--output-def,$(epanetrootname).def
|
||||
|
||||
$(exename): $(epanet_main_heads) $(libname) $(epanet_main).o
|
||||
$(CC) $(CFLAGS) -o $@ $(epanet_main).o -l$(epanetrootname) $(LDFLAGS)
|
||||
|
||||
$(epanet_objs): $(epanet_heads)
|
||||
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
del $(epanet_main).o $(epanet_objs) $(exename) $(libname) $(epanetrootname).def
|
||||
|
||||
.PHONY: install
|
||||
install:
|
||||
copy $(exename) $(execdir)
|
||||
copy $(libname) $(libdir)
|
||||
copy $(epanetrootname).def $(libdir)
|
||||
|
||||
54
build/WinSDK/Makefile.bat
Normal file
54
build/WinSDK/Makefile.bat
Normal file
@@ -0,0 +1,54 @@
|
||||
rem : set path to Windows SDK
|
||||
Set Reg.Key=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows
|
||||
Set Reg.Val=CurrentInstallFolder
|
||||
Set Build_PATH=%CD%
|
||||
|
||||
rem : set path for source EPANET files
|
||||
cd ..\..\include
|
||||
Set H_PATH=%CD%
|
||||
cd ..\src
|
||||
Set SRC_PATH=%CD%
|
||||
|
||||
rem : set Windows SDK Path from registry
|
||||
For /F "Tokens=2*" %%A In ('Reg Query "%Reg.Key%" /v "%Reg.Val%" ^| Find /I "%Reg.Val%"' ) Do Call Set SDK_PATH=%%B
|
||||
|
||||
|
||||
rem : 64 bit
|
||||
rem : check pc architecture
|
||||
Set Reg.Qry=HKLM\Hardware\Description\System\CentralProcessor\0
|
||||
REG.exe Query %Reg.Qry% > checkOS.tmp
|
||||
Find /i "x86" < checkOS.tmp > StringCheck.tmp
|
||||
If %ERRORLEVEL% == 1 (
|
||||
CALL "%SDK_PATH%bin\"SetEnv.cmd /x64 /release
|
||||
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
|
||||
md "%Build_PATH%"\64bit
|
||||
move /y "%SRC_PATH%"\*.dll "%Build_PATH%"\64bit
|
||||
move /y "%SRC_PATH%"\*.exe "%Build_PATH%"\64bit
|
||||
copy "%H_PATH%"\*.h "%Build_PATH%"\64bit
|
||||
)
|
||||
|
||||
|
||||
rem : 32 bit with DEF
|
||||
CALL "%SDK_PATH%bin\"SetEnv.cmd /x86 /release
|
||||
echo "32 bit with epanet2.def mapping"
|
||||
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
|
||||
md "%Build_PATH%"\32bit
|
||||
move /y "%SRC_PATH%"\*.dll "%Build_PATH%"\32bit
|
||||
move /y "%SRC_PATH%"\*.exe "%Build_PATH%"\32bit
|
||||
|
||||
|
||||
rem : a bit of housekeeping and cleaning
|
||||
del "%SRC_PATH%"\*.obj
|
||||
del "%SRC_PATH%"\*.exp
|
||||
del "%SRC_PATH%"\*.lib
|
||||
del "%SRC_PATH%"\*.map
|
||||
del "%SRC_PATH%"\*.tmp
|
||||
|
||||
cd "%Build_PATH%"
|
||||
|
||||
@@ -59,6 +59,19 @@ EXPORTS
|
||||
ENgetnumdemands = _ENgetnumdemands@8
|
||||
ENgetbasedemand = _ENgetbasedemand@12
|
||||
ENgetdemandpattern = _ENgetdemandpattern@12
|
||||
ENgetcurve = _ENgetcurve@16
|
||||
ENgetheadcurve = _ENgetheadcurve@8
|
||||
ENgetcurve = _ENgetcurve@20
|
||||
ENgetstatistic = _ENgetstatistic@8
|
||||
ENgetcoord = _ENgetcoord@12
|
||||
ENsetcoord = _ENsetcoord@12
|
||||
ENgetqualinfo = _ENgetqualinfo@16
|
||||
ENsetbasedemand = _ENsetbasedemand@12
|
||||
ENgetaveragepatternvalue = _ENgetaveragepatternvalue@8
|
||||
ENgetheadcurveindex = _ENgetheadcurveindex@8
|
||||
ENgetpumptype = _ENgetpumptype@8
|
||||
ENgetcurveindex = _ENgetcurveindex@8
|
||||
ENgetcurveid = _ENgetcurveid@8
|
||||
ENgetcurvelen = _ENgetcurvelen@8
|
||||
ENgetcurvevalue = _ENgetcurvevalue@16
|
||||
ENsetcurvevalue = _ENsetcurvevalue@16
|
||||
ENsetcurve = _ENsetcurve@16
|
||||
ENaddcurve = _ENaddcurve@4
|
||||
@@ -7,6 +7,24 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
223109E61BA865930030AAE8 /* Net3.inp in CopyFiles */ = {isa = PBXBuildFile; fileRef = 223109E31BA8658A0030AAE8 /* Net3.inp */; };
|
||||
223109EB1BA869DA0030AAE8 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 22CD9A5D1B27898E00B65E83 /* main.c */; };
|
||||
223109ED1BA869DA0030AAE8 /* libepanet-static.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2255753B17551217009946B1 /* libepanet-static.a */; };
|
||||
223109EF1BA869DA0030AAE8 /* Net3.inp in CopyFiles */ = {isa = PBXBuildFile; fileRef = 223109E31BA8658A0030AAE8 /* Net3.inp */; };
|
||||
223109F61BA869F30030AAE8 /* epanet.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F711068369500641384 /* epanet.c */; };
|
||||
223109F71BA869F30030AAE8 /* hash.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F731068369500641384 /* hash.c */; };
|
||||
223109F81BA869F30030AAE8 /* hydraul.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F751068369500641384 /* hydraul.c */; };
|
||||
223109F91BA869F30030AAE8 /* inpfile.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F761068369500641384 /* inpfile.c */; };
|
||||
223109FA1BA869F30030AAE8 /* input1.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F771068369500641384 /* input1.c */; };
|
||||
223109FB1BA869F30030AAE8 /* input2.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F781068369500641384 /* input2.c */; };
|
||||
223109FC1BA869F30030AAE8 /* input3.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F791068369500641384 /* input3.c */; };
|
||||
223109FD1BA869F30030AAE8 /* mempool.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F7A1068369500641384 /* mempool.c */; };
|
||||
223109FE1BA869F30030AAE8 /* output.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F7C1068369500641384 /* output.c */; };
|
||||
223109FF1BA869F30030AAE8 /* quality.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F7D1068369500641384 /* quality.c */; };
|
||||
22310A001BA869F30030AAE8 /* report.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F7E1068369500641384 /* report.c */; };
|
||||
22310A011BA869F30030AAE8 /* rules.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F7F1068369500641384 /* rules.c */; };
|
||||
22310A021BA869F30030AAE8 /* smatrix.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F801068369500641384 /* smatrix.c */; };
|
||||
22310A051BA869F30030AAE8 /* epanet2.h in Headers */ = {isa = PBXBuildFile; fileRef = 22322FA9106836B000641384 /* epanet2.h */; };
|
||||
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 */; };
|
||||
@@ -27,19 +45,6 @@
|
||||
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 */; };
|
||||
22322F9A1068369500641384 /* epanet.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F711068369500641384 /* epanet.c */; };
|
||||
22322F9B1068369500641384 /* hash.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F731068369500641384 /* hash.c */; };
|
||||
22322F9C1068369500641384 /* hydraul.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F751068369500641384 /* hydraul.c */; };
|
||||
22322F9D1068369500641384 /* inpfile.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F761068369500641384 /* inpfile.c */; };
|
||||
22322F9E1068369500641384 /* input1.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F771068369500641384 /* input1.c */; };
|
||||
22322F9F1068369500641384 /* input2.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F781068369500641384 /* input2.c */; };
|
||||
22322FA01068369500641384 /* input3.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F791068369500641384 /* input3.c */; };
|
||||
22322FA11068369500641384 /* mempool.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F7A1068369500641384 /* mempool.c */; };
|
||||
22322FA21068369500641384 /* output.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F7C1068369500641384 /* output.c */; };
|
||||
22322FA31068369500641384 /* quality.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F7D1068369500641384 /* quality.c */; };
|
||||
22322FA41068369500641384 /* report.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F7E1068369500641384 /* report.c */; };
|
||||
22322FA51068369500641384 /* rules.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F7F1068369500641384 /* rules.c */; };
|
||||
22322FA61068369500641384 /* smatrix.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F801068369500641384 /* smatrix.c */; };
|
||||
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 */; };
|
||||
@@ -54,51 +59,111 @@
|
||||
2255754917551234009946B1 /* report.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F7E1068369500641384 /* report.c */; };
|
||||
2255754A17551234009946B1 /* rules.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F7F1068369500641384 /* rules.c */; };
|
||||
2255754B17551234009946B1 /* smatrix.c in Sources */ = {isa = PBXBuildFile; fileRef = 22322F801068369500641384 /* smatrix.c */; };
|
||||
225762C51C068A3900484EC7 /* Net1.inp in CopyFiles */ = {isa = PBXBuildFile; fileRef = 225762C31C068A2A00484EC7 /* Net1.inp */; };
|
||||
225762C61C068A3B00484EC7 /* Net2.inp in CopyFiles */ = {isa = PBXBuildFile; fileRef = 225762C41C068A2A00484EC7 /* Net2.inp */; };
|
||||
226537E0179EDEEB00258C60 /* epanet2.h in Headers */ = {isa = PBXBuildFile; fileRef = 22322FA9106836B000641384 /* epanet2.h */; };
|
||||
22CD9A5E1B27898E00B65E83 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 22CD9A5D1B27898E00B65E83 /* main.c */; };
|
||||
22CD9A611B278BB900B65E83 /* libepanet-static.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2255753B17551217009946B1 /* libepanet-static.a */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
22322FAF1068370B00641384 /* PBXContainerItemProxy */ = {
|
||||
223109E91BA869DA0030AAE8 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = D2AAC0620554660B00DB518D;
|
||||
remoteInfo = epanet;
|
||||
remoteGlobalIDString = 2255753A17551217009946B1;
|
||||
remoteInfo = "epanet-static";
|
||||
};
|
||||
22CD9A5F1B278B0400B65E83 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 2255753A17551217009946B1;
|
||||
remoteInfo = "epanet-static";
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
223109E11BA865690030AAE8 /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 6;
|
||||
files = (
|
||||
223109E61BA865930030AAE8 /* Net3.inp in CopyFiles */,
|
||||
225762C51C068A3900484EC7 /* Net1.inp in CopyFiles */,
|
||||
225762C61C068A3B00484EC7 /* Net2.inp in CopyFiles */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
223109EE1BA869DA0030AAE8 /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 6;
|
||||
files = (
|
||||
223109EF1BA869DA0030AAE8 /* Net3.inp in CopyFiles */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
223109E31BA8658A0030AAE8 /* Net3.inp */ = {isa = PBXFileReference; lastKnownFileType = text; name = Net3.inp; path = "../../example-networks/Net3.inp"; sourceTree = "<group>"; };
|
||||
223109F31BA869DA0030AAE8 /* runepanet copy */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "runepanet copy"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
22310A091BA869F30030AAE8 /* libepanet-static copy.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libepanet-static copy.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
22322F66106833BB00641384 /* runepanet */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = runepanet; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
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; };
|
||||
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; };
|
||||
225762C31C068A2A00484EC7 /* Net1.inp */ = {isa = PBXFileReference; lastKnownFileType = text; name = Net1.inp; path = "../../example-networks/Net1.inp"; sourceTree = "<group>"; };
|
||||
225762C41C068A2A00484EC7 /* Net2.inp */ = {isa = PBXFileReference; lastKnownFileType = text; name = Net2.inp; path = "../../example-networks/Net2.inp"; sourceTree = "<group>"; };
|
||||
22CD9A5D1B27898E00B65E83 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = main.c; path = ../../run/main.c; sourceTree = "<group>"; };
|
||||
22E107B21C163E5300689CED /* outputapi.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = outputapi.c; path = ../../tools/outputapi/outputapi.c; sourceTree = "<group>"; };
|
||||
22E107B31C163E5300689CED /* outputapi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = outputapi.h; path = ../../tools/outputapi/outputapi.h; sourceTree = "<group>"; };
|
||||
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 */
|
||||
223109EC1BA869DA0030AAE8 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
223109ED1BA869DA0030AAE8 /* libepanet-static.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
22310A031BA869F30030AAE8 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
22322F64106833BB00641384 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
22CD9A611B278BB900B65E83 /* libepanet-static.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -122,6 +187,9 @@
|
||||
08FB7794FE84155DC02AAC07 /* epanet */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
22E107B11C163E3B00689CED /* Output API */,
|
||||
223109E21BA865790030AAE8 /* sample networks */,
|
||||
22CD9A5C1B27896200B65E83 /* run epanet */,
|
||||
22322FA8106836A000641384 /* Include */,
|
||||
08FB7795FE84155DC02AAC07 /* Source */,
|
||||
1AB674ADFE9D54B511CA2CBB /* Products */,
|
||||
@@ -162,10 +230,22 @@
|
||||
D2AAC0630554660B00DB518D /* libepanet.dylib */,
|
||||
22322F66106833BB00641384 /* runepanet */,
|
||||
2255753B17551217009946B1 /* libepanet-static.a */,
|
||||
223109F31BA869DA0030AAE8 /* runepanet copy */,
|
||||
22310A091BA869F30030AAE8 /* libepanet-static copy.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
223109E21BA865790030AAE8 /* sample networks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
223109E31BA8658A0030AAE8 /* Net3.inp */,
|
||||
225762C31C068A2A00484EC7 /* Net1.inp */,
|
||||
225762C41C068A2A00484EC7 /* Net2.inp */,
|
||||
);
|
||||
name = "sample networks";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
22322FA8106836A000641384 /* Include */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -174,9 +254,34 @@
|
||||
name = Include;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
22CD9A5C1B27896200B65E83 /* run epanet */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
22CD9A5D1B27898E00B65E83 /* main.c */,
|
||||
);
|
||||
name = "run epanet";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
22E107B11C163E3B00689CED /* Output API */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
22E107B31C163E5300689CED /* outputapi.h */,
|
||||
22E107B21C163E5300689CED /* outputapi.c */,
|
||||
);
|
||||
name = "Output API";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
22310A041BA869F30030AAE8 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
22310A051BA869F30030AAE8 /* epanet2.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
2255753917551217009946B1 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -203,17 +308,53 @@
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
223109E71BA869DA0030AAE8 /* runepanet float-precision */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 223109F01BA869DA0030AAE8 /* Build configuration list for PBXNativeTarget "runepanet float-precision" */;
|
||||
buildPhases = (
|
||||
223109EA1BA869DA0030AAE8 /* Sources */,
|
||||
223109EC1BA869DA0030AAE8 /* Frameworks */,
|
||||
223109EE1BA869DA0030AAE8 /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
223109E81BA869DA0030AAE8 /* PBXTargetDependency */,
|
||||
);
|
||||
name = "runepanet float-precision";
|
||||
productName = runepanet;
|
||||
productReference = 223109F31BA869DA0030AAE8 /* runepanet copy */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
223109F41BA869F30030AAE8 /* epanet-static float-precision */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 22310A061BA869F30030AAE8 /* Build configuration list for PBXNativeTarget "epanet-static float-precision" */;
|
||||
buildPhases = (
|
||||
223109F51BA869F30030AAE8 /* Sources */,
|
||||
22310A031BA869F30030AAE8 /* Frameworks */,
|
||||
22310A041BA869F30030AAE8 /* Headers */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "epanet-static float-precision";
|
||||
productName = "epanet-static";
|
||||
productReference = 22310A091BA869F30030AAE8 /* libepanet-static copy.a */;
|
||||
productType = "com.apple.product-type.library.static";
|
||||
};
|
||||
22322F65106833BB00641384 /* runepanet */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 22322F6A106833E600641384 /* Build configuration list for PBXNativeTarget "runepanet" */;
|
||||
buildPhases = (
|
||||
22322F63106833BB00641384 /* Sources */,
|
||||
22322F64106833BB00641384 /* Frameworks */,
|
||||
223109E11BA865690030AAE8 /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
22322FB01068370B00641384 /* PBXTargetDependency */,
|
||||
22CD9A601B278B0400B65E83 /* PBXTargetDependency */,
|
||||
);
|
||||
name = runepanet;
|
||||
productName = runepanet;
|
||||
@@ -260,7 +401,7 @@
|
||||
08FB7793FE84155DC02AAC07 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0500;
|
||||
LastUpgradeCheck = 0630;
|
||||
};
|
||||
buildConfigurationList = 1DEB914E08733D8E0010E9CD /* Build configuration list for PBXProject "epanet" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
@@ -279,28 +420,46 @@
|
||||
D2AAC0620554660B00DB518D /* epanet */,
|
||||
22322F65106833BB00641384 /* runepanet */,
|
||||
2255753A17551217009946B1 /* epanet-static */,
|
||||
223109E71BA869DA0030AAE8 /* runepanet float-precision */,
|
||||
223109F41BA869F30030AAE8 /* epanet-static float-precision */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
223109EA1BA869DA0030AAE8 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
223109EB1BA869DA0030AAE8 /* main.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
223109F51BA869F30030AAE8 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
223109F61BA869F30030AAE8 /* epanet.c in Sources */,
|
||||
223109F71BA869F30030AAE8 /* hash.c in Sources */,
|
||||
223109F81BA869F30030AAE8 /* hydraul.c in Sources */,
|
||||
223109F91BA869F30030AAE8 /* inpfile.c in Sources */,
|
||||
223109FA1BA869F30030AAE8 /* input1.c in Sources */,
|
||||
223109FB1BA869F30030AAE8 /* input2.c in Sources */,
|
||||
223109FC1BA869F30030AAE8 /* input3.c in Sources */,
|
||||
223109FD1BA869F30030AAE8 /* mempool.c in Sources */,
|
||||
223109FE1BA869F30030AAE8 /* output.c in Sources */,
|
||||
223109FF1BA869F30030AAE8 /* quality.c in Sources */,
|
||||
22310A001BA869F30030AAE8 /* report.c in Sources */,
|
||||
22310A011BA869F30030AAE8 /* rules.c in Sources */,
|
||||
22310A021BA869F30030AAE8 /* smatrix.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
22322F63106833BB00641384 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
22322F9A1068369500641384 /* epanet.c in Sources */,
|
||||
22322F9B1068369500641384 /* hash.c in Sources */,
|
||||
22322F9C1068369500641384 /* hydraul.c in Sources */,
|
||||
22322F9D1068369500641384 /* inpfile.c in Sources */,
|
||||
22322F9E1068369500641384 /* input1.c in Sources */,
|
||||
22322F9F1068369500641384 /* input2.c in Sources */,
|
||||
22322FA01068369500641384 /* input3.c in Sources */,
|
||||
22322FA11068369500641384 /* mempool.c in Sources */,
|
||||
22322FA21068369500641384 /* output.c in Sources */,
|
||||
22322FA31068369500641384 /* quality.c in Sources */,
|
||||
22322FA41068369500641384 /* report.c in Sources */,
|
||||
22322FA51068369500641384 /* rules.c in Sources */,
|
||||
22322FA61068369500641384 /* smatrix.c in Sources */,
|
||||
22CD9A5E1B27898E00B65E83 /* main.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -347,10 +506,15 @@
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
22322FB01068370B00641384 /* PBXTargetDependency */ = {
|
||||
223109E81BA869DA0030AAE8 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = D2AAC0620554660B00DB518D /* epanet */;
|
||||
targetProxy = 22322FAF1068370B00641384 /* PBXContainerItemProxy */;
|
||||
target = 2255753A17551217009946B1 /* epanet-static */;
|
||||
targetProxy = 223109E91BA869DA0030AAE8 /* PBXContainerItemProxy */;
|
||||
};
|
||||
22CD9A601B278B0400B65E83 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 2255753A17551217009946B1 /* epanet-static */;
|
||||
targetProxy = 22CD9A5F1B278B0400B65E83 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
@@ -359,17 +523,11 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
EXECUTABLE_PREFIX = lib;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "EN_API_FLOAT_TYPE=double";
|
||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||
INSTALL_PATH = /usr/local/lib;
|
||||
PRODUCT_NAME = epanet;
|
||||
SDKROOT = "";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -377,28 +535,29 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
EXECUTABLE_PREFIX = lib;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "EN_API_FLOAT_TYPE=double";
|
||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||
INSTALL_PATH = /usr/local/lib;
|
||||
PRODUCT_NAME = epanet;
|
||||
SDKROOT = "";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
1DEB914F08733D8E0010E9CD /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
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;
|
||||
@@ -407,7 +566,8 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = macinclude;
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = "";
|
||||
};
|
||||
@@ -416,13 +576,19 @@
|
||||
1DEB915008733D8E0010E9CD /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
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;
|
||||
@@ -430,24 +596,73 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = macinclude;
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
SDKROOT = "";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
223109F11BA869DA0030AAE8 /* 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 copy";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
223109F21BA869DA0030AAE8 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "";
|
||||
INFOPLIST_PREPROCESSOR_DEFINITIONS = "";
|
||||
PRODUCT_NAME = "runepanet copy";
|
||||
ZERO_LINK = NO;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
22310A071BA869F30030AAE8 /* 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_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
PRODUCT_NAME = "epanet-static copy";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
22310A081BA869F30030AAE8 /* 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_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
PRODUCT_NAME = "epanet-static copy";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
22322F68106833BC00641384 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = CLE;
|
||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "";
|
||||
INFOPLIST_PREPROCESSOR_DEFINITIONS = "";
|
||||
INSTALL_PATH = /usr/local/bin;
|
||||
PRODUCT_NAME = runepanet;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -455,14 +670,11 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
COPY_PHASE_STRIP = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = CLE;
|
||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "";
|
||||
INFOPLIST_PREPROCESSOR_DEFINITIONS = "";
|
||||
INSTALL_PATH = /usr/local/bin;
|
||||
PRODUCT_NAME = runepanet;
|
||||
SDKROOT = macosx;
|
||||
ZERO_LINK = NO;
|
||||
};
|
||||
name = Release;
|
||||
@@ -471,20 +683,15 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
EXECUTABLE_PREFIX = lib;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
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;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.8;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -492,19 +699,14 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
COPY_PHASE_STRIP = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
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;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.8;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@@ -529,6 +731,24 @@
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
223109F01BA869DA0030AAE8 /* Build configuration list for PBXNativeTarget "runepanet float-precision" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
223109F11BA869DA0030AAE8 /* Debug */,
|
||||
223109F21BA869DA0030AAE8 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
22310A061BA869F30030AAE8 /* Build configuration list for PBXNativeTarget "epanet-static float-precision" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
22310A071BA869F30030AAE8 /* Debug */,
|
||||
22310A081BA869F30030AAE8 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
22322F6A106833E600641384 /* Build configuration list for PBXNativeTarget "runepanet" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:epanet.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
43
doc/How-to-use-the-toolkit.dox
Normal file
43
doc/How-to-use-the-toolkit.dox
Normal file
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
@page how-to-use How to Use the Toolkit
|
||||
|
||||
The following topics briefly describe how to accomplish some basic tasks for which the Toolkit would be used. See the Example Applications topic for code listings of complete applications of the Toolkit.
|
||||
|
||||
@section open-close Opening and Closing the Toolkit
|
||||
|
||||
The Toolkit must open an EPANET [Input File](Input-File) to obtain a description of the pipe network to be analyzed before any of its other functions can be called. (The exception to this is the @ref ENepanet function, which performs a complete hydraulic/water quality simulation similar to a command line execution of EPANET). Once all analysis is completed, it must close itself down to free all allocated memory. The functions for doing this are @ref ENopen and @ref ENclose, respectively. An example of using these functions is shown below.
|
||||
|
||||
~~~~~~~~~~~~~~~{.c}
|
||||
char *f1, // Name of input file
|
||||
*f2, // name of report file
|
||||
*f3; // name of output file (can be blank)
|
||||
int errcode;
|
||||
errcode = ENopen(f1, f2, f3);
|
||||
if (errcode > 0) {
|
||||
ENclose();
|
||||
return;
|
||||
}
|
||||
{ Call functions that perform desired analysis }
|
||||
ENclose();
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
@section parameters Retrieving and Setting Network Parameters
|
||||
|
||||
The Toolkit has various functions available for retrieving and setting the parameters that define the design and operation of the pipe network being analyzed. The names of retrieval functions all begin with `ENget` (e.g., [ENgetnodevalue](ENgetnodevalue), [ENgetoption](ENgetoption), etc.) while the functions used for setting parameter values begin with `ENset` (e.g., [ENsetnodevalue](ENsetnodevalue), [ENsetoption](ENsetoption), etc.).
|
||||
|
||||
Most of these functions use an index number to reference a specific network component (such as a node, link, or time pattern). This number is simply the position of the component in the list of all components of similar type (e.g., node 10 is the tenth node, starting from 1, in the network) and is not the same as the ID label assigned to the component in the Input File being processed. A series of functions exist to determine a component's index number given its ID label (see [ENgetlinkindex](ENgetlinkindex), [ENgetnodeindex](ENgetnodeindex), and [ENgetpatternindex](ENgetpatternindex)). Likewise, functions exist to retrieve a component's ID label given its index number (see [ENgetlinkid](ENgetlinkid), [ENgetnodeid](ENgetnodeid), and [ENgetpatternid](ENgetpatternid)). The [ENgetcount](ENgetcount) function can be used to determine the number of different components in the network.
|
||||
|
||||
The code below is an example of using the parameter retrieval and setting functions. It changes all pipes with diameter of 10 inches to 12 inches.
|
||||
|
||||
~~~~~~~~~~~~~~~{.c}
|
||||
int i, Nlinks;
|
||||
float D;
|
||||
ENgetcount(EN_LINKCOUNT, &Nlinks);
|
||||
for (i = 1; i <= Nlinks; i++) {
|
||||
ENgetlinkvalue(i, EN_DIAMETER, &D);
|
||||
if (D == 10) ENsetlinkvalue(i, EN_DIAMETER, 12);
|
||||
}
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
*/
|
||||
23
doc/Toolkit-Overview.dox
Normal file
23
doc/Toolkit-Overview.dox
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
@page toolkit-overview Toolkit Overview
|
||||
|
||||
|
||||
The Programmer's Toolkit is an extension of the EPANET simulation package. EPANET performs extended period simulation of hydraulic and water quality behavior within pressurized pipe networks. A network can consist of pipes, nodes (pipe junctions), pumps, valves and storage tanks or reservoirs. EPANET tracks the flow of water in each pipe, the pressure at each node, the height of water in each tank, and the concentration of a chemical species throughout the network during a multi-time period simulation. In addition to chemical species, water age and source tracing can also be simulated.
|
||||
|
||||
The Toolkit provides a series of functions that allow programmers to customize the use of EPANET's hydraulic and water quality solution engine to their own applications. Before using the Toolkit one should become familiar with the way that EPANET represents a pipe network and the design and operating information it requires to perform a simulation. This information can be obtained from reading EPANET's on-line Help file or from the EPANET Users Manual.
|
||||
|
||||
A typical usage of the Toolkit functions to analyze a distribution system might look as follows:
|
||||
|
||||
1. Use the @ref ENopen function to open the Toolkit system, along with an EPANET [Input file](Input-File).
|
||||
2. Use the `ENsetxxx` series of functions to change selected system characteristics.
|
||||
3. Run a full hydraulic simulation using the @ref ENsolveH function (which automatically saves results to a [Hydraulics file](Hydraulics-File)) or use the @ref ENopenH - @ref ENinitH - @ref ENrunH - @ref ENnextH - @ref ENcloseH series of functions to step through a hydraulic simulation, accessing results along the way with the `ENgetxxx` series of functions.
|
||||
4. Run a full water quality simulation using @ref ENsolveQ (which automatically saves hydraulic and water quality results to an [Output file](Output-File)) or use the @ref ENopenQ - @ref ENinitQ - @ref ENrunQ - @ref ENnextQ (or @ref ENstepQ) - @ref ENcloseQ series of functions to step through a water quality simulation, accessing results along the way with the `ENgetxxx` series of functions.
|
||||
5. Return to Step 2 to run additional analyses or use the @ref ENreport function to write a formatted report to the [Report file](Report-File).
|
||||
6. Call the @ref ENclose function to close all files and release system memory.
|
||||
|
||||
More specific examples of using the functions can be found in the [Example Applications](Example-Applications) topic.
|
||||
|
||||
|
||||
- @subpage how-to-use
|
||||
|
||||
*/
|
||||
2479
doc/doxyfile
Normal file
2479
doc/doxyfile
Normal file
File diff suppressed because it is too large
Load Diff
12
doc/main.dox
Executable file
12
doc/main.dox
Executable file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
@mainpage EPANET Open Source
|
||||
|
||||
The EPANET Open-Source Library is a pressurized pipe network hydraulic and water quality analysis toolkit, originally developed by USEPA, written in C.
|
||||
|
||||
__Note:__ This repository is not affiliated with, or endorsed by, the USEPA. For the "official" release of EPANET (2.00.12 UI and Toolkit) please go to the [EPA's GitHub repo](https://github.com/USEPA/Water-Distribution-Network-Model) or [the USEPA website](http://www2.epa.gov/water-research/epanet). It is also not the graphical user interface version. This is the hydraulic and water quality solver engine.
|
||||
|
||||
However, if you are interested in extending EPANET for academic, personal, or commercial use, then you've come to the right place. For community discussion, FAQ, and roadmapping of the project, go to the [Community Forum](http://community.wateranalytics.org/category/epanet).
|
||||
|
||||
- @subpage toolkit-overview "Toolkit Overview"
|
||||
|
||||
*/
|
||||
12
doc/modules_controls.dox
Normal file
12
doc/modules_controls.dox
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
|
||||
@defgroup Controls Managing Controls
|
||||
|
||||
|
||||
@addtogroup Controls
|
||||
@{
|
||||
@enum EN_ControlType
|
||||
@fn int ENgetcontrol(int controlIndex, int *controlType, int *linkIndex, EN_API_FLOAT_TYPE *setting, int *nodeIndex, EN_API_FLOAT_TYPE *level)
|
||||
@fn int ENsetcontrol(int cindex, int ctype, int lindex, EN_API_FLOAT_TYPE setting, int nindex, EN_API_FLOAT_TYPE level)
|
||||
@}
|
||||
*/
|
||||
20
doc/modules_curves.dox
Normal file
20
doc/modules_curves.dox
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
|
||||
@defgroup Curves
|
||||
|
||||
|
||||
@addtogroup Curves
|
||||
@{
|
||||
@fn int ENgetcurve(int curveIndex, char* id, int *nValues, EN_API_FLOAT_TYPE **xValues, EN_API_FLOAT_TYPE **yValues)
|
||||
@fn int ENgetheadcurveindex(int index, int *curveindex)
|
||||
@fn int ENgetpumptype(int index, int *type)
|
||||
@fn int ENgetheadcurve(int linkIndex, char *curveId)
|
||||
@fn int ENgetcurveindex(char *id, int *index)
|
||||
@fn int ENgetcurveid(int index, char *id)
|
||||
@fn int ENgetcurvelen(int index, int *len)
|
||||
@fn int ENgetcurvevalue(int index, int pnt, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y)
|
||||
@fn int ENsetcurvevalue(int index, int pnt, EN_API_FLOAT_TYPE x, EN_API_FLOAT_TYPE y)
|
||||
@fn int ENsetcurve(int index, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y, int len)
|
||||
@fn int ENaddcurve(char *id)
|
||||
@}
|
||||
*/
|
||||
20
doc/modules_filemanagement.dox
Normal file
20
doc/modules_filemanagement.dox
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
|
||||
@defgroup FileManagement File Management
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@addtogroup FileManagement
|
||||
@{
|
||||
@fn int ENwriteline (char *line)
|
||||
@fn int ENreport ()
|
||||
@fn int ENresetreport ()
|
||||
@fn int ENsetreport (char *reportFormat)
|
||||
@fn int ENopen (char *inpFile, char *rptFile, char *binOutFile)
|
||||
@fn int ENsaveinpfile (char *filename)
|
||||
@fn int ENclose()
|
||||
@}
|
||||
*/
|
||||
41
doc/modules_hydraulicfunctions.dox
Normal file
41
doc/modules_hydraulicfunctions.dox
Normal file
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
|
||||
@defgroup HydraulicFunctions Hydraulic Analysis
|
||||
|
||||
~~~~~~~~~~~~~~~{.c}
|
||||
int errcode;
|
||||
long t, tstep;
|
||||
|
||||
errcode = ENopenH();
|
||||
if (!errcode) {
|
||||
errcode = ENinitH(EN_SAVE);
|
||||
if (!errcode) {
|
||||
do {
|
||||
tstep = 0;
|
||||
ERRCODE(ENrunH(&t));
|
||||
ERRCODE(ENnextH(&tstep));
|
||||
} while (tstep > 0);
|
||||
}
|
||||
}
|
||||
|
||||
ENcloseH();
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
|
||||
@addtogroup HydraulicFunctions
|
||||
@{
|
||||
|
||||
@fn int ENsolveH()
|
||||
@fn int ENsaveH()
|
||||
@fn int ENopenH()
|
||||
@fn int ENinitH(int initFlag)
|
||||
@fn int ENrunH(long *currentTime)
|
||||
@fn int ENnextH(long *tStep)
|
||||
@fn int ENcloseH()
|
||||
@fn int ENsavehydfile(char *filename)
|
||||
@fn int ENusehydfile(char *filename)
|
||||
@fn int ENgetstatistic(int code, EN_API_FLOAT_TYPE* value)
|
||||
|
||||
@}
|
||||
*/
|
||||
16
doc/modules_networkinfo.dox
Normal file
16
doc/modules_networkinfo.dox
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
|
||||
@defgroup NetworkInfo Network Info
|
||||
|
||||
|
||||
@addtogroup NetworkInfo
|
||||
@{
|
||||
@fn int ENgetcount (int code, int *count)
|
||||
@fn int ENgetnodeindex (char *id, int *index)
|
||||
@fn int ENgetnodeid (int index, char *id)
|
||||
@fn int ENgetnodetype (int index, int *code)
|
||||
@fn int ENgetnodevalue (int index, int code, EN_API_FLOAT_TYPE *value)
|
||||
@fn int ENgetcoord (int index, EN_API_FLOAT_TYPE *x, EN_API_FLOAT_TYPE *y)
|
||||
@fn int ENsetcoord (int index, EN_API_FLOAT_TYPE x, EN_API_FLOAT_TYPE y)
|
||||
@}
|
||||
*/
|
||||
14
doc/modules_patterns.dox
Normal file
14
doc/modules_patterns.dox
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
|
||||
@defgroup Patterns
|
||||
|
||||
|
||||
@addtogroup Patterns
|
||||
@{
|
||||
@fn int ENgetpatternindex (char *id, int *index)
|
||||
@fn int ENgetpatternid (int index, char *id)
|
||||
@fn int ENgetpatternlen (int index, int *len)
|
||||
@fn int ENgetpatternvalue (int index, int period, EN_API_FLOAT_TYPE *value)
|
||||
@fn int ENgetaveragepatternvalue (int index, EN_API_FLOAT_TYPE *value)
|
||||
@}
|
||||
*/
|
||||
17
doc/modules_qualityfunctions.dox
Normal file
17
doc/modules_qualityfunctions.dox
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
|
||||
@defgroup QualityFunctions Water Quality Functions
|
||||
|
||||
|
||||
|
||||
@addtogroup QualityFunctions
|
||||
@{
|
||||
@fn int ENsolveQ ()
|
||||
@fn int ENopenQ ()
|
||||
@fn int ENinitQ (int saveFlag)
|
||||
@fn int ENrunQ (long *currentTime)
|
||||
@fn int ENnextQ (long *tStep)
|
||||
@fn int ENstepQ (long *timeLeft)
|
||||
@fn int ENcloseQ ()
|
||||
@}
|
||||
*/
|
||||
14
doc/modules_toolkitoptions.dox
Normal file
14
doc/modules_toolkitoptions.dox
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
|
||||
@defgroup ToolkitOptions Toolkit Options
|
||||
|
||||
|
||||
@addtogroup ToolkitOptions
|
||||
@{
|
||||
@fn int ENgetoption (int code, EN_API_FLOAT_TYPE *value)
|
||||
@fn int ENgettimeparam (int code, long *value)
|
||||
@fn int ENgetflowunits (int *code)
|
||||
@fn int ENgetqualtype (int *qualcode, int *tracenode)
|
||||
@fn int ENgeterror (int errcode, char *errmsg, int maxLen)
|
||||
@}
|
||||
*/
|
||||
178
example-networks/Net1.inp
Normal file
178
example-networks/Net1.inp
Normal file
@@ -0,0 +1,178 @@
|
||||
[TITLE]
|
||||
EPANET Example Network 1
|
||||
A simple example of modeling chlorine decay. Both bulk and
|
||||
wall reactions are included.
|
||||
|
||||
[JUNCTIONS]
|
||||
;ID Elev Demand Pattern
|
||||
10 710 0 ;
|
||||
11 710 150 ;
|
||||
12 700 150 ;
|
||||
13 695 100 ;
|
||||
21 700 150 ;
|
||||
22 695 200 ;
|
||||
23 690 150 ;
|
||||
31 700 100 ;
|
||||
32 710 100 ;
|
||||
|
||||
[RESERVOIRS]
|
||||
;ID Head Pattern
|
||||
9 800 ;
|
||||
|
||||
[TANKS]
|
||||
;ID Elevation InitLevel MinLevel MaxLevel Diameter MinVol VolCurve
|
||||
2 850 120 100 150 50.5 0 ;
|
||||
|
||||
[PIPES]
|
||||
;ID Node1 Node2 Length Diameter Roughness MinorLoss Status
|
||||
10 10 11 10530 18 100 0 Open ;
|
||||
11 11 12 5280 14 100 0 Open ;
|
||||
12 12 13 5280 10 100 0 Open ;
|
||||
21 21 22 5280 10 100 0 Open ;
|
||||
22 22 23 5280 12 100 0 Open ;
|
||||
31 31 32 5280 6 100 0 Open ;
|
||||
110 2 12 200 18 100 0 Open ;
|
||||
111 11 21 5280 10 100 0 Open ;
|
||||
112 12 22 5280 12 100 0 Open ;
|
||||
113 13 23 5280 8 100 0 Open ;
|
||||
121 21 31 5280 8 100 0 Open ;
|
||||
122 22 32 5280 6 100 0 Open ;
|
||||
|
||||
[PUMPS]
|
||||
;ID Node1 Node2 Parameters
|
||||
9 9 10 HEAD 1 ;
|
||||
|
||||
[VALVES]
|
||||
;ID Node1 Node2 Diameter Type Setting MinorLoss
|
||||
|
||||
[TAGS]
|
||||
|
||||
[DEMANDS]
|
||||
;Junction Demand Pattern Category
|
||||
|
||||
[STATUS]
|
||||
;ID Status/Setting
|
||||
|
||||
[PATTERNS]
|
||||
;ID Multipliers
|
||||
;Demand Pattern
|
||||
1 1.0 1.2 1.4 1.6 1.4 1.2
|
||||
1 1.0 0.8 0.6 0.4 0.6 0.8
|
||||
|
||||
[CURVES]
|
||||
;ID X-Value Y-Value
|
||||
;PUMP: Pump Curve for Pump 9
|
||||
1 1500 250
|
||||
|
||||
[CONTROLS]
|
||||
LINK 9 OPEN IF NODE 2 BELOW 110
|
||||
LINK 9 CLOSED IF NODE 2 ABOVE 140
|
||||
|
||||
|
||||
[RULES]
|
||||
|
||||
[ENERGY]
|
||||
Global Efficiency 75
|
||||
Global Price 0.0
|
||||
Demand Charge 0.0
|
||||
|
||||
[EMITTERS]
|
||||
;Junction Coefficient
|
||||
|
||||
[QUALITY]
|
||||
;Node InitQual
|
||||
10 0.5
|
||||
11 0.5
|
||||
12 0.5
|
||||
13 0.5
|
||||
21 0.5
|
||||
22 0.5
|
||||
23 0.5
|
||||
31 0.5
|
||||
32 0.5
|
||||
9 1.0
|
||||
2 1.0
|
||||
|
||||
[SOURCES]
|
||||
;Node Type Quality Pattern
|
||||
|
||||
[REACTIONS]
|
||||
;Type Pipe/Tank Coefficient
|
||||
|
||||
|
||||
[REACTIONS]
|
||||
Order Bulk 1
|
||||
Order Tank 1
|
||||
Order Wall 1
|
||||
Global Bulk -.5
|
||||
Global Wall -1
|
||||
Limiting Potential 0.0
|
||||
Roughness Correlation 0.0
|
||||
|
||||
[MIXING]
|
||||
;Tank Model
|
||||
|
||||
[TIMES]
|
||||
Duration 24:00
|
||||
Hydraulic Timestep 1:00
|
||||
Quality Timestep 0:05
|
||||
Pattern Timestep 2:00
|
||||
Pattern Start 0:00
|
||||
Report Timestep 1:00
|
||||
Report Start 0:00
|
||||
Start ClockTime 12 am
|
||||
Statistic None
|
||||
|
||||
[REPORT]
|
||||
Status Yes
|
||||
Summary No
|
||||
Page 0
|
||||
|
||||
[OPTIONS]
|
||||
Units GPM
|
||||
Headloss H-W
|
||||
Specific Gravity 1.0
|
||||
Viscosity 1.0
|
||||
Trials 40
|
||||
Accuracy 0.001
|
||||
CHECKFREQ 2
|
||||
MAXCHECK 10
|
||||
DAMPLIMIT 0
|
||||
Unbalanced Continue 10
|
||||
Pattern 1
|
||||
Demand Multiplier 1.0
|
||||
Emitter Exponent 0.5
|
||||
Quality Chlorine mg/L
|
||||
Diffusivity 1.0
|
||||
Tolerance 0.01
|
||||
|
||||
[COORDINATES]
|
||||
;Node X-Coord Y-Coord
|
||||
10 20.00 70.00
|
||||
11 30.00 70.00
|
||||
12 50.00 70.00
|
||||
13 70.00 70.00
|
||||
21 30.00 40.00
|
||||
22 50.00 40.00
|
||||
23 70.00 40.00
|
||||
31 30.00 10.00
|
||||
32 50.00 10.00
|
||||
9 10.00 70.00
|
||||
2 50.00 90.00
|
||||
|
||||
[VERTICES]
|
||||
;Link X-Coord Y-Coord
|
||||
|
||||
[LABELS]
|
||||
;X-Coord Y-Coord Label & Anchor Node
|
||||
6.99 73.63 "Source"
|
||||
13.48 68.13 "Pump"
|
||||
43.85 91.21 "Tank"
|
||||
|
||||
[BACKDROP]
|
||||
DIMENSIONS 7.00 6.00 73.00 94.00
|
||||
UNITS None
|
||||
FILE
|
||||
OFFSET 0.00 0.00
|
||||
|
||||
[END]
|
||||
309
example-networks/Net2.inp
Normal file
309
example-networks/Net2.inp
Normal file
@@ -0,0 +1,309 @@
|
||||
[TITLE]
|
||||
EPANET Example Network 2
|
||||
Example of modeling a 55-hour fluoride tracer study.
|
||||
Measured fluoride data is contained in the file Net2-FL.dat
|
||||
and should be registered with the project to produce a
|
||||
Calibration Report (select Calibration Data from the Project
|
||||
menu).
|
||||
|
||||
[JUNCTIONS]
|
||||
;ID Elev Demand Pattern
|
||||
1 50 -694.4 2 ;
|
||||
2 100 8 ;
|
||||
3 60 14 ;
|
||||
4 60 8 ;
|
||||
5 100 8 ;
|
||||
6 125 5 ;
|
||||
7 160 4 ;
|
||||
8 110 9 ;
|
||||
9 180 14 ;
|
||||
10 130 5 ;
|
||||
11 185 34.78 ;
|
||||
12 210 16 ;
|
||||
13 210 2 ;
|
||||
14 200 2 ;
|
||||
15 190 2 ;
|
||||
16 150 20 ;
|
||||
17 180 20 ;
|
||||
18 100 20 ;
|
||||
19 150 5 ;
|
||||
20 170 19 ;
|
||||
21 150 16 ;
|
||||
22 200 10 ;
|
||||
23 230 8 ;
|
||||
24 190 11 ;
|
||||
25 230 6 ;
|
||||
27 130 8 ;
|
||||
28 110 0 ;
|
||||
29 110 7 ;
|
||||
30 130 3 ;
|
||||
31 190 17 ;
|
||||
32 110 17 ;
|
||||
33 180 1.5 ;
|
||||
34 190 1.5 ;
|
||||
35 110 0 ;
|
||||
36 110 1 ;
|
||||
|
||||
[RESERVOIRS]
|
||||
;ID Head Pattern
|
||||
|
||||
[TANKS]
|
||||
;ID Elevation InitLevel MinLevel MaxLevel Diameter MinVol VolCurve
|
||||
26 235 56.7 50 70 50 0 ;
|
||||
|
||||
[PIPES]
|
||||
;ID Node1 Node2 Length Diameter Roughness MinorLoss Status
|
||||
1 1 2 2400 12 100 0 Open ;
|
||||
2 2 5 800 12 100 0 Open ;
|
||||
3 2 3 1300 8 100 0 Open ;
|
||||
4 3 4 1200 8 100 0 Open ;
|
||||
5 4 5 1000 12 100 0 Open ;
|
||||
6 5 6 1200 12 100 0 Open ;
|
||||
7 6 7 2700 12 100 0 Open ;
|
||||
8 7 8 1200 12 140 0 Open ;
|
||||
9 7 9 400 12 100 0 Open ;
|
||||
10 8 10 1000 8 140 0 Open ;
|
||||
11 9 11 700 12 100 0 Open ;
|
||||
12 11 12 1900 12 100 0 Open ;
|
||||
13 12 13 600 12 100 0 Open ;
|
||||
14 13 14 400 12 100 0 Open ;
|
||||
15 14 15 300 12 100 0 Open ;
|
||||
16 13 16 1500 8 100 0 Open ;
|
||||
17 15 17 1500 8 100 0 Open ;
|
||||
18 16 17 600 8 100 0 Open ;
|
||||
19 17 18 700 12 100 0 Open ;
|
||||
20 18 32 350 12 100 0 Open ;
|
||||
21 16 19 1400 8 100 0 Open ;
|
||||
22 14 20 1100 12 100 0 Open ;
|
||||
23 20 21 1300 8 100 0 Open ;
|
||||
24 21 22 1300 8 100 0 Open ;
|
||||
25 20 22 1300 8 100 0 Open ;
|
||||
26 24 23 600 12 100 0 Open ;
|
||||
27 15 24 250 12 100 0 Open ;
|
||||
28 23 25 300 12 100 0 Open ;
|
||||
29 25 26 200 12 100 0 Open ;
|
||||
30 25 31 600 12 100 0 Open ;
|
||||
31 31 27 400 8 100 0 Open ;
|
||||
32 27 29 400 8 100 0 Open ;
|
||||
34 29 28 700 8 100 0 Open ;
|
||||
35 22 33 1000 8 100 0 Open ;
|
||||
36 33 34 400 8 100 0 Open ;
|
||||
37 32 19 500 8 100 0 Open ;
|
||||
38 29 35 500 8 100 0 Open ;
|
||||
39 35 30 1000 8 100 0 Open ;
|
||||
40 28 35 700 8 100 0 Open ;
|
||||
41 28 36 300 8 100 0 Open ;
|
||||
|
||||
[PUMPS]
|
||||
;ID Node1 Node2 Parameters
|
||||
|
||||
[VALVES]
|
||||
;ID Node1 Node2 Diameter Type Setting MinorLoss
|
||||
|
||||
[TAGS]
|
||||
|
||||
[DEMANDS]
|
||||
;Junction Demand Pattern Category
|
||||
|
||||
[STATUS]
|
||||
;ID Status/Setting
|
||||
|
||||
[PATTERNS]
|
||||
;ID Multipliers
|
||||
;Demand Pattern
|
||||
1 1.26 1.04 .97 .97 .89 1.19
|
||||
1 1.28 .67 .67 1.34 2.46 .97
|
||||
1 .92 .68 1.43 .61 .31 .78
|
||||
1 .37 .67 1.26 1.56 1.19 1.26
|
||||
1 .6 1.1 1.03 .73 .88 1.06
|
||||
1 .99 1.72 1.12 1.34 1.12 .97
|
||||
1 1.04 1.15 .91 .61 .68 .46
|
||||
1 .51 .74 1.12 1.34 1.26 .97
|
||||
1 .82 1.37 1.03 .81 .88 .81
|
||||
1 .81
|
||||
;Pump Station Outflow Pattern
|
||||
2 .96 .96 .96 .96 .96 .96
|
||||
2 .62 0 0 0 0 0
|
||||
2 .8 1 1 1 1 .15
|
||||
2 0 0 0 0 0 0
|
||||
2 .55 .92 .92 .92 .92 .9
|
||||
2 .9 .45 0 0 0 0
|
||||
2 0 .7 1 1 1 1
|
||||
2 .2 0 0 0 0 0
|
||||
2 0 .74 .92 .92 .92 .92
|
||||
2 .92
|
||||
;Pump Station Fluoride Pattern
|
||||
3 .98 1.02 1.05 .99 .64 .46
|
||||
3 .35 .35 .35 .35 .35 .35
|
||||
3 .17 .17 .13 .13 .13 .15
|
||||
3 .15 .15 .15 .15 .15 .15
|
||||
3 .15 .12 .1 .08 .11 .09
|
||||
3 .09 .08 .08 .08 .08 .08
|
||||
3 .08 .09 .07 .07 .09 .09
|
||||
3 .09 .09 .09 .09 .09 .09
|
||||
3 .09 .08 .35 .72 .82 .92
|
||||
3 1
|
||||
|
||||
[CURVES]
|
||||
;ID X-Value Y-Value
|
||||
|
||||
[CONTROLS]
|
||||
|
||||
[RULES]
|
||||
|
||||
[ENERGY]
|
||||
Global Efficiency 75
|
||||
Global Price 0.0
|
||||
Demand Charge 0.0
|
||||
|
||||
[EMITTERS]
|
||||
;Junction Coefficient
|
||||
|
||||
[QUALITY]
|
||||
;Node InitQual
|
||||
1 1.0
|
||||
2 1.0
|
||||
3 1.0
|
||||
4 1.0
|
||||
5 1.0
|
||||
6 1.0
|
||||
7 1.0
|
||||
8 1.0
|
||||
9 1.0
|
||||
10 1.0
|
||||
11 1.0
|
||||
12 1.0
|
||||
13 1.0
|
||||
14 1.0
|
||||
15 1.0
|
||||
16 1.0
|
||||
17 1.0
|
||||
18 1.0
|
||||
19 1.0
|
||||
20 1.0
|
||||
21 1.0
|
||||
22 1.0
|
||||
23 1.0
|
||||
24 1.0
|
||||
25 1.0
|
||||
27 1.0
|
||||
28 1.0
|
||||
29 1.0
|
||||
30 1.0
|
||||
31 1.0
|
||||
32 1.0
|
||||
33 1.0
|
||||
34 1.0
|
||||
35 1.0
|
||||
36 1.0
|
||||
26 1.0
|
||||
|
||||
[SOURCES]
|
||||
;Node Type Quality Pattern
|
||||
1 CONCEN 1.0 3
|
||||
|
||||
[REACTIONS]
|
||||
;Type Pipe/Tank Coefficient
|
||||
|
||||
|
||||
[REACTIONS]
|
||||
Order Bulk 1
|
||||
Order Tank 1
|
||||
Order Wall 1
|
||||
Global Bulk 0.0
|
||||
Global Wall 0.0
|
||||
Limiting Potential 0.0
|
||||
Roughness Correlation 0.0
|
||||
|
||||
[MIXING]
|
||||
;Tank Model
|
||||
|
||||
[TIMES]
|
||||
Duration 55:00
|
||||
Hydraulic Timestep 1:00
|
||||
Quality Timestep 0:05
|
||||
Pattern Timestep 1:00
|
||||
Pattern Start 0:00
|
||||
Report Timestep 1:00
|
||||
Report Start 0:00
|
||||
Start ClockTime 8 am
|
||||
Statistic None
|
||||
|
||||
[REPORT]
|
||||
Status No
|
||||
Summary No
|
||||
Page 0
|
||||
|
||||
[OPTIONS]
|
||||
Units GPM
|
||||
Headloss H-W
|
||||
Specific Gravity 1.0
|
||||
Viscosity 1.0
|
||||
Trials 40
|
||||
Accuracy 0.001
|
||||
CHECKFREQ 2
|
||||
MAXCHECK 10
|
||||
DAMPLIMIT 0
|
||||
Unbalanced Continue 10
|
||||
Pattern 1
|
||||
Demand Multiplier 1.0
|
||||
Emitter Exponent 0.5
|
||||
Quality Fluoride mg/L
|
||||
Diffusivity 1.0
|
||||
Tolerance 0.01
|
||||
|
||||
[COORDINATES]
|
||||
;Node X-Coord Y-Coord
|
||||
1 21.00 4.00
|
||||
2 19.00 20.00
|
||||
3 11.00 21.00
|
||||
4 14.00 28.00
|
||||
5 19.00 25.00
|
||||
6 28.00 23.00
|
||||
7 36.00 39.00
|
||||
8 38.00 30.00
|
||||
9 36.00 42.00
|
||||
10 37.00 23.00
|
||||
11 37.00 49.00
|
||||
12 39.00 60.00
|
||||
13 38.00 64.00
|
||||
14 38.00 66.00
|
||||
15 37.00 69.00
|
||||
16 27.00 65.00
|
||||
17 27.00 69.00
|
||||
18 23.00 68.00
|
||||
19 21.00 59.00
|
||||
20 45.00 68.00
|
||||
21 51.00 62.00
|
||||
22 54.00 69.00
|
||||
23 35.00 74.00
|
||||
24 37.00 71.00
|
||||
25 35.00 76.00
|
||||
27 39.00 87.00
|
||||
28 49.00 85.00
|
||||
29 42.00 86.00
|
||||
30 47.00 80.00
|
||||
31 37.00 80.00
|
||||
32 23.00 64.00
|
||||
33 56.00 73.00
|
||||
34 56.00 77.00
|
||||
35 43.00 81.00
|
||||
36 53.00 87.00
|
||||
26 33.00 76.00
|
||||
|
||||
[VERTICES]
|
||||
;Link X-Coord Y-Coord
|
||||
|
||||
[LABELS]
|
||||
;X-Coord Y-Coord Label & Anchor Node
|
||||
24.00 7.00 "Pump"
|
||||
24.00 4.00 "Station"
|
||||
26.76 77.42 "Tank"
|
||||
|
||||
[BACKDROP]
|
||||
DIMENSIONS 8.75 -0.15 58.25 91.15
|
||||
UNITS None
|
||||
FILE
|
||||
OFFSET 0.00 0.00
|
||||
|
||||
[END]
|
||||
@@ -311,7 +311,6 @@ Link 330 OPEN IF Node 1 ABOVE 19.1
|
||||
[QUALITY]
|
||||
;Node InitQual
|
||||
|
||||
|
||||
[SOURCES]
|
||||
;Node Type Quality Pattern
|
||||
|
||||
@@ -411,6 +410,7 @@ Link 330 OPEN IF Node 1 ABOVE 19.1
|
||||
169 25.68 12.74
|
||||
171 26.65 11.80
|
||||
173 26.87 11.59
|
||||
177 25.92 10.59
|
||||
179 25.71 10.40
|
||||
181 25.72 10.74
|
||||
183 25.45 10.18
|
||||
@@ -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
|
||||
@@ -175,17 +183,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 +205,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 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 ENgetversion Lib "epanet2.dll" (Value As Long) As Long
|
||||
|
||||
@@ -209,4 +221,13 @@ 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, 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 ENgetcurveindex Lib "epanet2.dll" (ByVal ID As String, Index As Long) As Long
|
||||
Declare Function ENgetcurveid Lib "epanet2.dll" (ByVal Index As Long, ByVal ID As String) As Long
|
||||
Declare Function ENgetcurvelen Lib "epanet2.dll" (ByVal Index As Long, L As Long) As Long
|
||||
Declare Function ENgetcurvevalue Lib "epanet2.dll" (ByVal Index As Long, ByVal Ptn As Long, X As Single, Y As Single) As Long
|
||||
Declare Function ENsetcurvevalue Lib "epanet2.dll" (ByVal Index As Long, ByVal Ptn As Long, ByVal X As Single, ByVal Y As Single) As Long
|
||||
Declare Function ENsetcurve Lib "epanet2.dll" (ByVal Index As Long, X As Any, Y As Any, ByVal N As Long) As Long
|
||||
Declare Function ENaddcurve Lib "epanet2.dll" (ByVal ID As String) As Long
|
||||
File diff suppressed because it is too large
Load Diff
228
include/epanet2.vb
Normal file
228
include/epanet2.vb
Normal file
@@ -0,0 +1,228 @@
|
||||
|
||||
'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 ENgetheadcurveindex Lib "epanet2.dll" (ByVal Index As Int32, ByVal CurveIndex As int32) As Int32 'ES
|
||||
Declare Function ENgetpumptype Lib "epanet2.dll" (ByVal Index As Int32, ByRef PumpType As Int32) As Int32 'ES
|
||||
|
||||
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
|
||||
|
||||
Declare Function ENgetcurveindex Lib "epanet2.dll" (ByVal ID As String, ByRef Index As Int32) As Int32
|
||||
Declare Function ENgetcurveid Lib "epanet2.dll" (ByVal Index As Int32, ByVal ID As StringBuilder) As Int32
|
||||
Declare Function ENgetcurvelen Lib "epanet2.dll" (ByVal Index As Int32, ByRef L As Int32) As Int32
|
||||
Declare Function ENgetcurvevalue Lib "epanet2.dll" (ByVal Index As Int32, ByVal Pnt As Int32, ByRef X As Single, ByRef Y As Single) As Int32
|
||||
Declare Function ENsetcurvevalue Lib "epanet2.dll" (ByVal Index As Int32, ByVal Pnt As Int32, ByVal X As Single, ByVal Y As Single) As Int32
|
||||
Declare Function ENsetcurve Lib "epanet2.dll" (ByVal Index as Int32, ByRef X as Single, ByRef Y as Single, ByVal N as Int32) as Int32
|
||||
Declare Function ENaddcurve Lib "epanet2.dll" (ByVal ID As String) As Int32
|
||||
|
||||
End Module
|
||||
133
run/main.c
Normal file
133
run/main.c
Normal file
@@ -0,0 +1,133 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "epanet2.h"
|
||||
|
||||
#define MAXMSG 79 /* Max. # characters in message text */
|
||||
#define MAXWARNCODE 99
|
||||
/* text copied here, no more need of include "text.h" */
|
||||
#define FMT01 "\nEPANET Version %d.%d.%d\n"
|
||||
#define FMT03 "\n Correct syntax is:\n epanet <input file> <output file>\n"
|
||||
#define FMT09 "\nEPANET completed.\n"
|
||||
#define FMT10 "\nEPANET completed. There are warnings."
|
||||
#define FMT11 "\nEPANET completed. There are errors."
|
||||
|
||||
|
||||
void writeConsole(char *s);
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------------------------
|
||||
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 (optional, stdout if left blank)
|
||||
** f3 = name of binary output file (optional, nullfile if left blank).
|
||||
**--------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
char *f1,*f2,*f3;
|
||||
char blank[] = "";
|
||||
char errmsg[MAXMSG+1]="";
|
||||
int errcode;
|
||||
int version;
|
||||
char s[25];
|
||||
int major;
|
||||
int minor;
|
||||
int patch;
|
||||
|
||||
/* get version from DLL and trasform in Major.Minor.Patch format
|
||||
instead of hardcoded version */
|
||||
ENgetversion(&version);
|
||||
major= version/10000;
|
||||
minor= (version%10000)/100;
|
||||
patch= version%100;
|
||||
sprintf(s,FMT01, major , minor, patch);
|
||||
writeConsole(s);
|
||||
|
||||
|
||||
/* Check for proper number of command line arguments */
|
||||
if (argc < 2) {
|
||||
writeConsole(FMT03);
|
||||
return(1);
|
||||
}
|
||||
|
||||
/* set inputfile name */
|
||||
f1 = argv[1];
|
||||
if (argc > 2) {
|
||||
/* set rptfile name */
|
||||
f2 = argv[2];
|
||||
}
|
||||
else {
|
||||
/* use stdout for rptfile */
|
||||
f2 = blank;
|
||||
}
|
||||
if (argc > 3) {
|
||||
/* set binary output file name */
|
||||
f3 = argv[3];
|
||||
}
|
||||
else {
|
||||
/* NO binary output*/
|
||||
f3 = blank;
|
||||
}
|
||||
|
||||
/* Call the main control function */
|
||||
if (strlen(f2)> 0) {
|
||||
/* use stdout for progress messages */
|
||||
errcode = ENepanet(f1,f2,f3,writeConsole);
|
||||
}
|
||||
else {
|
||||
/* use stdout for reporting, no progress messages */
|
||||
errcode = ENepanet(f1,f2,f3,NULL);
|
||||
}
|
||||
|
||||
/* Error/Warning check */
|
||||
if (errcode == 0) {
|
||||
/* no errors */
|
||||
writeConsole(FMT09);
|
||||
return(0);
|
||||
}
|
||||
else {
|
||||
ENgeterror(errcode, errmsg, MAXMSG);
|
||||
writeConsole(errmsg);
|
||||
if (errcode > MAXWARNCODE) {
|
||||
/* error */
|
||||
writeConsole(FMT11);
|
||||
return(errcode);
|
||||
}
|
||||
else {
|
||||
/* warning */
|
||||
writeConsole(FMT10);
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} /* End of main */
|
||||
|
||||
|
||||
void writeConsole(char *s)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: text string
|
||||
** Output: none
|
||||
** Purpose: writes string of characters to console
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
{
|
||||
fprintf(stdout,"%s\n",s);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
|
||||
@@ -133,7 +133,5 @@ char *Fldname[] = {t_ELEV, t_DEMAND, t_HEAD,
|
||||
t_SETTING, t_REACTRATE, t_FRICTION,
|
||||
"", "", "", "", "", "", NULL};
|
||||
|
||||
char *LogoTxt[] = {LOGO1,LOGO2,LOGO3,LOGO4,LOGO5,LOGO6,NULL};
|
||||
|
||||
|
||||
#endif
|
||||
837
src/epanet.c
837
src/epanet.c
File diff suppressed because it is too large
Load Diff
@@ -65,13 +65,11 @@ int addnodeID(int, char *); /* Adds node ID to data base */
|
||||
int addlinkID(int, char *); /* Adds link ID to data base */
|
||||
int addpattern(char *); /* Adds pattern to data base */
|
||||
int addcurve(char *); /* Adds curve to data base */
|
||||
int addcoord(char *); /* Adds coord to data base */
|
||||
STmplist *findID(char *, STmplist *); /* Locates ID on linked list */
|
||||
int unlinked(void); /* Checks for unlinked nodes */
|
||||
int getpumpparams(void); /* Computes pump curve coeffs.*/
|
||||
int getpatterns(void); /* Gets pattern data from list*/
|
||||
int getcurves(void); /* Gets curve data from list */
|
||||
int getcoords(void); /* Gets coordinate data from list */
|
||||
int findmatch(char *,char *[]); /* Finds keyword in line */
|
||||
int match(char *, char *); /* Checks for word match */
|
||||
int gettokens(char *); /* Tokenizes input line */
|
||||
|
||||
@@ -30,11 +30,12 @@ unsigned int _enHash(char *str);
|
||||
unsigned int _enHash(char *str)
|
||||
{
|
||||
unsigned int hash = 5381;
|
||||
unsigned int retHash;
|
||||
int c;
|
||||
while ((c = *str++)) {
|
||||
hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
|
||||
}
|
||||
unsigned int retHash = hash % ENHASHTABLEMAXSIZE;
|
||||
retHash = hash % ENHASHTABLEMAXSIZE;
|
||||
return retHash;
|
||||
}
|
||||
|
||||
@@ -52,6 +53,7 @@ ENHashTable *ENHashTableCreate()
|
||||
|
||||
int ENHashTableInsert(ENHashTable *ht, char *key, int data)
|
||||
{
|
||||
size_t len;
|
||||
unsigned int i = _enHash(key);
|
||||
ENHashEntry *entry;
|
||||
if ( i >= ENHASHTABLEMAXSIZE ) {
|
||||
@@ -61,7 +63,9 @@ int ENHashTableInsert(ENHashTable *ht, char *key, int data)
|
||||
if (entry == NULL) {
|
||||
return(0);
|
||||
}
|
||||
entry->key = key;
|
||||
len = strlen(key) + 1;
|
||||
entry->key = calloc(len, sizeof(char));
|
||||
strncpy(entry->key, key, len);
|
||||
entry->data = data;
|
||||
entry->next = ht[i];
|
||||
ht[i] = entry;
|
||||
@@ -114,6 +118,7 @@ void ENHashTableFree(ENHashTable *ht)
|
||||
while (entry != NULL)
|
||||
{
|
||||
nextentry = entry->next;
|
||||
free(entry->key);
|
||||
free(entry);
|
||||
entry = nextentry;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,11 @@ void saveauxdata(FILE *f) /
|
||||
switch(sect)
|
||||
{
|
||||
case _RULES:
|
||||
case _COORDS:
|
||||
case _COORDS: if (Coordflag == FALSE)
|
||||
{
|
||||
fprintf(f, "%s", line);
|
||||
}
|
||||
break;
|
||||
case _VERTICES:
|
||||
case _LABELS:
|
||||
case _BACKDROP:
|
||||
@@ -92,7 +96,11 @@ void saveauxdata(FILE *f) /
|
||||
switch(sect)
|
||||
{
|
||||
case _RULES:
|
||||
case _COORDS:
|
||||
case _COORDS: if (Coordflag == FALSE)
|
||||
{
|
||||
fprintf(f, "%s", line);
|
||||
}
|
||||
break;
|
||||
case _VERTICES:
|
||||
case _LABELS:
|
||||
case _BACKDROP:
|
||||
@@ -558,6 +566,9 @@ int saveinpfile(char *fname)
|
||||
fprintf(f, "\n STATUS %s", RptFlagTxt[Statflag]);
|
||||
fprintf(f, "\n SUMMARY %s", RptFlagTxt[Summaryflag]);
|
||||
fprintf(f, "\n ENERGY %s", RptFlagTxt[Energyflag]);
|
||||
fprintf(f, "\n MESSAGES %s", RptFlagTxt[Messageflag]);
|
||||
if (strlen(Rpt2Fname) > 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 */
|
||||
|
||||
|
||||
116
src/input2.c
116
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;
|
||||
@@ -222,6 +217,8 @@ int readdata()
|
||||
|
||||
/* Otherwise process next line of input in current section */
|
||||
else
|
||||
{
|
||||
if (sect >=0) //for cases were no section is present on the top of the input file
|
||||
{
|
||||
inperr = newline(sect,line);
|
||||
if (inperr > 0)
|
||||
@@ -230,6 +227,12 @@ int readdata()
|
||||
errsum++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
errcode = 200;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Stop if reach end of file or max. error count */
|
||||
if (errsum == MAXERRS) break;
|
||||
@@ -245,7 +248,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 +302,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 +526,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 +718,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[])
|
||||
/*
|
||||
|
||||
42
src/input3.c
42
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;
|
||||
|
||||
|
||||
@@ -592,45 +590,23 @@ int coordata()
|
||||
*/
|
||||
{
|
||||
double x, y;
|
||||
SFloatlist *fx, *fy;
|
||||
STmplist *c;
|
||||
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 */
|
||||
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 coord data */
|
||||
strncpy(Coord[j].ID, Node[j].ID, MAXID);
|
||||
Coord[j].X = x;
|
||||
Coord[j].Y = y;
|
||||
Coord[j].HaveCoords = TRUE;
|
||||
|
||||
/* Save the pointer to this curve */
|
||||
PrevCoord = c;
|
||||
return(0);
|
||||
|
||||
/* Save coordn data */
|
||||
//Coord[Njuncs].X = x;
|
||||
//Coord[Njuncs].Y = y;
|
||||
|
||||
} /* 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)
|
||||
|
||||
@@ -503,6 +503,7 @@ int savefinaloutput()
|
||||
ERRCODE(savetimestat(x,LINKHDR));
|
||||
if (!errcode) Nperiods = 1;
|
||||
fclose(TmpOutFile);
|
||||
TmpOutFile=NULL;
|
||||
free(x);
|
||||
}
|
||||
|
||||
|
||||
@@ -222,6 +222,7 @@ 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,6 +282,8 @@ 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];
|
||||
}
|
||||
@@ -1552,7 +1553,7 @@ double avgqual(int k)
|
||||
msum += (seg->c)*(seg->v);
|
||||
seg = seg->prev;
|
||||
}
|
||||
if (vsum > 0.0) return(msum/vsum);
|
||||
if (vsum > 0.0 && Qtime > 0) return(msum/vsum);
|
||||
else return( (NodeQual[Link[k].N1] + NodeQual[Link[k].N2])/2. );
|
||||
}
|
||||
|
||||
|
||||
18
src/report.c
18
src/report.c
@@ -52,7 +52,6 @@ extern char *NodeTxt[];
|
||||
extern char *LinkTxt[];
|
||||
extern char *StatTxt[];
|
||||
extern char *TstatTxt[];
|
||||
extern char *LogoTxt[];
|
||||
extern char *RptFormTxt[];
|
||||
|
||||
typedef REAL4 *Pfloat;
|
||||
@@ -148,15 +147,30 @@ void writelogo()
|
||||
*/
|
||||
{
|
||||
int i;
|
||||
int version;
|
||||
int major;
|
||||
int minor;
|
||||
char s[80];
|
||||
time_t timer; /* time_t structure & functions time() & */
|
||||
/* ctime() are defined in time.h */
|
||||
|
||||
version = CODEVERSION;
|
||||
major= version/10000;
|
||||
minor= (version%10000)/100;
|
||||
|
||||
time(&timer);
|
||||
strcpy(DateStamp,ctime(&timer));
|
||||
PageNum = 1;
|
||||
LineNum = 2;
|
||||
fprintf(RptFile,FMT18);
|
||||
fprintf(RptFile,"%s",DateStamp);
|
||||
for (i=0; LogoTxt[i] != NULL; i++) writeline(LogoTxt[i]);
|
||||
writeline(LOGO1);
|
||||
writeline(LOGO2);
|
||||
writeline(LOGO3);
|
||||
writeline(LOGO4);
|
||||
sprintf(s,LOGO5, major , minor);
|
||||
writeline(s);
|
||||
writeline(LOGO6);
|
||||
writeline("");
|
||||
} /* End of writelogo */
|
||||
|
||||
|
||||
@@ -1,332 +0,0 @@
|
||||
#include <map>
|
||||
#include <iomanip>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "testLemonTiger.h"
|
||||
#include "toolkit.h"
|
||||
|
||||
#define COLW 15
|
||||
#define OUTPRECISION 6
|
||||
|
||||
using namespace std;
|
||||
|
||||
typedef struct {
|
||||
double head;
|
||||
double demand;
|
||||
double quality;
|
||||
} nodeState_t;
|
||||
|
||||
typedef struct {
|
||||
double flow;
|
||||
} linkState_t;
|
||||
|
||||
typedef map<int, nodeState_t> networkNodeState_t; // nodeIndex, state
|
||||
typedef map<int, linkState_t> networkLinkState_t; // linkIndex, state
|
||||
|
||||
typedef struct {
|
||||
networkNodeState_t nodeState;
|
||||
networkLinkState_t linkState;
|
||||
} networkState_t;
|
||||
typedef map<long, networkState_t> result_t; // time, networkState
|
||||
// access results by, for instance, resultsContainer[time][nodeIndex].head
|
||||
|
||||
|
||||
|
||||
void checkErr(int err, std::string function);
|
||||
void saveHydResults(networkState_t* networkState);
|
||||
void saveQualResults(networkState_t* networkState);
|
||||
void printResults(result_t* state1, result_t* state2, std::ostream& out);
|
||||
void compare(result_t* results1, result_t* results2, std::ostream &out);
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
|
||||
// create storage structures for results.
|
||||
result_t epanetResults, lemonTigerResults;
|
||||
|
||||
cout << "Lemon Tiger TEST" << endl
|
||||
<< "________________" << endl;
|
||||
|
||||
|
||||
long simulationTime = 0;
|
||||
long nextEventH = 0, nextEventQ = 0;
|
||||
long simTimeRemaining = 0;
|
||||
|
||||
try {
|
||||
|
||||
/* Batch solver (old epanet) */
|
||||
cout << "*****Original EPANET results******" << endl;
|
||||
checkErr( ENopen(argv[1], argv[2], (char*)""), "ENopen" );
|
||||
|
||||
checkErr( ENopenH(), "ENopenH" );
|
||||
checkErr( ENinitH(EN_SAVE), "ENinitH" );
|
||||
|
||||
cout << "Running hydraulics..." << endl;
|
||||
do {
|
||||
|
||||
/* Solve for hydraulics & advance to next time period */
|
||||
checkErr( ENrunH(&simulationTime), "ENrunH" );
|
||||
checkErr( ENnextH(&nextEventH), "ENnextH" );
|
||||
|
||||
// gather hydraulic results
|
||||
saveHydResults(&epanetResults[simulationTime]);
|
||||
|
||||
|
||||
|
||||
} while (nextEventH > 0);
|
||||
// hydraulics are done
|
||||
checkErr( ENcloseH(), "ENcloseH" );
|
||||
cout << "\t\t\tdone." << endl;
|
||||
cout << "Running WQ..." << endl;
|
||||
|
||||
checkErr( ENopenQ(), "ENopenQ" );
|
||||
checkErr( ENinitQ(EN_NOSAVE), "ENinitQ" );
|
||||
|
||||
do {
|
||||
|
||||
checkErr( ENrunQ(&simulationTime), "ENrunQ" );
|
||||
checkErr( ENnextQ(&nextEventH), "ENstepQ" );
|
||||
|
||||
// gather quality results
|
||||
saveQualResults(&epanetResults[simulationTime]);
|
||||
|
||||
} while (nextEventH > 0);
|
||||
// water quality is done
|
||||
checkErr( ENcloseQ(), "ENcloseQ" );
|
||||
cout << "\t\t\tdone." << endl;
|
||||
|
||||
// everything is done
|
||||
checkErr( ENclose(), "ENclose" );
|
||||
|
||||
|
||||
nextEventH = 0;
|
||||
simTimeRemaining = 0;
|
||||
simulationTime = 0;
|
||||
|
||||
/* stepwise solver (LemonTiger) */
|
||||
cout << "*****LemonTiger results******" << endl;
|
||||
|
||||
checkErr( ENopen(argv[1], argv[2], (char*)""), "ENopen" );
|
||||
|
||||
checkErr( ENopenH(), "ENopenH" );
|
||||
checkErr( ENinitH(EN_NOSAVE), "ENinitH" );
|
||||
checkErr( ENopenQ(), "ENopenQ" );
|
||||
checkErr( ENinitQ(EN_NOSAVE), "ENinitQ" );
|
||||
|
||||
cout << "Running stepwise hydraulics and water quality..." << endl;
|
||||
do {
|
||||
/* Solve for hydraulics & advance to next time period */
|
||||
checkErr( ENrunH(&simulationTime), "ENrunH" );
|
||||
checkErr( ENrunQ(&simulationTime), "ENrunQ" );
|
||||
|
||||
checkErr( ENnextH(&nextEventH), "ENnextH" );
|
||||
checkErr( ENnextQ(&nextEventQ), "ENstepQ" );
|
||||
|
||||
|
||||
saveHydResults(&lemonTigerResults[simulationTime]);
|
||||
saveQualResults(&lemonTigerResults[simulationTime]);
|
||||
|
||||
|
||||
} while (nextEventH > 0);
|
||||
cout << "\t\t\tdone." << endl;
|
||||
|
||||
// all done
|
||||
checkErr( ENcloseH(), "ENcloseH" );
|
||||
checkErr( ENcloseQ(), "ENcloseQ" );
|
||||
checkErr( ENclose(), "ENclose" );
|
||||
|
||||
|
||||
// summarize the results
|
||||
printResults(&epanetResults, &lemonTigerResults, cout);
|
||||
compare(&epanetResults, &lemonTigerResults, cout);
|
||||
|
||||
} catch (int err) {
|
||||
cerr << "exiting with error " << err << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void saveHydResults(networkState_t* networkState) {
|
||||
int nNodes, nLinks;
|
||||
float head, demand, flow;
|
||||
ENgetcount(EN_NODECOUNT, &nNodes);
|
||||
ENgetcount(EN_LINKCOUNT, &nLinks);
|
||||
for (int iNode = 1; iNode <= nNodes; ++iNode) {
|
||||
ENgetnodevalue(iNode, EN_HEAD, &head);
|
||||
ENgetnodevalue(iNode, EN_DEMAND, &demand);
|
||||
(*networkState).nodeState[iNode].head = head;
|
||||
(*networkState).nodeState[iNode].demand = demand;
|
||||
}
|
||||
for (int iLink = 1; iLink <= nLinks; ++iLink) {
|
||||
ENgetlinkvalue(iLink, EN_FLOW, &flow);
|
||||
(*networkState).linkState[iLink].flow = flow;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void saveQualResults(networkState_t* networkState) {
|
||||
int nNodes;
|
||||
float quality;
|
||||
ENgetcount(EN_NODECOUNT, &nNodes);
|
||||
|
||||
for (int iNode = 1; iNode <= nNodes; iNode++) {
|
||||
ENgetnodevalue(iNode, EN_QUALITY, &quality);
|
||||
(*networkState).nodeState[iNode].quality = quality;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void printResults(result_t* results1, result_t* results2, std::ostream &out) {
|
||||
|
||||
result_t::const_iterator resultIterator;
|
||||
|
||||
for (resultIterator = (*results1).begin(); resultIterator != (*results1).end(); ++resultIterator) {
|
||||
// get the current frame
|
||||
const long time = resultIterator->first;
|
||||
const networkNodeState_t networkNodeState1= resultIterator->second.nodeState;
|
||||
//nodeState1 = resultIterator->second.nodeState;
|
||||
const networkLinkState_t networkLinkState1 = resultIterator->second.linkState;
|
||||
//linkState1 = resultIterator->second.linkState;
|
||||
|
||||
// see if this time is indexed in the second state container
|
||||
if ((*results2).find(time) == (*results2).end()) {
|
||||
// nope.
|
||||
out << "time " << time << " not found in second result set" << endl;
|
||||
}
|
||||
else {
|
||||
// get the second result set's state
|
||||
const networkNodeState_t networkNodeState2 = (*results2)[time].nodeState;
|
||||
const networkLinkState_t networkLinkState2 = (*results2)[time].linkState;
|
||||
// print the current simulation time
|
||||
out << left;
|
||||
out << setfill('*') << setw(100) << "*" << endl;
|
||||
out << setfill(' ');
|
||||
out << setw(4) << "T = " << setw(6) << time;
|
||||
out << "|" << setw(3*COLW) << "EPANET";
|
||||
out << "|" << setw(3*COLW) << "LemonTiger" << endl;
|
||||
out << setw(10) << "Index" << "|";
|
||||
out << setw(COLW) << "Demand" << setw(COLW) << "Head" << setw(COLW) << "Quality" << "|";
|
||||
out << setw(COLW) << "Demand" << setw(COLW) << "Head" << setw(COLW) << "Quality" << endl;
|
||||
out << setprecision(OUTPRECISION);
|
||||
|
||||
// loop through the nodes in the networkState objs, and print out the results for this time period
|
||||
networkNodeState_t::const_iterator networkNodeIterator;
|
||||
for (networkNodeIterator = networkNodeState1.begin(); networkNodeIterator != networkNodeState1.end(); ++networkNodeIterator) {
|
||||
int nodeIndex = networkNodeIterator->first;
|
||||
// trusting that all nodes are present...
|
||||
const nodeState_t nodeState1 = networkNodeIterator->second;
|
||||
const nodeState_t nodeState2 = networkNodeState2.at(nodeIndex);
|
||||
|
||||
if (nodeState1.quality != nodeState2.quality ) {
|
||||
// epanet
|
||||
out << setw(10) << nodeIndex << "|";
|
||||
out << setw(COLW) << nodeState1.demand;
|
||||
out << setw(COLW) << nodeState1.head;
|
||||
out << setw(COLW) << nodeState1.quality;
|
||||
|
||||
// lemontiger
|
||||
out << "|";
|
||||
out << setw(COLW) << nodeState2.demand;
|
||||
out << setw(COLW) << nodeState2.head;
|
||||
out << setw(COLW) << nodeState2.quality;
|
||||
out << endl;
|
||||
}
|
||||
}
|
||||
|
||||
networkLinkState_t::const_iterator networkLinkIterator;
|
||||
for (networkLinkIterator = networkLinkState1.begin(); networkLinkIterator != networkLinkState1.end(); ++networkLinkIterator) {
|
||||
int linkIndex = networkLinkIterator->first;
|
||||
// trusting that all nodes are present...
|
||||
const linkState_t linkState1 = networkLinkIterator->second;
|
||||
const linkState_t linkState2 = networkLinkState2.at(linkIndex);
|
||||
|
||||
if ( linkState1.flow != linkState2.flow ) {
|
||||
// epanet
|
||||
out << setw(10) << linkIndex << "|";
|
||||
out << setw(COLW) << linkState1.flow;
|
||||
|
||||
// lemontiger
|
||||
out << "|";
|
||||
out << setw(COLW) << linkState2.flow;
|
||||
out << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void compare(result_t* results1, result_t* results2, std::ostream &out) {
|
||||
|
||||
double sumHeadDiff=0, sumDemandDiff=0, sumQualDiff=0, sumFlowDiff=0;
|
||||
|
||||
result_t::const_iterator resultIterator;
|
||||
|
||||
for (resultIterator = (*results1).begin(); resultIterator != (*results1).end(); ++resultIterator) {
|
||||
// get the current frame
|
||||
const long time = resultIterator->first;
|
||||
const networkNodeState_t nodeState1 = resultIterator->second.nodeState;
|
||||
const networkLinkState_t linkState1 = resultIterator->second.linkState;
|
||||
|
||||
// see if this time is indexed in the second state container
|
||||
if ((*results2).find(time) == (*results2).end()) {
|
||||
// nope.
|
||||
out << "time " << time << " not found in second result set" << endl;
|
||||
}
|
||||
else {
|
||||
// get the second result set's state
|
||||
const networkNodeState_t networkNodeState2 = (*results2)[time].nodeState;
|
||||
const networkLinkState_t networkLinkState2 = (*results2)[time].linkState;
|
||||
double qualD=0;
|
||||
|
||||
networkNodeState_t::const_iterator networkNodeIterator;
|
||||
for (networkNodeIterator = nodeState1.begin(); networkNodeIterator != nodeState1.end(); ++networkNodeIterator) {
|
||||
int nodeIndex = networkNodeIterator->first;
|
||||
// trusting that all nodes are present...
|
||||
const nodeState_t nodeState1 = networkNodeIterator->second;
|
||||
const nodeState_t nodeState2 = networkNodeState2.at(nodeIndex);
|
||||
|
||||
sumHeadDiff += fabs(nodeState1.head - nodeState2.head);
|
||||
sumDemandDiff += fabs(nodeState1.demand - nodeState2.demand);
|
||||
|
||||
qualD += fabs(nodeState1.quality - nodeState2.quality);
|
||||
}
|
||||
//out << "T: " << time << " dq: " << setprecision(20) << qualD << endl;
|
||||
sumQualDiff += qualD;
|
||||
|
||||
networkLinkState_t::const_iterator networkLinkIterator;
|
||||
for (networkLinkIterator = linkState1.begin(); networkLinkIterator != linkState1.end(); ++networkLinkIterator) {
|
||||
int linkIndex = networkLinkIterator->first;
|
||||
// trusting that all nodes are present...
|
||||
const linkState_t linkState1 = networkLinkIterator->second;
|
||||
const linkState_t linkState2 = networkLinkState2.at(linkIndex);
|
||||
|
||||
sumFlowDiff += fabs(linkState1.flow - linkState2.flow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int c1 = 18;
|
||||
int p = 20;
|
||||
out << setw(c1) << "Head Diff:" << setprecision(p) << sumHeadDiff << endl;
|
||||
out << setw(c1) << "Demand Diff:" << setprecision(p) << sumDemandDiff << endl;
|
||||
out << setw(c1) << "Quality Diff:" << setprecision(p) << sumQualDiff << endl;
|
||||
out << setw(c1) << "Flow Diff:" << setprecision(p) << sumFlowDiff << endl;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void checkErr(int err, std::string function) {
|
||||
if (err > 0) {
|
||||
cerr << "Error in " << function << ": " << err << endl;
|
||||
char errmsg[1024];
|
||||
ENgeterror(err, errmsg, 1024);
|
||||
cerr << errmsg << endl;
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
//
|
||||
// testLemonTiger.h
|
||||
// epanet
|
||||
//
|
||||
// Created by Sam Hatchett on 2/1/13.
|
||||
//
|
||||
//
|
||||
|
||||
#ifndef __epanet__testLemonTiger__
|
||||
#define __epanet__testLemonTiger__
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#endif /* defined(__epanet__testLemonTiger__) */
|
||||
@@ -332,10 +332,10 @@ AUTHOR: L. Rossman
|
||||
#define LOGO4 \
|
||||
"* Analysis for Pipe Networks *"
|
||||
#define LOGO5 \
|
||||
"* Version 2.00.12 *" //(2.00.12 - LR)
|
||||
"* Version %d.%d *"
|
||||
#define LOGO6 \
|
||||
"******************************************************************"
|
||||
#define FMT01 "\n... EPANET Version 2.0\n"
|
||||
#define FMT01 "\n... EPANET Version %d.%d\n"
|
||||
#define FMT02 "\n o Retrieving network data"
|
||||
#define FMT03 "\n Correct syntax is:\n epanet <input file> <output file>\n"
|
||||
#define FMT04 "\n Cannot use duplicate file names."
|
||||
@@ -493,6 +493,10 @@ AUTHOR: L. Rossman
|
||||
#define ERR250 "Input Error 250: function call contains invalid format."
|
||||
#define ERR251 "Input Error 251: function call contains invalid parameter code."
|
||||
|
||||
#define ERR253 "Input Error 253: Function call error - No such demand category index."
|
||||
#define ERR254 "Input Error 254: Function call error - Node have no coordinates."
|
||||
#define ERR255 "Input Error 255: Function call error - Coordinates were not loaded."
|
||||
|
||||
#define ERR301 "File Error 301: identical file names."
|
||||
#define ERR302 "File Error 302: cannot open input file."
|
||||
#define ERR303 "File Error 303: cannot open report file."
|
||||
|
||||
255
src/toolkit.h
255
src/toolkit.h
@@ -1,255 +0,0 @@
|
||||
/*
|
||||
*******************************************************************
|
||||
|
||||
TOOLKIT.H - Prototypes for EPANET Functions Exported to DLL Toolkit
|
||||
|
||||
VERSION: 2.00
|
||||
DATE: 5/8/00
|
||||
10/25/00
|
||||
3/1/01
|
||||
8/15/07 (2.00.11)
|
||||
2/14/08 (2.00.12)
|
||||
AUTHOR: L. Rossman
|
||||
US EPA - NRMRL
|
||||
|
||||
*******************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DLLEXPORT
|
||||
#ifdef DLL
|
||||
#ifdef __cplusplus
|
||||
#define DLLEXPORT extern "C" __declspec(dllexport)
|
||||
#else
|
||||
#define DLLEXPORT __declspec(dllexport) __stdcall
|
||||
#endif
|
||||
#elif defined(CYGWIN)
|
||||
#define DLLEXPORT __stdcall
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
#define DLLEXPORT
|
||||
#else
|
||||
#define DLLEXPORT
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// --- Define the EPANET toolkit constants
|
||||
|
||||
#define EN_ELEVATION 0 /* Node parameters */
|
||||
#define EN_BASEDEMAND 1
|
||||
#define EN_PATTERN 2
|
||||
#define EN_EMITTER 3
|
||||
#define EN_INITQUAL 4
|
||||
#define EN_SOURCEQUAL 5
|
||||
#define EN_SOURCEPAT 6
|
||||
#define EN_SOURCETYPE 7
|
||||
#define EN_TANKLEVEL 8
|
||||
#define EN_DEMAND 9
|
||||
#define EN_HEAD 10
|
||||
#define EN_PRESSURE 11
|
||||
#define EN_QUALITY 12
|
||||
#define EN_SOURCEMASS 13
|
||||
#define EN_INITVOLUME 14
|
||||
#define EN_MIXMODEL 15
|
||||
#define EN_MIXZONEVOL 16
|
||||
|
||||
#define EN_TANKDIAM 17
|
||||
#define EN_MINVOLUME 18
|
||||
#define EN_VOLCURVE 19
|
||||
#define EN_MINLEVEL 20
|
||||
#define EN_MAXLEVEL 21
|
||||
#define EN_MIXFRACTION 22
|
||||
#define EN_TANK_KBULK 23
|
||||
#define EN_TANKVOLUME 24
|
||||
#define EN_MAXVOLUME 25
|
||||
|
||||
#define EN_DIAMETER 0 /* Link parameters */
|
||||
#define EN_LENGTH 1
|
||||
#define EN_ROUGHNESS 2
|
||||
#define EN_MINORLOSS 3
|
||||
#define EN_INITSTATUS 4
|
||||
#define EN_INITSETTING 5
|
||||
#define EN_KBULK 6
|
||||
#define EN_KWALL 7
|
||||
#define EN_FLOW 8
|
||||
#define EN_VELOCITY 9
|
||||
#define EN_HEADLOSS 10
|
||||
#define EN_STATUS 11
|
||||
#define EN_SETTING 12
|
||||
#define EN_ENERGY 13
|
||||
#define EN_LINKQUAL 14 /* TNT */
|
||||
#define EN_LINKPATTERN 15
|
||||
|
||||
#define EN_DURATION 0 /* Time parameters */
|
||||
#define EN_HYDSTEP 1
|
||||
#define EN_QUALSTEP 2
|
||||
#define EN_PATTERNSTEP 3
|
||||
#define EN_PATTERNSTART 4
|
||||
#define EN_REPORTSTEP 5
|
||||
#define EN_REPORTSTART 6
|
||||
#define EN_RULESTEP 7
|
||||
#define EN_STATISTIC 8
|
||||
#define EN_PERIODS 9
|
||||
#define EN_STARTTIME 10 /* Added TNT 10/2/2009 */
|
||||
#define EN_HTIME 11
|
||||
#define EN_HALTFLAG 12
|
||||
#define EN_NEXTEVENT 13
|
||||
|
||||
#define EN_ITERATIONS 0
|
||||
#define EN_RELATIVEERROR 1
|
||||
|
||||
#define EN_NODECOUNT 0 /* Component counts */
|
||||
#define EN_TANKCOUNT 1
|
||||
#define EN_LINKCOUNT 2
|
||||
#define EN_PATCOUNT 3
|
||||
#define EN_CURVECOUNT 4
|
||||
#define EN_CONTROLCOUNT 5
|
||||
|
||||
#define EN_JUNCTION 0 /* Node types */
|
||||
#define EN_RESERVOIR 1
|
||||
#define EN_TANK 2
|
||||
|
||||
#define EN_CVPIPE 0 /* Link types. */
|
||||
#define EN_PIPE 1 /* See LinkType in TYPES.H */
|
||||
#define EN_PUMP 2
|
||||
#define EN_PRV 3
|
||||
#define EN_PSV 4
|
||||
#define EN_PBV 5
|
||||
#define EN_FCV 6
|
||||
#define EN_TCV 7
|
||||
#define EN_GPV 8
|
||||
|
||||
#define EN_NONE 0 /* Quality analysis types. */
|
||||
#define EN_CHEM 1 /* See QualType in TYPES.H */
|
||||
#define EN_AGE 2
|
||||
#define EN_TRACE 3
|
||||
|
||||
#define EN_CONCEN 0 /* Source quality types. */
|
||||
#define EN_MASS 1 /* See SourceType in TYPES.H. */
|
||||
#define EN_SETPOINT 2
|
||||
#define EN_FLOWPACED 3
|
||||
|
||||
#define EN_CFS 0 /* Flow units types. */
|
||||
#define EN_GPM 1 /* See FlowUnitsType */
|
||||
#define EN_MGD 2 /* in TYPES.H. */
|
||||
#define EN_IMGD 3
|
||||
#define EN_AFD 4
|
||||
#define EN_LPS 5
|
||||
#define EN_LPM 6
|
||||
#define EN_MLD 7
|
||||
#define EN_CMH 8
|
||||
#define EN_CMD 9
|
||||
|
||||
#define EN_TRIALS 0 /* Misc. options */
|
||||
#define EN_ACCURACY 1
|
||||
#define EN_TOLERANCE 2
|
||||
#define EN_EMITEXPON 3
|
||||
#define EN_DEMANDMULT 4
|
||||
|
||||
#define EN_LOWLEVEL 0 /* Control types. */
|
||||
#define EN_HILEVEL 1 /* See ControlType */
|
||||
#define EN_TIMER 2 /* in TYPES.H. */
|
||||
#define EN_TIMEOFDAY 3
|
||||
|
||||
#define EN_AVERAGE 1 /* Time statistic types. */
|
||||
#define EN_MINIMUM 2 /* See TstatType in TYPES.H */
|
||||
#define EN_MAXIMUM 3
|
||||
#define EN_RANGE 4
|
||||
|
||||
#define EN_MIX1 0 /* Tank mixing models */
|
||||
#define EN_MIX2 1
|
||||
#define EN_FIFO 2
|
||||
#define EN_LIFO 3
|
||||
|
||||
#define EN_NOSAVE 0 /* Save-results-to-file flag */
|
||||
#define EN_SAVE 1
|
||||
|
||||
#define EN_INITFLOW 10 /* Re-initialize flows flag */
|
||||
|
||||
#define EN_CONST_HP 0 /* constant horsepower */
|
||||
#define EN_POWER_FUNC 1 /* power function */
|
||||
#define EN_CUSTOM 2 /* user-defined custom curve */
|
||||
|
||||
// --- Declare the EPANET toolkit functions
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
int DLLEXPORT ENepanet(char *, char *, char *, void (*) (char *));
|
||||
|
||||
int DLLEXPORT ENopen(char *, char *, char *);
|
||||
int DLLEXPORT ENsaveinpfile(char *);
|
||||
int DLLEXPORT ENclose(void);
|
||||
|
||||
int DLLEXPORT ENsolveH(void);
|
||||
int DLLEXPORT ENsaveH(void);
|
||||
int DLLEXPORT ENopenH(void);
|
||||
int DLLEXPORT ENinitH(int);
|
||||
int DLLEXPORT ENrunH(long *);
|
||||
int DLLEXPORT ENnextH(long *);
|
||||
int DLLEXPORT ENcloseH(void);
|
||||
int DLLEXPORT ENsavehydfile(char *);
|
||||
int DLLEXPORT ENusehydfile(char *);
|
||||
|
||||
int DLLEXPORT ENsolveQ(void);
|
||||
int DLLEXPORT ENopenQ(void);
|
||||
int DLLEXPORT ENinitQ(int);
|
||||
int DLLEXPORT ENrunQ(long *);
|
||||
int DLLEXPORT ENnextQ(long *);
|
||||
int DLLEXPORT ENstepQ(long *);
|
||||
int DLLEXPORT ENcloseQ(void);
|
||||
|
||||
int DLLEXPORT ENwriteline(char *);
|
||||
int DLLEXPORT ENreport(void);
|
||||
int DLLEXPORT ENresetreport(void);
|
||||
int DLLEXPORT ENsetreport(char *);
|
||||
|
||||
int DLLEXPORT ENgetcontrol(int, int *, int *, float *,
|
||||
int *, float *);
|
||||
int DLLEXPORT ENgetcount(int, int *);
|
||||
int DLLEXPORT ENgetoption(int, float *);
|
||||
int DLLEXPORT ENgettimeparam(int, long *);
|
||||
int DLLEXPORT ENgetflowunits(int *);
|
||||
int DLLEXPORT ENgetpatternindex(char *, int *);
|
||||
int DLLEXPORT ENgetpatternid(int, char *);
|
||||
int DLLEXPORT ENgetpatternlen(int, int *);
|
||||
int DLLEXPORT ENgetpatternvalue(int, int, float *);
|
||||
int DLLEXPORT ENgetqualtype(int *, int *);
|
||||
int DLLEXPORT ENgeterror(int, char *, int);
|
||||
int DLLEXPORT ENgetstatistic(int code, int* value);
|
||||
|
||||
int DLLEXPORT ENgetnodeindex(char *, int *);
|
||||
int DLLEXPORT ENgetnodeid(int, char *);
|
||||
int DLLEXPORT ENgetnodetype(int, int *);
|
||||
int DLLEXPORT ENgetnodevalue(int, int, float *);
|
||||
|
||||
int DLLEXPORT ENgetnumdemands(int, int *);
|
||||
int DLLEXPORT ENgetbasedemand(int, int, float *);
|
||||
int DLLEXPORT ENgetdemandpattern(int, int, int *);
|
||||
|
||||
int DLLEXPORT ENgetlinkindex(char *, int *);
|
||||
int DLLEXPORT ENgetlinkid(int, char *);
|
||||
int DLLEXPORT ENgetlinktype(int, int *);
|
||||
int DLLEXPORT ENgetlinknodes(int, int *, int *);
|
||||
int DLLEXPORT ENgetlinkvalue(int, int, float *);
|
||||
|
||||
int DLLEXPORT ENgetcurve(int curveIndex, int *nValues, float **xValues, float **yValues);
|
||||
int DLLEXPORT ENgetheadcurve(int, char *);
|
||||
int DLLEXPORT ENgetpumptype(int, int *);
|
||||
|
||||
int DLLEXPORT ENgetversion(int *);
|
||||
|
||||
int DLLEXPORT ENsetcontrol(int, int, int, float, int, float);
|
||||
int DLLEXPORT ENsetnodevalue(int, int, float);
|
||||
int DLLEXPORT ENsetlinkvalue(int, int, float);
|
||||
int DLLEXPORT ENaddpattern(char *);
|
||||
int DLLEXPORT ENsetpattern(int, float *, int);
|
||||
int DLLEXPORT ENsetpatternvalue(int, int, float);
|
||||
int DLLEXPORT ENsettimeparam(int, long);
|
||||
int DLLEXPORT ENsetoption(int, float);
|
||||
int DLLEXPORT ENsetstatusreport(int);
|
||||
int DLLEXPORT ENsetqualtype(int, char *, char *, char *);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
@@ -28,7 +28,7 @@ AUTHOR: L. Rossman
|
||||
Definition of 4-byte integers & reals
|
||||
-------------------------------------------
|
||||
*/
|
||||
typedef double REAL4; //(2.00.11 - LR)
|
||||
typedef float REAL4; //(2.00.11 - LR)
|
||||
typedef int INT4; //(2.00.12 - LR)
|
||||
|
||||
/*
|
||||
@@ -39,7 +39,7 @@ typedef int INT4; /
|
||||
/*** Updated ***/
|
||||
#define CODEVERSION 20100
|
||||
#define MAGICNUMBER 516114521
|
||||
#define VERSION 200
|
||||
#define ENGINE_VERSION 201
|
||||
#define EOFMARK 0x1A /* Use 0x04 for UNIX systems */
|
||||
#define MAXTITLE 3 /* Max. # title lines */
|
||||
#define MAXID 31 /* Max. # characters in ID name */ //(2.00.11 - LR)
|
||||
@@ -170,8 +170,9 @@ typedef struct /* CURVE OBJECT */
|
||||
typedef struct /* Coord OBJECT */
|
||||
{
|
||||
char ID[MAXID+1]; /* Coord ID */
|
||||
double *X; /* X-values */
|
||||
double *Y; /* Y-values */
|
||||
double X; /* X-value */
|
||||
double Y; /* Y-value */
|
||||
char HaveCoords; /* Coordinates flag */
|
||||
} Scoord;
|
||||
|
||||
struct Sdemand /* DEMAND CATEGORY OBJECT */
|
||||
|
||||
32
src/vars.h
32
src/vars.h
@@ -17,15 +17,15 @@ AUTHOR: L. Rossman
|
||||
#include <stdio.h>
|
||||
#include "hash.h"
|
||||
|
||||
FILE *InFile, /* Input file pointer */
|
||||
EXTERN FILE *InFile, /* Input file pointer */
|
||||
*OutFile, /* Output file pointer */
|
||||
*RptFile, /* Report file pointer */
|
||||
*HydFile, /* Hydraulics file pointer */
|
||||
*TmpOutFile; /* Temporary file handle */
|
||||
long HydOffset, /* Hydraulics file byte offset */
|
||||
EXTERN long HydOffset, /* Hydraulics file byte offset */
|
||||
OutOffset1, /* 1st output file byte offset */
|
||||
OutOffset2; /* 2nd output file byte offset */
|
||||
char Msg[MAXMSG+1], /* Text of output message */
|
||||
EXTERN char Msg[MAXMSG+1], /* Text of output message */
|
||||
InpFname[MAXFNAME+1], /* Input file name */
|
||||
Rpt1Fname[MAXFNAME+1], /* Primary report file name */
|
||||
Rpt2Fname[MAXFNAME+1], /* Secondary report file name */
|
||||
@@ -64,8 +64,9 @@ AUTHOR: L. Rossman
|
||||
SaveHflag, /* Hydraul. results saved flag */
|
||||
OpenQflag, /* Quality system opened flag */
|
||||
SaveQflag, /* Quality results saved flag */
|
||||
Saveflag; /* General purpose save flag */
|
||||
int MaxNodes, /* Node count from input file */
|
||||
Saveflag, /* General purpose save flag */
|
||||
Coordflag; /* Load coordinates flag */
|
||||
EXTERN int MaxNodes, /* Node count from input file */
|
||||
MaxLinks, /* Link count from input file */
|
||||
MaxJuncs, /* Junction count */
|
||||
MaxPipes, /* Pipe count */
|
||||
@@ -76,7 +77,6 @@ AUTHOR: L. Rossman
|
||||
MaxRules, /* Rule count */
|
||||
MaxPats, /* Pattern count */
|
||||
MaxCurves, /* Curve count */
|
||||
MaxCoords, /* Coords count */
|
||||
Nnodes, /* Number of network nodes */
|
||||
Ntanks, /* Number of tanks */
|
||||
Njuncs, /* Number of junction nodes */
|
||||
@@ -88,7 +88,6 @@ AUTHOR: L. Rossman
|
||||
Nrules, /* Number of control rules */
|
||||
Npats, /* Number of time patterns */
|
||||
Ncurves, /* Number of data curves */
|
||||
Ncoords, /* Number of Coords */
|
||||
Nperiods, /* Number of reporting periods */
|
||||
Ncoeffs, /* Number of non-0 matrix coeffs*/
|
||||
DefPat, /* Default demand pattern */
|
||||
@@ -99,7 +98,7 @@ AUTHOR: L. Rossman
|
||||
PageSize, /* Lines/page in output report */
|
||||
CheckFreq, /* Hydraulics solver parameter */
|
||||
MaxCheck; /* Hydraulics solver parameter */
|
||||
double Ucf[MAXVAR], /* Unit conversion factors */
|
||||
EXTERN double Ucf[MAXVAR], /* Unit conversion factors */
|
||||
Ctol, /* Water quality tolerance */
|
||||
Htol, /* Hydraulic head tolerance */
|
||||
Qtol, /* Flow rate tolerance */
|
||||
@@ -128,7 +127,7 @@ AUTHOR: L. Rossman
|
||||
Wwall, /* Avg. wall reaction rate */
|
||||
Wtank, /* Avg. tank reaction rate */
|
||||
Wsource; /* Avg. mass inflow */
|
||||
long Tstart, /* Starting time of day (sec) */
|
||||
EXTERN long Tstart, /* Starting time of day (sec) */
|
||||
Hstep, /* Nominal hyd. time step (sec) */
|
||||
Qstep, /* Quality time step (sec) */
|
||||
Pstep, /* Time pattern time step (sec) */
|
||||
@@ -141,12 +140,12 @@ AUTHOR: L. Rossman
|
||||
Hydstep, /* Actual hydraulic time step */
|
||||
Rulestep, /* Rule evaluation time step */
|
||||
Dur; /* Duration of simulation (sec) */
|
||||
SField Field[MAXVAR]; /* Output reporting fields */
|
||||
EXTERN SField Field[MAXVAR]; /* Output reporting fields */
|
||||
|
||||
/* Array pointers not allocated and freed in same routine */
|
||||
char *LinkStatus, /* Link status */
|
||||
EXTERN char *LinkStatus, /* Link status */
|
||||
*OldStat; /* Previous link/tank status */
|
||||
double *NodeDemand, /* Node actual demand */
|
||||
EXTERN double *NodeDemand, /* Node actual demand */
|
||||
*NodeQual, /* Node actual quality */
|
||||
*E, /* Emitter flows */
|
||||
*LinkSetting, /* Link settings */
|
||||
@@ -159,7 +158,6 @@ EXTERN double *QTankVolumes;
|
||||
EXTERN double *QLinkFlow;
|
||||
EXTERN STmplist *Patlist; /* Temporary time pattern list */
|
||||
EXTERN STmplist *Curvelist; /* Temporary list of curves */
|
||||
EXTERN STmplist *Coordlist; /* Temporary list of coordinates*/
|
||||
EXTERN Spattern *Pattern; /* Time patterns */
|
||||
EXTERN Scurve *Curve; /* Curve data */
|
||||
EXTERN Scoord *Coord; /* Coordinate data */
|
||||
@@ -194,19 +192,19 @@ EXTERN int _iterations; /* Info about hydraulic solution */
|
||||
** The following arrays are used to efficiently manage this sparsity:
|
||||
*/
|
||||
|
||||
double *Aii, /* Diagonal coeffs. of A */
|
||||
EXTERN double *Aii, /* Diagonal coeffs. of A */
|
||||
*Aij, /* Non-zero, off-diagonal coeffs. of A */
|
||||
*F; /* Right hand side coeffs. */
|
||||
double *P, /* Inverse headloss derivatives */
|
||||
EXTERN double *P, /* Inverse headloss derivatives */
|
||||
*Y; /* Flow correction factors */
|
||||
int *Order, /* Node-to-row of A */
|
||||
EXTERN int *Order, /* Node-to-row of A */
|
||||
*Row, /* Row-to-node of A */
|
||||
*Ndx; /* Index of link's coeff. in Aij */
|
||||
/*
|
||||
** The following arrays store the positions of the non-zero coeffs.
|
||||
** of the lower triangular portion of A whose values are stored in Aij:
|
||||
*/
|
||||
int *XLNZ, /* Start position of each column in NZSUB */
|
||||
EXTERN int *XLNZ, /* Start position of each column in NZSUB */
|
||||
*NZSUB, /* Row index of each coeff. in each column */
|
||||
*LNZ; /* Position of each coeff. in Aij array */
|
||||
|
||||
|
||||
@@ -1,150 +0,0 @@
|
||||
[TITLE]
|
||||
|
||||
|
||||
[JUNCTIONS]
|
||||
;ID Elev Demand Pattern
|
||||
TreatmentPlant 0 0 ;
|
||||
Montgomery 0 80 ;
|
||||
Tennessee 0 250 ;
|
||||
Reading 0 100 ;
|
||||
Mills 0 1000 stepdemand ;
|
||||
Vine 0 50 ;
|
||||
|
||||
[RESERVOIRS]
|
||||
;ID Head Pattern
|
||||
Resr 100 ;
|
||||
|
||||
[TANKS]
|
||||
;ID Elevation InitLevel MinLevel MaxLevel Diameter MinVol VolCurve
|
||||
NewportTank 50 40 0 80 20 0 ;
|
||||
|
||||
[PIPES]
|
||||
;ID Node1 Node2 Length Diameter Roughness MinorLoss Status
|
||||
ReservoirCheckValve Resr TreatmentPlant 10 4 100 0 CV ;
|
||||
2 TreatmentPlant Montgomery 3 6 100 0 Open ;
|
||||
3 Montgomery Tennessee 6 6 100 0 Open ;
|
||||
4 Tennessee Reading 12 6 100 0 Open ;
|
||||
5 Reading Mills 24 6 100 0 Open ;
|
||||
NewportTankPipe Tennessee NewportTank 50 3 100 0 Open ;
|
||||
1 Reading Vine 50 6 100 0 Open ;
|
||||
|
||||
[PUMPS]
|
||||
;ID Node1 Node2 Parameters
|
||||
|
||||
[VALVES]
|
||||
;ID Node1 Node2 Diameter Type Setting MinorLoss
|
||||
|
||||
[TAGS]
|
||||
|
||||
[DEMANDS]
|
||||
;Junction Demand Pattern Category
|
||||
|
||||
[STATUS]
|
||||
;ID Status/Setting
|
||||
|
||||
[PATTERNS]
|
||||
;ID Multipliers
|
||||
;
|
||||
stepdemand 1 1 1 1 1 1
|
||||
stepdemand 0 0 0 0 0 0
|
||||
|
||||
[CURVES]
|
||||
;ID X-Value Y-Value
|
||||
|
||||
[CONTROLS]
|
||||
|
||||
|
||||
|
||||
|
||||
[RULES]
|
||||
|
||||
|
||||
|
||||
[ENERGY]
|
||||
Global Efficiency 75
|
||||
Global Price 0
|
||||
Demand Charge 0
|
||||
|
||||
[EMITTERS]
|
||||
;Junction Coefficient
|
||||
|
||||
[QUALITY]
|
||||
;Node InitQual
|
||||
|
||||
[SOURCES]
|
||||
;Node Type Quality Pattern
|
||||
|
||||
[REACTIONS]
|
||||
;Type Pipe/Tank Coefficient
|
||||
|
||||
|
||||
[REACTIONS]
|
||||
Order Bulk 1
|
||||
Order Tank 1
|
||||
Order Wall 1
|
||||
Global Bulk 0
|
||||
Global Wall 0
|
||||
Limiting Potential 0
|
||||
Roughness Correlation 0
|
||||
|
||||
[MIXING]
|
||||
;Tank Model
|
||||
|
||||
[TIMES]
|
||||
Duration 24:00
|
||||
Hydraulic Timestep 0:10
|
||||
Quality Timestep 0:01
|
||||
Pattern Timestep 1:00
|
||||
Pattern Start 0:00
|
||||
Report Timestep 1:00
|
||||
Report Start 0:00
|
||||
Start ClockTime 12 am
|
||||
Statistic NONE
|
||||
|
||||
[REPORT]
|
||||
Status No
|
||||
Summary No
|
||||
Page 0
|
||||
|
||||
[OPTIONS]
|
||||
Units GPM
|
||||
Headloss H-W
|
||||
Specific Gravity 1
|
||||
Viscosity 1
|
||||
Trials 40
|
||||
Accuracy 0.001
|
||||
CHECKFREQ 2
|
||||
MAXCHECK 10
|
||||
DAMPLIMIT 0
|
||||
Unbalanced Continue 10
|
||||
Pattern 1
|
||||
Demand Multiplier 1.0
|
||||
Emitter Exponent 0.5
|
||||
Quality Trace Resr
|
||||
Diffusivity 1
|
||||
Tolerance 0.01
|
||||
|
||||
[COORDINATES]
|
||||
;Node X-Coord Y-Coord
|
||||
TreatmentPlant -1075.95 6943.94
|
||||
Montgomery 1273.73 6946.20
|
||||
Tennessee 3204.11 6946.20
|
||||
Reading 6352.85 6946.20
|
||||
Mills 10226.04 6943.94
|
||||
Vine 6356.24 5063.29
|
||||
Resr -2414.20 6923.08
|
||||
NewportTank 3209.76 8318.26
|
||||
|
||||
[VERTICES]
|
||||
;Link X-Coord Y-Coord
|
||||
|
||||
[LABELS]
|
||||
;X-Coord Y-Coord Label & Anchor Node
|
||||
|
||||
[BACKDROP]
|
||||
DIMENSIONS 0.00 0.00 10000.00 10000.00
|
||||
UNITS Meters
|
||||
FILE
|
||||
OFFSET 0.00 0.00
|
||||
|
||||
[END]
|
||||
@@ -1,123 +0,0 @@
|
||||
[TITLE]
|
||||
EPANET Example Network 3
|
||||
Example showing how the percent of Lake water in a dual-source
|
||||
system changes over time.
|
||||
|
||||
[JUNCTIONS]
|
||||
;ID Elev Demand Pattern
|
||||
node1 147 1 1 ;
|
||||
node2 147 1 1
|
||||
|
||||
[RESERVOIRS]
|
||||
;ID Head Pattern
|
||||
reservoir 220.0 ;
|
||||
|
||||
[TANKS]
|
||||
;ID Elevation InitLevel MinLevel MaxLevel Diameter MinVol VolCurve
|
||||
|
||||
[PIPES]
|
||||
;ID Node1 Node2 Length Diameter Roughness MinorLoss Status
|
||||
pipe1 reservoir node1 100 12 100 0 Open ;
|
||||
pipe2 node1 node2 100 12 100 0 Open ;
|
||||
|
||||
[PUMPS]
|
||||
;ID Node1 Node2 Parameters
|
||||
|
||||
[VALVES]
|
||||
;ID Node1 Node2 Diameter Type Setting MinorLoss
|
||||
|
||||
[TAGS]
|
||||
|
||||
[DEMANDS]
|
||||
;Junction Demand Pattern Category
|
||||
|
||||
[STATUS]
|
||||
;ID Status/Setting
|
||||
10 Closed
|
||||
|
||||
[PATTERNS]
|
||||
;ID Multipliers
|
||||
;General Default Demand Pattern
|
||||
1 1
|
||||
|
||||
[CURVES]
|
||||
;ID X-Value Y-Value
|
||||
|
||||
|
||||
[CONTROLS]
|
||||
|
||||
[RULES]
|
||||
|
||||
[ENERGY]
|
||||
Global Efficiency 75
|
||||
Global Price 0.0
|
||||
Demand Charge 0.0
|
||||
|
||||
[EMITTERS]
|
||||
;Junction Coefficient
|
||||
|
||||
[QUALITY]
|
||||
;Node InitQual
|
||||
|
||||
|
||||
[SOURCES]
|
||||
;Node Type Quality Pattern
|
||||
|
||||
[REACTIONS]
|
||||
;Type Pipe/Tank Coefficient
|
||||
|
||||
|
||||
[REACTIONS]
|
||||
Order Bulk 1
|
||||
Order Tank 1
|
||||
Order Wall 1
|
||||
Global Bulk 0.0
|
||||
Global Wall 0.0
|
||||
Limiting Potential 0.0
|
||||
Roughness Correlation 0.0
|
||||
|
||||
[MIXING]
|
||||
;Tank Model
|
||||
|
||||
[TIMES]
|
||||
Duration 24:00
|
||||
Hydraulic Timestep 0:05
|
||||
Quality Timestep 0:05
|
||||
Pattern Timestep 1:00
|
||||
Pattern Start 0:00
|
||||
Report Timestep 1:00
|
||||
Report Start 0:00
|
||||
Start ClockTime 12 am
|
||||
Statistic None
|
||||
|
||||
[REPORT]
|
||||
Status Yes
|
||||
Summary No
|
||||
Page 0
|
||||
|
||||
[OPTIONS]
|
||||
Units GPM
|
||||
Headloss H-W
|
||||
Specific Gravity 1.0
|
||||
Viscosity 1.0
|
||||
Trials 40
|
||||
Accuracy 0.001
|
||||
CHECKFREQ 2
|
||||
MAXCHECK 10
|
||||
DAMPLIMIT 0
|
||||
Unbalanced Continue 10
|
||||
Pattern 1
|
||||
Demand Multiplier 1.0
|
||||
Emitter Exponent 0.5
|
||||
Quality Trace reservoir
|
||||
Diffusivity 1.0
|
||||
Tolerance 0.01
|
||||
|
||||
[COORDINATES]
|
||||
;Node X-Coord Y-Coord
|
||||
|
||||
|
||||
[VERTICES]
|
||||
;Link X-Coord Y-Coord
|
||||
|
||||
[END]
|
||||
BIN
tests/network_tests/net1/net1.enb
Normal file
BIN
tests/network_tests/net1/net1.enb
Normal file
Binary file not shown.
178
tests/network_tests/net1/net1.inp
Normal file
178
tests/network_tests/net1/net1.inp
Normal file
@@ -0,0 +1,178 @@
|
||||
[TITLE]
|
||||
EPANET Example Network 1
|
||||
A simple example of modeling chlorine decay. Both bulk and
|
||||
wall reactions are included.
|
||||
|
||||
[JUNCTIONS]
|
||||
;ID Elev Demand Pattern
|
||||
10 710 0 ;
|
||||
11 710 150 ;
|
||||
12 700 150 ;
|
||||
13 695 100 ;
|
||||
21 700 150 ;
|
||||
22 695 200 ;
|
||||
23 690 150 ;
|
||||
31 700 100 ;
|
||||
32 710 100 ;
|
||||
|
||||
[RESERVOIRS]
|
||||
;ID Head Pattern
|
||||
9 800 ;
|
||||
|
||||
[TANKS]
|
||||
;ID Elevation InitLevel MinLevel MaxLevel Diameter MinVol VolCurve
|
||||
2 850 120 100 150 50.5 0 ;
|
||||
|
||||
[PIPES]
|
||||
;ID Node1 Node2 Length Diameter Roughness MinorLoss Status
|
||||
10 10 11 10530 18 100 0 Open ;
|
||||
11 11 12 5280 14 100 0 Open ;
|
||||
12 12 13 5280 10 100 0 Open ;
|
||||
21 21 22 5280 10 100 0 Open ;
|
||||
22 22 23 5280 12 100 0 Open ;
|
||||
31 31 32 5280 6 100 0 Open ;
|
||||
110 2 12 200 18 100 0 Open ;
|
||||
111 11 21 5280 10 100 0 Open ;
|
||||
112 12 22 5280 12 100 0 Open ;
|
||||
113 13 23 5280 8 100 0 Open ;
|
||||
121 21 31 5280 8 100 0 Open ;
|
||||
122 22 32 5280 6 100 0 Open ;
|
||||
|
||||
[PUMPS]
|
||||
;ID Node1 Node2 Parameters
|
||||
9 9 10 HEAD 1 ;
|
||||
|
||||
[VALVES]
|
||||
;ID Node1 Node2 Diameter Type Setting MinorLoss
|
||||
|
||||
[TAGS]
|
||||
|
||||
[DEMANDS]
|
||||
;Junction Demand Pattern Category
|
||||
|
||||
[STATUS]
|
||||
;ID Status/Setting
|
||||
|
||||
[PATTERNS]
|
||||
;ID Multipliers
|
||||
;Demand Pattern
|
||||
1 1.0 1.2 1.4 1.6 1.4 1.2
|
||||
1 1.0 0.8 0.6 0.4 0.6 0.8
|
||||
|
||||
[CURVES]
|
||||
;ID X-Value Y-Value
|
||||
;PUMP: Pump Curve for Pump 9
|
||||
1 1500 250
|
||||
|
||||
[CONTROLS]
|
||||
LINK 9 OPEN IF NODE 2 BELOW 110
|
||||
LINK 9 CLOSED IF NODE 2 ABOVE 140
|
||||
|
||||
|
||||
[RULES]
|
||||
|
||||
[ENERGY]
|
||||
Global Efficiency 75
|
||||
Global Price 0.0
|
||||
Demand Charge 0.0
|
||||
|
||||
[EMITTERS]
|
||||
;Junction Coefficient
|
||||
|
||||
[QUALITY]
|
||||
;Node InitQual
|
||||
10 0.5
|
||||
11 0.5
|
||||
12 0.5
|
||||
13 0.5
|
||||
21 0.5
|
||||
22 0.5
|
||||
23 0.5
|
||||
31 0.5
|
||||
32 0.5
|
||||
9 1.0
|
||||
2 1.0
|
||||
|
||||
[SOURCES]
|
||||
;Node Type Quality Pattern
|
||||
|
||||
[REACTIONS]
|
||||
;Type Pipe/Tank Coefficient
|
||||
|
||||
|
||||
[REACTIONS]
|
||||
Order Bulk 1
|
||||
Order Tank 1
|
||||
Order Wall 1
|
||||
Global Bulk -.5
|
||||
Global Wall -1
|
||||
Limiting Potential 0.0
|
||||
Roughness Correlation 0.0
|
||||
|
||||
[MIXING]
|
||||
;Tank Model
|
||||
|
||||
[TIMES]
|
||||
Duration 24:00
|
||||
Hydraulic Timestep 1:00
|
||||
Quality Timestep 0:05
|
||||
Pattern Timestep 2:00
|
||||
Pattern Start 0:00
|
||||
Report Timestep 1:00
|
||||
Report Start 0:00
|
||||
Start ClockTime 12 am
|
||||
Statistic None
|
||||
|
||||
[REPORT]
|
||||
Status Yes
|
||||
Summary No
|
||||
Page 0
|
||||
|
||||
[OPTIONS]
|
||||
Units GPM
|
||||
Headloss H-W
|
||||
Specific Gravity 1.0
|
||||
Viscosity 1.0
|
||||
Trials 40
|
||||
Accuracy 0.001
|
||||
CHECKFREQ 2
|
||||
MAXCHECK 10
|
||||
DAMPLIMIT 0
|
||||
Unbalanced Continue 10
|
||||
Pattern 1
|
||||
Demand Multiplier 1.0
|
||||
Emitter Exponent 0.5
|
||||
Quality Chlorine mg/L
|
||||
Diffusivity 1.0
|
||||
Tolerance 0.01
|
||||
|
||||
[COORDINATES]
|
||||
;Node X-Coord Y-Coord
|
||||
10 20.00 70.00
|
||||
11 30.00 70.00
|
||||
12 50.00 70.00
|
||||
13 70.00 70.00
|
||||
21 30.00 40.00
|
||||
22 50.00 40.00
|
||||
23 70.00 40.00
|
||||
31 30.00 10.00
|
||||
32 50.00 10.00
|
||||
9 10.00 70.00
|
||||
2 50.00 90.00
|
||||
|
||||
[VERTICES]
|
||||
;Link X-Coord Y-Coord
|
||||
|
||||
[LABELS]
|
||||
;X-Coord Y-Coord Label & Anchor Node
|
||||
6.99 73.63 "Source"
|
||||
13.48 68.13 "Pump"
|
||||
43.85 91.21 "Tank"
|
||||
|
||||
[BACKDROP]
|
||||
DIMENSIONS 7.00 6.00 73.00 94.00
|
||||
UNITS None
|
||||
FILE
|
||||
OFFSET 0.00 0.00
|
||||
|
||||
[END]
|
||||
35
tests/scripts/vb6_binary_files_compare/BinaryCompare.vbp
Normal file
35
tests/scripts/vb6_binary_files_compare/BinaryCompare.vbp
Normal file
@@ -0,0 +1,35 @@
|
||||
Type=Exe
|
||||
Form=frmMain.frm
|
||||
Module=basShellSync; ShellSync.bas
|
||||
Module=basNetRes; basNetRes.bas
|
||||
IconForm="frmMain"
|
||||
Startup="frmMain"
|
||||
HelpFile=""
|
||||
Title="Testing"
|
||||
ExeName32="BinaryCompare.exe"
|
||||
Command32=""
|
||||
Name="BinaryCompare"
|
||||
HelpContextID="0"
|
||||
CompatibleMode="0"
|
||||
MajorVer=1
|
||||
MinorVer=0
|
||||
RevisionVer=1
|
||||
AutoIncrementVer=1
|
||||
ServerSupportFiles=0
|
||||
VersionComments="by Elad Salomons"
|
||||
CompilationType=0
|
||||
OptimizationType=0
|
||||
FavorPentiumPro(tm)=0
|
||||
CodeViewDebugInfo=0
|
||||
NoAliasing=0
|
||||
BoundsCheck=0
|
||||
OverflowCheck=0
|
||||
FlPointCheck=0
|
||||
FDIVCheck=0
|
||||
UnroundedFP=0
|
||||
StartMode=0
|
||||
Unattended=0
|
||||
Retained=0
|
||||
ThreadPerObject=0
|
||||
MaxNumberOfThreads=1
|
||||
DebugStartupOption=0
|
||||
39
tests/scripts/vb6_binary_files_compare/ShellSync.bas
Normal file
39
tests/scripts/vb6_binary_files_compare/ShellSync.bas
Normal file
@@ -0,0 +1,39 @@
|
||||
Attribute VB_Name = "basShellSync"
|
||||
Option Explicit
|
||||
|
||||
Private Const INFINITE = &HFFFFFFFF
|
||||
Private Const SYNCHRONIZE = &H100000
|
||||
Private Const PROCESS_QUERY_INFORMATION = &H400&
|
||||
|
||||
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
|
||||
Private Declare Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess As Long, lpExitCode As Long) As Long
|
||||
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
|
||||
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
|
||||
Public Function ShellSync(ByVal PathName As String, ByVal WindowStyle As VbAppWinStyle) As Long
|
||||
'-----------------------------------------------------------------------------------------------
|
||||
'Shell and wait. Return exit code result, raise an
|
||||
'exception on any error.
|
||||
Dim lngPid As Long
|
||||
Dim lngHandle As Long
|
||||
Dim lngExitCode As Long
|
||||
|
||||
lngPid = Shell(PathName, WindowStyle)
|
||||
If lngPid <> 0 Then
|
||||
lngHandle = OpenProcess(SYNCHRONIZE Or PROCESS_QUERY_INFORMATION, 0, lngPid)
|
||||
If lngHandle <> 0 Then
|
||||
WaitForSingleObject lngHandle, INFINITE
|
||||
If GetExitCodeProcess(lngHandle, lngExitCode) <> 0 Then
|
||||
ShellSync = lngExitCode
|
||||
CloseHandle lngHandle
|
||||
Else
|
||||
CloseHandle lngHandle
|
||||
Err.Raise &H8004AA00, "ShellSync", "Failed to retrieve exit code, error " & CStr(Err.LastDllError)
|
||||
End If
|
||||
Else
|
||||
Err.Raise &H8004AA01, "ShellSync", "Failed to open child process"
|
||||
End If
|
||||
Else
|
||||
Err.Raise &H8004AA02, "ShellSync", "Failed to Shell child process"
|
||||
End If
|
||||
|
||||
End Function
|
||||
188
tests/scripts/vb6_binary_files_compare/basNetRes.bas
Normal file
188
tests/scripts/vb6_binary_files_compare/basNetRes.bas
Normal file
@@ -0,0 +1,188 @@
|
||||
Attribute VB_Name = "basNetRes"
|
||||
Public Type typNetRes
|
||||
nNodes As Long
|
||||
nLinks As Long
|
||||
|
||||
NodesID() As String
|
||||
LinksID() As String
|
||||
|
||||
NodesDemand() As Single
|
||||
NodesHead() As Single
|
||||
NodesPressure() As Single
|
||||
NodesQuality() As Single
|
||||
|
||||
LinksFlow() As Single
|
||||
LinksHeadloss() As Single
|
||||
LinksQuality() As Single
|
||||
LinksSetting() As Single
|
||||
LinksStatus() As Single
|
||||
LinksVelocity() As Single
|
||||
|
||||
End Type
|
||||
Public Function ReadOutputFile(OutFile As String, NetRes As typNetRes)
|
||||
'---------------------------------------------------------------------------------------
|
||||
Dim i As Long, F As Long, r As Long, nRep As Long, j As Long
|
||||
Dim tmpArr() As Single
|
||||
Dim pos As Long, N As Long
|
||||
Dim tmpLong As Long, tmpSingle As Single
|
||||
Dim ReportingTimeStep As Long, ReportingStartTime As Long
|
||||
Dim SimulationDuration As Long
|
||||
Dim ProblemTitletLine As String * 80
|
||||
Dim NumberOfNodes As Long
|
||||
Dim NumberOfLinks As Long
|
||||
Dim NumberOfReservoirsAndTanks As Long
|
||||
Dim NumberOfPumps As Long
|
||||
Dim NumberOfValves As Long
|
||||
Dim WaterQualityOption As Long
|
||||
Dim FlowUnitsOption As Long, PressureUnitsOption As Long
|
||||
Dim NameOfFile As String * 260, tmpString32 As String * 32
|
||||
Dim ii As Long
|
||||
Dim WarningFlag As Long
|
||||
|
||||
With NetRes
|
||||
pos = 1: N = 0
|
||||
F = FreeFile
|
||||
Open OutFile For Binary As #F
|
||||
Get #F, pos, tmpLong: pos = pos + 4
|
||||
Get #F, pos, tmpLong: pos = pos + 4
|
||||
Get #F, pos, NumberOfNodes: pos = pos + 4
|
||||
Get #F, pos, NumberOfReservoirsAndTanks: pos = pos + 4
|
||||
Get #F, pos, NumberOfLinks: pos = pos + 4
|
||||
Get #F, pos, NumberOfPumps: pos = pos + 4
|
||||
Get #F, pos, NumberOfValves: pos = pos + 4
|
||||
Get #F, pos, WaterQualityOption: pos = pos + 4
|
||||
Get #F, pos, tmpLong: pos = pos + 4
|
||||
Get #F, pos, FlowUnitsOption: pos = pos + 4
|
||||
Get #F, pos, PressureUnitsOption: pos = pos + 4
|
||||
Get #F, pos, tmpLong: pos = pos + 4
|
||||
Get #F, pos, ReportingStartTime: pos = pos + 4
|
||||
Get #F, pos, ReportingTimeStep: pos = pos + 4
|
||||
Get #F, pos, SimulationDuration: pos = pos + 4
|
||||
Get #F, pos, ProblemTitletLine: pos = pos + 80
|
||||
Get #F, pos, ProblemTitletLine: pos = pos + 80
|
||||
Get #F, pos, ProblemTitletLine: pos = pos + 80
|
||||
Get #F, pos, NameOfFile: pos = pos + 260
|
||||
Get #F, pos, NameOfFile: pos = pos + 260
|
||||
Get #F, pos, tmpString32: pos = pos + 32
|
||||
Get #F, pos, tmpString32: pos = pos + 32
|
||||
.nNodes = NumberOfNodes
|
||||
.nLinks = NumberOfLinks
|
||||
ReDim .NodesID(.nNodes)
|
||||
For j = 1 To NumberOfNodes
|
||||
Get #F, pos, tmpString32: pos = pos + 32
|
||||
i = InStr(1, tmpString32, Chr(0))
|
||||
.NodesID(j) = Mid(tmpString32, 1, i - 1)
|
||||
Next j
|
||||
ReDim .LinksID(.nLinks)
|
||||
For j = 1 To NumberOfLinks
|
||||
Get #F, pos, tmpString32: pos = pos + 32
|
||||
i = InStr(1, tmpString32, Chr(0))
|
||||
.LinksID(j) = Mid(tmpString32, 1, i - 1)
|
||||
Next j
|
||||
For j = 1 To NumberOfLinks * 3 'Index of Start Node of Each Link + Index of End Node of Each Link + Type Code of Each Link
|
||||
Get #F, pos, tmpLong: pos = pos + 4
|
||||
Next j
|
||||
For j = 1 To NumberOfReservoirsAndTanks 'Node Index of Each Tank
|
||||
Get #F, pos, tmpLong: pos = pos + 4
|
||||
Next j
|
||||
For j = 1 To NumberOfReservoirsAndTanks 'Cross-Sectional Area of Each Tank
|
||||
Get #F, pos, tmpSingle: pos = pos + 4
|
||||
Next j
|
||||
For j = 1 To NumberOfNodes 'Elevation of Each Node
|
||||
Get #F, pos, tmpSingle: pos = pos + 4
|
||||
Next j
|
||||
For j = 1 To NumberOfLinks 'Length of Each Link
|
||||
Get #F, pos, tmpSingle: pos = pos + 4
|
||||
Next j
|
||||
For j = 1 To NumberOfLinks 'Diameter of Each Link
|
||||
Get #F, pos, tmpSingle: pos = pos + 4
|
||||
Next j
|
||||
For j = 1 To NumberOfPumps 'Energy Use Section
|
||||
Get #F, pos, tmpLong: pos = pos + 4 'Pump Index in List of Links
|
||||
Get #F, pos, tmpSingle: pos = pos + 4 'Pump Utilization (%)
|
||||
Get #F, pos, tmpSingle: pos = pos + 4 'Average Efficiency (%)
|
||||
Get #F, pos, tmpSingle: pos = pos + 4 'Average Kwatts/Million Gallons (/Meter3)
|
||||
Get #F, pos, tmpSingle: pos = pos + 4 'Average Kwatts
|
||||
Get #F, pos, tmpSingle: pos = pos + 4 'Peak Kwatts
|
||||
Get #F, pos, tmpSingle: pos = pos + 4 'Average Cost Per Day
|
||||
Next j
|
||||
Get #F, pos, tmpSingle: pos = pos + 4 'Overall Peak Energy Usage
|
||||
|
||||
'reporting
|
||||
nRep = SimulationDuration / ReportingTimeStep + 1
|
||||
ReDim tmpArr(nRep)
|
||||
ReDim .NodesDemand(.nNodes, nRep)
|
||||
ReDim .NodesHead(.nNodes, nRep)
|
||||
ReDim .NodesPressure(.nNodes, nRep)
|
||||
ReDim .NodesQuality(.nNodes, nRep)
|
||||
|
||||
ReDim .LinksFlow(.nLinks, nRep)
|
||||
ReDim .LinksHeadloss(.nLinks, nRep)
|
||||
ReDim .LinksQuality(.nLinks, nRep)
|
||||
ReDim .LinksSetting(.nLinks, nRep)
|
||||
ReDim .LinksStatus(.nLinks, nRep)
|
||||
ReDim .LinksVelocity(.nLinks, nRep)
|
||||
|
||||
For r = 1 To nRep
|
||||
For j = 1 To NumberOfNodes 'Demand at Each Node
|
||||
Get #F, pos, tmpSingle: pos = pos + 4
|
||||
.NodesDemand(j, r) = tmpSingle
|
||||
Next j
|
||||
For j = 1 To NumberOfNodes 'Hydraulic Head at Each Node
|
||||
Get #F, pos, tmpSingle: pos = pos + 4
|
||||
.NodesHead(j, r) = tmpSingle
|
||||
Next j
|
||||
For j = 1 To NumberOfNodes 'Pressure at Each Node
|
||||
Get #F, pos, tmpSingle: pos = pos + 4
|
||||
.NodesPressure(j, r) = tmpSingle
|
||||
Next j
|
||||
For j = 1 To NumberOfNodes 'Water Quality at Each Node
|
||||
Get #F, pos, tmpSingle: pos = pos + 4
|
||||
.NodesPressure(j, r) = tmpSingle
|
||||
Next j
|
||||
For j = 1 To NumberOfLinks 'Flow in Each Link
|
||||
Get #F, pos, tmpSingle: pos = pos + 4
|
||||
.LinksFlow(j, r) = tmpSingle
|
||||
Next j
|
||||
For j = 1 To NumberOfLinks 'Velocity in Each Link
|
||||
Get #F, pos, tmpSingle: pos = pos + 4
|
||||
.LinksVelocity(j, r) = tmpSingle
|
||||
Next j
|
||||
For j = 1 To NumberOfLinks 'Headloss per 1000 Units of Length for Each Link
|
||||
Get #F, pos, tmpSingle: pos = pos + 4
|
||||
.LinksHeadloss(j, r) = tmpSingle
|
||||
Next j
|
||||
For j = 1 To NumberOfLinks 'Average Water Quality in Each Link
|
||||
Get #F, pos, tmpSingle: pos = pos + 4
|
||||
.LinksQuality(j, r) = tmpSingle
|
||||
Next j
|
||||
For j = 1 To NumberOfLinks 'Status Code for Each Link
|
||||
Get #F, pos, tmpSingle: pos = pos + 4
|
||||
.LinksStatus(j, r) = tmpSingle
|
||||
Next j
|
||||
For j = 1 To NumberOfLinks 'Setting for Each Link
|
||||
Get #F, pos, tmpSingle: pos = pos + 4
|
||||
.LinksSetting(j, r) = tmpSingle
|
||||
Next j
|
||||
For j = 1 To NumberOfLinks 'Reaction Rate for Each Link (mass/L/day)
|
||||
Get #F, pos, tmpSingle: pos = pos + 4
|
||||
Next j
|
||||
For j = 1 To NumberOfLinks 'Friction Factor for Each Link
|
||||
Get #F, pos, tmpSingle: pos = pos + 4
|
||||
Next j
|
||||
Next r
|
||||
|
||||
'Epilog Section
|
||||
Get #F, pos, tmpSingle: pos = pos + 4 'Average bulk reaction rate (mass/hr)
|
||||
Get #F, pos, tmpSingle: pos = pos + 4 'Average wall reaction rate (mass/hr)
|
||||
Get #F, pos, tmpSingle: pos = pos + 4 'Average tank reaction rate (mass/hr)
|
||||
Get #F, pos, tmpSingle: pos = pos + 4 'Average source inflow rate (mass/hr)
|
||||
Get #F, pos, tmpLong: pos = pos + 4 'Number of Reporting Periods
|
||||
Get #F, pos, WarningFlag: pos = pos + 4 'Warning Flag
|
||||
Get #F, pos, tmpLong: pos = pos + 4 'Magic Number ( = 516114521)
|
||||
|
||||
Close #F
|
||||
End With
|
||||
|
||||
End Function
|
||||
|
||||
179
tests/scripts/vb6_binary_files_compare/frmMain.frm
Normal file
179
tests/scripts/vb6_binary_files_compare/frmMain.frm
Normal file
@@ -0,0 +1,179 @@
|
||||
VERSION 5.00
|
||||
Begin VB.Form frmMain
|
||||
Caption = "Form1"
|
||||
ClientHeight = 5304
|
||||
ClientLeft = 48
|
||||
ClientTop = 396
|
||||
ClientWidth = 9648
|
||||
LinkTopic = "Form1"
|
||||
ScaleHeight = 5304
|
||||
ScaleWidth = 9648
|
||||
StartUpPosition = 3 'Windows Default
|
||||
Begin VB.ListBox List1
|
||||
Height = 4272
|
||||
Left = 1680
|
||||
TabIndex = 1
|
||||
Top = 360
|
||||
Width = 7092
|
||||
End
|
||||
Begin VB.CommandButton cmdRun
|
||||
Caption = "RUN"
|
||||
Height = 372
|
||||
Left = 360
|
||||
TabIndex = 0
|
||||
Top = 360
|
||||
Width = 972
|
||||
End
|
||||
End
|
||||
Attribute VB_Name = "frmMain"
|
||||
Attribute VB_GlobalNameSpace = False
|
||||
Attribute VB_Creatable = False
|
||||
Attribute VB_PredeclaredId = True
|
||||
Attribute VB_Exposed = False
|
||||
Option Explicit
|
||||
|
||||
Dim NetName As String
|
||||
|
||||
Dim net1 As typNetRes
|
||||
Dim net2 As typNetRes
|
||||
|
||||
Private Sub CompareVersions(NetName As String)
|
||||
'-----------------------------------------------
|
||||
Dim i As Long
|
||||
Dim v1 As Single, v2 As Single
|
||||
Dim T As Long
|
||||
Dim L As Long
|
||||
Dim maxDiff As Single
|
||||
Dim diff As Single
|
||||
Dim nRep As Long
|
||||
Dim F As Long
|
||||
|
||||
i = ShellSync("epanet2d.exe nets\" & NetName & ".inp nets\" & NetName & "_1.rep nets\" & NetName & "_1.out", vbNormalFocus)
|
||||
i = ReadOutputFile("nets\" & NetName & "_1.out", net1)
|
||||
|
||||
i = ShellSync("epanet2.exe nets\" & NetName & ".inp nets\" & NetName & "_2.rep nets\" & NetName & "_2.out", vbNormalFocus)
|
||||
i = ReadOutputFile("nets\" & NetName & "_2.out", net2)
|
||||
|
||||
F = FreeFile
|
||||
Open App.Path & "\Nets\" & NetName & ".dif" For Output As #F
|
||||
|
||||
nRep = UBound(net1.LinksFlow, 2)
|
||||
|
||||
maxDiff = 100: diff = 101
|
||||
For L = 1 To net1.nLinks
|
||||
For T = 1 To nRep
|
||||
v1 = net1.LinksFlow(L, T)
|
||||
v2 = net2.LinksFlow(L, T)
|
||||
If Abs(v1 - v2) > 0 Then diff = -Round(Log(Abs(v1 - v2)) / Log(10))
|
||||
If diff < maxDiff Then maxDiff = diff
|
||||
Next T
|
||||
Next L
|
||||
Print #F, "Links Flow max diff = " & Format(maxDiff, "0")
|
||||
|
||||
maxDiff = 100: diff = 101
|
||||
For L = 1 To net1.nLinks
|
||||
For T = 1 To nRep
|
||||
v1 = net1.LinksHeadloss(L, T)
|
||||
v2 = net2.LinksHeadloss(L, T)
|
||||
If Abs(v1 - v2) > 0 Then diff = -Round(Log(Abs(v1 - v2)) / Log(10))
|
||||
If diff < maxDiff Then maxDiff = diff
|
||||
Next T
|
||||
Next L
|
||||
Print #F, "Links Headloss max diff = " & Format(maxDiff, "0")
|
||||
|
||||
maxDiff = 100: diff = 101
|
||||
For L = 1 To net1.nLinks
|
||||
For T = 1 To nRep
|
||||
v1 = net1.LinksQuality(L, T)
|
||||
v2 = net2.LinksQuality(L, T)
|
||||
If Abs(v1 - v2) > 0 Then diff = -Round(Log(Abs(v1 - v2)) / Log(10))
|
||||
If diff < maxDiff Then maxDiff = diff
|
||||
Next T
|
||||
Next L
|
||||
Print #F, "Links Quality max diff = " & Format(maxDiff, "0")
|
||||
|
||||
maxDiff = 100: diff = 101
|
||||
For L = 1 To net1.nLinks
|
||||
For T = 1 To nRep
|
||||
v1 = net1.LinksVelocity(L, T)
|
||||
v2 = net2.LinksVelocity(L, T)
|
||||
If Abs(v1 - v2) > 0 Then diff = -Round(Log(Abs(v1 - v2)) / Log(10))
|
||||
If diff < maxDiff Then maxDiff = diff
|
||||
Next T
|
||||
Next L
|
||||
Print #F, "Links Velocity max diff = " & Format(maxDiff, "0")
|
||||
|
||||
maxDiff = 100: diff = 101
|
||||
For L = 1 To net1.nNodes
|
||||
For T = 1 To nRep
|
||||
v1 = net1.NodesDemand(L, T)
|
||||
v2 = net2.NodesDemand(L, T)
|
||||
If Abs(v1 - v2) > 0 Then diff = -Round(Log(Abs(v1 - v2)) / Log(10))
|
||||
If diff < maxDiff Then maxDiff = diff
|
||||
Next T
|
||||
Next L
|
||||
Print #F, "Nodes Demand max diff = " & Format(maxDiff, "0")
|
||||
|
||||
maxDiff = 100: diff = 101
|
||||
For L = 1 To net1.nNodes
|
||||
For T = 1 To nRep
|
||||
v1 = net1.NodesHead(L, T)
|
||||
v2 = net2.NodesHead(L, T)
|
||||
If Abs(v1 - v2) > 0 Then diff = -Round(Log(Abs(v1 - v2)) / Log(10))
|
||||
If diff < maxDiff Then maxDiff = diff
|
||||
Next T
|
||||
Next L
|
||||
Print #F, "Nodes Head max diff = " & Format(maxDiff, "0")
|
||||
|
||||
maxDiff = 100: diff = 101
|
||||
For L = 1 To net1.nNodes
|
||||
For T = 1 To nRep
|
||||
v1 = net1.NodesPressure(L, T)
|
||||
v2 = net2.NodesPressure(L, T)
|
||||
If Abs(v1 - v2) > 0 Then diff = -Round(Log(Abs(v1 - v2)) / Log(10))
|
||||
If diff < maxDiff Then maxDiff = diff
|
||||
Next T
|
||||
Next L
|
||||
Print #F, "Nodes Pressure max diff = " & Format(maxDiff, "0")
|
||||
|
||||
maxDiff = 100: diff = 101
|
||||
For L = 1 To net1.nNodes
|
||||
For T = 1 To nRep
|
||||
v1 = net1.NodesQuality(L, T)
|
||||
v2 = net2.NodesQuality(L, T)
|
||||
If Abs(v1 - v2) > 0 Then diff = -Round(Log(Abs(v1 - v2))) / Log(10)
|
||||
If diff < maxDiff Then maxDiff = diff
|
||||
Next T
|
||||
Next L
|
||||
Print #F, "Nodes Quality max diff = " & Format(maxDiff, "0")
|
||||
|
||||
Close #F
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub cmdRun_Click()
|
||||
'----------------------------------------------
|
||||
Dim fName As String
|
||||
|
||||
fName = Dir(App.Path & "\Nets\*.inp")
|
||||
If fName <> "" Then
|
||||
Do
|
||||
List1.AddItem fName: DoEvents
|
||||
fName = StrReverse(fName)
|
||||
fName = Mid(fName, 5)
|
||||
fName = StrReverse(fName)
|
||||
Call CompareVersions(fName)
|
||||
fName = Dir
|
||||
Loop Until fName = ""
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub Form_Load()
|
||||
|
||||
List1.Clear
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
8
tests/scripts/vb6_binary_files_compare/nets/Net2.dif
Normal file
8
tests/scripts/vb6_binary_files_compare/nets/Net2.dif
Normal file
@@ -0,0 +1,8 @@
|
||||
Links Flow max diff = 3
|
||||
Links Headloss max diff = 4
|
||||
Links Quality max diff = 3
|
||||
Links Velocity max diff = 6
|
||||
Nodes Demand max diff = 3
|
||||
Nodes Head max diff = 5
|
||||
Nodes Pressure max diff = 3
|
||||
Nodes Quality max diff = 100
|
||||
311
tests/scripts/vb6_binary_files_compare/nets/Net2.inp
Normal file
311
tests/scripts/vb6_binary_files_compare/nets/Net2.inp
Normal file
@@ -0,0 +1,311 @@
|
||||
[TITLE]
|
||||
EPANET Example Network 2
|
||||
Example of modeling a 55-hour fluoride tracer study.
|
||||
Measured fluoride data is contained in the file Net2-FL.dat
|
||||
and should be registered with the project to produce a
|
||||
Calibration Report (select Calibration Data from the Project
|
||||
menu).
|
||||
|
||||
[JUNCTIONS]
|
||||
;ID Elev Demand Pattern
|
||||
1 50 -694.4 2 ;
|
||||
2 100 8 ;
|
||||
3 60 14 ;
|
||||
4 60 8 ;
|
||||
5 100 8 ;
|
||||
6 125 5 ;
|
||||
7 160 4 ;
|
||||
8 110 9 ;
|
||||
9 180 14 ;
|
||||
10 130 5 ;
|
||||
11 185 34.78 ;
|
||||
12 2100 16 ;
|
||||
13 210 2 ;
|
||||
14 200 2 ;
|
||||
15 190 2 ;
|
||||
16 150 20 ;
|
||||
17 180 20 ;
|
||||
18 100 20 ;
|
||||
19 150 5 ;
|
||||
20 170 19 ;
|
||||
21 150 16 ;
|
||||
22 200 10 ;
|
||||
23 230 8 ;
|
||||
24 190 11 ;
|
||||
25 230 6 ;
|
||||
27 130 8 ;
|
||||
28 110 0 ;
|
||||
29 110 7 ;
|
||||
30 130 3 ;
|
||||
31 190 17 ;
|
||||
32 110 17 ;
|
||||
33 180 1.5 ;
|
||||
34 190 1.5 ;
|
||||
35 110 0 ;
|
||||
36 110 1 ;
|
||||
|
||||
[RESERVOIRS]
|
||||
;ID Head Pattern
|
||||
|
||||
[TANKS]
|
||||
;ID Elevation InitLevel MinLevel MaxLevel Diameter MinVol VolCurve
|
||||
26 235 56.7 50 70 50 0 ;
|
||||
|
||||
[PIPES]
|
||||
;ID Node1 Node2 Length Diameter Roughness MinorLoss Status
|
||||
1 1 2 2400 12 100 0 Open ;
|
||||
2 2 5 800 12 100 0 Open ;
|
||||
3 2 3 1300 8 100 0 Open ;
|
||||
4 3 4 1200 8 100 0 Open ;
|
||||
5 4 5 1000 12 100 0 Open ;
|
||||
6 5 6 1200 12 100 0 Open ;
|
||||
7 6 7 2700 12 100 0 Open ;
|
||||
8 7 8 1200 12 140 0 Open ;
|
||||
9 7 9 400 12 100 0 Open ;
|
||||
10 8 10 1000 8 140 0 Open ;
|
||||
11 9 11 700 12 100 0 Open ;
|
||||
12 11 12 1900 12 100 0 Open ;
|
||||
13 12 13 600 12 100 0 Open ;
|
||||
14 13 14 400 12 100 0 Open ;
|
||||
15 14 15 300 12 100 0 Open ;
|
||||
16 13 16 1500 8 100 0 Open ;
|
||||
17 15 17 1500 8 100 0 Open ;
|
||||
18 16 17 600 8 100 0 Open ;
|
||||
19 17 18 700 12 100 0 Open ;
|
||||
20 18 32 350 12 100 0 Open ;
|
||||
21 16 19 1400 8 100 0 Open ;
|
||||
22 14 20 1100 12 100 0 Open ;
|
||||
23 20 21 1300 8 100 0 Open ;
|
||||
24 21 22 1300 8 100 0 Open ;
|
||||
25 20 22 1300 8 100 0 Open ;
|
||||
26 24 23 600 12 100 0 Open ;
|
||||
27 15 24 250 12 100 0 Open ;
|
||||
28 23 25 300 12 100 0 Open ;
|
||||
29 25 26 200 12 100 0 Open ;
|
||||
30 25 31 600 12 100 0 Open ;
|
||||
31 31 27 400 8 100 0 Open ;
|
||||
32 27 29 400 8 100 0 Open ;
|
||||
34 29 28 700 8 100 0 Open ;
|
||||
35 22 33 1000 8 100 0 Open ;
|
||||
36 33 34 400 8 100 0 Open ;
|
||||
37 32 19 500 8 100 0 Open ;
|
||||
38 29 35 500 8 100 0 Open ;
|
||||
39 35 30 1000 8 100 0 Open ;
|
||||
40 28 35 700 8 100 0 Open ;
|
||||
41 28 36 300 8 100 0 Open ;
|
||||
|
||||
[PUMPS]
|
||||
;ID Node1 Node2 Parameters
|
||||
|
||||
[VALVES]
|
||||
;ID Node1 Node2 Diameter Type Setting MinorLoss
|
||||
|
||||
[TAGS]
|
||||
|
||||
[DEMANDS]
|
||||
;Junction Demand Pattern Category
|
||||
|
||||
[STATUS]
|
||||
;ID Status/Setting
|
||||
|
||||
[PATTERNS]
|
||||
;ID Multipliers
|
||||
;Demand Pattern
|
||||
1 1.26 1.04 .97 .97 .89 1.19
|
||||
1 1.28 .67 .67 1.34 2.46 .97
|
||||
1 .92 .68 1.43 .61 .31 .78
|
||||
1 .37 .67 1.26 1.56 1.19 1.26
|
||||
1 .6 1.1 1.03 .73 .88 1.06
|
||||
1 .99 1.72 1.12 1.34 1.12 .97
|
||||
1 1.04 1.15 .91 .61 .68 .46
|
||||
1 .51 .74 1.12 1.34 1.26 .97
|
||||
1 .82 1.37 1.03 .81 .88 .81
|
||||
1 .81
|
||||
;Pump Station Outflow Pattern
|
||||
2 .96 .96 .96 .96 .96 .96
|
||||
2 .62 0 0 0 0 0
|
||||
2 .8 1 1 1 1 .15
|
||||
2 0 0 0 0 0 0
|
||||
2 .55 .92 .92 .92 .92 .9
|
||||
2 .9 .45 0 0 0 0
|
||||
2 0 .7 1 1 1 1
|
||||
2 .2 0 0 0 0 0
|
||||
2 0 .74 .92 .92 .92 .92
|
||||
2 .92
|
||||
;Pump Station Fluoride Pattern
|
||||
3 .98 1.02 1.05 .99 .64 .46
|
||||
3 .35 .35 .35 .35 .35 .35
|
||||
3 .17 .17 .13 .13 .13 .15
|
||||
3 .15 .15 .15 .15 .15 .15
|
||||
3 .15 .12 .1 .08 .11 .09
|
||||
3 .09 .08 .08 .08 .08 .08
|
||||
3 .08 .09 .07 .07 .09 .09
|
||||
3 .09 .09 .09 .09 .09 .09
|
||||
3 .09 .08 .35 .72 .82 .92
|
||||
3 1
|
||||
|
||||
[CURVES]
|
||||
;ID X-Value Y-Value
|
||||
|
||||
[CONTROLS]
|
||||
|
||||
|
||||
[RULES]
|
||||
|
||||
|
||||
[ENERGY]
|
||||
Global Efficiency 75
|
||||
Global Price 0.0
|
||||
Demand Charge 0.0
|
||||
|
||||
[EMITTERS]
|
||||
;Junction Coefficient
|
||||
|
||||
[QUALITY]
|
||||
;Node InitQual
|
||||
1 1.0
|
||||
2 1.0
|
||||
3 1.0
|
||||
4 1.0
|
||||
5 1.0
|
||||
6 1.0
|
||||
7 1.0
|
||||
8 1.0
|
||||
9 1.0
|
||||
10 1.0
|
||||
11 1.0
|
||||
12 1.0
|
||||
13 1.0
|
||||
14 1.0
|
||||
15 1.0
|
||||
16 1.0
|
||||
17 1.0
|
||||
18 1.0
|
||||
19 1.0
|
||||
20 1.0
|
||||
21 1.0
|
||||
22 1.0
|
||||
23 1.0
|
||||
24 1.0
|
||||
25 1.0
|
||||
27 1.0
|
||||
28 1.0
|
||||
29 1.0
|
||||
30 1.0
|
||||
31 1.0
|
||||
32 1.0
|
||||
33 1.0
|
||||
34 1.0
|
||||
35 1.0
|
||||
36 1.0
|
||||
26 1.0
|
||||
|
||||
[SOURCES]
|
||||
;Node Type Quality Pattern
|
||||
1 CONCEN 1.0 3
|
||||
|
||||
[REACTIONS]
|
||||
;Type Pipe/Tank Coefficient
|
||||
|
||||
|
||||
[REACTIONS]
|
||||
Order Bulk 1
|
||||
Order Tank 1
|
||||
Order Wall 1
|
||||
Global Bulk 0.0
|
||||
Global Wall 0.0
|
||||
Limiting Potential 0.0
|
||||
Roughness Correlation 0.0
|
||||
|
||||
[MIXING]
|
||||
;Tank Model
|
||||
|
||||
[TIMES]
|
||||
Duration 55:00
|
||||
Hydraulic Timestep 1:00
|
||||
Quality Timestep 0:05
|
||||
Pattern Timestep 1:00
|
||||
Pattern Start 0:00
|
||||
Report Timestep 1:00
|
||||
Report Start 0:00
|
||||
Start ClockTime 8 am
|
||||
Statistic NONE
|
||||
|
||||
[REPORT]
|
||||
Status Full
|
||||
Summary No
|
||||
Page 0
|
||||
|
||||
[OPTIONS]
|
||||
Units GPM
|
||||
Headloss H-W
|
||||
Specific Gravity 1.0
|
||||
Viscosity 1.0
|
||||
Trials 40
|
||||
Accuracy 0.001
|
||||
CHECKFREQ 2
|
||||
MAXCHECK 10
|
||||
DAMPLIMIT 0
|
||||
Unbalanced Continue 10
|
||||
Pattern 1
|
||||
Demand Multiplier 1.0
|
||||
Emitter Exponent 0.5
|
||||
Quality Fluoride mg/L
|
||||
Diffusivity 1.0
|
||||
Tolerance 0.01
|
||||
|
||||
[COORDINATES]
|
||||
;Node X-Coord Y-Coord
|
||||
1 21.00 4.00
|
||||
2 19.00 20.00
|
||||
3 11.00 21.00
|
||||
4 14.00 28.00
|
||||
5 19.00 25.00
|
||||
6 28.00 23.00
|
||||
7 36.00 39.00
|
||||
8 38.00 30.00
|
||||
9 36.00 42.00
|
||||
10 37.00 23.00
|
||||
11 37.00 49.00
|
||||
12 39.00 60.00
|
||||
13 38.00 64.00
|
||||
14 38.00 66.00
|
||||
15 37.00 69.00
|
||||
16 27.00 65.00
|
||||
17 27.00 69.00
|
||||
18 23.00 68.00
|
||||
19 21.00 59.00
|
||||
20 45.00 68.00
|
||||
21 51.00 62.00
|
||||
22 54.00 69.00
|
||||
23 35.00 74.00
|
||||
24 37.00 71.00
|
||||
25 35.00 76.00
|
||||
27 39.00 87.00
|
||||
28 49.00 85.00
|
||||
29 42.00 86.00
|
||||
30 47.00 80.00
|
||||
31 37.00 80.00
|
||||
32 23.00 64.00
|
||||
33 56.00 73.00
|
||||
34 56.00 77.00
|
||||
35 43.00 81.00
|
||||
36 53.00 87.00
|
||||
26 33.00 76.00
|
||||
|
||||
[VERTICES]
|
||||
;Link X-Coord Y-Coord
|
||||
|
||||
[LABELS]
|
||||
;X-Coord Y-Coord Label & Anchor Node
|
||||
24.00 7.00 "Pump"
|
||||
24.00 4.00 "Station"
|
||||
26.76 77.42 "Tank"
|
||||
|
||||
[BACKDROP]
|
||||
DIMENSIONS 8.75 -0.15 58.25 91.15
|
||||
UNITS None
|
||||
FILE
|
||||
OFFSET 0.00 0.00
|
||||
|
||||
[END]
|
||||
12
tests/scripts/vb6_binary_files_compare/readme.txt
Normal file
12
tests/scripts/vb6_binary_files_compare/readme.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
The program will run all INP files in the Nets sub-directory.
|
||||
A report, binary output files and a .dif file will be created for each INP file.
|
||||
The report is the min(—log10(abs(X1-X2))) where X1 and X2 are the results arrays obtains from the two binary files.
|
||||
|
||||
Files needed in the code directory:
|
||||
epanet2d.exe is the official EPANET standalone version.
|
||||
epanet2.exe is the current development version (the one being tested).
|
||||
|
||||
How to use: run the program and click the RUN button.
|
||||
|
||||
By Elad Salomons
|
||||
email: selad@optiwater.com
|
||||
35
tests/test_networks.sh
Executable file
35
tests/test_networks.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#! /bin/bash
|
||||
test_networks()
|
||||
{
|
||||
returnValue=0
|
||||
for d in network_tests/*/ ; do
|
||||
for netfile in `ls $d*.inp`; do
|
||||
officialBinFile=${netfile%.*}.enb
|
||||
candidateBinFile=${netfile%.*}-candidate.enb
|
||||
echo "testing $netfile with known good binary output $officialBinFile"
|
||||
if ../build/CMake/buildproducts/bin/runepanet $netfile ${netfile%.*}-candidate.rpt $candidateBinFile
|
||||
then
|
||||
echo "epanet run for $netfile SUCCESS"
|
||||
else
|
||||
echo "epanet run for $netfile FAILED"
|
||||
returnValue=1
|
||||
fi
|
||||
if python ENBinaryOutDiff.py $officialBinFile $candidateBinFile
|
||||
then
|
||||
echo "binary output for $netfile PASSED"
|
||||
else
|
||||
echo "binary output for $netfile FAILED"
|
||||
returnValue=1
|
||||
fi
|
||||
echo "+++++"
|
||||
done
|
||||
done
|
||||
return $returnValue
|
||||
}
|
||||
|
||||
cp ../build/CMake/buildproducts/bin/libENBinaryOut.* ./libENBinaryOut.so
|
||||
cp ../tools/outputapi/*.py ./
|
||||
|
||||
|
||||
|
||||
test_networks
|
||||
1
tools/outputapi/ENBinaryOutDiff.py
Normal file
1
tools/outputapi/ENBinaryOutDiff.py
Normal file
@@ -0,0 +1 @@
|
||||
'''
|
||||
1
tools/outputapi/ENOutputWrapper.py
Normal file
1
tools/outputapi/ENOutputWrapper.py
Normal file
File diff suppressed because one or more lines are too long
502
tools/outputapi/outputapi.c
Normal file
502
tools/outputapi/outputapi.c
Normal file
@@ -0,0 +1,502 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// outputapi.c -- API for reading results from EPANet binary output file
|
||||
//
|
||||
// Version: 0.10
|
||||
// Date: 08/05/14
|
||||
// Date: 05/21/14
|
||||
//
|
||||
// Author: Michael E. Tryby
|
||||
// US EPA - NRMRL
|
||||
//
|
||||
// Purpose: Output API provides an interface for retrieving results from
|
||||
// an EPANet binary output file.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include "outputapi.h"
|
||||
|
||||
#define INT4 int
|
||||
#define REAL4 float
|
||||
#define RECORDSIZE 4 // number of bytes per file record
|
||||
|
||||
#define MEMCHECK(x) (((x) == NULL) ? 411 : 0 )
|
||||
|
||||
#define MINNREC 14 // minimum allowable number of records
|
||||
#define NNODERESULTS 4 // number of result fields for nodes
|
||||
#define NLINKRESULTS 8 // number of result fields for links
|
||||
|
||||
|
||||
struct ENResultsAPI {
|
||||
char name[MAXFNAME + 1]; // file path/name
|
||||
bool isOpened; // current state (CLOSED = 0, OPEN = 1)
|
||||
FILE *file; // FILE structure pointer
|
||||
|
||||
INT4 nodeCount, tankCount, linkCount, pumpCount, valveCount;
|
||||
INT4 reportStart, reportStep, simDuration, nPeriods;
|
||||
|
||||
INT4 flowFlag, pressFlag;
|
||||
|
||||
INT4 outputStartPos; // starting file position of output data
|
||||
INT4 bytesPerPeriod; // bytes saved per simulation time period
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Local functions
|
||||
//-----------------------------------------------------------------------------
|
||||
float getNodeValue(ENResultsAPI*, int, int, ENR_NodeAttribute);
|
||||
float getLinkValue(ENResultsAPI*, int, int, ENR_LinkAttribute);
|
||||
|
||||
|
||||
ENResultsAPI* DLLEXPORT ENR_alloc(void)
|
||||
{
|
||||
return malloc(sizeof(struct ENResultsAPI));
|
||||
}
|
||||
|
||||
int DLLEXPORT ENR_open(ENResultsAPI* enrapi, const char* path)
|
||||
//
|
||||
// Purpose: Open the output binary file and read epilogue
|
||||
//
|
||||
{
|
||||
int magic1, magic2, errCode, version;
|
||||
|
||||
strncpy(enrapi->name, path, MAXFNAME);
|
||||
enrapi->isOpened = false;
|
||||
|
||||
// Attempt to open binary output file for reading only
|
||||
if ((enrapi->file = fopen(path, "rb")) == NULL)
|
||||
return 434;
|
||||
else
|
||||
enrapi->isOpened = true;
|
||||
|
||||
// Fast forward to end and check for minimum number of records
|
||||
fseek(enrapi->file, 0L, SEEK_END);
|
||||
if (ftell(enrapi->file) < MINNREC*RECORDSIZE) {
|
||||
fclose(enrapi->file);
|
||||
// Error run terminated no results in binary file
|
||||
return 435;
|
||||
}
|
||||
|
||||
// Fast forward to end and read file epilogue
|
||||
fseek(enrapi->file, -3*RECORDSIZE, SEEK_END);
|
||||
fread(&(enrapi->nPeriods), RECORDSIZE, 1, enrapi->file);
|
||||
fread(&errCode, RECORDSIZE, 1, enrapi->file);
|
||||
fread(&magic2, RECORDSIZE, 1, enrapi->file);
|
||||
|
||||
// Rewind and read magic number from beginning of file
|
||||
fseek(enrapi->file, 0L, SEEK_SET);
|
||||
fread(&magic1, RECORDSIZE, 1, enrapi->file);
|
||||
|
||||
// Perform error checks
|
||||
if (magic1 != magic2 || errCode != 0 || enrapi->nPeriods == 0) {
|
||||
fclose(enrapi->file);
|
||||
// Error run terminated no results in binary file
|
||||
return 435;
|
||||
}
|
||||
|
||||
// Otherwise read network size
|
||||
fread(&version, RECORDSIZE, 1, enrapi->file);
|
||||
fread(&(enrapi->nodeCount), RECORDSIZE, 1, enrapi->file);
|
||||
fread(&(enrapi->tankCount), RECORDSIZE, 1, enrapi->file);
|
||||
fread(&(enrapi->linkCount), RECORDSIZE, 1, enrapi->file);
|
||||
fread(&(enrapi->pumpCount), RECORDSIZE, 1, enrapi->file);
|
||||
|
||||
// Jump ahead and read flow and pressure units
|
||||
fseek(enrapi->file, 3*RECORDSIZE, SEEK_CUR);
|
||||
fread(&(enrapi->flowFlag), RECORDSIZE, 1, enrapi->file);
|
||||
fread(&(enrapi->pressFlag), RECORDSIZE, 1, enrapi->file);
|
||||
|
||||
// Jump ahead and read time information
|
||||
fseek(enrapi->file, RECORDSIZE, SEEK_CUR);
|
||||
fread(&(enrapi->reportStart), RECORDSIZE, 1, enrapi->file);
|
||||
fread(&(enrapi->reportStep), RECORDSIZE, 1, enrapi->file);
|
||||
fread(&(enrapi->simDuration), RECORDSIZE, 1, enrapi->file);
|
||||
|
||||
// Compute positions and offsets for retrieving data
|
||||
enrapi->outputStartPos = 884;
|
||||
enrapi->outputStartPos += 32*enrapi->nodeCount + 32*enrapi->linkCount;
|
||||
enrapi->outputStartPos += 12*enrapi->linkCount+ 8*enrapi->tankCount
|
||||
+ 4*enrapi->nodeCount + 8*enrapi->linkCount;
|
||||
enrapi->outputStartPos += 28*enrapi->pumpCount + 4;
|
||||
|
||||
enrapi->bytesPerPeriod = 16*enrapi->nodeCount + 32*enrapi->linkCount;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DLLEXPORT ENR_getNetSize(ENResultsAPI* enrapi, ENR_ElementCount code, int* count)
|
||||
//
|
||||
// Purpose: Returns network size
|
||||
//
|
||||
{
|
||||
*count = -1;
|
||||
if (enrapi->isOpened) {
|
||||
switch (code)
|
||||
{
|
||||
case ENR_nodeCount: *count = enrapi->nodeCount; break;
|
||||
case ENR_tankCount: *count = enrapi->tankCount; break;
|
||||
case ENR_linkCount: *count = enrapi->linkCount; break;
|
||||
case ENR_pumpCount: *count = enrapi->pumpCount; break;
|
||||
case ENR_valveCount: *count = enrapi->valveCount; break;
|
||||
default: return 421;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return 412;
|
||||
}
|
||||
|
||||
int DLLEXPORT ENR_getUnits(ENResultsAPI* enrapi, ENR_Unit code, int* unitFlag)
|
||||
//
|
||||
// Purpose: Returns pressure and flow units
|
||||
//
|
||||
{
|
||||
*unitFlag = -1;
|
||||
if (enrapi->isOpened) {
|
||||
switch (code)
|
||||
{
|
||||
case ENR_flowUnits: *unitFlag = enrapi->flowFlag; break;
|
||||
case ENR_pressUnits: *unitFlag = enrapi->pressFlag; break;
|
||||
default: return 421;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return 412;
|
||||
}
|
||||
|
||||
int DLLEXPORT ENR_getTimes(ENResultsAPI* enrapi, ENR_Time code, int* time)
|
||||
//
|
||||
// Purpose: Returns report and simulation time related parameters.
|
||||
//
|
||||
{
|
||||
*time = -1;
|
||||
if (enrapi->isOpened) {
|
||||
switch (code)
|
||||
{
|
||||
case ENR_reportStart: *time = enrapi->reportStart; break;
|
||||
case ENR_reportStep: *time = enrapi->reportStep; break;
|
||||
case ENR_simDuration: *time = enrapi->simDuration; break;
|
||||
case ENR_numPeriods: *time = enrapi->nPeriods; break;
|
||||
default: return 421;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return 412;
|
||||
}
|
||||
|
||||
|
||||
float* ENR_newOutValueSeries(ENResultsAPI* enrapi, int seriesStart,
|
||||
int seriesLength, int* length, int* errcode)
|
||||
//
|
||||
// Purpose: Allocates memory for outValue Series.
|
||||
//
|
||||
// Warning: Caller must free memory allocated by this function using ENR_free().
|
||||
//
|
||||
{
|
||||
int size;
|
||||
float* array;
|
||||
|
||||
if (enrapi->isOpened) {
|
||||
|
||||
size = seriesLength - seriesStart;
|
||||
if (size > enrapi->nPeriods)
|
||||
size = enrapi->nPeriods;
|
||||
|
||||
// Allocate memory for outValues
|
||||
array = (float*) calloc(size + 1, sizeof(float));
|
||||
*errcode = (MEMCHECK(array));
|
||||
|
||||
*length = size;
|
||||
return array;
|
||||
}
|
||||
*errcode = 412;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
float* ENR_newOutValueArray(ENResultsAPI* enrapi, ENR_ApiFunction func,
|
||||
ENR_ElementType type, int* length, int* errcode)
|
||||
//
|
||||
// Purpose: Allocates memory for outValue Array.
|
||||
//
|
||||
// Warning: Caller must free memory allocated by this function using ENR_free().
|
||||
//
|
||||
{
|
||||
int size;
|
||||
float* array;
|
||||
|
||||
if (enrapi->isOpened) {
|
||||
switch (func)
|
||||
{
|
||||
case ENR_getAttribute:
|
||||
if (type == ENR_node)
|
||||
size = enrapi->nodeCount;
|
||||
else
|
||||
size = enrapi->linkCount;
|
||||
break;
|
||||
case ENR_getResult:
|
||||
if (type == ENR_node)
|
||||
size = NNODERESULTS;
|
||||
else
|
||||
size = NLINKRESULTS;
|
||||
break;
|
||||
default: *errcode = 421;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Allocate memory for outValues
|
||||
array = (float*) calloc(size, sizeof(float));
|
||||
*errcode = (MEMCHECK(array));
|
||||
|
||||
*length = size;
|
||||
return array;
|
||||
}
|
||||
*errcode = 412;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
int DLLEXPORT ENR_getNodeSeries(ENResultsAPI* enrapi, int nodeIndex, ENR_NodeAttribute attr,
|
||||
int seriesStart, int seriesLength, float* outValueSeries, int* length)
|
||||
//
|
||||
// What if timeIndex 0? length 0?
|
||||
//
|
||||
// Purpose: Get time series results for particular attribute. Specify series
|
||||
// start and length using seriesStart and seriesLength respectively.
|
||||
//
|
||||
{
|
||||
int k;
|
||||
|
||||
if (enrapi->isOpened) {
|
||||
|
||||
// Check memory for outValues
|
||||
if (outValueSeries == NULL) return 411;
|
||||
|
||||
// loop over and build time series
|
||||
for (k = 0; k <= seriesLength; k++)
|
||||
outValueSeries[k] = getNodeValue(enrapi, seriesStart + 1 + k,
|
||||
nodeIndex, attr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
// Error no results to report on binary file not opened
|
||||
return 412;
|
||||
}
|
||||
|
||||
int DLLEXPORT ENR_getLinkSeries(ENResultsAPI* enrapi, int linkIndex, ENR_LinkAttribute attr,
|
||||
int seriesStart, int seriesLength, float* outValueSeries)
|
||||
//
|
||||
// What if timeIndex 0? length 0?
|
||||
//
|
||||
// Purpose: Get time series results for particular attribute. Specify series
|
||||
// start and length using seriesStart and seriesLength respectively.
|
||||
//
|
||||
{
|
||||
int k;
|
||||
|
||||
if (enrapi->isOpened) {
|
||||
// Check memory for outValues
|
||||
if (outValueSeries == NULL) return 411;
|
||||
|
||||
// loop over and build time series
|
||||
for (k = 0; k <= seriesLength; k++)
|
||||
outValueSeries[k] = getLinkValue(enrapi, seriesStart +1 + k,
|
||||
linkIndex, attr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
// Error no results to report on binary file not opened
|
||||
return 412;
|
||||
}
|
||||
|
||||
|
||||
int DLLEXPORT ENR_getNodeAttribute(ENResultsAPI* enrapi, int timeIndex,
|
||||
ENR_NodeAttribute attr, float* outValueArray)
|
||||
//
|
||||
// Purpose: For all nodes at given time, get a particular attribute
|
||||
//
|
||||
{
|
||||
INT4 offset;
|
||||
|
||||
if (enrapi->isOpened) {
|
||||
// Check memory for outValues
|
||||
if (outValueArray == NULL) return 411;
|
||||
|
||||
// calculate byte offset to start time for series
|
||||
offset = enrapi->outputStartPos + (timeIndex)*enrapi->bytesPerPeriod;
|
||||
// add offset for node and attribute
|
||||
offset += (attr*enrapi->nodeCount)*RECORDSIZE;
|
||||
|
||||
fseek(enrapi->file, offset, SEEK_SET);
|
||||
fread(outValueArray, RECORDSIZE, enrapi->nodeCount, enrapi->file);
|
||||
|
||||
return 0;
|
||||
}
|
||||
// Error no results to report on binary file not opened
|
||||
return 412;
|
||||
}
|
||||
|
||||
int DLLEXPORT ENR_getLinkAttribute(ENResultsAPI* enrapi, int timeIndex,
|
||||
ENR_LinkAttribute attr, float* outValueArray)
|
||||
//
|
||||
// Purpose: For all links at given time, get a particular attribute
|
||||
//
|
||||
{
|
||||
INT4 offset;
|
||||
|
||||
if (enrapi->isOpened) {
|
||||
// Check memory for outValues
|
||||
if (outValueArray == NULL) return 411;
|
||||
|
||||
// calculate byte offset to start time for series
|
||||
offset = enrapi->outputStartPos + (timeIndex)*enrapi->bytesPerPeriod
|
||||
+ (NNODERESULTS*enrapi->nodeCount)*RECORDSIZE;
|
||||
// add offset for link and attribute
|
||||
offset += (attr*enrapi->linkCount)*RECORDSIZE;
|
||||
|
||||
fseek(enrapi->file, offset, SEEK_SET);
|
||||
fread(outValueArray, RECORDSIZE, enrapi->linkCount, enrapi->file);
|
||||
|
||||
return 0;
|
||||
}
|
||||
// Error no results to report on binary file not opened
|
||||
return 412;
|
||||
}
|
||||
|
||||
int DLLEXPORT ENR_getNodeResult(ENResultsAPI* enrapi, int timeIndex, int nodeIndex,
|
||||
float* outValueArray)
|
||||
//
|
||||
// Purpose: For a node at given time, get all attributes
|
||||
//
|
||||
{
|
||||
int j;
|
||||
|
||||
if (enrapi->isOpened) {
|
||||
// Check memory for outValues
|
||||
if (outValueArray == NULL) return 411;
|
||||
|
||||
for (j = 0; j < NNODERESULTS; j++)
|
||||
outValueArray[j] = getNodeValue(enrapi, timeIndex + 1, nodeIndex, j);
|
||||
|
||||
return 0;
|
||||
}
|
||||
// Error no results to report on binary file not opened
|
||||
return 412;
|
||||
}
|
||||
|
||||
int DLLEXPORT ENR_getLinkResult(ENResultsAPI* enrapi, int timeIndex, int linkIndex,
|
||||
float* outValueArray)
|
||||
//
|
||||
// Purpose: For a link at given time, get all attributes
|
||||
//
|
||||
{
|
||||
int j;
|
||||
|
||||
if (enrapi->isOpened) {
|
||||
// Check memory for outValues
|
||||
if (outValueArray == NULL) return 411;
|
||||
|
||||
for (j = 0; j < NLINKRESULTS; j++)
|
||||
outValueArray[j] = getLinkValue(enrapi, timeIndex + 1, linkIndex, j);
|
||||
|
||||
return 0;
|
||||
}
|
||||
// Error no results to report on binary file not opened
|
||||
return 412;
|
||||
}
|
||||
|
||||
int DLLEXPORT ENR_free(float* array)
|
||||
//
|
||||
// Purpose: frees memory allocated using ENR_newOutValueSeries() or
|
||||
// ENR_newOutValueArray()
|
||||
//
|
||||
{
|
||||
if (array != NULL)
|
||||
free(array);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int DLLEXPORT ENR_close(ENResultsAPI* enrapi)
|
||||
//
|
||||
// Purpose: Clean up after and close Output API
|
||||
//
|
||||
{
|
||||
if (enrapi->isOpened) {
|
||||
fclose(enrapi->file);
|
||||
free(enrapi);
|
||||
}
|
||||
// Error binary file not opened
|
||||
else return 412;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int DLLEXPORT ENR_errMessage(int errcode, char* errmsg, int n)
|
||||
//
|
||||
// Purpose: takes error code returns error message
|
||||
//
|
||||
// Input Error 411: no memory allocated for results
|
||||
// Input Error 412: no results binary file hasn't been opened
|
||||
// Input Error 421: invalid parameter code
|
||||
// File Error 434: unable to open binary output file
|
||||
// File Error 435: run terminated no results in binary file
|
||||
{
|
||||
switch (errcode)
|
||||
{
|
||||
case 411: strncpy(errmsg, ERR411, n); break;
|
||||
case 412: strncpy(errmsg, ERR412, n); break;
|
||||
case 421: strncpy(errmsg, ERR421, n); break;
|
||||
case 434: strncpy(errmsg, ERR434, n); break;
|
||||
case 435: strncpy(errmsg, ERR435, n); break;
|
||||
default: return 421;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
float getNodeValue(ENResultsAPI* enrapi, int timeIndex, int nodeIndex,
|
||||
ENR_NodeAttribute attr)
|
||||
//
|
||||
// Purpose: Retrieves an attribute value at a specified node and time
|
||||
//
|
||||
{
|
||||
REAL4 y;
|
||||
INT4 offset;
|
||||
|
||||
// calculate byte offset to start time for series
|
||||
offset = enrapi->outputStartPos + (timeIndex - 1)*enrapi->bytesPerPeriod;
|
||||
// add bytepos for node and attribute
|
||||
offset += (nodeIndex + attr*enrapi->nodeCount)*RECORDSIZE;
|
||||
|
||||
fseek(enrapi->file, offset, SEEK_SET);
|
||||
fread(&y, RECORDSIZE, 1, enrapi->file);
|
||||
|
||||
return y;
|
||||
}
|
||||
|
||||
float getLinkValue(ENResultsAPI* enrapi, int timeIndex, int linkIndex,
|
||||
ENR_LinkAttribute attr)
|
||||
//
|
||||
// Purpose: Retrieves an attribute value at a specified link and time
|
||||
//
|
||||
{
|
||||
REAL4 y;
|
||||
INT4 offset;
|
||||
|
||||
// Calculate byte offset to start time for series
|
||||
offset = enrapi->outputStartPos + (timeIndex - 1)*enrapi->bytesPerPeriod
|
||||
+ (NNODERESULTS*enrapi->nodeCount)*RECORDSIZE;
|
||||
// add bytepos for link and attribute
|
||||
offset += (linkIndex + attr*enrapi->linkCount)*RECORDSIZE;
|
||||
|
||||
fseek(enrapi->file, offset, SEEK_SET);
|
||||
fread(&y, RECORDSIZE, 1, enrapi->file);
|
||||
|
||||
return y;
|
||||
}
|
||||
122
tools/outputapi/outputapi.h
Normal file
122
tools/outputapi/outputapi.h
Normal file
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* outputapi.h
|
||||
*
|
||||
* Created on: Jun 4, 2014
|
||||
* Author: mtryby
|
||||
*/
|
||||
|
||||
#ifndef OUTPUTAPI_H_
|
||||
#define OUTPUTAPI_H_
|
||||
|
||||
#define MAXFNAME 259
|
||||
|
||||
/*------------------- Error Messages --------------------*/
|
||||
#define ERR411 "Input Error 411: no memory allocated for results."
|
||||
#define ERR412 "Input Error 412: no results; binary file hasn't been opened."
|
||||
#define ERR421 "Input Error 421: invalid parameter code."
|
||||
#define ERR434 "File Error 434: unable to open binary output file."
|
||||
#define ERR435 "File Error 435: run terminated; no results in binary file."
|
||||
|
||||
|
||||
/* Epanet Results binary file API */
|
||||
typedef struct ENResultsAPI ENResultsAPI; // opaque struct object
|
||||
|
||||
typedef enum {
|
||||
ENR_node = 1,
|
||||
ENR_link = 2
|
||||
} ENR_ElementType;
|
||||
|
||||
typedef enum {
|
||||
ENR_getSeries = 1,
|
||||
ENR_getAttribute = 2,
|
||||
ENR_getResult = 3
|
||||
} ENR_ApiFunction;
|
||||
|
||||
typedef enum {
|
||||
ENR_nodeCount = 1,
|
||||
ENR_tankCount = 2,
|
||||
ENR_linkCount = 3,
|
||||
ENR_pumpCount = 4,
|
||||
ENR_valveCount = 5
|
||||
} ENR_ElementCount;
|
||||
|
||||
typedef enum {
|
||||
ENR_flowUnits = 1,
|
||||
ENR_pressUnits = 2
|
||||
} ENR_Unit;
|
||||
|
||||
typedef enum {
|
||||
ENR_reportStart = 1,
|
||||
ENR_reportStep = 2,
|
||||
ENR_simDuration = 3,
|
||||
ENR_numPeriods = 4
|
||||
}ENR_Time;
|
||||
|
||||
typedef enum {
|
||||
ENR_demand = 0,
|
||||
ENR_head = 1,
|
||||
ENR_pressure = 2,
|
||||
ENR_quality = 3
|
||||
} ENR_NodeAttribute;
|
||||
|
||||
typedef enum {
|
||||
ENR_flow = 0,
|
||||
ENR_velocity = 1,
|
||||
ENR_headloss = 2,
|
||||
ENR_avgQuality = 3,
|
||||
ENR_status = 4,
|
||||
ENR_setting = 5,
|
||||
ENR_rxRate = 6,
|
||||
ENT_frctnFctr = 7
|
||||
} ENR_LinkAttribute;
|
||||
|
||||
|
||||
#ifdef WINDOWS
|
||||
#ifdef __cplusplus
|
||||
#define DLLEXPORT extern "C" __declspec(dllexport) __stdcall
|
||||
#else
|
||||
#define DLLEXPORT __declspec(dllexport) __stdcall
|
||||
#endif
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
#define DLLEXPORT extern "C"
|
||||
#else
|
||||
#define DLLEXPORT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
ENResultsAPI* DLLEXPORT ENR_alloc(void);
|
||||
|
||||
int DLLEXPORT ENR_open(ENResultsAPI* enrapi, const char* path);
|
||||
|
||||
int DLLEXPORT ENR_getNetSize(ENResultsAPI* enrapi, ENR_ElementCount code, int* count);
|
||||
int DLLEXPORT ENR_getUnits(ENResultsAPI* enrapi, ENR_Unit code, int* unitFlag);
|
||||
|
||||
float* ENR_newOutValueSeries(ENResultsAPI* enrapi, int seriesStart,
|
||||
int seriesLength, int* length, int* errcode);
|
||||
float* ENR_newOutValueArray(ENResultsAPI* enrapi, ENR_ApiFunction func,
|
||||
ENR_ElementType type, int* length, int* errcode);
|
||||
|
||||
int DLLEXPORT ENR_getNodeSeries(ENResultsAPI* enrapi, int nodeIndex, ENR_NodeAttribute attr,
|
||||
int timeIndex, int length, float* outValueSeries, int* len);
|
||||
int DLLEXPORT ENR_getLinkSeries(ENResultsAPI* enrapi, int linkIndex, ENR_LinkAttribute attr,
|
||||
int timeIndex, int length, float* outValueSeries);
|
||||
|
||||
int DLLEXPORT ENR_getNodeAttribute(ENResultsAPI* enrapi, int timeIndex,
|
||||
ENR_NodeAttribute attr, float* outValueArray);
|
||||
int DLLEXPORT ENT_getLinkAttribute(ENResultsAPI* enrapi, int timeIndex,
|
||||
ENR_LinkAttribute attr, float* outValueArray);
|
||||
|
||||
int DLLEXPORT ENR_getNodeResult(ENResultsAPI* enrapi, int timeIndex, int nodeIndex,
|
||||
float* outValueArray);
|
||||
int DLLEXPORT ENR_getLinkResult(ENResultsAPI* enrapi, int timeIndex, int linkIndex,
|
||||
float* outValueArray);
|
||||
|
||||
int DLLEXPORT ENR_free(float *array);
|
||||
int DLLEXPORT ENR_close(ENResultsAPI* enrapi);
|
||||
int DLLEXPORT ENR_errMessage(int errcode, char* errmsg, int n);
|
||||
|
||||
|
||||
#endif /* OUTPUTAPI_H_ */
|
||||
|
||||
31
tools/update-authors.sh
Executable file
31
tools/update-authors.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
##
|
||||
## This script will auto-generate the AUTHORS attribution file.
|
||||
## If your name does not display correctly, then please
|
||||
## update the .mailmap file in the root repo directory
|
||||
##
|
||||
|
||||
git log --reverse --format='%aN <%aE>' | perl -we '
|
||||
|
||||
BEGIN {
|
||||
%seen = (), @authors = ();
|
||||
}
|
||||
|
||||
## must manually add Lew first, since he generated the code prior to CVS
|
||||
push @authors, "Lew Rossman <LRossman\@cinci.rr.com>\n";
|
||||
|
||||
while (<>) {
|
||||
next if $seen{$_};
|
||||
next if /orquina.jessica\@epa.gov/; ## this individual never authored code; just init-ed the repo
|
||||
$seen{$_} = push @authors, $_;
|
||||
}
|
||||
|
||||
END {
|
||||
print "# Authors ordered by first contribution.\n";
|
||||
print "# Generated by tools/update-authors.sh\n";
|
||||
print "\n", @authors;
|
||||
|
||||
}
|
||||
|
||||
' > ../AUTHORS
|
||||
Reference in New Issue
Block a user