Commit Graph

58 Commits

Author SHA1 Message Date
Lew Rossman 70d5483361 Add read/write of disabled controls to input file 2025-02-11 15:38:30 -05:00
Lew Rossman b0796f346a Adding leakage model 2024-06-26 11:15:01 -04:00
Yu Chun Tsao 96cb4c9c88 fix: Use two semicolons in each heading line 2024-06-19 00:46:17 +08:00
Yu Chun Tsao 317990a8d1 feat: Add column headings for sections in INP file
This commit includes the following changes:
- Column headings have been added for each section in the INP file.
- The alignment of the values has been updated to match these headings.

These enhancements improve readability and understanding of the INP file.
2024-06-15 23:48:14 +08:00
Lew Rossman 7e66114863 Changes EMITTER BACKFLOW keyword
This change avoids a conflict between the EMITTER EXPONENT and EMITTER BACKFLOW keywords when running a v2.3 input file in the v2.2 EPANET GUI.
2024-05-11 12:37:52 -04:00
Lew Rossman a9079b023b Allow simple controls to set valves OPEN/CLOSED 2023-05-13 12:29:35 -04:00
Lew Rossman 847fa82139 Add emitter backflow option
Adds a global hydraulic option to allow backflow or not through emitter elements. To maintain backward compatibility the default is YES.
2023-02-05 15:16:20 -05:00
Lew Rossman f60102105a Ignore errors in coords. read from file
Ignores errors when reading node & link vertex coordinates from an input file. Also when saving a project to an input file, the [DEMANDS] section only includes non-zero demands.
See issues #603 and #174 .
2023-01-26 12:50:26 -05:00
Lew Rossman 6db17193f5 New positional control valve added 2022-08-16 11:47:44 -04:00
Luke Butler 9c0b576182 Fix for GPV controls in EN_saveinpfile
EN_saveinpfile was incorrectly saving the index of the GPV head loss curve inside of a simple control instead of the control status
2022-03-30 23:13:48 -04:00
Lew Rossman afda609223 Adds get/set for default demand pattern to toolkit 2022-01-14 08:50:33 -05:00
Lew Rossman 951c7ce727 Refactor tank mixing zone volume
Addresses issue #597.
2020-07-11 17:12:49 -04:00
Lew Rossman 7aadc83ddf Adds link vertex get/set functions to the API 2019-10-29 16:33:40 -04:00
Lew Rossman 9669742ab3 Adds tank overflow feature 2019-06-17 09:16:04 -04:00
Lew Rossman c9b836973e Removes _DEBUG directives from all source files
This commit removes the #ifdef _DEBUG statements at the top of all source code files per issue #482. It also updates the doc files to stress that the speedup observed for hydraulic analysis with the MMD node re-ordering method only applies to single period runs.
2019-05-13 23:49:19 -04:00
Lew Rossman 365ab00dcb Refactors the API's demand editing functions 2019-05-09 10:26:40 -04:00
michaeltryby ce70d144ce Restoring write_demands section in saveinpfile 2019-04-22 13:13:38 -04:00
michaeltryby c98a43e72c Isolating bug
Not writing demand section of input file should eliminate it
2019-04-22 12:47:52 -04:00
michaeltryby d34ac67172 updating get demand name and write demands
Everything passing locally
2019-04-22 12:14:33 -04:00
michaeltryby b80b4ed09c Update inpfile.c
Testing linux build
2019-04-22 10:52:04 -04:00
Michael Tryby 6a084cc764 Update inpfile.c
Trying to isolate bug
2019-04-19 22:35:15 -04:00
Michael Tryby 8761543395 Working on gcc bug
Tests are passing on Appveyor
2019-04-19 22:24:31 -04:00
Michael Tryby e2e12fab22 Cleaning up gcc build 2019-04-19 21:51:55 -04:00
Michael Tryby 405822cdf6 Cleaning up build on gcc 2019-04-19 21:34:25 -04:00
Michael Tryby e9650d2d6d Work in progress
Fixing memory leaks
Unit tests passing
2019-04-19 21:21:58 -04:00
Michael Tryby 109276e379 Work in progress
Implementing generic demand pattern lists. Compiles but does not run.
2019-04-17 17:24:34 -04:00
Michael Tryby 927cf9770e merging upstream dev 2019-04-03 16:40:58 -04:00
Michael Tryby 84bf6f98d0 Cleaning up include statements adding crtdbg.h 2019-04-03 15:55:23 -04:00
Lew Rossman 83ffc1cfc7 Removed the EN_DEFDEMANDPAT option
See issue #429. Also allowed the EN_HEADLOSSFORM option to be changed if the solver is not active.
2019-04-03 10:25:37 -04:00
Lew Rossman 6a4b95f4d5 Bug fixes 2019-04-02 22:21:05 -04:00
Lew Rossman 18f65eb8b0 Replace fixed-sized comment strings with dynamic strings 2019-03-17 19:54:51 -04:00
Lew Rossman 03f41d567d Set InFile to NULL after closing it 2019-03-09 10:52:59 -05:00
Lew Rossman e5ec4eecab Fixes writing auxiliary data for deleted elements to a saved input file (#411) 2019-03-08 16:41:12 -05:00
Lew Rossman 0cfa45e52e New updates to address compiler warnings (issue #370)
In addition to addressing compiler warnings, argument names in the API function prototypes were made more consistent and descriptive. Also additional Doxygen comments were added in preparation for producing a more thorough documentation of the API.
2019-01-19 16:56:19 -05:00
Lew Rossman dd376692ad Floating pt. args in thread-safe API changed to doubles (Issue #365) 2019-01-09 15:14:10 -05:00
Lew Rossman 9a540cc0f4 Code cleanup
1. Added a standard header to each code module and removed obsolete comments.
2. Re-named several of the sub-structs in the project struct and re-arranged some of their contents.
3. Re-named _defaultModel to _defaultProject.
4. Removed the need to call EN_createproject and EN_deleteproject when working with the default project.
5. Made X & Y coords. part of Snode properties instead of a separate struct.
6. Moved the non-API functions in epanet.c into a new module named project.c.
7. Re-factored the quality module so that it uses the same nodal adjacency lists as the hydraulics solver.
8. Re-factored the sparse matrix module (smatrix.c) to be more memory efficient.
9. Restricted line lengths to < 90 columns.
10. Grouped the placement of functions in EPANET2.H and EPANET.C by category.
2018-11-27 14:22:06 -05:00
Lew Rossman 7443cea9d4 Fixes #172 (adjust controls when node/link is deleted) & EN_addrule added
- Deleting controls with node/link deletion made conditional.
- New EN_addrule function added along with a test file.
- Rule structures re-named & rules.c heavily modified.
- Issue with exceeding limit on number of temporary file names fixed.
- VB declaration and DEF files updated.
2018-11-07 23:09:47 -05:00
Elad Salomons cc21b55b68 Read and write demand categories names
Fixes #290
2018-09-22 11:19:05 +03:00
Michael Tryby bec729a669 Fixing compiler warnings 2018-09-13 10:48:55 -04:00
Lew Rossman b3e26b9ac8 Resolved conflict in inpfile.c 2018-08-13 10:11:34 -04:00
Lew Rossman 3bd2d4a800 Merge branch 'contributor-lr' of https://github.com/LRossman/EPANET into contributor-lr 2018-08-13 10:09:44 -04:00
Lew Rossman a73d9235e7 Fixed max. flow change node ID in Status Report 2018-08-13 10:04:24 -04:00
Elad Salomons d94e1643bf Update Windows build script and VB header file
Also save HeadErrorLimit and FlowChangeLimit only if they are used.
2018-08-13 09:19:05 +03:00
Lew Rossman b5e3986e6b Pressure Dependent Demands added to address issue 163 2018-08-09 10:42:47 -04:00
Elad Salomons f86df2291a Saving HeadErrorLimit and FlowChangeLimit only if they are used
To help a bit with backward computability the two new parameters will be saved to the INP file only if values were set for them.
2018-06-21 10:20:16 +03:00
Lew Rossman b3ab8ea2c7 Addresses issue #161
Adds new options HEADERROR and FLOWCHANGE to provide more rigorous criteria for hydraulic convergence. Also breaks HYDRAUL.C into 3 separate files to improve code readability.
2018-06-16 11:02:18 -04:00
Sam Hatchett f97d837231 Feature wrapper (#136)
this quite sizable commit does several things, but is primarily
focussed on building a toolkit that can run simultaneous
simulations/analyses within a shared memory space. Versions <=2.1 use a
long list of global variables that prevent multiple instantiations on
linux systems without resorting to compilation tricks (like duplicate
binaries or similar via static linkage). This version uses a single "Project" pointer to encapsulate
the network and analysis data. There are no changes to existing algo
implementations other than to accomodate dereferencing of the passed-in
pointers. A more detailed list of major changes below:

- mirrors all “ENxxxx” function calls with “EN_xxxx” versions (note the
underscore) that take an extra first parameter: a pointer to an
EN_Project struct, which contains all network, hydraulic, quality, and
associated data.
- tweaks some code formatting to make it more readable
- removes some deprecated/commented code that was sufficiently old
- fixes implicit type-cast warnings

* Added ENaddnode and ENaddlink functions

* More memory reallocations

* Added ENInit, ENsetheadcurveindex

* Added ENdeletelink and ENdeletenode

* restored default behavior for float types

* fixed type

* Added docstrings for ENinit

* cleanup change

* moves global rule variables to vars.h

* migrates rule structs to typedefs

for better readability

* char types to proper enums

fixes #93

* Change some variable declarations for compatibility

Changes to keep compatibility with C89 compilers: variables must be
declared at the top of the functions. Remove the use of EN_LinkType in
function call as it is not compatible with ENgetnodetype.

* Moved declaration of idstodelete to top of function

* Updated ENinit function and headers

Updated header files with new functions
Updated def file with new functions
For ENinit changes names of parameters #98
Added enum for headloss formula

* Missed these files in 1a033fc

* migrates char types to enums fixes #93,

supports unified link/node type enums, rather than public/private
redefinitions

* removing links in reverse-index order maintains proper indexing fixes #96

* style

* clarifies curve getter units issue (dox)

closes #95

* fixes link/node confusion in ENsetlinktype

partially reverts a3bce95dc330a5a297634a303d438e2e1bc41cc9

* partial compilation fix

* fixes dox issue

* fixes allocation issues with enums

- updates style in various places
- introduces FlowDirection enum
- use snprintf to prevent overflow

* fixes enum type cast

* updated mac project settings

* Use of _snprintf on Windows and remove DLLEXPORT from mempool.h

snprintf it not compatible on Windows so we use _snprintf
mempool gave starnge compilation errors while removing DLLEXPORT worked.
Not sure why these functions needed to be exposed in the DLL?

* Revert "Use of _snprintf on Windows and remove DLLEXPORT from mempool.h"

This reverts commit 6238f77d47fa0feaabe5836043c006937de433a2.

* use of _snprintf instead of snprintf on Windows and removed DLLEXPORT from mempool.h

Had compilation errors on mempool.h. Removed DLLEXPORT so solve it. Not
sure why there was a need to expose these functions?

* Shift indices for Links in ENaddnode

Need to shift indices for Links not just Pipes since a pump could be
connected directly to a reservoir. Also set the defult base demand to
zero (was 5).

* Set defualts for madatory link properties in ENaddlink and small fix for ENsetheadcurveindex

Relates to #102 and closes #103

* wraps globals into structs, duplicates api functions with objective versions



* parse and serialize Comment field for network elements

related to #47

* adds getter for head/efficiency curve

in EN_getlinkvalue

* adds getter for event node index

… to return the index of the junction (tank) that triggered the event.

* fixes edge case in parsing

… where inp files without demands in [JUNCTIONS] and without any
[DEMAND] categories will fail.

* adds freeing function for project pointer

* removes redundant string literals, fixes overrun issue in error message getter function

* check for hydraulics already closed

* moving error definitions to data file

* deprecates ENR err message getter (unused)

* updates location of errors data file

also begins to expose blind structs to curves and patterns,
anticipating buildout of APIs for those.

* updates CLI output to reflect executable name as invoked

relates to #109

* Feature nrtest (#131)

* Initial commit EPANET testing tools.

* Initial commit for epanet-nrtestsuite

* SWIG wrapper for EPANET outputapi (#118)

* Removed pervious version of outputapi and wrapper

* SWIG wrapper for EPANET outputapi

* Patching cmake build script fixed target for outputapi

* Build failing on deprecated test script

* Minor changes. Responding to review comments.

* Feature nrtest (#121)

* Configured python setup to automatically build nrtest tools.

* Working on build / testing automation

* Adding EPANET 2.0.12 benchmark

* Updated Travis yml to run nrtest

* Fixing InsecurePlatformWarning

* Fixing InsecurePlatformWarning again

* Fixing InsecurePlatformWarning

* Fixing InsecurePlatformWarning

* Fixing InsecurePlatformWarning

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Working on configuring python environment and building test tools under Travis CI.

* Making gen-config.sh and run-nrtest.sh executable

* Debugging .travis.yml

* Debugging .travis.yml

* Debugging .travis.yml again

* Debugging .travis.yml again

* debugging travis setup

* debugging Travis setup

* debugging Travis setup

* debugging Travis setup

* debugging Travis setup

* debugging Travis setup

* debugging Travis setup

* debugging Travis setup

* debugging Travis setup

* debugging Travis setup

* debugging Travis setup

* Fixing bug with __strncpy_chk destlen < len

* nrtesting clean up

* re-implements fixes from:

5eead5ae40
3c788567a4

* removes extraneous build files, moves cmake and updates travis

* mirror of 9b37035560f9683f1514b439f7586a5c17bca5bf

* Move some variable declarations

* More variable declarations

* Fix TmpDir

* Allocate _defaultModel

* Fix EN_addcurve funcrion

* Fix for inpfile

* Fix writeRuleinInp call

* Set MAXMSG to 79 chars

* Fix for flow direction

* Refactoring testing related python packages and SWIG wrapper bug fix (#139)

* Eliminated epanet-reader package. Removed numpy dependency from epanet-output. Fixed reference counting bug in SWIG wrapper. Added error checking to run_nrtest.sh. Added nrtest package to requirements file.

* changing buildhome directory

* Fixing bug related to preprocessor definition of PI
2018-01-09 16:56:42 -05:00
Elad Salomons e1da9bc9d7 Fix duplicate w_POWER definition
Fix duplicate w_POWER definition and some house keeping. Tested the new
commit by @AngelaMarchi from #87, all results are the same as version
2.1.
2016-11-09 16:37:57 +02:00
AngelaMarchi 83dd6c7b7c ChangingRuleBased_v2
The code has the following modifications:
- RULE section is written just after controls
- SYST is now written SYSTEM (also PRESSURE, DEMAND, POWER, SETTING,
FILLTIME and DRAINTIME have been changed)
- some description to the function writeRuleinInp has been added
- Actions are now written in the correct order
2016-11-08 18:37:54 +10:30
AngelaMarchi 6f8be1be55 ModifyingRuleBaseControls
These modifications allow rule based controls to be modified with the
additional functions added in the dll toolkit
2016-09-23 13:07:06 +09:30